DiagnosticsLAN Networks

IP Address Conflicts: How to Spot and Fix Them

Typical causes, the RFC 5227 ARP probe and announcement, DHCPDECLINE, symptoms, diagnosis with arp -a, arping, DHCP leases and the switch's MAC table, reservations, a single DHCP server, DHCP snooping, the addressing plan.

  • Category: Diagnostics · LAN Networks
  • Published:
  • Editorial team: Alba Technology Academy
  • Reading time: about 12 minutes

One morning Windows shows a warning: “Windows has detected an IP address conflict”. Or there is no message at all, but the office printer works only on and off: one document prints, the next one stays in the queue; the camera is visible for a few minutes and then disappears. Behind these symptoms there is often the same cause: two devices are using the same IP address. Let's see why it happens, how systems notice it, how to find the device responsible in a few minutes and how to organise the network so that it does not happen again.

What an IP address conflict is

On a local network every IP address must belong to a single interface. To deliver a packet to 192.168.1.150, the other devices use ARP to ask which MAC address corresponds to that IP and store the answer in their cache. If two devices have the same address, both reply, and each cache keeps the last reply it received.

Take a small 192.168.1.0/24 network. The OPNsense firewall, 192.168.1.1, is the gateway and the DHCP server, with a dynamic pool from 192.168.1.100 to 192.168.1.199. Years ago the printer was configured by hand with the static address 192.168.1.150 (MAC 00:00:5e:00:53:0d). One day the printer is switched off, a new PC arrives and the DHCP server, which knows nothing about the manual configuration, gives it exactly 192.168.1.150 (MAC 00:00:5e:00:53:0b). When the printer is switched back on, the address is contested.

From then on the ARP cache of the firewall, and those of the PCs, flip between two MACs. When the entry points to the printer, replies from the Internet meant for the PC end up at the printer, which discards them: the PC's browsing stutters. When it points to the PC, print jobs go to the PC: the printer seems to be off. Neither device works reliably.

One IP address, two devices The firewall 192.168.1.1 is connected to the switch, to which PC B and the printer are connected, both with the address 192.168.1.150. PC B has the MAC 00:00:5e:00:53:0b, the printer 00:00:5e:00:53:0d. In the firewall's ARP cache the entry for 192.168.1.150 switches from one MAC to the other with every new ARP reply. The same IP address on two different interfaces Firewall · gateway 192.168.1.1 Switch PC B 192.168.1.150 …:53:0b · DHCP Printer 192.168.1.150 …:53:0d · static The firewall's ARP cache 192.168.1.150 → …:53:0b …:53:0d changes with each reply The last ARP reply wins: traffic for .150 goes now to one device, now to the other.
Figure 1 — Simplified diagram, example addresses. The red box marks the MAC the cache is using at that moment.

The usual causes

A conflict hardly ever happens by chance. These are the causes most often found in homes and small businesses.

  1. A static address inside the DHCP pool. This is the most common cause. A device is configured by hand with an address that the server considers free, so sooner or later the server will hand it to another client. It happens with printers, cameras, NAS units and equipment installed by different technicians at different times.
  2. Two DHCP servers on the same network. An ISP router left with DHCP enabled behind the firewall, an access point or a Wi-Fi extender in router mode, a small router plugged into a network socket by mistake. Each server hands out addresses from its own pool without knowing anything about the other; if the pools overlap, two clients receive the same address. Often the second server also hands out the wrong gateway, and the problems add up.
  3. A cloned device or one restored from a backup. A cloned virtual machine, or a device restored from another one's configuration, inherits the original's static address. If the original is still running, the two compete for the address. In cloned VMs the MAC or the client's DHCP identifier may also stay the same, and the server gives both of them the same address.
  4. An expired lease, but the address is still in use. The client must stop using the address when the lease expires. Some devices, after a long sleep or because of a firmware bug, keep using it without renewing it; in the meantime the server has given it to someone else.
  5. A replaced or reset DHCP server. A new firewall, or a server that has lost its list of leases, starts again from the first address in the pool while the clients still hold the addresses they received before.
