Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to have a single host name with multiple IP addresses? The hostname will be used to access a box in LAN with 192.168.x.y and from outside with IP w.x.y.z which is portforwarded to that box in a router.

share|improve this question
    
It's really not clear what you're asking about. What do you think it means to point an IP address to a host name? –  David Schwartz Dec 22 '12 at 4:03

2 Answers 2

Why not use a simple batch file or script to rotate between HOSTS files?

For example, this works on Windows when run as Administrator (you may have to un-hide your HOSTS file and make it writable first):

@echo off
set ThisDir=%CD%
cd /d %systemroot%\system32\drivers\etc
ren hosts. hosts.tmp
ren hosts.other hosts.
ren hosts.tmp hosts.other 
cd /d %ThisDir%

Run it and it will swap HOSTS for HOSTS.OTHER and the next time you run it, it will switch them back.

share|improve this answer
    
your solution is simple and good. I don't know bash. How about including the flashing of DNS (Host Profiles Management app does that)? Then it will be complete and I will mark your answer as an answer. Thanks. –  Win Myo Htet Dec 22 '12 at 4:40
up vote 0 down vote accepted

Yes, it is. You can use hostfile switching program like http://hostprofiles.codeplex.com/ (for windows and linux) and http://osxdaily.com/2010/04/29/switch-and-manage-multiple-hosts-files-with-gas-mask/ (for mac) to do that. You will have

home host file

192.168.x.y  myutilbox.twh

outside host file

w.x.y.z myutilbox.twh

You will switch the hostfile accordingly and use the hostname, "myutilbox.twh" to access your box.

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.