0

Q: if 2 devices A and B share same ip address in LAN, can device A retrive all messages whose destination is device B?

I think this depends on how the LAN is configured.

If it's wireless then device A can hear all packets regardless of their destination since those are signals in the air.

In case it's wired (ie ethernet) I think the answer is yes if A manipulated with the ethernet cable somehow, and now in other cases since a packet inside LAN is sent according to the unique mac address and not the IP address.

Are any of my claims wrong or not accurate?


I asked ChatGPT and here's the answer I got:

If two devices, A and B, share the same IP address in a local area network (LAN), it would create an IP address conflict and result in communication issues. This is because the IP address is used to identify devices on a network and ensure that data is delivered to the correct destination.

In this scenario, device A and B would both respond to messages sent to the shared IP address, leading to confusion and data loss. The network may also have difficulty determining which device is the intended recipient of a message, leading to unpredictable behavior.

As a result, device A would not be able to retrieve all messages intended for device B, and vice versa. The only way to resolve this issue would be to assign unique IP addresses to both devices, so that the network can correctly identify and deliver data to the correct destination.

And I strongly disagree with this claim:

In this scenario, device A and B would both respond to messages sent to the shared IP address.

Why is that? let's say the share address is 192.168.1.4 when such packet reaches the router it will look at the MAC address inside the packet and route it correctly...

when I asked ChatGPT again with the above explanation I got:

The statement that "device A and B would both respond to messages sent to the shared IP address" is not accurate, as the router would ensure that the correct device receives the packets based on the MAC address. However, it's important to note that having two devices share the same IP address can still cause communication issues in the network, as the network may have difficulty determining which device is the intended recipient of a message, leading to unpredictable behavior. It's always recommended to assign unique IP addresses to each device in a network to avoid such issues.

Yet I can't find any problem of 2 devices sharing same ip in LAN as long as they have unique MAC addresses...

1
  • See this answer about what happens with duplicate IP addresses on the same LAN.
    – Ron Maupin
    Feb 11 at 18:51

1 Answer 1

1

TLDR: you can't share an IP address with multiple devices inside the same LAN (unless they coordinate the use of that address, e.g. for a virtual one).

Q: if 2 devices A and B share same ip address in LAN, can device A retrive all messages whose destination is device B?

Only in rare cases. Most often, an IEEE 802 network is used below IP. Those networks work based on MAC addresses and any IP packet gets delivered to the MAC address the encapsulating frame is addressed to. That way, the packet only reached the MAC node derived by ARP (IPv4) or NDP (IPv6).

Only on networks not using L2 addressing is it possible that multiple nodes receive a packet addressed to a shared address.

Sharing the MAC address as well creates another set of problems with the underlying network (including flapping MACs with switched Ethernet or association problems with Wi-Fi).

In this scenario, device A and B would both respond to messages sent to the shared IP address.

If the packet even reaches both devices, whether they'd both actually respond to that message depends on their configuration (off topic here). When initiating a TCP connection, only one of them would succeed there. When a connection-less transport protocol like UDP is used and there's a listener on each device, then both might respond.

Yet I can't find any problem of 2 devices sharing same ip in LAN as long as they have unique MAC addresses...

With a shared IP address and no special configuration (like VRRP or HSRP), both devices would respond to ARP or NDP requests. Which one the source would accept is somewhat unpredictable. Also, ARP/NDP are repeated in certain intervals, so an established connection might fail when the other device's MAC address is suddenly taking precedence.

2
  • Thanks, you said: If the packet even reaches both devices, how can this ever happen? the router routes packages in LAN according to unique MAC address not IP.
    – Albert
    Feb 11 at 20:38
  • It could happen on a network not based on MAC addresses or on broadcast-based Ethernet (10BASE5 or 10BASE5 or with repeaters) and a shared MAC address. On a modern network that unlikely to impossible. However, a router doesn't need to be involved.
    – Zac67
    Feb 11 at 22:08

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