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 address 188.8.131.52/24 gateway 184.108.40.206 dns-nameservers 220.127.116.11 allow-hotplug ens9 iface ens9 inet static address 18.104.22.168 netmask 255.255.255.0 gateway 22.214.171.124 post-up ip route change default via 126.96.36.199 #post-up route del default gw 188.8.131.52 ens3 #post-up route add default gw 184.108.40.206 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 220.127.116.11
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?