Skip to contentSkip to conversation

source IP address for ARP requests

DISCUSSION Michael Tokarev 3 participants 3 messages May 7, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello.

With a somewhat unusual configuration:

eth0 10.0.0.1/32
eth1 192.168.1.1/24
route add 10.0.0.2 dev eth1 src 10.0.0.1

namely, so that just one ip address is available on an "unrelated" subnet, with "our" address taken from another interface.

With this config, ARPs for 10.0.0.2 are sent to eth1 with source address of 192.168.1.1, even if "src" is configured for the route in question:

9:28:46.220680 ARP, Request who-has 10.0.0.2 tell 192.168.1.1, length 28

Is that right, or should the host send ARP requests with src=10.0.0.1?

This is kernel 3.2(.40).

Thank you!

/mjt

#1 lore raw
Quoted 12 lines

  eth0  10.0.0.1/32
  eth1  192.168.1.1/24
  route add 10.0.0.2 dev eth1 src 10.0.0.1

namely, so that just one ip address is available on an "unrelated" subnet, with "our" address taken from another interface.

With this config, ARPs for 10.0.0.2 are sent to eth1 with source address of 192.168.1.1, even if "src" is configured for the route in question:

Quoted 5 lines

  9:28:46.220680 ARP, Request who-has 10.0.0.2 tell 192.168.1.1, length 28

Is that right, or should the host send ARP requests with src=10.0.0.1?

I suspect you cannot change the behavior of layer 2 discovery protocols by configuring a certain layer 3 parameter (a route + "src").

Also from an ARP perspective, this is imho correct behavior, because 10.0.0.2 should learn "sender hardware address" and "sender protocol address" from the ARP _request_ and add them to its own ARP table - without an additional ARP request. 10.0.0.2 is connected to eth1, so only mac and ip address of eth1 counts in this case (= 192.168.1.1).

Regards,
Lukas

#2 lore raw
In reply to Michael Tokarev

Hello,

Quoted 16 lines · Michael Tokarev

Hello.

With a somewhat unusual configuration:

eth0 10.0.0.1/32
eth1 192.168.1.1/24
route add 10.0.0.2 dev eth1 src 10.0.0.1

namely, so that just one ip address is available on an "unrelated" subnet, with "our" address taken from another interface.

With this config, ARPs for 10.0.0.2 are sent to eth1 with source address of 192.168.1.1, even if "src" is configured for the route in question:

Quoted 6 lines

9:28:46.220680 ARP, Request who-has 10.0.0.2 tell 192.168.1.1, length 28

Is that right, or should the host send ARP requests with src=10.0.0.1?

This is kernel 3.2(.40).

IIRC, it works in this way from 2.4+. I guess some
packet from 192.168.1.1 to 10.0.0.2 triggers such ARP request. The kernel prefers to copy the addresses from IP header to the ARP request, it can be tuned with arp_announce, you can check Documentation/networking/ip-sysctl.txt

Regards

--
Julian Anastasov <[email protected]>