Static addresses inside and outside the pool Two bars represent the 192.168.1.0/24 network, from .1 to .254. In the first, wrong one, the printer has the static address .150 inside the DHCP pool from .100 to .199, and the server can also give it to a PC. In the second, correct one, static addresses and reservations are from .1 to .49, the printer has .20 and the pool stays from .100 to .199. Wrong · static address inside the pool DHCP pool static printer .150: DHCP can also give it to a PC Correct · static addresses and reservations outside the pool static DHCP pool printer .20 (static or reserved) .100.199 .1.49.100.199.254
Figure 2 — The same 192.168.1.0/24 network with two addressing plans. An address set by hand must never fall inside the dynamic pool.

How the system notices

Many operating systems do not wait for trouble: before using an address they check that it is free. The method is described in RFC 5227 (IPv4 Address Conflict Detection) and uses two kinds of ARP message.

MessageSender IPTarget IPWhat it is for
ARP Probe0.0.0.0192.168.1.150Asks whether anyone is already using the address, without “polluting” other devices' caches. It is sent several times, at random intervals of one or two seconds.
ARP Announcement192.168.1.150192.168.1.150After probes with no reply, it tells everyone the new IP–MAC association and updates their caches.

If a reply for 192.168.1.150 arrives from another MAC during the probes, the address is taken and the system does not use it. The check carries on afterwards too: a system that receives an ARP message with its own address as the sender, but with a different MAC, has found a conflict. RFC 5227 allows it to defend the address with a new announcement, but if the conflict repeats within a few seconds it must stop using it.

With DHCP the mechanism is combined with the DHCPDECLINE message of RFC 2131: a client that discovers, with the ARP probe, that the address it received is already in use rejects it. The server marks it as unavailable and the client starts the request again, after at least ten seconds, and obtains a different address. Some servers, if configured to do so, run a similar check before offering an address, by sending a ping to it.

However, the check only protects the device that arrives second, and only if the other device is switched on at that moment. In the example, the printer was off when the PC checked the address: the probe got no reply and the PC used it. Moreover, not every device implements RFC 5227: many printers, cameras and budget devices check nothing at all. On Windows a detected conflict produces the on-screen warning and, usually, an event with ID 4199 from the Tcpip source in the System log, with the MAC of the other device. On Linux the check depends on the network manager and its configuration.

In IPv6 the check is mandatory and built into the protocol: it is the Duplicate Address Detection of RFC 4862, carried out with Neighbor Discovery messages.

The symptoms

  • Intermittent connectivity: the device works for a few seconds or a few minutes, then stops, then starts again, for no apparent reason.
  • An operating system warning about the address conflict, or a 169.254.x.x address after repeated DHCPDECLINE messages.
  • An ARP cache that flips: for the same IP, two different MACs appear at different moments.
  • Dropped sessions: a TCP connection to a device breaks when the packets start reaching the other one, which rejects them or does not answer at all.
  • The “wrong” management page: typing the printer's address into the browser sometimes opens another device's page.

These symptoms resemble a faulty cable or a weak Wi-Fi signal. To tell them apart it is worth following a method, such as the one described in the article on the Internet not working: address, gateway, DNS, one step at a time.

Step-by-step diagnosis

The aim is to find the two MACs that use the address and, for each one, the physical device and the switch port. The examples use the network described above; the outputs are indicative and vary with the system and its language.

1. Two MACs in the cache. From a PC on the same network, send a ping to the suspect address and look at the ARP entry. If you repeat the test after a few seconds, the MAC may change:

C:\> ping -n 2 192.168.1.150
C:\> arp -a 192.168.1.150

Interface: 192.168.1.10 --- 0xb
  Internet Address      Physical Address      Type
  192.168.1.150         00-00-5e-00-53-0d     dynamic

C:\> arp -a 192.168.1.150
  192.168.1.150         00-00-5e-00-53-0b     dynamic

