Virtual networks
How containers talk to each other: the virtual interface pair and the host bridge, Docker's network drivers, VXLAN encapsulation between hosts, Kubernetes' network model and the NetworkPolicy.
- 36 cards
- 6 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Questions
- Sort and link
- On the diagram
- Scenarios
- Understand
A few cards from the deck
veth pair: what is it?
Show the answer
Two virtual network interfaces linked like the two ends of a cable: whatever enters one comes out of the other, even when they live in two different namespaces.
One end is moved into the container's network namespace (where it becomes
eth0), the other is plugged into the host bridge: this virtual cable is what lets the container out of its isolation.What happens on the last command?
```bash
docker run -d --name web nginx
docker run --rm alpine ping -c1 web`ping: bad address 'web': the name is not resolved- The ping succeeds: Docker resolves
webon every network Network unreachable: the two containers are on isolated networksConnection refused:webis found but does not listen
Show the answer
ping: bad address 'web': the name is not resolvedBoth containers are on the default bridge, which offers no name resolution. On a network created with
docker network create, the same command succeeds. It is a resolution failure, not a routing one.With the … driver, the container shares the host's network stack; with the … driver, it only has the loopback interface.
Show the answer
With the host driver, the container shares the host's network stack; with the none driver, it only has the loopback interface.
hostremoves network isolation (the container's ports are the host's ports, with no publishing),nonemakes it total: no interface to the outside, no route.Linux bridge: what is it?
Show the answer
A software switch in the kernel that joins several virtual interfaces and forwards frames between them according to their MAC addresses.
Docker creates one per bridge network (
docker0for the default one): the containers plugged into it can reach each other, and the host sends them out through address translation.