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

    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 Basic
    bridge link show
    Show bridge port details for all interfaces.
    bridge fdb show
    Show forwarding database entries.
    bridge vlan show
    Show VLAN filter entries. # Advanced Examples Advanced bridge link set dev eth0 state 1 Enable the interface eth0 in the bridge. bridge fdb add 00:11:22:33:44:55 dev eth0 master Add a MAC address to the forwarding database. bridge vlan add vid 10 dev eth0 Add VLAN ID 10 to the interface eth0. bridge monitor Monitor bridge events in real-time.

    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.

    Related Commands

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

    Use Cases

    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