linux双出口的一点记录

[root@dbrg-2 opt]# more route.sh
#!/bin/bash
# This is route
#eth0(192.168.1.1 is lan);
#eth1(192.168.2.2 is wan1);
#eth2(192.168.3.2 is wan2);
route add -net 192.168.1.0/24  gw 192.168.1.1
ip route add default via 192.168.3.1 table net
ip route add default via 192.168.2.1
ip route add 192.168.1.0/25 via 192.168.1.1 table net
ip rule add from 192.168.3.2 table net
#ip rule add from 192.168.1.0/25 pref 10000 table net
ip rule add from 192.168.1.128/25 pref 10000 table net
iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -o eth1 -j SNAT --to-source 192.168.2.2
iptables -t nat -A POSTROUTING -s 192.168.1.0/255.255.255.0 -o eth2 -j SNAT --to-source 192.168.3.2
#iptables -t nat -A PREROUTING -d 192.168.2.2 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.1.26
#iptables -t nat -A POSTROUTING -s 192.168.1.26 -o eth2 -p tcp -m tcp --sport 80 -j SNAT --to-source 192.168.3.2

你可能感兴趣的:(linux,iptables,route,休闲,双出口)