UCI to specify different DHCP-event script?

I've got a configuration where the default route is defined in /etc/config/network on a static-addressed interface. That should "always" be default route. There is another interface (wwan0) that is managed by DHCP. When that interface gets its lease, /lib/netifd/dhcp.script replaces the default route (and several other things) with that from DHCP. From what I can tell, that behavior is "hard wired" into the script.

Is there UCI-based configuration that can be done to specify a different script for the events triggered by udhcp and odhcp6c? (I didn't see anything obvious in /lib/netifd/proto/dhcp.sh)

Can you change the metrics on both gateways, so that WAN is always higher?

Regrettably, /lib/netifd/dhcp.script overwrites the default route.

All routing through this special-purpose link will be done either with static routes or by use of multiple FIBs. It's a very limited data plan that could easily be "blown through" quite quickly with an inappropriate routing of general traffic.

As @lleachii already suggested, the simplest solution is to assign a higher metric to the dhcp interface. Netifd will then apply this metric to any routes (including the interface subnet) set up by the dhcp script.

The uci for that would be (assuming your dhcp interface is wwan):

uci set network.wwan.metric=10
uci commit network
ifup wwan
1 Like