Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Mon Oct 21, 2019 4:37 am


Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
 
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.
     

Topic review - Debian persistent static route - how to make a static route persistent across reboots
Author Message
Post subject: Debian persistent static route - how to make a static route persistent across reboots  |  Post Posted: Sat Jan 17, 2015 7:55 pm
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":
Quote:
post-up command
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.

Code:
# Network interface for debian
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
        address 10.1.22.181
        netmask 255.255.255.0
        network 10.1.22.0
        broadcast 10.1.22.255
        gateway 10.1.22.1
        dns-nameservers 8.8.8.8
        post-up ip ro add 1.1.1.1 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 1.1.1.1 via 10.1.22.10" command can also be added to "/etc/rc.local".

Debian list routing table:
Code:
# ip route
default via 10.1.22.3 dev eth0  proto static  initcwnd 10 initrwnd 10
1.1.1.1 via 10.1.22.10 dev eth0
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO