[CentOS] Static routes with a metric?
Benjamin Franz
jfranz at freerun.com
Wed Dec 7 18:28:12 UTC 2011
On 12/7/2011 10:03 AM, Matt Garman wrote:
> Hi,
>
> [...]
>
> What I basically need to be able to do is this:
> route add -host h1 gw g1 metric 0
> route add -host h1 gw g2 metric 10
>
> Notice that everything is the same except the gateway and metric. I could
> put this in /etc/rc.local, but was wondering if there's a cleaner way to do
> it in e.g. the network-scripts directory.
>
If you create files in the /etc/sysconfig/network-scripts directory
named according to the scheme
route-eth0
route-eth1
route-eth2
it will execute each line in the files as
/sbin/ip route add <line>
when each interface is brought up.
Look in the /etc/sysconfig/network-scripts/ifup-routes script for all
the gory details and features.
--
Benjamin Franz
More information about the CentOS
mailing list