Network bridging involves associating two networks that normally would not pass network traffic between them. Bridging works at OSI Layer 2 with MAC addresses. A Linux system can be configured to bridge two networks. The brctl (bridge control) command is used to configure bridging within Linux.
A common example of bridging is as follows:
- brctl show — View the bridging configuration.
- brctl addbr {bridge name} — Create an empty bridge.
- brctl addif {bridge name} eth0 — Add eth0 to the bridge.
- brctl addif {bridge name} eth1 — Add eth1 to the bridge, linking the networks connected to eth0 and eth1.
Syntax
The syntax of the brctl command is:
# brctl [command]
brctl Command Examples
1. Show a list with information about currently existing Ethernet bridges:
# brctl show
2. Create a new Ethernet bridge interface:
# brctl add bridge_name
3. Delete an existing Ethernet bridge interface:
# brctl del bridge_name
4. Add an interface to an existing bridge:
# brctl addif bridge_name interface_name
5. Remove an interface from an existing bridge:
# brctl delif bridge_name interface_name