|Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
|Debian persistent static route - how to make a static route persistent across reboots
|Page 1 of 1|
|Author:||mandrei99 [ Sat Jan 17, 2015 7:55 pm ]|
|Post subject:||Debian persistent static route - how to make a static route persistent across reboots|
Debian linux "man interfaces" explains some callbacks used before or after an interface is brought up/down. One of them is "post-up". Quote "man interfaces":
Run command after bringing the interface up. If this command fails then ifup aborts, refraining from marking the interface as configured (even
though it has really been configured), prints an error message, and exits with status 0. This behavior may change in the future.
Interface configuration file in Debian is under "/etc/network/interfaces" so that's where we can add the persistent static route.
# Network interface for debian
# The loopback network interface
iface lo inet loopback
# The primary network interface
iface eth0 inet static
post-up ip ro add 18.104.22.168 via 10.1.22.10
A static route in Linux, as in any other net system, has 3 main components: host, netmask and gateway.
The above "ip ro add 22.214.171.124 via 10.1.22.10" command can also be added to "/etc/rc.local".
Debian list routing table:
# ip route
default via 10.1.22.3 dev eth0 proto static initcwnd 10 initrwnd 10
126.96.36.199 via 10.1.22.10 dev eth0
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group