What happens if 2 devices want the same static IP address?

I don't know much about IP addressing. In my mind, static IP addresses are something that a device requests, asking for a specific address.

With that approach, what happens if 2 devices attempt to connect to a network and request the same static IP address? Is it first come first served, and the 2nd device won't receive the address? Does it (or can it) automatically get a different one?


Solution 1:

What happens if 2 devices want the same static IP address?

If two computers on the same network have the same IP address the results are unpredictable.

It is possible that neither computer will have a working network connection.

Other possibilities include:

  • Only one device is able to access the network
  • There will be intermittent problems on both devices

Solution 2:

If, for whatever reason, two or more network interfaces in a broadcast domain (aka subnet) respond to the same IP address, you will see serious network problems on all involved network interfaces.

This has the following reason: whenever a package arrives for the IP address in question the router asks the whole subnet "who has IP address foo?" and any network interface with IP address foo will answer. The answer contains the hardware address (aka MAC) of the network interface and will be written into the so-called ARP cache of the router for future (at least the next 5 minutes) use. So, whoever answers first will be the destination regardless of being the correct target of the specific package (which could have been requested by another network interface with the same IP address.)

Furthermore, most routers discard packages from network interfaces that claim to have a specific IP address but don't match the existing ARP cache entry. Thus network interfaces with the same IP address can't initiate network connections for a time.

Solution 3:

First of all lets define a few terms since your usage of static is rather unique.

  1. Dynamic IP: The host broadcasts a DHCP request. If there is a DHCP server on the network then this DHCP server can answer, giving the asker an IP. (And optionally more, but lets keep it simple for now).
  2. Static IP: No DHCP is involved at all. You have a NIC and you configure an IP for it. That one is set and does not change. No questions are asked on the network.
  3. Reserved IP via DHCP: The DHCP server can be told to give a specific MAC a specific IP. Since MAC addresses are unique that computer will always get the same dynamic IP.

Note that a computer which does a DHCP req may ask for a specific IP. It is up to the DHCP server to honor that or not.

In my mind, static IP addresses are something that a device requests, asking for a specific address.

That is not commonly the case, but your question is clear.

With that approach, what happens if 2 devices attempt to connect to a network and request the same static IP address?

The first device does a DHCP req. The DHCP server receives the request, grants the DHCP lease by sending the needed information and marks the IP as in use.

The second device does a DHCP req. The DHCP server sees that the IP is already handed out and will return another IP.

Is it first come first served, and the 2nd device won't receive the address? Does it (or can it) automatically get a different one?

Yes. First one get the IP. Second one get a different IP.