日期:2014-05-16  浏览次数:20630 次

linux下路由负载均衡

vi /etc/iproute2/rt_tables 200 Service 100 Tech ip route add 192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.200.8 table Tech ip route add 202.127.124.0/28 dev eth1 proto kernel scope link src 202.127.124.1 table Tech ip route add default via 202.127.124.2 dev eth1 ip route add 192.168.200.0/24 dev eth0 proto kernel scope link src 192.168.100.8 table Service ip route add 219.236.153.0/28 dev eth2 proto kernel scope link src 219.236.153.1 table Service ip route add default via 219.236.153.2 dev eth2 ip rule list ip rule add from 192.168.100.6 to Tech ip rule add from 192.168.100.7 to Service iptables -t nat -A POSTROUTING -s 192.168.100.6 -j MASQUERADE iptables -t nat -A POSTROUTING -s 192.168.100.7 -j MASQUERADE sysctl -A | grep net.ipv4.ip_forward route print