Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of overlay Network of flannel under docker

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "flannnel overlay network example analysis under docker". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

###1. Network topology ###

The topology is as follows:

The container NIC is bridged to the flannel0 NIC through docker0, and the flannel0 segment corresponding to each host is 10.1.x. [1-255]/24, and a cross-host network segment formed by flannell is 10.1.x.x/16, while flannell 0 is a network card virtualized by flanneld process.

The address of docker0 is determined by the FLANNEL_SUBNET parameter of/run/flannel/subnet.env.

###2.How to communicate between Container1 of Host A and Container2 of Host B ###When Container1 of Host A requests the data of Container2 of Host B, the process is as follows:

According to the routing rule of host A "10.1.15.0 255.255.255.0 U 0 0 docker0", the data is handed over to docker0 for processing. 0.0.0.0

docker0 receives the data, which is then routed to flannel0 according to the routing rule "10.1.0.0 255.255.0.0 U 0 0 flannel0." 0.0.0.0 Flanneld will send the data packet to eth0 and send it to the eth0 network card of the other host using udp protocol.

After eth0 NIC of host B is received, according to the routing rule 10.1.0.0 255.255.0.0 U 0 0 flannel0", it will be handed over to flannel0 NIC for processing. 0.0.0.0

Flanneld unpacks the data and hands it over to docker0 according to the routing rule "10.1.20.0 255.255.255.0 U 0 0 docker0." 0.0.0.0

Container 2 of host B will receive the data.

The network communication explanation is completed.

###3. Add physical machines to automatic deployment program ###Based on above, therefore:

Network card docker0, flannel0 network card correctly established.

Routes are configured correctly! 10.1.x. [1-255]/24 and 10.1.x.x/16.

Our network environment checks are based on this. Usually, both of the above automatically establish success correctly, but sometimes exceptions occur.

Check the network environment ifconfig docker0 and flannel0 when adding physical machines and need to configure routing rules correctly.

Flanneld udp port 2375 needs to be added to iptables exception.

This is the end of the introduction to "Flannel overlay network example analysis under docker." Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report