As far as I can tell, when configuring a route, I have to specify a "parent interface".
However, it's not clear to me what the parent interface is. Say I want to translate the command
ip route add <foo/24> via <bar> to UCI syntax - how do I determine the right "parent interface"? And why do I need to specify this in the first place, given that
ip does not need it to setup the route?
The parent interface is usually (if not always) the uplink to the rest of the network. That will often be the LAN bridge on OpenWrt.
Because of the onlink option mentioned in the wiki.
Hmm. And what does the
onlink option do? The Wiki says that "When enabled gateway is on link even if the gateway does not match any interface prefix" and ip-route(8) says that onlink means to "pretend that the nexthop is directly attached to this link". But what does it mean to pretend that this is the case?
It will basically arp for the gateway. That's a kinda rare scenario though.
Really sorry if I'm being dumb, but what does "arp for the gateway" mean?
To me, "arp" means finding out the MAC address for a given IP address. But I think that needs to happen in every case (otherwise there's nothing to put in e.g. the Ethernet header). So how does this relate to
You arp an address that is in your broadcast domain, that is the address is in the same subnet. If it is not, by default you look for a route to that subnet and send it via a gateway.
The interface may not exist or have an IP when the route configuration is considered. This is common with a VPN.