8

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?

6
  • 1
    If your question pertains to Windows environments, this article explains it well.
    – Vinayak
    Mar 14, 2015 at 16:57
  • 2
    Also, 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
    Mar 14, 2015 at 17:03
  • @Vinayak, thanks! The article was definitely helpful!
    – John
    Mar 14, 2015 at 18:26
  • 3
    World War 3, don't try it!
    – Moab
    Mar 15, 2015 at 0:48
  • 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
    Jul 21, 2015 at 22:21

3 Answers 3

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
2
  • 11
    David: 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
    Mar 14, 2015 at 19:10
  • 1
    I'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
    Mar 14, 2015 at 22:57
5

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.

2

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.

2
  • cant we assign one static IP to two devices as master and slave so one will be active until its up? Jan 27, 2020 at 11:51
  • Sort off. Assign to NIC but do not bring the interface up might work. But if you want failover search for LAGG
    – Hennes
    Jan 28, 2020 at 9:48

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.