# Need to forward git trafic through subdomain

## KarlisRepsons

Hello all,

Anyone knows how to forward all traffic, that goes to subdomain.domain.lv to another IP?

I'm happened to be in a dire need of public git repository and would like to keep it on my own small server. But can't avoid domain.lv pointing at that IP, which is intended to forward to small server. Its actually strange how those DNS records work - they seam to distinguish between ports, but have pretty no flexibility. Or do I get it wrong?

----------

## poly_poly-man

my guess (backed with no evidence of this particular case):

domain.lv is just a domain - there is no real host right there. when yu go to domain.lv, depending on the client, will add a seperate host specifier to the beginning - http clients wil likely prepend www., ftp clients ftp., mail., etc.

HOwever, IIRC, there is a DNS entry you can add to the server to make an automatic domain to default host redirect... this is probably what you have in place right now.

So basically, make another host definition in the dns zone, and you'll be fine - just realize that pointing git at domain.lv won't work by default without some crazy iptables rules and whatnot, but it should be fairly obvious to point, say, git.domain.lv to a different host than domain.lv.

hope that made sense and helped...

----------

## KarlisRepsons

 *poly_poly-man wrote:*   

> my guess (backed with no evidence of this particular case):
> 
> domain.lv is just a domain - there is no real host right there.
> 
> 

 

Well, there is a server (or host as you wrote - lets call it IP1), that registered domain.lv is pointing to. I just have little idea about those DNS records, all the support personal is going to ask is: "What A type entry and what MX entry" or similar. The problem is, that IP1 would be great for webpage, but I want to use domain somehow for git too! And the problem is in the fact, that git-daemon and ssh for accessing repository is on another machine IP2. If only git public repo. was needed, it could be solved by port forwarding (I assume now), but ssh is on both machines!

----------

## Mad Merlin

Create a new domain (git.domain.lv for example) which points to the IP of the public server you're hosting your git repo on, the DNS entry for domain.lv remains unchanged. It'll work like this:

```

$ host img.wittyrpg.net

img.wittyrpg.net has address 97.107.134.138

$ host wittyrpg.net

wittyrpg.net has address 206.248.167.197

```

Requests to git.domain.lv now go directly to your new server, while everything else goes to your existing small server (as it does now).

----------

## KarlisRepsons

 *Mad Merlin wrote:*   

> Create a new domain (git.domain.lv for example) which points to the IP of the public server you're hosting your git repo on

 

Could you also write about how to do it? If I knew already, there would be no question in this forum... It looks, however, that primarily gitorious.org can be used.

----------

## poly_poly-man

well, whatever dns server has the info for domain.lv, simply add an entry or tell someone to add an entry for your other host.

----------

## xtz

I cannot see what is so complicated here. Why not the domain.tld has an IP of itself? In the zone files of the DNS server you can have an A record for the domain itself just like a normal record for any other subdomain or stuff. I never tried, but I guess you can even add it as a CNAME record, to point out to another one.

----------

## poly_poly-man

 *xtz wrote:*   

> I cannot see what is so complicated here. Why not the domain.tld has an IP of itself? In the zone files of the DNS server you can have an A record for the domain itself just like a normal record for any other subdomain or stuff. I never tried, but I guess you can even add it as a CNAME record, to point out to another one.

 I've always seen it done as CNAME... but whatever... same idea.

----------

## Mad Merlin

 *KarlisRepsons wrote:*   

>  *Mad Merlin wrote:*   Create a new domain (git.domain.lv for example) which points to the IP of the public server you're hosting your git repo on 
> 
> Could you also write about how to do it? If I knew already, there would be no question in this forum... It looks, however, that primarily gitorious.org can be used.

 

Who hosts your DNS for you? Go to their web control panel and add another entry for the subdomain. (If that's not mind bendingly easy, you should switch to a new DNS provider.)

----------

