[TriLUG] How to set a persistent route in Linux

Jason Faulkner jasonlf at gmail.com
Tue Mar 28 23:19:36 EST 2006


(hey, I learned this this week! huzzah!)

in debian, just put a script in /etc/network/if-up.d that pulls them
up. Something basic like

#!/bin/sh
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.2 dev eth0

and it automagically runs it when you bring networking up. BRILLIANT!

On 28 Mar 2006 22:29:40 -0500, Jon Carnes <jonc at nc.rr.com> wrote:
> I've always hacked my /etc/rc.d/rc.local file and added "permanent"
> routes that way, but I've known that was a hack... you lose the route if
> you do a "service network restart" and that shouldn't happen.
>
> I knew their should be an easy way to add a permanent route and there
> is. For Red Hat type installs add a file as such:
>   /etc/sysconfig/network-scripts/route-eth0
>
> The route in the file should be of the form:
>   192.168.2.0/24 via 192.168.1.2
>
> This is the equivalent to putting a route statement in:
> route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.2 dev eth0
>
> Now when I do a network restart, my static routes come up just dandy!
>
> for more info:
> http://www.akadia.com/services/redhat_static_routes.html
>
> Jon Carnes
> Trilug: where sometimes the "T" stands for "Trivia!"
>
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>


--
Jason Faulkner
------------------------
OldOs.org Owner/Admin //
OpenDocument Fellowship Sysadmin


More information about the TriLUG mailing list