/etc/conf.d/net
/etc/init.d/multinetmodules=( "iproute2" )
config_eth0=( "10.1.1.34/24" )
config_eth1=( "192.168.2.77/24" )
In the kernel config:depend() {
after net
}
start() {
ip route add 10.1.1.0/24 dev eth0 src 10.1.1.34 table route1
ip route add default via 10.1.1.1 table route1
ip rule add from 10.1.1.34 table route1
ip route add 192.168.2.0/24 dev eth2 src 192.168.2.77 table route2
ip route add default via 192.168.2.1 table route2
ip rule add from 192.168.2.77 table route2
ip route add default scope global nexthop via 10.1.1.1 dev eth0 weight 1 nexthop via 192.168.2.1 dev eth2 weight 3
}
/etc/iproute2/rt_tablesCONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
100 dual
101 route1
102 route2
failovertest linux # ping -c2 192.168.2.102
PING 192.168.2.102 (192.168.2.102) 56(84) bytes of data.
64 bytes from 192.168.2.102: icmp_seq=1 ttl=250 time=1.03 ms
64 bytes from 192.168.2.102: icmp_seq=2 ttl=250 time=1.37 ms
--- 192.168.2.102 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.034/1.204/1.375/0.173 ms
failovertest linux # ping -c2 10.1.1.101
PING 10.1.1.101 (10.1.1.101) 56(84) bytes of data.
64 bytes from 10.1.1.101: icmp_seq=1 ttl=64 time=92.4 ms
64 bytes from 10.1.1.101: icmp_seq=2 ttl=64 time=19.7 ms
--- 10.1.1.101 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 19.763/56.124/92.485/36.361 ms
Also, when I run this command manually I get an error:failovertest linux # ping -c2 74.125.127.100
connect: Network is unreachable
Resources:failovertest linux # ip route add default scope global nexthop via 10.1.1.1 dev eth0 weight 1 nexthop via 192.168.2.1 dev eth2 weight 3
RTNETLINK answers: No such process
http://www.gentoo-wiki.info/Dual_internet_connections

