[CentOS] Multiple Internet facing Nics - Gateway issue

John R Pierce pierce at hogranch.com
Thu Jul 2 05:50:06 UTC 2009


Doug Coats wrote:
> So if I run the following two commands the rules show up in the list.
>  
> ip rule add from 173.11.51.46 table Cable
> ip rule add from 67.152.166.2 table T1
>  
> # ip rule list
> 0:      from all lookup 255
> 32764:  from 67.152.166.2 lookup T1
> 32765:  from 173.11.51.46 lookup Cable
> 32766:  from all lookup main
> 32767:  from all lookup default
>
> So why does that work but my other command not?

what other command?  the rt_tables file just associates the names T1 and 
Cable with rule #s, it doesn't actually define the rules, for that you 
need to use the "ip rule add ..." commands.

me, I make one interface the 'default', and just define ONE extra route 
for the 'other' network


say eth0 is 100.100.16.15/24 with a default gateway of 100.100.16.1, and 
eth1 is 200.200.18.30/24 with a route of 200.200.18.1 ...

I'd setup the system so the global default gateway is the one on eth0 
via /etc/sysconfig/network

then, I'd define ONE extra rule, and one extra route table entry...

    ip rule add from 200.200.18.30 table Alt
    ip route add default via 200.200.18.1 dev eth1 table Alt

now, these commands are NOT persistent, and, AFAIK, RHEL has no 
provision for `ip route` or rule commands, so I end up sticking this 
stuff in /etc/rc.d/rc.local or something.





More information about the CentOS mailing list