Linux bridge utilities (brctl)¶
brctl is a command-line utility used for managing Ethernet bridges on Linux systems^[600-developer-docker-docker-bridge.md]. It allows administrators to configure the network bridge interface itself and manage which physical or virtual interfaces are attached to it^[600-developer-docker-docker-bridge.md].
Common Commands¶
The utility provides several subcommands to handle bridge lifecycle and configuration^[600-developer-docker-docker-bridge.md].
- Add a bridge: Creates a new logical bridge instance.
brctl addbr br0 - Add an interface: Attaches a network device (e.g.,
eth0) to the bridge, making it a part of the bridge.brctl addif br0 eth0 - Delete an interface: Removes a network device from the bridge.
brctl delif br0 eth0 - Delete a bridge: Removes the logical bridge instance.
brctl delbr br0 - Show configuration: Lists all existing bridges and the interfaces currently attached to them.
brctl show
Installation¶
The brctl tool is provided by the bridge-utils package^[600-developer-docker-docker-bridge.md]. On RPM-based distributions like CentOS, it can be installed via yum^[600-developer-docker-docker-bridge.md].
yum install bridge-utils
Configuration¶
While brctl handles the runtime attachment of devices, persistent network configuration (such as assigning static IPs to the bridge) is typically handled by distribution-specific configuration files^[600-developer-docker-docker-bridge.md].
For example, on RHEL/CentOS systems, a bridge file might be configured at /etc/sysconfig/network-scripts/ifcfg-br0 with TYPE=Bridge, while the physical Ethernet configuration file (e.g., ifcfg-eth0) must include the directive BRIDGE=br0 to link the device to the bridge^[600-developer-docker-docker-bridge.md].
Related Concepts¶
- [[Docker networking]]
- [[Linux networking]]
Sources¶
^[600-developer-docker-docker-bridge.md]