Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Wan Networks
- eth0 192.168.1.10/24 gateway 192.168.1.1
- eth1 192.168.2.10/24 gateway 192.168.2.1
- eth2 192.168.3.10/24 gateway 192.168.3.1
- Lan Network
- eth3
- edit /etc/iproute/rt_tables
- 201 table1
- 202 table2
- 203 table3
- edit /etc/network/interfaces
- auto eth0
- iface eth0 inet static
- address 192.168.1.10
- netmask 255.255.255.0
- # gateway 192.168.1.1
- broadcast 192.168.1.255
- network 192.168.1.0
- post-up ip route add 192.168.1.0/24 dev eth0 src 192.168.1.10 table table1
- post-up ip route add default via 192.168.1.1 table table1
- post-up ip rule add from 192.168.1.10 table table1
- post-down ip rule del from 192.168.1.10 table table1
- auto eth1
- iface eth1 inet static
- address 192.168.2.10
- netmask 255.255.255.0
- # gateway 192.168.2.1
- broadcast 192.168.2.255
- network 192.168.2.0
- post-up ip route add 192.168.2.0/24 dev eth1 src 192.168.2.10 table table2
- post-up ip route add default via 192.168.2.1 table table2
- post-up ip rule add from 192.168.2.10 table table2
- post-down ip rule del from 192.168.2.10 table table2
- auto eth2
- iface eth2 inet static
- address 192.168.3.10
- netmask 255.255.255.0
- # gateway 192.168.3.1
- broadcast 192.168.3.255
- network 192.168.3.0
- post-up ip route add 192.168.3.0/24 dev eth2 src 192.168.3.10 table table3
- post-up ip route add default via 192.168.3.1 table table3
- post-up ip rule add from 192.168.3.10 table table3
- post-down ip rule del from 192.168.3.10 table table3
- IPTABLES COMMAND
- iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
- iptables -t mangle -A PREROUTING -m mark ! --mark 0 -j ACCEPT
- iptables -t mangle -A PREROUTING -j MARK --set-mark 10
- iptables -t mangle -A PREROUTING -m statistic --mode random --probability 0.5 -j MARK --set-mark 20
- iptables -t mangle -A PREROUTING -j CONNMARK --save-mark
- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
- iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
- edit /etc/rc.local
- ip route add default scope global nexthop via 192.168.1.1 dev eth0 weight 1 nexthop via 192.168.2.1 dev eth1 weight 1 nexthop via 192.168.3.1 dev eth2 weight 1
- edit /proc/sys/net/ipv4/ip_forward
- 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement