I used to add static routes up until debian 9 this way:

up route add -net gw
up route add -host gw

What changed for debian10 and what's the new syntax for static routes in the /etc/network/interfaces file?

3 Answers 3


The up ... lines are not stand-alone, but they are extensions of an iface ... line before them. Before Debian 9, the actual network interface used to pretty much always be the last entry in /etc/network/interfaces, so just adding up route add ... lines at the end might have actually worked pretty often.

If you chose to install a desktop environment, the installation is likely to include NetworkManager, and in that case, there may be no iface line for your network interface at all, allowing the interface to be controlled by NetworkManager instead. In that case, you could use one-time nmcli commands to persistently add new routes:

 nmcli c modify eno1 +ipv4.routes "" # network route
 nmcli c modify eno1 +ipv4.routes "" # host route

And if you don't use NetworkManager... the net-tools package that includes the old ifconfig and route commands has been deprecated since Debian 9, and is no longer installed by default. So unless you have explicitly chosen to install net-tools, you should use the newer ip route commands instead:

iface eno1 ...
    up /bin/ip route add via   # network route
    up /bin/ip route add via   # single host route
  • Thank you for the answer, any idea why the routes don't apply after a reboot?
    – thpetrus
    Feb 5, 2020 at 12:00
  • Are you sure you have not made any typos, e.g. specified a gateway IP that is not reachable directly with the IP/netmask configuration of that interface? Are you using NetworkManager or not, and if not, have you made sure NetworkManager is definitely disabled? In /etc/network/interfaces, you may need to use an absolute path: up /bin/ip ... instead of just up ip ....
    – telcoM
    Feb 5, 2020 at 12:09
  • using nmcli you might want to use nmcli connection show to get your value of eno1 above.
    – Archemar
    Nov 12, 2020 at 15:03
  • A bit late to the party, but did you find a solution? I found that when using dhcp the up command is not executed. Feb 10, 2022 at 14:07

This works for debian 9 (debian stretch), debian 10 (debian buster) and debian 11 (debian bullseye):

Edit /etc/network/interfaces file and add your permanent routes.


auto ens192
allow-hotplug ens192
iface ens192 inet static
    dns-search secar.cz
    up ip route del via dev ens192 
    up ip route add via dev ens192
    up ip route del via dev ens192
    up ip route add via dev ens192

Here is completed guide for permanent debian static routes

  • I could not find the route command on my Debian 11, I wonder, has it been moved to be a function of ip now?
    – Sam Sirry
    Feb 13, 2022 at 5:05
  • I don't use the route command anywhere in my tutorial... Feb 15, 2022 at 9:45
  • In the example above there's ip route add. This used to be done with the route command by itself. Now I see it has been integrated as a function of ip
    – Sam Sirry
    Feb 16, 2022 at 1:24

I solve the problem in /etc/systemd/network/, here i put all network configuration!

Replace or comment if exists: dhcp.network file for static.network


Address=aaa.aaa.aaa.aaa/aa  (MY IP)
Gateway=ccc.ccc.ccc.ccc         (Default Gateway)



Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.