Сейчас поставил все правильно, вроде, но все-равно идут все через 1 шлюз, вывод команд:
-----------------------------------------------------------
root@gate:~# ip ru sh
0: from all lookup local
101: from all iif eth0 lookup 101
102: from all iif eth1 lookup 102
32766: from all lookup main
32767: from all lookup default
-----------------------------------------------------------
root@gate:~# ip ro sh table 101
default via 195.5.5.203 dev ppp0
-----------------------------------------------------------
root@gate:~# ip ro sh table 102
default via 217.12.196.125 dev eth3
-----------------------------------------------------------
root@gate:~# ip ro sh table main
195.5.5.203 dev ppp0 proto kernel scope link src 94.179.102.123
217.12.196.124/30 dev eth3 proto kernel scope link src 217.12.196.126
10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.3
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.2
default via 217.12.196.125 dev eth3 metric 100
-----------------------------------------------------------
root@gate:~# ip ro sh table default
-----------------------------------------------------------
root@gate:~# iptables -t nat -nvL --line
Chain PREROUTING (policy ACCEPT 8125 packets, 632K bytes)
num pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 10 packets, 3020 bytes)
num pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 20 packets, 3552 bytes)
num pkts bytes target prot opt in out source destination
1 3015 330K MASQUERADE all -- * eth3 0.0.0.0/0 0.0.0.0/0
2 0 0 MASQUERADE all -- * ppp0 0.0.0.0/0 0.0.0.0/0
-----------------------------------------------------------
root@gate:~# iptables -t mangle -nvL --line
Chain PREROUTING (policy ACCEPT 37871 packets, 8205K bytes)
num pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 3908 packets, 296K bytes)
num pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 26027 packets, 7408K bytes)
num pkts bytes target prot opt in out source destination
1 0 0 TCPMSS tcp -- * ppp0 0.0.0.0/0 0.0.0.0/0 tcp flags:0x06/0x02 tcpmss match 1400:65495 TCPMSS clamp to PMTU
Chain OUTPUT (policy ACCEPT 3430 packets, 275K bytes)
num pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 29457 packets, 7683K bytes)
num pkts bytes target prot opt in out source destination
-----------------------------------------------------------
root@gate:~# iptables -nvL --line
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
А вот файлы настроек:
-----------------------------------------------------------
/etc/network/interfaces
auto lo
iface lo inet loopback
#ITL
auto eth3
iface eth3 inet static
address 217.12.196.126
netmask 255.255.255.252
gateway 217.12.196.125
pre-up ifconfig eth1 up
#post-up /etc/network/nat.itl.sh
#LAN 2
auto eth0
iface eth0 inet static
address 10.0.0.2
netmask 255.255.255.0
#LAN 3
auto eth1
iface eth1 inet static
address 10.0.0.3
netmask 255.255.255.0
auto provider
iface provider inet ppp
pre-up ifconfig eth2 up
pre-up ifconfig eth0 up
#post-up /etc/network/nat.utel.sh
provider provider
-----------------------------------------------------------
/etc/network/nat.itl.sh
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.conf.eth0.arp_filter=1
sysctl net.ipv4.conf.eth2.arp_filter=1
ip rule add iif eth1 table 102 pref 102
ip ro add default via 217.12.196.125 dev eth3 table 102
/sbin/iptables -t nat -A POSTROUTING -o eth3 -j MASQUERADE
-----------------------------------------------------------
/etc/network/nat.utel.sh
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.conf.eth0.arp_filter=1
sysctl net.ipv4.conf.eth2.arp_filter=1
ip rule add iif eth0 table 101 pref 101
ip ro add default via 195.5.5.203 dev ppp0 table 101
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE