- 论坛徽章:
- 0
|
iptables -t mangle -A PREROUTING -i WAN1dev -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100
iptables -t mangle -A PREROUTING -i WAN2dev -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x200
iptables -t mangle -A POSTROUTING -o WAN1dev -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x100
iptables -t mangle -A POSTROUTING -o WAN2dev -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x200
iptables -t mangle -A PREROUTING -i Landev -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark
ip rule add prio 100 from Wan1subnet subnet 100
ip rule add fwmark 0x100 prio 101 table 100
ip route add table 100 to Wan1subnet dev WAN1dev proto kernel scope link
ip route add table 100 to Wan2subnet dev WAN2dev proto kernel scope link
ip route add table 100 to Lansubnet dev Landev proto kernel scope link
ip route add default via GW1 dev WAN1dev table 100
ip rule add prio 100 from Wan2subnet subnet 200
ip rule add fwmark 0x200 prio 101 table 200
ip route add table 200 to Wan1subnet dev WAN1dev proto kernel scope link
ip route add table 200 to Wan2subnet dev WAN2dev proto kernel scope link
ip route add table 200 to Lansubnet dev Landev proto kernel scope link
ip route add default via GW2 dev WAN2dev table 200
应该这样.
附:关于内核中conntrack的定义
It allows matching on additional conntrack information, which is x
useful in complex configurations, such as NAT gateways with multiple x
internet links or tunnels.
另外在2.4中早就有此模块.
[ 本帖最后由 wysilly 于 2007-4-25 20:46 编辑 ] |
|