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 "1.2.3.4/23 2.3.4.5" # network route
nmcli c modify eno1 +ipv4.routes "2.3.4.5 3.4.5.6" # 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 1.2.3.4/23 via 2.3.4.5 # network route
up /bin/ip route add 2.3.4.5/32 via 3.4.5.6 # single host route