![docker ip a docker ip a](https://www.devguide.at/wp-content/uploads/2019/06/unicast-broadcast-multicast.jpg)
#DOCKER IP A INSTALL#
You may wish to confirm with another command: brctl Install the following: yum install bridge-utils (4) In other words, in tomcat01, eth0 and centos docker0, veth3 are paired, similar to veth-ns1 and veth-ns2 in the previous actual combat.
![docker ip a docker ip a](https://docker-k8s-lab.readthedocs.io/en/latest/_images/ovs-gre-docker.png)
(3) Since you can ping, and centos and tomcat1 belong to different network namespace s, how are they connected? (3) ping the network of tomcat01 in centos and find that it can be pinged (2) Check the network of container tomcat01: docker exec -it tomcat01 ip a, you can find (1) Check centos network: ip a, you can find How can they ping? Some small partners may think, isn't it the same as the actual battle of namespace above? Note that there is no Veth pair technology here In depth analysis of container network Bridge docker0 default bridge It is worth considering that tomcat01 and tomcat02 belong to two network namespace s at this time. (2) Go into the two containers and check the ip address docker exec -it tomcat01 ip a (1) How about creating two container s? docker run -d -name tomcat01 -p 8081:8080 tomcatĭocker run -d -name tomcat02 -p 8082:8080 tomcat
#DOCKER IP A VERIFICATION#
We can enter the container for verification Ip netns exec ns2 ping 192.168.0.11 NS for ContainerĪccording to the above description, in fact, each container will have its own network namespace, which is independent. (15) At this time, the two network namespace s Ping each other and it is found that they can ping each other ip netns exec ns1 ping 192.168.0.12 (14) Check again and find that the state is UP and there is IP at the same time ip netns exec ns1 ip a Ip netns exec ns2 ip link set veth-ns2 up (13) Start veth-ns1 and veth-ns2 ip netns exec ns1 ip link set veth-ns1 up (12) Check again and find that the state is DOWN and there is still no IP address ip netns exec ns1 ip link Ip netns exec ns2 ip addr add 192.168.0.12/24 dev veth-ns2 Obviously, there are still some conditions for communication ip netns exec ns1 ip addr add 192.168.0.11/24 dev veth-ns1 (11) At this time, veth-ns1 and veth-ns2 do not have ip addresses. (10) Check the link between the host and ns1 and ns2 ip link (9) Add veth-ns1 to NS1 and veth-ns2 to NS2 ip link set veth-ns1 netns ns1 (7) Create a pair of links, that is, the links to be connected through veth pair ip link add veth-ns1 type veth peer name veth-ns2 Veth pair: Virtual Ethernet Pair is a pair of ports that can realize the above functions (6) At this point, I want to connect the two namespace networks (5) Create a network namespace again ip netns add ns2 You can find that state becomes UNKOWN ip netns exec ns1 ip a (3) Start the lo network card on ns1 ip netns exec ns1 ifup lo (2) Check the status of the network card in the namespace ip netns exec ns1 ip a (1) Create a network namespace ip netns add ns1 Ip netns delete ns1 #delete namespace actual combat Management of network namespace ip netns list #see Ip netns list: view the network namespace on the current machine On linux, network isolation is managed through network namespace, and different network namespaces are isolated from each other Start / close a network card: ifup/ifdown eth0 or ip link set eth0 up/down Network Namespace Restart the network card: service network restart / systemctl restart network You can modify the ifcfg - * file directly, but we can add it through the command (1)ip addr add 192.168.0.100/24 dev eth0 Interpretation of ip a Status: UP/DOWN/UNKOWN etc.Ĭonfiguration file stay Linux The network card in is actually a file, so you can find the corresponding network card fileįor example: cat /etc/sysconfig/network-scripts/ifcfg-eth0
![docker ip a docker ip a](https://www.tecmint.com/wp-content/uploads/2019/06/Find-DNS-Server-IP-Address-in-Linux.png)
Network card in Linux View network card ip link show Welcome to learn and discuss.ĭocker network official website Computer network model OSI seven layer model This article will introduce the network situation in Docker.