In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to use flannel host-gw backend, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Flannel supports a variety of backend,host-gw is another backend of flannel, we will switch the previous vxlan backend to host-gw.
Unlike vxlan, host-gw does not encapsulate packets, but instead creates route entries to other host subnet in the host's routing table, allowing containers to communicate across hosts. To use host-gw, first modify the configuration flannel-config.json of flannel:
{
"Network": "10.2.0.0 Universe 16"
"SubnetLen": 24
"Backend": {
"Type": "host-gw"
}
}
Type replaces the previous vxlan with host-gw. Update the etcd database:
Etcdctl-endpoints=192.168.56.101:2379 set / docker-test/network/config
< flannel-config.json Ctrl+C 掉之前 host1 和 host2 的 flanneld 进程并重启。 flanneld -etcd-endpoints=http://192.168.56.101:2379 -iface=enp0s8 -etcd-prefix=/docker-test/network host1 上 flanneld 启动输出 与之前 vxlan backend 启动时有几点不同: ① flanneld 检查到原先已分配的 subnet 10.2.40.0/24,重用之。 ② flanneld 从 etcd 数据库中检索到 host2 的 subnet 10.2.17.0/24,但因为其 type=vxlan,立即忽略。 ③ 两分钟后,再次发现 subnet 10.2.17.0/24,将其加到路由表中。这次没有忽略 subnet 的原因是此时我们在 host2 上重启了 flanneld,根据当前 etcd 的配置使用 host-gw backend。 查看 host1 的路由表,增加了一条到 10.2.17.0/24 的路由,网关为 host2 的 IP 192.168.56.105。Similarly, when host2 starts flanneld, it reuses subnet 10.2.17.0 subnet 24, and adds host1's subnet 10.2.40.0 amp 24 to the routing table, and the gateway is host1 IP 192.168.56.104.
From / run/flannel/subnet.env, you can see that the MTU used by host-gw is 1500
This is different from vxlan MTU=1450, so you should modify the docker startup parameter, mtu=1500, and restart docker daemon.
Here is a simple comparison between host-gw and vxlan backend.
Host-gw configures each host as a gateway, and the host knows the subnet and forwarding addresses of other hosts. Vxlan builds tunnels between hosts, and the containers of different hosts are all in a large network segment (for example, 10.2.0.0and16).
Although vxlan and host-gw use different mechanisms to establish connections between hosts, bbox1 can still communicate with bbox2 without any change to the container.
Because vxlan requires additional packaging and unpacking of data, performance is slightly lower than that of host-gw.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.