[CentOS] Multiple Internet facing Nics - Gateway issue

Thu Jul 2 09:14:36 UTC 2009
Lorenzo Quatrini <lorenzo.quatrini at gmail.com>

Doug Coats ha scritto:
> I am ecstatically confused.
>  
> After I entered the last two commands my routing is working the way that
> I need it to.
>  
> ip rule add from 173.11.51.46 table Cable
> ip rule add from 67.152.166.2 table T1
>  
> The problem is I don't know which actual commands worked.  I had just
> rebooted.  The other ip commands were all in the rc.local file so they
> all ran.
>  
> Why did the above commands make the Cable and T1 rules show up in the
> rules list but the following two did not?
>  
> ip route add 173.11.51.44/30 <http://173.11.51.44/30> dev eth2 src
> 173.11.51.45 table Cable
> ip route add 67.152.166.0/27 <http://67.152.166.0/27> dev eth3 src
> 67.152.166.2 table T1
> Do I need all of the commands?  So that what is in rc.local looks like this?
>  
> ip rule add from 173.11.51.46 table Cable
> ip route add 173.11.51.44/30 <http://173.11.51.44/30> dev eth2 src
> 173.11.51.45 table Cable
> ip route add default via 173.11.51.45 table Cable
> ip route add 173.11.51.44/30 <http://173.11.51.44/30> dev eth2 src
> 173.11.51.45
> ip route add default via 173.11.51.46
> ip rule add from 173.11.51.45 to default lookup Cable
> ip rule add from 67.152.166.2 table T1
> ip route add 67.152.166.0/27 <http://67.152.166.0/27> dev eth3 src
> 67.152.166.2 table T1
> ip route add default via 67.152.166.2 table T1
> ip route add 67.152.166.0/27 <http://67.152.166.0/27> dev eth3 src
> 67.152.166.2
> ip rule add from 67.152.166.2 to default lookup T1
> ip route flush cache
> 
> 

Don't know if can be applied here, but when I did some test I discovered that
if you want to have 2 gateways you have to use "scope" so... could you try
doing this:

ip route delete default
ip route add default scope global nexthop via 173.11.51.46 weight 10 nexthop
via 67.152.166.2 weight 20

for what I can recall that was all that I need to tell the system about the
dual route. Of course if you want to load-balance adjust the weight to your needs.

Hope this helps

Regards
Lorenzo Quatrini