[TriLUG] iproute2 persistence
Jon Carnes
jonc at nc.rr.com
Tue Aug 15 00:05:01 EDT 2006
On Mon, 2006-08-14 at 10:16, Aaron S. Joyner wrote:
> Brian Henning wrote:
>
> > Hiya Gang,
> > Is there a standard place to put iproute2 settings (ip rule, ip
> > route, etc) to be reloaded on startup, or do I just add the necessary
> > lines to rc.local?
> >
> > Thanks!
> > ~Brian
> >
> Most distro's don't have a simple place to drop in such rules, at this
> time. Depending on how picky you are / need to be about when things are
> loaded, and how clean you want to keep your init scripts, you may want
> to make an additional init script for it. You can pick one of the
> simpler services, gut most of the functionality from the script, leaving
> the start) stop) cases and modify those to your liking. Dropping them
> into /etc/rc.local will do just fine, though.
>
> Aaron S. Joyner
We studied this during one of our RHCE prep classes. For me to remember
it, it must have been taught by Lisa! Anyway, for Red Hat, the following
should work (at least it does for me) - for adding routes to various
interfaces...
In /etc/sysconfig/network-scripts/
You define the interface settings with files:
ifcfg-eth0
ifcfg-eth1
ifcfg-lo
You define specific routes through those interfaces with files:
route-eth0
route-eth1
As an example, if your default gateway uses eth0, but you want to reach
a network by going though the secondary ethernet card (eth1) then you
would put something similar to this in route-eth1:
126.174.133.24/29 via 192.168.2.1
When eth1 is brought up by the system, a route to network
126.174.133.24/29 will automatically be added, going through eth1 and
using 192.168.2.1 as the Gateway. (of course 192.168.2.1 must be on the
same local network as eth1).
If you want to add more than one route, then just add more lines to the
file. One route per line.
Hope that is somewhat illuminating!
Jon
More information about the TriLUG
mailing list