[CentOS] iproute2 custom tables and rules the CentOS way...
Barry Brimer
lists at brimer.org
Mon Jan 24 22:28:16 UTC 2011
Quoting Ray Van Dolson <rayvd at bludgeon.org>:
> Hi all;
>
> I have a custom iproute2 table and a few rules to go along with it
> (CentOS 5) -- I have added the table to /etc/iproute2/rt_tables.
>
> if-up and friends doesn't seem to handle this real gracefully. How are
> those of you out there doing something similar managing this
> customization?
>
> I don't really want to muck with /etc/init.d/network or the if-up
> scripts to avoid breaking upgrades. rc.local my best bet?
I have a file named /etc/sysconfig/network-scripts/rule-eth0 which contains my
rules for eth0 and a file named /etc/sysconfig/network-scripts/route-eth0 which
are read by /etc/sysconfig/network-scripts/ifdown-routes and
/etc/sysconfig/network-scripts/ifup-routes.
The contents of my /etc/sysconfig/network-scripts/rule-eth0 is:
from 10.X.X.X/24 table testtable
The contents of my /etc/sysconfig/network-scripts/route-eth0 is:
default via 10.X.X.1 table testtable
10.X.X.0/24 dev eth0 table testtable
127.0.0.0/8 dev lo table testtable
For completeness, I have the following in /etc/iproute2/rt_tables:
100 testtable
There is no modification of /etc/init.d/network or any of the
/etc/sysconfig/network-scripts/if* files.
Hope this helps.
Barry
More information about the CentOS
mailing list