On Linux the most direct tool is arping. With the -b option every request stays broadcast, so all the devices using the address reply:

$ sudo arping -b -c 2 -I eth0 192.168.1.150
ARPING 192.168.1.150 from 192.168.1.10 eth0
Unicast reply from 192.168.1.150 [00:00:5E:00:53:0D]  0.912ms
Unicast reply from 192.168.1.150 [00:00:5E:00:53:0B]  1.204ms
Unicast reply from 192.168.1.150 [00:00:5E:00:53:0D]  0.887ms
Unicast reply from 192.168.1.150 [00:00:5E:00:53:0B]  1.176ms
Sent 2 probes (2 broadcast(s))
Received 4 response(s)

Two replies for each request, from two different MACs: the conflict is confirmed. ip neigh show 192.168.1.150, on the other hand, shows only the cache's current entry.

2. Who received the address from DHCP. Look for 192.168.1.150 in the server's list of leases. If it appears with the MAC …:0b, PC B obtained it properly, and the other MAC belongs to a device configured by hand. On OPNsense the list is in the DHCP services section, under the leases entry (menus may vary with the version and with the DHCP service in use). If there is no lease, or it points to a different server, suspect a second DHCP server: on Windows ipconfig /all shows the address of the server that granted the lease.

3. From the MAC to the switch port. Look up the unknown MAC in the switch's MAC address table. On a managed switch with Cisco IOS-style syntax the command is the following; other vendors use similar commands or a web page:

switch# show mac address-table address 0000.5e00.530d
          Mac Address Table
-------------------------------------------
Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    0000.5e00.530d    DYNAMIC     Gi1/0/6

The MAC is on port 6. If another switch is connected to that port, repeat the search on the next switch, until you reach the port that leads to a single device. The first three bytes of the MAC, the OUI, often identify the manufacturer of the network card and help you work out what kind of device it is.

From the conflict to the switch port Four steps in sequence. First: arping or arp -a show two MACs for 192.168.1.150. Second: the DHCP lease list shows that …:0b is PC B, with a regular lease. Third: the switch's MAC table shows that …:0d is on port 6. Fourth: the printer with the static address is connected to port 6. 1 · ARP cache arping, arp -a .150 → …:0b .150 → …:0d two MACs 2 · DHCP leases the server's list …:0b → .150 PC B, regular …:0d is missing 3 · MAC table of the switch …:0d → port 6 VLAN 1 port found 4 · Device port 6 printer static IP .150 to be fixed From the IP to the MAC, from the MAC to the port, from the port to the device.
Figure 3 — The diagnostic path. Example addresses and port numbers.

The fix

Once the device has been found, fix the cause, not just the effect. Changing the printer's address to another random number, perhaps still inside the pool, only moves the problem a few weeks down the line.

  • Static addresses outside the pool. Set aside part of the network for devices configured by hand and shrink the pool to the rest, as in figure 2: for example, static addresses from .2 to .49, pool from .100 to .199.
  • DHCP reservations. For printers, NAS units and cameras the tidiest solution is to leave the device on DHCP and create a reservation on the server: MAC 00:00:5e:00:53:0d → 192.168.1.20. The device always receives the same address, and the server knows about it and will not give it to anyone else. On OPNsense it is called a static mapping or a reservation, depending on the DHCP service and the version. The details are in the article on DHCP.
  • A single DHCP server per network. On access points and extenders use access point (or bridge) mode, with DHCP disabled; the ISP router behind the firewall must be configured without DHCP on the internal network side. If you need two servers for redundancy, they must have separate pools or a failover mechanism provided by the software.
  • DHCP snooping on managed switches. The switch accepts DHCP replies only from the trusted port where the legitimate server is connected and blocks those from any other server. It also records the associations between MAC, IP and port, which other features, such as Dynamic ARP Inspection, use to discard inconsistent ARP messages.
  • After the fix, renew the configuration of the clients involved (ipconfig /release and ipconfig /renew on Windows) and let the ARP cache expire, or clear it, on the devices that still hold the old entry, including the firewall.

