美文网首页
记录一个路由配置正确且存在,但是路由功能不正常的问题

记录一个路由配置正确且存在,但是路由功能不正常的问题

作者: cloudFans | 来源:发表于2022-08-30 18:30 被阅读0次

[root@observability-worker-5 ~]# ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac tracepath 169.254.20.10 -n
 1?: [LOCALHOST]                      pmtu 1500



 1:  no reply
 2:  no reply
^C
[root@observability-worker-5 ~]#   ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.117.192.1    0.0.0.0         UG    0      0        0 eth0
10.117.192.0    0.0.0.0         255.255.192.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.31.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#  ip netns exec cni-db73cc58-97c0-41b2-e194-99112afc889a  route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.117.192.1    0.0.0.0         UG    0      0        0 eth0
10.117.192.0    0.0.0.0         255.255.192.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.31.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]# ip netns exec cni-db73cc58-97c0-41b2-e194-99112afc889a  ping 169.254.20.10
PING 169.254.20.10 (169.254.20.10) 56(84) bytes of data.
64 bytes from 169.254.20.10: icmp_seq=1 ttl=64 time=0.062 ms
64 bytes from 169.254.20.10: icmp_seq=2 ttl=64 time=0.060 ms



# 可以看到两个pod的容器所在的ns的路由是一致的,但是到localdns 169.254.20.10 网络 不通

# 尝试重建一次到localdns的路由,然后就通了

[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#  ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac  route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.117.192.1    0.0.0.0         UG    0      0        0 eth0
10.117.192.0    0.0.0.0         255.255.192.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.31.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#  ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac  ip route del 169.254.0.0/255.255.0.0 dev eth0
[root@observability-worker-5 ~]#  ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac  route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.117.192.1    0.0.0.0         UG    0      0        0 eth0
10.117.192.0    0.0.0.0         255.255.192.0   U     0      0        0 eth0
172.31.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#  ip netns exec cni-edb93d25-740a-3992-775f-350b6cf6a1ac  ip route add 169.254.0.0/255.255.0.0 dev eth0
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
[root@observability-worker-5 ~]#
# 结果还是不通

目前怀疑是ns刚创建出来的时候就设置路由是不是可能有问题,可能跟内核版本有关系

复盘,这个应该是同一个pod创建到同一个物理机上,但是使用了同一个ip在不同的ns中

相关文章

网友评论

      本文标题:记录一个路由配置正确且存在,但是路由功能不正常的问题

      本文链接:https://www.haomeiwen.com/subject/qmwdnrtx.html