Sample Header Ad - 728x90

Why does a network interface need to have a routing table entry configured to answer ARP requests?

0 votes
2 answers
125 views
I'm using a fresh minimal Ubuntu server 24.04.1 LTS install. I run these commands as root to set up networking and do some experiments:
apt install -y netcat-traditional tcpdump inetutils-ping

ip netns add ns1
ip netns add ns2

ip link add my_veth1 type veth peer name my_veth2

ip link set my_veth1 up netns ns1
ip link set my_veth2 up netns ns2

ip -n ns1 address add 1.2.3.4 dev my_veth1
ip -n ns1 route add 2.3.4.0/24 dev my_veth1

ip -n ns2 address add 2.3.4.5 dev my_veth2
Then I run these commands in different terminals:
# Terminal 1
ip netns exec ns1 tcpdump -l -i my_veth1

# Terminal 2
ip netns exec ns2 tcpdump -l -i my_veth2

# Terminal 3
ip netns exec ns1 ping 2.3.4.5
I get the same output in terminals 1 and 2:
02:40:27.511438 ARP, Request who-has 2.3.4.5 tell 1.2.3.4, length 28
02:40:27.511438 ARP, Request who-has 2.3.4.5 tell 1.2.3.4, length 28
02:40:27.511438 ARP, Request who-has 2.3.4.5 tell 1.2.3.4, length 28
...
veth2 has the IP address 2.3.4.5 and is receiving the ARP request. Why doesn't it send an answer? It only answers when I configure a routing table entry:
ip -n ns2 route add 1.2.3.0/24 dev my_veth2
But it shouldn't be necessary since the MAC address of the network interface that veth2 should respond to is already encoded in the request it is responding to.
Asked by Adrian (249 rep)
Nov 25, 2024, 03:25 AM
Last activity: Nov 25, 2024, 04:20 PM