Documenting the addressing plan

The most effective prevention is a simple document, updated with every change, that says which part of the network is used for what and who uses the fixed addresses. A table like this one is enough, in a shared spreadsheet or in the network documentation:

RangeUseExamples
192.168.1.1Gateway (firewall)OPNsense, LAN interface
192.168.1.2 – .19Network devices, staticManaged switches, access points
192.168.1.20 – .49DHCP reservationsPrinters, NAS, cameras
192.168.1.50 – .99ReserveFuture expansion
192.168.1.100 – .199Dynamic DHCP poolPCs, laptops, smartphones

For each fixed address, note the MAC, the name, the location and the switch port. As the network grows, the same logic applies to every VLAN, with a plan for each subnet; how to choose the size of the subnets is explained in the article on IP addresses and subnet masks.

Common mistakes

  • Using an address “that looks free”. A ping with no reply does not prove that the address is free: the device may be off or may block pings. The addressing plan, together with the list of leases, is what counts.
  • Giving a new device the gateway's address. A device configured by mistake with 192.168.1.1 conflicts with the default gateway: the whole network loses Internet access intermittently, not just one device.
  • Plugging in a home router “to get more sockets”. With its DHCP enabled it becomes a second server: to get more ports you need a switch, or the router must be configured as a plain access point.
  • Moving the pool without checking the active leases. If you shrink the pool, clients that still hold an address in the excluded part keep it until they renew: before assigning those addresses to static devices, wait for the leases to expire or force a renewal.
  • Restarting the devices in turn. A restart may let one or the other win for a while and give the illusion that the problem is solved. The conflict comes back at the first opportunity.
  • Forgetting about copies. After restoring a configuration or cloning a virtual machine, change the address before connecting the copy to the network.

Practical conclusions

  • When a device works on and off, check whether two MACs appear for its address: repeat arp -a or use arping.
  • Compare the MACs with the DHCP server's list of leases and follow the unknown one through the switch's MAC table down to the port.
  • Keep static addresses outside the pool and prefer DHCP reservations for printers, NAS units and cameras.
  • Keep a single DHCP server per network: access points and extenders in access point mode, the ISP router without internal DHCP.
  • Enable DHCP snooping on managed switches and document the addressing plan, with the MACs and ports of the fixed devices.

Readers who want to go further into IP addressing, DHCP and the organisation of local networks will find these topics developed step by step in the Academy's books and video courses.

The video

IP Address Conflicts: How to Spot and Fix Them — Animation without voice-over, with on-screen text in English and sound effects.

Technical sources

  • RFC 5227 — IPv4 Address Conflict Detection — The ARP probe with sender IP 0.0.0.0, the ARP announcement, ongoing conflict detection and address defence; the system stops using the address if the conflict repeats within the defence interval.
  • RFC 2131 — Dynamic Host Configuration Protocol — Address allocation and leases, the client's check of the address it received and the DHCPDECLINE message, with a new request after at least ten seconds.
  • RFC 826 — An Ethernet Address Resolution Protocol — The ARP protocol: request, reply and the cache of IP-to-MAC associations.
  • RFC 4862 — IPv6 Stateless Address Autoconfiguration — Duplicate Address Detection, the mandatory check for duplicate addresses in IPv6, carried out with Neighbor Discovery messages (RFC 4861).
  • IEEE 802.1Q — Bridges and Bridged Networks — MAC address learning and the switch's forwarding table, per VLAN, used to find a device's port.
  • RFC 1918 e RFC 7042 — Addresses used in the examples: the private network 192.168.1.0/24 and the MAC addresses 00:00:5E:00:53:xx reserved for documentation.
  • Documentazione ufficiale di OPNsense — DHCP — Dynamic pool, reservations (static mappings) and the lease list in the DHCP services section; menus and names depend on the version and on the DHCP service in use.

Standards and official documentation available from the respective organisations.

OPNsense® is a registered trademark. Alba Technology does not represent the OPNsense project.