purk ~ # ip addr show dev eth0
10: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 192.168.2.254/24 brd 192.168.2.255 scope global eth0
purk ~ # ip addr show dev eth1
11: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 42.42.1.1/30 brd 42.42.1.3 scope global eth1
purk ~ # ip addr show dev eth2
12: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 42.42.2.1/30 brd 42.42.2.3 scope global eth1
purk ~ # ip addr show dev eth3
13: eth3: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 42.42.3.1/30 brd 42.42.3.3 scope global eth1
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.254
42.42.1.0/30 dev eth1 proto kernel scope link src 42.42.1.1
42.42.2.0/30 dev eth2 proto kernel scope link src 42.42.2.1
42.42.3.0/30 dev eth3 proto kernel scope link src 42.42.3.1
127.0.0.0/8 via 127.0.0.1 dev lo scope link
purk ~ # cat /etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
default route:
ip route add default via 42.42.1.2 table pipe1
ip route add default via 42.42.2.2 table pipe2
ip route add default via 42.42.3.2 table pipe3
purk ~ # ip route show table pipe3
default via 42.42.3.2 dev eth3
# iptables -t mangle -A PREROUTING -o !eth0 -p tcp -m state --state NEW -m random --average 20 -j MARK --set-mark 10
# iptables -t mangle -A PREROUTING -o !eth0 -p tcp -m state --state NEW -m random --average 30 -j MARK --set-mark 20
# iptables -t mangle -A PREROUTING -o !eth0 -p tcp -m state --state NEW -m random --average 50 -j MARK --set-mark 30
# ip rule add fwmark 10 table pipe1
# ip rule add fwmark 20 table pipe2
# ip rule add fwmark 30 table pipe3
# iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 42.42.1.1
# iptables -t nat -A POSTROUTING -o eth2 -j SNAT --to-source 42.42.2.1
# iptables -t nat -A POSTROUTING -o eth3 -j SNAT --to-source 42.42.3.1