1

While studying Internet Protocol, I came upon the following example of two devices:

Device A:

IP address: 10.1.1.1
Subnet mask: 255.255.255.0

and

Device B:

IP address 10.1.1.200
Subnet mask 255.255.255.128

In this case, if A sends a packet to B, it thinks that B is on the same network; however, if B sends a packet to A, it thinks that A is on a different network.

Mathematically (after ANDing the subnet mask and IP addresses), I can see that this will be so. However, it makes no intuitive sense to me. It B is in a subnet "one level below" A, doesn't it mean that A's subnet got divided in two parts (with two routers probably handling each subnet)? How can a host be part of that same subnet in that case?

Can someone explain (preferably with a diagram) how this would actually look in the real world, assuming simple hosts and routers?

2

What you describe is a misconfiguration where both hosts are on the same layer-2 LAN, but the mask is set incorrectly on one of the hosts. The point is that there are no routers between them.

When a host wants to send something to a different host, it will mask the destination layer-3 address with its configured mask to see if the destination is on the same layer-3 network.

If the destination is on the same network, the host will use ARP to get the layer-2 address of the destination, encapsulate the layer-3 packet in a layer-2 frame with the layer-2 address of the destination host, and send the frame directly to the destination host.

If the destination layer-3 address is on a different layer-3 network, then the host will encapsulate the layer-3 packet in a layer-2 frame with the layer-2 address of its configured gateway.

That means that Host A can get the layer-2 address of Host B and encapsulate the layer-3 packet in a layer-2 frame addressed to Host B, but Host B cannot get the layer-2 address of Host A, and it will encapsulate the layer-3 packet with the layer-2 address of its configured gateway.

  • While it is generally a bad way to design networks, this sort of thing does exist -- and from time to time, it might be necessary. This is the realm of proxy-arp (and why no one should ever want to do it.) The outer network contains the inner one(s) and will try to contact them directly (L2); they're on the other side of a router that will answer ARP for the respective inner network. The inner network then routes normally to the rest of the outer network. – Ricky Beam Dec 26 '18 at 22:41
1

As Ron Maupin says, this is generally a misconfiguration (or occasionally a transition situation.)

If as you describe A thinks B is a neighbour but B thinks A is not a neighbour, and they are connected (by switch, say) there are a number of cases related to how they have ARP implemented. Understanding what will happen is very useful for debugging if you find yourself with such a mismatched configuration. Be conscious that embedded device IP implementations are not of the same quality as major router and host OS implementations.

The ARP RFC 826 was published when classful addressing was the norm (1982), long before CIDR was introduced by RFC 1519 (1993). As such, it doesn't cover the case of two hosts on the same network with different netmasks, even though subnetting was common then. It's clear that the requestor shouldn't make requests for IP addresses outside its range (though some OS have certainly done this). But what should a host do if it receives an ARP request from an IP address outside its own network (as defined by receiver's netmask)? This is not covered by the ARP RFC nor the subsequent host requirements RFCs.

Tests with current Cisco and Ubuntu show they do not answer ARP from outside the receiver's network. But it's surely possible that some OS are still "sloppy" and answer the ARP request without looking at the local netmask. (Indeed, some OS might update B's ARP table and thus make B think A is local despite what the netmask says.)

  • If A has no existing ARP entry for B, it will send an ARP request
    • B receives the ARP request
    • If B is "strict" it will ignore the request; if "sloppy" it will send ARP reply
    • A will probably retry if it expects ARP reply but doesn't get one
  • If A (now) has an ARP entry for B
    • A will send IP packet to B
    • B receives packet
    • If B has suitable local router R, will send reply to R

Tests can be made with a static ARP entry for B on A.

I'm generally ignoring proxy ARP, as it just transforms the question into "If A thinks P is a neighbour but P thinks A is not a neighbour."

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.