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

6

2

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?

John

Posted 2015-03-14T16:54:45.363

Reputation: 193

1

If your question pertains to Windows environments, this article explains it well.

– Vinayak – 2015-03-14T16:57:29.063

2Also, static IPs are just that, static. You tell the NIC to choose that IP so if it's already taken, you get an error. You don't get a random IP you didn't ask for (that happens if DHCP is enabled and you've set the NIC to obtain IP address automatically). – Vinayak – 2015-03-14T17:03:20.220

@Vinayak, thanks! The article was definitely helpful! – John – 2015-03-14T18:26:14.863

It might be noteworthy that all modern operating systems check (via ARP) whether an address already exists on the network and will refuse to use it if that’s the case. – Daniel B – 2015-03-15T00:02:00.343

3World War 3, don't try it! – Moab – 2015-03-15T00:48:30.917

1@Vinayak, not so. The NIC doesn't know about IP; it is the OS that "claims" the IP address by choosing to respond to ARP requests from other computers ( they are broadcast ) asking "who has this IP address?" – psusi – 2015-07-21T22:21:53.177

Answers

7

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

DavidPostill

Posted 2015-03-14T16:54:45.363

Reputation: 118 938

9David: I agree. @John: A network device does not "request" a static IP address so much as it "claims" it. Imagine, if I said, "I am Santa Claus," and David said, "*I* am Santa Claus," then the Post Office would get confused. I might get some mail that was meant for me and some that was meant for David, and vice versa, and (probably) a lot of mail would get lost. – Scott – 2015-03-14T19:10:07.617

1I'd probably add some more details to the answer on why there will be problems. /// "Responds to" might be a better description than "claims" – much like someone responds to a name. You send an ARP request by asking "is there a John in this room", and two people reply. Or, you've met one of them earlier [ARP cache]. – user1686 – 2015-03-14T22:57:29.380

4

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.

bjanssen

Posted 2015-03-14T16:54:45.363

Reputation: 2 289

1

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.

Hennes

Posted 2015-03-14T16:54:45.363

Reputation: 60 739

cant we assign one static IP to two devices as master and slave so one will be active until its up? – ImranRazaKhan – 2020-01-27T11:51:38.537

Sort off. Assign to NIC but do not bring the interface up might work. But if you want failover search for LAGG – Hennes – 2020-01-28T09:48:48.597