9

I have cloned a Windows 2003 machine and put it on the same domain as the original.

I want to make sure that the clone never accesses the original. I want it to think it is the original. I don't want to exhaustively check the clone for everything that might reference the name or IP address of the original and change to the name or IP address of the clone.

Will I get what I want if I add the following two lines to the hosts file on the clone?

127.0.0.1   originalname   #divert attempts to access the original machine
127.0.0.1   192.168.1.2    #divert attempts to access the original machine

originalname is the name of the original machine. 192.168.1.2 is the IP address of the original machine.

cja
  • 9,512
  • 21
  • 75
  • 129

1 Answers1

8

You first line should do the trick although you might want to add an additional short name to that entry.

Your second entry will never work. You can not redirect/mask an IP address with another IP address. The server should no longer think it should be resolved at 192.168.1.2 once you put the first line in place.

To be 100% sure you can always Flush the DNS cache for good measure. http://technet.microsoft.com/en-us/library/cc782459(v=ws.10).aspx

This is worth reading and should explain the process of name resolution on Windows operating systems: http://support.microsoft.com/kb/172218.

Hosts files can not redirect IP addresses. They can only redirect names/hosts to resolve to a different IP address.

  • But what happens if a program tries to access 192.168.1.2? Won't it will access the original machine? – cja May 31 '13 at 11:46
  • Please could you explain "add an additional short name to that entry" ? – cja May 31 '13 at 11:49
  • 1
    If a program is using a host name to resolve the machine it will not access the other machine. If the program is using an IP address to point to a specific machine it will point to the original machine. – Gerric Chaplin May 31 '13 at 11:49
  • Hosts files often allow you to resolve both long and short names. A long name would be something like bob.example.com while the short name would just be bob. So in order to make sure you cover everything off you would place the following in the hosts file. `code` 127.0.0.1 bob.example.com bob `code` – Gerric Chaplin May 31 '13 at 11:50
  • Is there any way to prevent direct IP access then? – cja May 31 '13 at 11:51
  • 1
    The best way would be to use a firewall on the original server and block access for everything from the new server. This is the easiest method and means you do not need to dig around your clone server to change any IPs. – Gerric Chaplin May 31 '13 at 11:53