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

FAQ
It is currently Sat Aug 19, 2017 2:43 am


System administration, processes administration, jobs, cron, resources, limits, shells, ssh, telnet.

Author Message
mandrei99
Post  Post subject: Debian persistent static route - how to make a static route persistent across reboots  |  Posted: Sat Jan 17, 2015 7:55 pm

Joined: Tue Aug 04, 2009 9:16 am
Posts: 245

Offline
 

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":
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





Change default editor to VI in Debian Linux.


Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Debian persistent static route - how to make a static route persistent across reboots"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Change default editor to VI in Debian Linux

mandrei99

0

631

Fri Jan 16, 2015 6:59 pm

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
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