My machine has a physical network interface (eno1) and a bunch of virtual network interfaces (e.g. tap0). Each interface has its own IP and their subnets do not overlap.
I noticed that if I perform an ARP request from another machine that is connected to eno1's network asking for an IP that belongs to a virtual network interface (e.g. tap0), Linux will respond the ARP request, and it will respond with the MAC address of eno1 (that is, it responds with the MAC address of the interface that received the ARP request, regardless of which interface had the IP address)
Linux will only respond the ARP request if the IP belongs to one of its configured network interfaces, otherwise it ignores it.
I wonder what is the reason that it does that? I would think that it would simply ignore such ARP requests, as they are targetting IPs that are not only held by different interfaces, but also outside the subnet range.
Thanks!
@edit: As requested, this is the real example that I observed:
Machine 1 has interface eno1 with IP 192.168.0.2, subnet 192.168.0.0/24, MAC address 82:a2:17:43:15:ef
It also has interface docker0 (virtual) with IP 172.17.0.1, subnet 172.17.0.0/16, MAC Address 02:42:6f:31:bb:58
Machine 2 is connected to the same subnet of eno1 and has IP 192.168.0.55. Machine 2 performs an ARP request to the network, asking for the owner of IP 172.17.0.1.
Machine 1 answers the ARP request with MAC address 82:a2:17:43:15:ef (eno1 MAC address)
Additional notes:
- Machine 1 will only answer the ARP request if the IP belongs to one of its network interfaces.
- Machine 1 will always answer the MAC address of eno1, regardless if the target IP belongs to docker0, tap0, etc.