In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Background
When the Docker service starts, a docker0 bridge (with a docker0 internal interface) is created by default, which connects other physical or virtual NICs in the kernel layer, which places all containers and local hosts on the same physical network.
By default, Docker specifies the IP address and subnet mask of the docker0 interface so that hosts and containers can communicate with each other over the bridge. it also gives MTU (the maximum transmission unit allowed to be received by the interface), usually 1500 Bytes, or the default value supported on the host host network route. These values can be configured when the service starts.
two。 Environment
[root@iZ2ze278r1bks3c1m6jdznZ ~] # cat / etc/redhat-releaseCentOS Linux release 7.5.1804 (Core) [root@iZ2ze278r1bks3c1m6jdznZ ~] # uname-r3.10.0-514.26.2.el7.x86_64 [root@iZ2ze278r1bks3c1m6jdznZ ~] # docker versionClient: Version: 1.13.1 API version: 1.26 Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64 Go version: go1.9.4 Git commit: 8633870 docker-1.13.1 1.13.1 Built: Fri Sep 28 19:45:08 2018 OS/Arch: linux/amd64Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64 Go version: go1.9.4 Git commit: 8633870 go1.9.4 Git commit 1.13.1 Built: Fri Sep 28 19:45:08 2018 OS/Arch: linux/amd64 Experimental: false
3. Modify the default docker0 bridge
[root@iZ2ze278r1bks3c1m6jdznZ] # ifconfig docker0docker0: flags=4163 mtu 1500 inet 172.17.0.1 netmask 255.255.255.0 broadcast 0.0.0.0 ether 02:42:20:c4:fa:7a txqueuelen 0 (Ethernet) RX packets 63 bytes 4592 (4.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 44 bytes 4206 (4.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
We can see that the network segment of the default docker0 is 172.xx.xx.xx
Modify the file / etc/docker/daemon.json to add "bip": "ip/netmask" [do not share the same network segment with the host]
[root@iZ2ze278r1bks3c1m6jdznZ ~] # cat / etc/docker/daemon.json {"bip": "192.168.100.1 Compact 24"}
4. Restart the server
[root@iZ2ze278r1bks3c1m6jdznZ ~] # systemctl restart docker
5. View the network segment of docker0
[root@iZ2ze278r1bks3c1m6jdznZ] # ifconfig docker0docker0: flags=4163 mtu 1500 inet 192.168.100.1 netmask 255.255.255.0 broadcast 0.0.0.0 ether 02:42:20:c4:fa:7a txqueuelen 0 (Ethernet) RX packets 63 bytes 4592 (4.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 44 bytes 4206 (4.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
OK, so far we have successfully modified the docker0 bridge. In the next article, I will explain how to access containers and hosts.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.