>1) строка '-A POSTROUTING -s 192.168.20.0/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.254.2'
>легко упрощается до '-A POSTROUTING -o eth0 -j SNAT --to-source 192.168.254.2'
>
>2) дай ifconfig и route с обеих машин
>3) в input, output и forward поставь правило '-j LOG --log-prefix ...'
>- для каждой цепочки, что в логах нарисуется?
для 1-го роутера
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.0.0 * 255.255.255.0 U 0 0 0 eth2
xxx.xxx.xxx.0 * 255.255.255.0 U 0 0 0 eth0
192.168.254.0 * 255.255.255.0 U 0 0 0 eth3
169.254.0.0 * 255.255.0.0 U 0 0 0 eth3
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default $prov_router 0.0.0.0 UG 0 0 0 eth0
eth0 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:ZZ
inet addr:$real_ip Bcast:xxx.xxx.xxx.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:176058 errors:0 dropped:0 overruns:0 frame:0
TX packets:1068 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:11384603 (10.8 Mb) TX bytes:169554 (165.5 Kb)
Interrupt:11 Base address:0x3000
eth1 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:XX
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:319 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:28818 (28.1 Kb)
Interrupt:5 Base address:0x5000
eth2 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:YY
inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:153 errors:0 dropped:0 overruns:0 frame:0
TX packets:272 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:16050 (15.6 Kb) TX bytes:57955 (56.5 Kb)
Interrupt:11 Base address:0xa800
eth3 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:MM
inet addr:192.168.254.1 Bcast:192.168.254.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:280 errors:0 dropped:0 overruns:0 frame:0
TX packets:436 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:56740 (55.4 Kb) TX bytes:50978 (49.7 Kb)
Interrupt:5 Base address:0xac00
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:53 errors:0 dropped:0 overruns:0 frame:0
TX packets:53 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3984 (3.8 Kb) TX bytes:3984 (3.8 Kb)
на 2-м роутере
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.21.0 * 255.255.255.0 U 0 0 0 eth2
192.168.20.0 * 255.255.255.0 U 0 0 0 eth1
192.168.254.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth2
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.254.1 0.0.0.0 UG 0 0 0 eth0
eth0 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:BB
inet addr:192.168.254.2 Bcast:192.168.254.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:517 errors:0 dropped:0 overruns:0 frame:0
TX packets:446 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:59634 (58.2 Kb) TX bytes:71375 (69.7 Kb)
Interrupt:9 Base address:0xb000
eth1 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:CC
inet addr:192.168.20.1 Bcast:192.168.20.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:168 (168.0 b)
Interrupt:12 Base address:0xd800
eth2 Link encap:Ethernet HWaddr XX:YY:ZZ:DD:WW:DD
inet addr:192.168.21.1 Bcast:192.168.21.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:168 (168.0 b)
Interrupt:10 Base address:0xdc00
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:49 errors:0 dropped:0 overruns:0 frame:0
TX packets:49 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3954 (3.8 Kb) TX bytes:3954 (3.8 Kb)