[CentOS] Multiple Internet facing Nics - Gateway issue

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

Doug Coats wrote:
> So if I run the following two commands the rules show up in the list.
> ip rule add from table Cable
> ip rule add from table T1
> # ip rule list
> 0:      from all lookup 255
> 32764:  from lookup T1
> 32765:  from 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 with a default gateway of, and 
eth1 is with a route of ...

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 table Alt
    ip route add default via 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.