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