背景介绍
16、87和111都是虚拟机只有一个IP,3是物理机有两个IP分别为172.16.15.3和172.16.15.67
网段分为172.16.15.0~172.16.15.63(业务网)、172.16.15.64~172.16.15.127(管理网),两个网段之间是联通的,
业务网的网关为172.16.15.62,管理网的网关为172.16.15.126
172.16.15.87路由为
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.15.126 0.0.0.0 UG 0 0 0 eth0 172.16.15.64 * 255.255.255.192 U 0 0 0 eth0
172.16.15.3路由为
[root@sugon03 ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.15.62 0.0.0.0 UG 0 0 0 br1 172.16.15.0 0.0.0.0 255.255.255.192 U 0 0 0 br1 172.16.15.64 0.0.0.0 255.255.255.192 U 0 0 0 enp4s0f187可以ping通16、111、不能ping通3
[docker@pcopusrw01 /opt/apache-tomcat-8.5.9]#traceroute 172.16.15.15 traceroute to 172.16.15.15 (172.16.15.15), 30 hops max, 60 byte packets 1 172.16.15.124 (172.16.15.124) 13.747 ms 14.119 ms 14.536 ms 2 172.16.15.15 (172.16.15.15) 0.963 ms 1.101 ms 1.218 msping111因为在同一个网段,不走路由,直接点对点 ping 3走的也是路由(3上面的路由配置如下),但是ping包到达3的时候,却没有返回相应的包给87,因为3发现87是64网段的,因此发现可以直接通过64这个网段直接回包给87,而64这个网段对应的网卡ip为67,因此实际会给87的包是由67发的,而ping的原理是必须来源走同一个ip,现在是87请求的是3,而回的却是67,自然就被87把回的包给扔了,当做不可达
[root@sugon03 ~]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.15.62 0.0.0.0 UG 0 0 0 br1 172.16.15.0 0.0.0.0 255.255.255.192 U 0 0 0 br1 172.16.15.64 0.0.0.0 255.255.255.192 U 0 0 0 enp4s0f1
修改87的路由配置:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.15.126 0.0.0.0 UG 0 0 0 eth0 172.16.15.0 * 255.255.255.192 U 0 0 0 eth0 172.16.15.64 * 255.255.255.192 U 0 0 0 eth087可以ping通3、111、不能ping通16