I have two interfaces on a Debian Stretch install where I want to change the default gateway after booting the box to the second interface. I have a working config from Jessie that I updated to reflect Stretch like:

# The primary network interface
allow-hotplug ens3
iface ens3 inet static

allow-hotplug ens9
iface ens9 inet static
    post-up ip route change default via
    #post-up route del default gw ens3
    #post-up route add default gw ens9

The post-up route commands don't appear to work on Strech (but did on Jessie), and the post-up ip route change command doesn't work either, though if I run it later from command line like:

ip route change default via

It works fine. What am I doing wrong? I guess I could put it in a cron job to run 30 seconds after start, but why won't it work in my /etc/network/interfaces config file?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.