bridge

networkingLinux
The bridge command is one of the most frequently used commands in Linux/Unix-like operating systems. bridge Manage bridge addresses and devices with the iproute2 package

Quick Reference

Command Name:

bridge

Category:

networking

Platform:

Linux

Basic Usage:

bridge [options] [arguments]

Common Use Cases

  • 1

    Network bridge configuration

    Configure network bridges for traffic management

  • 2

    Virtual network setup

    Set up virtual networks for containers and VMs

  • 3

    Network administration

    Manage network bridges and their configurations

  • 4

    Traffic management

    Control network traffic flow through bridges

Syntax

bridge [OPTIONS] COMMAND

Options

Subcommand Description
link Bridge port (interface) configuration
fdb Forwarding database management
vlan VLAN filter management
monitor Watch for bridge changes

Common Options:

Option Description
-V, -Version Print the version of the bridge utility
-s, -stats Show more information with statistics
-n, -net NETNS Switch to the specified network namespace
-j, -json Output results in JSON format

Examples

How to Use These Examples

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

Basic Examples:

Show bridge port details for all interfaces
bridge link show
Show forwarding database entries
bridge fdb show
Show VLAN filter entries
bridge vlan show

Advanced Examples:

Enable the interface eth0 in the bridge
bridge link set dev eth0 state 1
Add a MAC address to the forwarding database
bridge fdb add 00:11:22:33:44:55 dev eth0 master
Add VLAN ID 10 to the interface eth0
bridge vlan add vid 10 dev eth0
Monitor bridge events in real-time
bridge monitor

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 bridge command is part of the iproute2 package and is the modern replacement for the older brctl command. It provides more advanced features and better integration with other networking tools. The bridge command works with three key components: 1. **link** - For managing bridge ports (network interfaces) 2. **fdb** - For managing the Forwarding Database (MAC addresses) 3. **vlan** - For managing VLAN filtering This command is commonly used in network virtualization, container networking, and software-defined networking scenarios. To create and configure bridges, you should use the 'ip link' command: ``` # Create a bridge ip link add name br0 type bridge # Add interfaces to the bridge ip link set dev eth0 master br0 # Remove interfaces from the bridge ip link set dev eth0 nomaster # Delete a bridge ip link delete br0 ``` The bridge command itself is focused on monitoring and managing the bridge components rather than creating the bridges themselves.

Common Use Cases

Network bridge configuration

Configure network bridges for traffic management

Virtual network setup

Set up virtual networks for containers and VMs

Network administration

Manage network bridges and their configurations

Traffic management

Control network traffic flow through bridges

Network isolation

Create isolated network segments using bridges

Related Commands

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

Use Cases

1

Network bridge configuration

Configure network bridges for traffic management

2

Virtual network setup

Set up virtual networks for containers and VMs

3

Network administration

Manage network bridges and their configurations

4

Traffic management

Control network traffic flow through bridges

5

Network isolation

Create isolated network segments using bridges

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 bridge command works in different scenarios.

$ bridge
View All Commands