Amar Cosic <amar.co...@gmail.com> writes:

> Hello list
>
> My mind is just "locked" at the moment and I am trying to figure out
> what am I doing wrong here. I have 4 static IP's on server machine
> and I have something like this in /etc/conf.d/net :
>
>
>
> config_eth0=( "77.xxx.104.14/24" )
> routes_eth0=( "default via 77.xxx.104.1" )
> config_eth0:1=( "77.xxx.104.100/24" )
> routes_eth0:1=( "default via 77.xxx.104.1" )
> config_eth0:2=( "77.xxx.104.101/24" )
> routes_eth0:2=( "default via 77.xxx.104.1" )
> config_eth0:3=( "77.xxx.105.100/24" )
> routes_eth0:3=( "default via 77.xxx.105.1" )
>
>
> eth0 works just fine while other ones fail. Could you help me with
> this one ?

Try emerging 'iproute2' (if not already installed) and then adding the
following line to /etc/iproute2/rt_tables
1   altlan


and then using the following in /etc/conf.d/net

modules-"iproute2"
config_eth0=( "77.xxx.104.14/24" "77.xxx.104.100/32" "77.xxx.104.101/32"
              "77.xxx.105.100/24" )
routes_eth0=( "default via 77.xxx.104.1"
              "default via 77.xxx.105.1 table altlan"
              "77.xxx.105.0/24 table altlan" )
rules_eth0=( "from 77.xxx.105.100 table altlan" )

postup() {
       # This function could be used, for example, to register with a
       # dynamic DNS service.  Another possibility would be to
       # send/receive mail once the interface is brought up.
       # Here is an example that allows the use of iproute rules
       # which have been configured using the rules_eth0 variable.
       #rules_eth0=" \
       #       'from 24.80.102.112/32 to 192.168.1.0/24 table localnet priority 
100' \
       #       'from 216.113.223.51/32 to 192.168.1.0/24 table localnet 
priority 100' \
       #"
       eval set -- $\rules_${IFVAR}
       if [ $# != 0 ]; then
               einfo "Adding IP policy routing rules"
               eindent
               # Ensure that the kernel supports policy routing
               if ! ip rule list | grep -q "^"; then
                       eerror "You need to enable IP Policy Routing 
(CONFIG_IP_MULTIPLE_TABLES)"
                       eerror "in your kernel to use ip rules"
               else
                       for x; do
                               ebegin "${x}"
                               ip rule add ${x} dev "${IFACE}"
                               eend $?
                       done
               fi
               eoutdent
               # Flush the cache
               ip route flush cache dev "${IFACE}"
       fi
}

postdown() {
#      Automatically erase any ip rules created in the example postup above
       if interface_exists "${IFACE}"; then
               # Remove any rules for this interface
               local rule
               ip rule list | grep " iif ${IFACE}[ ]*" | {
                       while read rule; do
                               rule="${rule#*:}"       
                               ip rule del ${rule}
                       done
               }
               # Flush the route cache
               ip route flush cache dev "${IFACE}"
       fi

       # Return 0 always
       return 0
}


Reply via email to