bridge-utils provides utilities for configuring Linux Ethernet bridges. A bridge connects multiple network segments at the data link layer (Layer 2), making separate networks appear as one. The brctl command allows creating, configuring, and managing bridge devices essential for virtual machine networking, container connectivity, and network segmentation.
Key Features
- Bridge Creation – Create software bridges between interfaces
- Port Management – Add and remove interfaces from bridges
- STP Support – Spanning Tree Protocol for loop prevention
- Aging Time – Configure MAC address table timeouts
- Forwarding Database – View learned MAC addresses
- Priority Settings – Configure STP priorities
Installation
# Debian/Ubuntu
sudo apt install bridge-utils
# RHEL/CentOS/Fedora
sudo dnf install bridge-utils
# Arch Linux
sudo pacman -S bridge-utils
Common Usage Examples
# Create a bridge
sudo brctl addbr br0
# Add interfaces to bridge
sudo brctl addif br0 eth0
sudo brctl addif br0 eth1
# Show bridge info
brctl show
# Show MAC table
brctl showmacs br0
# Enable STP
sudo brctl stp br0 on
# Set bridge priority
sudo brctl setbridgeprio br0 100
# Remove interface from bridge
sudo brctl delif br0 eth1
# Delete bridge
sudo brctl delbr br0
# Bring bridge up
sudo ip link set br0 up
Persistent Configuration
# /etc/network/interfaces (Debian)
auto br0
iface br0 inet dhcp
bridge_ports eth0 eth1
bridge_stp on
Use Cases
bridge-utils is essential for VM networking with KVM/QEMU, Docker container networking, connecting network segments, creating transparent firewalls, and network lab environments.
Was this article helpful?