brctl

networkingLinux
The brctl command is one of the most frequently used commands in Linux/Unix-like operating systems. brctl Ethernet bridge administration tool for Linux

Quick Reference

Command Name:

brctl

Category:

networking

Platform:

Linux

Basic Usage:

brctl [options] [arguments]

Common Use Cases

  • 1

    Network bridge management

    Create and manage network bridges

  • 2

    Network configuration

    Configure network bridging for virtual machines

  • 3

    System administration

    Manage network interfaces and bridges

  • 4

    Virtualization support

    Set up network bridges for virtual environments

Syntax

brctl [OPTIONS] COMMAND [BRIDGE] [INTERFACE]

Options

Command Description
addbr BRIDGE Create a new bridge device
delbr BRIDGE Delete the specified bridge device
addif BRIDGE INTERFACE Add the interface to the bridge
delif BRIDGE INTERFACE Remove the interface from the bridge
show [BRIDGE] Show all bridges or the specified bridge details
stp BRIDGE {on|off} Enable/disable the Spanning Tree Protocol
showstp BRIDGE Show STP information for the specified bridge
setfd BRIDGE TIME Set bridge forward delay time in seconds
showmacs BRIDGE Show MAC addresses learned by the bridge

Examples

How to Use These Examples

The examples below show common ways to use the brctl command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

Basic Examples:

Display all bridges and their associated interfaces
brctl show
Create a new bridge called br0
brctl addbr br0
Delete the bridge br0
brctl delbr br0
Add the interface eth0 to the bridge br0
brctl addif br0 eth0

Advanced Examples:

Remove the interface eth0 from the bridge br0
brctl delif br0 eth0
Enable the Spanning Tree Protocol on bridge br0
brctl stp br0 on
Set the bridge forward delay to 10 seconds
brctl setfd br0 10
Show the MAC addresses learned by the bridge
brctl showmacs br0

Try It Yourself

Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

Understanding Syntax

Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

Notes

The brctl command is used to manage Ethernet bridges in Linux. An Ethernet bridge is a device that connects multiple network segments at the data link layer (Layer 2) of the OSI model. Note that brctl is considered deprecated in modern Linux distributions. The recommended replacement is the 'bridge' command from the iproute2 package. Common uses of brctl include: - Setting up a software bridge for virtual machines - Creating network configurations for containers - Implementing network bridging between physical and virtual interfaces The bridge must be created before interfaces can be added to it, and all interfaces must be removed before a bridge can be deleted. For STP (Spanning Tree Protocol) settings to take effect, STP must be enabled on the bridge with the 'stp on' command.

Common Use Cases

Network bridge management

Create and manage network bridges

Network configuration

Configure network bridging for virtual machines

System administration

Manage network interfaces and bridges

Virtualization support

Set up network bridges for virtual environments

Network troubleshooting

Diagnose and fix network bridge issues

Related Commands

These commands are frequently used alongside brctl or serve similar purposes:

Use Cases

1

Network bridge management

Create and manage network bridges

2

Network configuration

Configure network bridging for virtual machines

3

System administration

Manage network interfaces and bridges

4

Virtualization support

Set up network bridges for virtual environments

5

Network troubleshooting

Diagnose and fix network bridge issues

Learn By Doing

The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the brctl command works in different scenarios.

$ brctl
View All Commands