Re: How to create static routes on startup with CentOS4?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



"Filipe Brandenburger" <filbranden@xxxxxxxxx> 
wrote in message 
news:e814db780804151115u490b43dfsff787e759fbf18c@xxxxxxxxxxxxxxxxx
> On Tue, Apr 15, 2008 at 12:36 PM, Eric B. 
> <ebenze@xxxxxxxxxxx> wrote:
>>  Is there anything that works similarly for the iproute2 ruleset?  I 
>> can't
>>  seem to find anything in /etc/init.d/network except for references to 
>> static
>>  routes using /sbin/route, which isn't good enough if one wants to use
>>  multiple routing tables.  Nor can I find anything in /etc/init.d/ that 
>> would
>>  seem applicable to the iproute2 system.
>
> You should put it in /etc/sysconfig/network-scripts/route-eth0 (change
> "eth0" to the name of the interface the routes apply to). For every
> line in this file, when the interface goes up, it will run "/sbin/ip
> route add $line" (see /etc/sysconfig/network-scripts/ifup-routes
> script if you want to understand exactly what it's doing).
>
> Apparently there's also a new syntax for
> /etc/sysconfig/network-scripts/route-eth0, in which you specify
> several variables, the same you do in ifcfg-eth0, then you set
> something like:
>
> ADDRESS0=1.2.3.0
> NETMASK0=255.255.255.0
> GATEWAY0=4.3.2.1
>
> And then you go ADDRESS1, ADDRESS2, ..., as you need more routes.
>
> There used to be a /etc/sysconfig/static-routes for this purpose but,
> as I understand, now the way to do it is per interface with the
> route-${ifname} files.
>
> To test if your file is working, do a "service network restart" and
> check if the routes are up as expected. You can also do "ifdown eth0"
> and "ifup eth0" if you want to restart only one interface (for
> instance if you're remotely connected through another interface).

Awesome!  Thanks so much.  That's exactly what I was looking for.  I must 
have missed it when I tried to grep the directory looking for the file that 
handled that stuff.


The last question then is if there is a way to add "ip rule" rules to 
specify which routing table to use based on packet information.
ex:  ip rule add fwmark 3 table 3

Are any of the network scripts able to handle this as well?

Thanks again!

Eric 



_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux