四、iproute2的设置过程
1、ip rule add from 172.21.30.252 lookup 1
2、ip route add 192.168.0.0/24 via 192.168.0.5 table 1
3、ip route add 0/0 via 172.21.30.1 table 1
4、ip rule add from 192.168.11.2 lookup 2
5、ip route add 192.168.0.0/24 via 192.168.0.5 table 2
6、ip route add 0/0 via 192.168.11.1 table 2
7、ip route replace default equalize nexthop via 172.21.30.1 dev eth1 nexthop via 192.168.11.1 dev eth2
8、ip route flush cache
执行完这些操作以后,用ip ruote show显示的结果:
172.21.30.0/24 dev eth1 proto kernel scope link src 172.21.30.252
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.5
192.168.11.0/24 dev eth2 proto kernel scope link src 192.168.11.2
default equalize
nexthop via 172.21.30.1 dev eth1 weight 1
nexthop via 192.168.11.1 dev eth2 weight 1