This is the content of /etc/network/interfaces:

auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens18
iface ens18 inet static
        post-up route add -net gw
        pre-down route del -net gw

Any idea what i am doing wrong? Using the command ip route add via works fine...

ip r gives this after a reboot:

root@server:~# ip r
default via dev ens18 onlink dev ens18 proto kernel scope link src dev tun0 proto static dev docker0 proto kernel scope link src linkdown

1 Answer 1


Please check that you have installed 'route' binary, looks like it doesn't installed. What's about which route?

  • Holy shit, you are right. Its not installed, and using apt install net-tools and a reboot fixed everything... Not thought this could be a problem if the ip route add command works.... (Its a debian netinstall)
    – peterge
    May 26, 2021 at 9:48
  • 2
    Don't use the route command. It's depreceated. Update your pre-up to ip route add ...
    – vidarlo
    May 26, 2021 at 9:53
  • Use ifup -v <iface> command to troubleshoot interface configuration issues. May 26, 2021 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .