[CentOS] Multiple Internet facing Nics - Gateway issue

John R Pierce pierce at hogranch.com
Fri Jul 3 18:10:36 UTC 2009


Lorenzo Quatrini wrote:
> So does anyone have a clue on which is the syntax for creating complex routes
> and rules using route-* and rule-*?
>   

the route-<if> and rule-<if> are invoked by ifup-routes (all this in 
/etc/sysconfig/networking-scripts), and it appears they are read and 
each line is appeneded to

    /sbin/ip rule add $line

or

    /sbin/ip route add $line

respectively.

now, it also appears the routes are processed before the rules, not 
sure, but this could be a complication?

actually, upon further perusal, the ROUTES section is parsed as...

   if [ -f "$file" ]; then
       if egrep -q '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
           # new format
           handle_file $file ${1%:*}
       else
           # older format
           { cat "$file" ; echo ; } | while read line; do
               if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
                   /sbin/ip route add $line
               fi
           done
       fi

where 'older format' is as I described, I'm not quite sure what that 
egrep is looking for, but it appears the new format its looking for is...

    ADDRESSn=<network>
    NETMASKn=<prefix>
    GATEWAYn=<next-hop>

(for n=0,1,2,...)

and it constructs a

    /sbin/ip route add <network>/<prefix> via <next-hop> dev <if>

from each triplet of these...

AH, yes, here, this shows it...  http://kbase.redhat.com/faq/docs/DOC-8024

now, this makes no provisions for routes that have rule table #s.    
apparently the rules-<if> files were added to rhel5 and finding /any/ 
documentation is challenging.








More information about the CentOS mailing list