Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an SCM server connected to my office LAN which runs the SCM tools like git, svn, etc. The office router has been configured with 'Port Forwarding' so that the SCM server can be accessed through the public (outside) IP from home, outside, etc. When at office, I can access the SCM server using the local IP address. But when at home, I need to use the port-forward-IP to access the SCM server.

I feel cumbersome to deal with two IP address. Now, is there way to access the SCM server using just one IP address seamlessly irrespective of my location.

share|improve this question

migrated from superuser.com Apr 30 '12 at 23:04

This question came from our site for computer enthusiasts and power users.

    
Not until the world moves to IPv6. –  Keith Apr 30 '12 at 7:37

3 Answers 3

If the router supports hairpin NAT, then yes, just use the public IP from everywhere.

If not, then no. From the outside, you must use the inside IP to get from the outside to the inside. From the inside, you cannot use the outside IP because it's only valid from the outside. So there is no single IP you can use from anywhere.

share|improve this answer

Your /etc/hosts file can have name,ip pairs.

So, add:

myscm internal.i.p.address
myscm external.i.p.address

in your /etc/hosts file and then when you try to resolve by the name (myscm), it will automatically be resolved. However, this is cheating and there may be a better way to retain DNS addresses across networks.

share|improve this answer
1  
Host entries are in the other order (IP then host name(s)) –  Mat Apr 30 '12 at 12:04

It might be possible by using the fact that different DNS servers will be used from inside and outside of the office network. If you configure the DNS server inside your office network to serve an internal IP-address and an external DNS server to serve an external IP-address, your laptops should in theory be able to use the DNS-name of the SCM server seamlessly from both inside and outside of the office network.

Caveat: I am not sure whether overloading a DNS-name in this fashion will cause some kind of conflict.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.