我有这个设置:
10.5.128.150
Ubuntu Ubuntu eth2 <------> server (10.5.128.154)
client eth1 <----> eth1 Router eth3 <------>
10.5.129.179 10.5.129.39 10.5.130.201
因此 Ubuntu 路由器管理三个域:
- 10.5.129.0/24:这是客户居住的地方
- 10.5.128.0/24 :由 eth2 管理并连接到服务器。
- 10.5.130.0/24:由 eth3 管理
按照这里的答案:https://askubuntu.com/a/168037/347674,我已将客户端配置为使用路由器作为 10.5.128.0/24 流量的网关。
这是路由器上的路由表:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
....
10.5.128.0 * 255.255.255.0 U 0 0 0 eth2
10.5.129.0 * 255.255.255.0 U 0 0 0 eth1
10.5.130.0 * 255.255.255.0 U 0 0 0 eth3
这对我来说看起来很好,但是当我尝试从客户端 ping 该服务器时,我没有得到回复:
# ping -n -I eth1 10.5.128.154
PING 10.5.128.154 (10.5.128.154) from 10.5.129.179 eth1: 56(84) bytes of data.
路由器显示 ping 流量正确进入路由器的 eth1:
# tcpdump -n -i eth1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
15:20:17.428153 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 909, seq 170, length 64
15:20:17.618104 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 2534, length 64
15:20:18.427959 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 909, seq 171, length 64
但是路由器上的 ping 黑洞。它永远不会像我期望的那样走出 eth2 接口:
# tcpdump -n -i eth2
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 262144 bytes
(它是空的。)
事实上它不会去任何地方:
# tcpdump -n -i any icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
15:31:53.138046 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3224, length 64
15:31:54.145980 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3225, length 64
15:31:55.154033 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3226, length 64
ping 的请求不应该根据其路由表在 eth2 上发出吗?或者我还需要在 Ubuntu 路由器上配置其他东西才能将数据包从 eth2 传出吗?