Last active
December 3, 2022 04:49
-
-
Save andiwand/5b5acc2c4873a0cfbe5eb0123c8fdd16 to your computer and use it in GitHub Desktop.
OpenWrt / LEDE hotplug script to add default routes correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# OpenWrt / LEDE hotplug script to add default routes correctly. | |
# | |
# Location "/etc/hotplug.d/iface/01-default-route". | |
# | |
# Fixed mwan3 "No default route in the main routing table" and | |
# "WARNING: this interface has no default route in the main routing table!" for me. | |
uci get "network.${INTERFACE}.gateway" > /dev/null 2>&1 || exit | |
GATEWAY=`uci get "network.${INTERFACE}.gateway"` | |
METRIC=`uci get "network.${INTERFACE}.metric"` | |
[ "$ACTION" = ifup ] && OPERATION=add || OPERATION=del | |
ip route $OPERATION default via $GATEWAY metric $METRIC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment