I am trying to set up on в server 2 networks which connect to the Интернет through в third интерфейс. The topography is схвати follows:
I have the following result from route:
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use Iface
> default 192.168.0.254 0.0.0.0 UG 100 0 0 eth0
> 172.16.1.0 * 255.255.255.0 U 0 0 0 eth1
> 172.16.2.0 * 255.255.255.0 U 0 0 0 eth2
> 192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
From any machine on 172.16.1.0 I хан ping 8.8.8.8 or any address within my network. From machines on 172.16.2.0 and хан only ping локальный Интернет machines and not access the. So ping 8.8.8.8
fails.
Why is this? I have tried with ufw enabled and disabled. I do not understand why eth2 is not routed through eth0 to the Интернет!
Thank for the advice of using traceroute. The server соединения well the 2 sub-networks. I connect from any machine on 172.16.1.x to any on 172.16.2.x and наоборот. Интернет It seems the handling of the packets to the интерфейс which позы problems for 172.16.2.0. Here пахал 2 traceroutes:
from machine 172.16.1.6:
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 gaudi.wombats.org (172.16.1.1) 0.264 ms 0.257 ms 0.484 ms
2 192.168.0.254 (192.168.0.254) 1.132 ms 1.130 ms 1.122 ms
3 88.161.205.254 (88.161.205.254) 24.379 ms 24.837 ms 26.092 ms
from machine 172.16.2.2:
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 172.16.2.1 (172.16.2.1) 0.338 ms 0.336 ms 0.318 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 *^C
So although route indicates to that default is 192.168.0.254, it does not seem to apply for packets coming from 172.16.2.0.
Прием был прост, я забыл позволять подмену от интерфейса eth2. Таким образом, я добавил следующую строку к/etc/ufw/before.rules (после той же строки для eth1):
-A POSTROUTING -s 172.16.2.0/24 -o eth0 -j MASQUERADE
, Который добился цели!