Virtual network interface
Also called vNIC
A virtual network interface is a network device that looks like a network card to the programs that use it, with addresses of its own, but is not a physical card. Usually there is no hardware behind it, only kernel code that hands its packets to other software on the host, though some are slices of a physical card. The kernel treats it like any other interface, so ordinary tools set its addresses and routes. Creating a software one needs no hardware, so a host can make one for every guest and container it runs.
That software, usually a bridge or a virtual switch, decides where the packets go next. To the guest or container on the other side, the traffic looks the same as traffic on a physical network. A bridge acts like a simple Ethernet switch, while a virtual switch such as Open vSwitch follows rules programmed into it. Traffic between two guests on the same host never touches a physical card.
The host end of a virtual interface is where network policy is applied, outside the reach of the workload. Network address translation and egress control both attach there, so the workload cannot turn them off. Each workload has its own interface, so rules can differ per workload without touching the neighbors. Counters on the host end also show how much each workload sends, which supports billing and rate limits.
TAP devices
TAP devices are virtual Ethernet interfaces on a Linux host with a file at the other end instead of a cable. A hypervisor or virtual machine monitor opens the file and reads the frames the host sends to the interface. Writing a frame to the file makes it appear on the host as if it had arrived on the interface. Each guest network card is usually backed by one TAP device on the host.
The monitor passes those frames to the guest through a paravirtual network card such as virtio-net, and carries frames from the guest back the other way. On the host side, the TAP device is attached to a bridge or routed like any other interface. Virtio-net moves frames through queues in shared memory, without pretending to be a real card. That is why paravirtual cards run far faster than emulated copies of old hardware.
Copying every frame through a monitor in user space costs time on each packet. Vhost-net moves that copying into the kernel, which cuts the number of trips between the kernel and the monitor. The monitor still sets up the device, but the data path then runs between the guest and the kernel. Some monitors skip TAP entirely and hand the queues to a switch in user space or to the hardware.
Veth pairs
Veth pairs are two virtual Ethernet interfaces joined like the two ends of a cable, so a packet sent into one comes out of the other. Container runtimes use them to connect a container to the host. Neither end has hardware behind it, so a packet crosses the pair as a plain handoff inside the kernel. Because the ends can sit in different namespaces, a pair is the usual way to link two separate network stacks.
The runtime moves one end into the network namespace of the container, where it usually appears as eth0. The other end stays on the host, attached to a bridge or routed. Inside, the container sees only that interface and a loopback device, not the cards of the host. The host end gets a generated name, which makes it hard to tell which container it belongs to.
The container then has its own interface and routing table, while the host controls everything past the far end. Rules on the host end apply to all of the traffic of the container. On a bridged network every container gets its own pair, and the bridge joins them into one local network. Containers on that bridge can reach each other unless the host adds rules to stop it.
Cloud interfaces
Cloud interfaces are virtual network interfaces that the network of a provider gives each virtual machine. They carry their own addresses and security rules, enforced outside the guest where it cannot change them. Inside the guest, the interface appears as an ordinary network card with a paravirtual driver. A machine can often have several, each in a different subnet for a separate kind of traffic.
The network of the provider often runs on a dedicated card in the host, which takes this work off the main processors. Bandwidth limits for each interface are enforced on that card too. The card wraps each guest packet in an outer header that carries it across the shared physical network of the provider. That wrapping lets many customers use the same private addresses without their traffic mixing.
Creating and wiring up an interface is part of the start of every machine. On hosts that start many short-lived machines, how fast it happens adds directly to start time. Platforms often create interfaces ahead of time and hand one to each machine as it starts. Reusing an interface means clearing its rules and addresses first, so nothing leaks from the last machine to the next.