Теперь у меня три сетевых интерфейса, eth0
, eth1
и eth2
.
eth0: 45.1.1.1, connect directly to the internet
eth1: 192.168.11.1, the gateway before the router
eth2: 45.1.1.2, connect directly to the internet
в роутере у меня два интерфейса:
192.168.11.2 for traffics from eth0
192.168.11.3 for traffic from eth2
Мне нужно перенаправить трафик с eth0
и eth2
к eth1
, и у меня есть следующие правила:
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 192.168.11.2
iptables -t nat -A PREROUTING -i eth1 -j DNAT --to-destination 192.168.11.3
iptables -t nat -A POSTROUTING -s 192.168.11.2 -j SNAT --to-source 45.1.1.1
iptables -t nat -A POSTROUTING -s 192.168.11.3 -j SNAT --to-source 45.1.1.2
после тестирования я обнаружил, что машины позади 192.168.11.3
не может подключиться к Интернету, но другой может. Что-то не так с моими правилами?