Concepts / Container networking

Container networking

veth pair

Also called veth, virtual Ethernet, virtual cable

Two virtual cards joined like the ends of a cable: what goes in one comes out the other, even across namespaces.

A veth pair is made as two cards at once (ip link add veth-web type veth peer name eth0 netns web). One end becomes the container's eth0 inside its namespace; the other stays on the host, usually plugged into a bridge such as docker0 (ip link set veth-web master docker0). Taken off the bridge, the container is unplugged: its card is up but nothing answers.

Two cables, one bridge
Two cables, one bridge

Each container's card is one end of a veth pair. The other end stays on the host and plugs into a bridge, a switch inside the host. From the Container networks: give every container a network of its own lab.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab