In virtualisation environments, software-defined networks, and multi-interface host systems, connecting multiple physical and virtual network interfaces into a unified Layer-2 broadcast domain is a routine engineering requirement. A software network bridge behaves exactly like a hardware Ethernet switch inside the Linux kernel, inspecting incoming MAC addresses and forwarding Ethernet frames transparently between slave ports. While older administrative tutorials frequently rely on the obsolete brctl utility from the bridge-utils package, modern Linux distributions manage bridges natively through iproute2. Learning how to configure a network bridge in Linux using ip link provides a clean, robust method to bridge physical network cards with KVM virtual machines and container tap interfaces.
Understanding Linux Kernel Network Bridges
A Linux bridge is a virtual network device that operates at the Data Link layer (OSI Layer 2). When physical Ethernet interfaces (such as eth0 or enp3s0) and virtual interfaces (such as vnet0 or tap0) are enslaved to a bridge (e.g. br0):
- Enslaved member interfaces relinquish their individual IP addresses.
- The master bridge device (
br0) assumes the host IP address and default gateway. - Connected virtual machines or external physical hosts communicate across the bridge as if they were plugged into the same physical hardware switch, sharing DHCP leases and subnet routing directly.
Step 1: Creating the Software Bridge Device
To create a new bridge interface named br0, open an elevated shell and use the ip link add command:
sudo ip link add name br0 type bridge
Verify that the bridge interface has been registered by the kernel:
ip link show type bridge
At this stage, br0 exists in a DOWN operational state with no member slave ports assigned.
Step 2: Assigning Physical or Virtual Interfaces to the Bridge
To enslave an existing interface (such as a physical NIC named eth1 or a virtual TAP interface) to the newly created bridge, assign it as a master member:
sudo ip link set dev eth1 master br0
To attach additional interfaces (such as a second network card or virtual machine tap port):
sudo ip link set dev tap0 master br0
You can confirm which interfaces belong to the bridge using the modern bridge link command:
bridge link show
Step 3: Bringing the Bridge and Interfaces Up
Before traffic can flow across the bridge, both the bridge device and its underlying member interfaces must be brought online:
sudo ip link set dev eth1 up
sudo ip link set dev br0 up
Step 4: Configuring IP Addressing on the Bridge
Because member slave ports operate in promiscuous Layer-2 forwarding mode, host IP configurations must be assigned directly to the bridge interface itself.
Assigning a Static IP Address:
sudo ip addr add 192.168.1.50/24 dev br0
sudo ip route add default via 192.168.1.1 dev br0
Acquiring an IP Address via DHCP:
If your local network uses a dynamic router DHCP pool, request a lease for the bridge:
sudo dhclient br0
Configuring Spanning Tree Protocol (STP) to Prevent Loops
If your bridge interconnects multiple physical switches or redundant Ethernet uplinks, packet loops can trigger broadcast storms that incapacitate your local network. You can activate Spanning Tree Protocol (STP) directly on the bridge:
sudo ip link set dev br0 type bridge stp_state 1
To verify the STP operational status and bridge forwarding delay:
ip -d link show br0
Removing Interfaces and Deleting the Bridge
When decommissioning a virtual environment or returning an interface to standalone routing:
Releasing a Slave Port:
sudo ip link set dev eth1 nomaster
Deleting the Bridge Device:
sudo ip link set dev br0 down
sudo ip link delete dev br0 type bridge
Deleting the bridge immediately disassociates all member ports and frees allocated kernel networking memory.
Utilising ip link to manage network bridges replaces deprecated legacy tools with the unified, fast iproute2 framework standard across all modern distributions. Whether deploying KVM hypervisors, Docker host networks, or multi-NIC router gateways, mastering kernel bridge commands delivers complete control over your Linux networking fabric.