Linux – ARP request with wrong IP address

arplinuxrouter

I have a strange problem with a Linux router.

The setup is like this:

host1   ===  Linux router   ===   host2
a.b.c.d --- a.b.c.e/g.h.i.j --- g.i.h.k

Every five minutes host1 tries to reach host2.

If host2 is down, the Linux router makes an ARP request for a.b.c.d on
the left network with address g.h.i.j (i.e. from network on the right side).
After receiving the MAC address from host1 the router sends an
ICMP-unreachable packet with g.h.i.j as sender address.

If host2 is up, everything is fine.
The router makes the ARP request with its address a.b.c.e.

On the router I have

$ uname -a
Linux pfc 3.6.9-voyage #1 SMP Tue Dec 11 09:53:27 HKT 2012 i586 GNU/Linux

There is no proxy_arp involved.

The problem is: in my eyes the route should not use the IP address from the right hand network for the ARP request. Or am I missing something here?

Best Answer

By default, the Linux kernel does not force itself to use the IP-Address assigned to a particular interface for use in ARP requests on that interface. The rational -- as it seems to me—is that all IP-Addresses assigned to any interface on the same host belong to that host, so it shouldn't matter which address is used in an ARP request.

Try sysctl -w net.ipv4.conf.all.arp_announce=2 and have a look at the respective kernel documentation:

arp_announce - INTEGER
    [...]
    2 - Always use the best local address for this target. [...]
Related Question