Score:1

Why linux generates ARP broadcast for packets that match the LAN route?

gt flag
hgl

I have two physical devices, a router and an access point, both installed with OpenWRT.

The router has two interfaces, one for LAN (192.168.1.1/24), the other for WAN. The AP also has two interfaces, one for LAN (192.168.1.2/24), the other for for WiFi (192.168.2.1/24). The two LAN interfaces are connected with a wire.

On the router, a route for WiFi is set up:

ip route add 192.168.2.0/24 via 192.168.1.1

When I ping 192.168.2.1 on the router, I hope that the echo request would go through the wire with a source IP 192.168.1.1 and a destination IP 192.168.2.1, and the router would get an echo reply back, but it turns out the router generates ARP broadcasts asking for the MAC address for 192.168.2.1 which is sent to AP's LAN interface and then ignored.

How could I make the router work as intended?

Massimo avatar
ng flag
Double check your subnet masks.
ru flag
You should use 192.168.1.2 as a node through which you are sending your packets to 192.168.2.0/24 network, the via part should be the remote node you are sending the packets to, that is available to your host, so ip route add 192.168.2.0/24 via 192.168.1.2
hgl avatar
gt flag
hgl
I can confirm router's LAN is /24, WAN /32, AP's LAN is /24 and WiFi /24
Michael Hampton avatar
cz flag
@rAlen Yes, that looks like the problem and the solution. You could make a full answer out of it.
hgl avatar
gt flag
hgl
@rAlen it works! Thanks a lot. I wish your comment was submitted as an answer so I could accept it!
Score:2
ru flag

The problem is you didn't tell your router where to send the packets, to which device that has access to that network.

You used the IP you have on the same host that can't access the 192.168.2.0/24 network so you are basically telling him to use himself as router for that network, it then sends ARP through the NIC that has the local IP you specified, trying to find the device with 192.168.2.1 IP connected to the same physical network(switch) as 192.168.1.1 NIC.

If you add the route with specifying the remote host in via section then everything should work.

ip route add 192.168.2.0/24 via 192.168.1.2

You then tell your router to send the packets that need to go to 192.168.2.0./24 network to device that has 192.168.1.2 IP, that is on the same network, and then that device will handle the routing to other network.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.