Packet capture for communication between kubernetes pods (flannel)

Environmental summary

kubernetes version: v1.15.0
Operating system: centos7
192.168.1.70-master node-flannel subnet 10.244.0.0/24
192.168.1.71-node node-flannel subnet 10.244.1.0/24
Insert picture description here
Insert picture description here
Insert picture description here

Scenario 1: Send an ICMP packet on the master node to the pod on the node node

Insert picture description here

Monitor the external network card ens32 on the master node

#8472 is the port monitored by the flannel process
#10.244.0.0 is the IP of the source VTEP device
#10.244.1.9 is the IP of the destination Pod
[root@master ~]# tcpdump udp -i ens32 -nn

14:42:43.792927 IP 192.168.1.70.44197 > 192.168.1.71.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.0.0 > 10.244.1.9: ICMP echo request, id 48129, seq 441, length 64
14:42:43.793258 IP 192.168.1.71.41132 > 192.168.1.70.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.1.9 > 10.244.0.0: ICMP echo reply, id 48129, seq 441, length 64

Found: The outer IP of the data packet is the host IP of both parties, and the inner IP is the IP of the flannel.1 network card and the IP of the target pod

Monitor the flannel.1 device and cni0 device on the node1 node

Monitor flannel.1 device
Insert picture description here
Monitor cni0 device

Insert picture description here

Scenario 2: Ping the Pod on node1 in the master's Pod

Enter the pod to ping the pod on another node
Insert picture description here

Monitor the external network card ens32 on the master node

#8472 is the port monitored by the flannel process
#10.244.0.5 is the IP of the source Pod #10.244.1.9 is the IP
of the destination Pod
[root@master ~]# tcpdump udp -i ens32 -nn
15:11:18.245905 IP 192.168.1.70. 59468> 192.168.1.71.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.0.5> 10.244.1.9: ICMP echo request, id 4352, seq 0, length 64
15:11:18.246494 IP 192.168.1.71.60179> 192.168.1.70.8472: OTV, flags [I] (0x08), overlay 0, instance 1
IP 10.244.1.9> 10.244.0.5: ICMP echo reply, id 4352, seq 0, length 64

Found: The outer IP of the packet is the IP of both hosts, and the inner IP is the IP of the two pods

Monitor the flannel.1 device and cni0 device on the node1 node

Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/nangonghen/article/details/102024843