Adding a route after switching on the interface - Post-Up
Quite often one or more explicit routes are needed on a network interface. Here are the quick instructions to put this in the /etc/network/interfaces file.
Quite often one or more explicit routes are needed on a network interface. Here are the quick instructions to put this in the /etc/network/interfaces file.
Here is shown how a route can be added after a network interface has been successfully initialized. However, it is just as important to set the same command to remove the route when shutting down the interface.
Post-up means in this context that the command is only issued when the interface is marked as UP.
You could also set this command with just UP instead of POST-UP.
In this example, a route is set to the destination network 192.168.20.0/24, which is reachable via the gateway 192.168.10.250.
## Edit the file
nano /etc/network/interfaces
## Change the network config to your choise network configuration
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.10
netmask 255.255.255.0
gateway 192.168.10.1
POST-UP ip route add 192.168.20.0/24 via 192.168.10.250
POST-DOWN ip route del 192.168.20.0/24 via 192.168.10.250
The DynDNS service of IPv64.net is free of charge and usable in all common routers and systems.
You have the choice between many different domain names.
The IPv64.net Healthchecks monitor your services, servers and endpoints. Receive notifications when your services fail.
This monitoring service is free with all features.
Registration with IPv64 is free of charge and immediately available for you.
TP-Link Omada EAP620 HD, AX1800 ~ 126.80 € Show me | |
Ubiquiti UniFi 6 Pro (U6-Pro) ~ 159.88 € Show me |