I have a number of computers with different computer names connected to the network. They currently hold a static IP address based on their MAC address. In other words, the static IP address is mapped to their MAC address. This gives rise to a problem and that's when we swap their hard drive (it's a removable one) from one computer to another in an event when one of the computer hardware dies, the MAC address becomes different and the application we are running on the harddrive has problem getting the right static IP for it to work.

We can't configure the IP address in the application all the time. And changing the static IP addresses to re-map to the computer's new MAC address can be quite a pain, especially when there are many computers.

Since all the computers have a unique computer name as their hostname, is it possible to configure such that when these computers grab IP addresses from the DHCP server, DHCP will learn about their hostname and assign the correct IP address based on their hostnames? This is to say, the static IP is mapped to the computers' hostname instead of their MAC address.

All the computers are running on Windows 7.

Would this be possible? If so how should I go about do this?

  • Why not configure the application(s) to listen on all interfaces? It's the only solution for non-static IP addresses.
    – Daniel B
    May 28, 2014 at 6:17
  • I didn't get the setup completely: is this an external harddisk that's got swapped?
    – VMai
    May 28, 2014 at 6:19
  • @VMai No, the PC runs on a removable SSD hard disk. We can swap from one computer to another and they will work the same. Of course in this situation, it won't because the MAC address will become different when we switch.
    – xenon
    May 28, 2014 at 9:37

2 Answers 2


How about creating a 'hosts' file containing the mappings? That's what it is for. C:\windows\system32\drivers\etc\hosts Then just copy this file to all computers. assign IPs statically to each machine, so the IP address is saved on the hard drive, will follow that hard drive wherever you take it.

  • Since the IP address is mapped to the MAC address of the computer, when I swap the harddrive, the computer will still grab a different IP from the DHCP because it now has a different network card, wouldn't this then cause the IPs in the hosts file to all become mismatch?
    – xenon
    May 28, 2014 at 3:12
  • As i said, dont use dhcp. Statically assign an ip address to each system. This will be stored on the hard drive.(registry) and will follow the hd wherever you take it. May 28, 2014 at 3:40

DHCP servers map IP address leases to DHCP client IDs. DHCP client IDs default to the MAC address of the client, but most OSes let you override that and put in a custom client ID string, which you could set to the same value as the client's hostname if you want. If you define your own DHCP client IDs, you take on the responsibility of making sure no two clients are trying to use the same client ID.

If your DHCP server only lets you map static IP leases to MAC addresses, not arbitrary DHCP client ID strings, then get a better DHCP server.

  • From your answer, I infer that the DHCP client ID string is not the hostname and I will have to set it to be the same as the hostname if I want it to "act" as though the IP was mapped to hostname, right? I tried looking up on how to change the DHCP client ID string on a Windows computer but can't find much on how I can do this.
    – xenon
    May 28, 2014 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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