What is veth?
Virtual Ethernet pair
A veth (virtual Ethernet) pair is two linked virtual interfaces on Linux that act like a cable: a frame sent into one end comes out of the other.
You create a pair with a command such as ip link add veth0 type veth peer name veth1. Neither end is attached to any hardware; the kernel simply hands every frame transmitted on one end to the other end as if it had just been received. The power comes from moving one end into a different network namespace, which is Linux's way of giving a process its own interfaces, addresses, routing table and firewall. Put one end inside a namespace and the other in the host, or attach it to a Linux bridge, and the namespace is connected to the network. Each end gets its own MAC address and can carry IP addresses, VLAN tags or anything else a normal Ethernet interface can.
This is exactly how Docker, Podman and Kubernetes networking connect containers. Inside a container you'll typically see an interface listed as eth0@if7: the @if7 means its peer is interface number 7 in another namespace, and on the host that peer is usually attached to a bridge such as docker0. Matching interface indexes is how you find which host-side veth belongs to which container. veth pairs are also handy for building labs on a single machine: several namespaces acting as hosts, joined by veth "cables" to a bridge acting as a switch, which is the approach the Switching basics lab uses. A common surprise is that if either end is deleted, or its namespace goes away, the other end disappears too. Packets on a veth can be captured with tcpdump like any other interface. The Linux Network Connectivity lesson explores interfaces and addresses with iproute2.
Lessons that use veth
- Switching basics: layer 2, VLANs and IP addressingBeginner · 40 min
How a switch learns MAC addresses and floods broadcasts, how IP subnets and default gateways decide where packets go, how VLANs split a switch into separate networks, and how trunks and a router connect them. Built on a real switch, three PCs and a VyOS router.
- EVPN and VXLAN: layer 2 over a routed fabricAdvanced · 45 min
Stretch a layer-2 segment across a routed leaf-spine fabric: VXLAN for the data plane, BGP EVPN for the control plane. Built with FRR: the underlay, VNIs, type-2 and type-3 routes, route targets, and the VXLAN packets on the wire.
- Building a network lab on an Apple Silicon MacBeginner · 45 min
Run real network labs on an M-series Mac: native FRR and Linux containers, x86-only images through Rosetta, and full x86 VyOS VMs under QEMU in Docker, with the pitfalls that stop most people and a starter lab that mixes all three.