Skip to content

Instantly share code, notes, and snippets.

@rationalsa
Last active March 11, 2021 00:32
Show Gist options
  • Save rationalsa/05844af723db8945bdea0a552ae89cf0 to your computer and use it in GitHub Desktop.
Save rationalsa/05844af723db8945bdea0a552ae89cf0 to your computer and use it in GitHub Desktop.
Save it in /etc/dhcp/dhclient-exit-hooks.d/
if [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
ip rule del lookup "$interface" || true
ip route flush table "$interface"
ip route add default via "$new_routers" dev "$interface" table "$interface"
ip rule add from "$new_ip_address" lookup "$interface"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment