A eth0 <-> B eth2
B eth0 <-> C eth0
计算机A:eth0 192.168.1.2
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 192.168.1.2 255.255.255.0 UG 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
224.0.0.0 * 240.0.0.0 U 0 0 0 eth0
计算机B:eth0 192.168.0.1 eth2 192.168.1.1
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth2
224.0.0.0 * 240.0.0.0 U 0 0 0 eth0
net.ipv4.ip_forward = 1
计算机C:eth0 192.168.0.3
在计算机A上:ping 192.168.0.3,但计算机C没有响应
在计算机B上:tcpdump显示来自计算机A的ping数据包仅到达eth2,但未转发到eth0
我也尝试在计算机B上添加iptables,但似乎没有什么作用
~ # iptables -L -v -n
Chain INPUT (policy ACCEPT 59 packets, 8978 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- eth2 eth0 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- eth0 eth2 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT all -- eth0 eth2 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT all -- eth2 eth0 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 50 packets, 23460 bytes)
pkts bytes target prot opt in out source destination