10

When installing KVM on Fedora or CentOS it creates virbr0, but I can't see anywhere that en0 is part of the bridge.

Question

Is there are a command to see the members of a network bridge?

3 Answers 3

6

The command which handles bridging in Linux is brctl.

The command you are most likely looking for is

   brctl show

The bridge name is, of-course on the left, and all the interfaces connected to that bridge will be listed - one per line - on the right in the "interfaces" column.

You may also specify a specific bridge with a command like

  brctl show virbr0
1
  • 4
    This answer should no longer be the accepted one. bridge-utils is depreciated. See A.B's answer below. Oct 7, 2021 at 16:44
30

Alternatively, there's a more recent command provided by iproute2, used together with ip link to manage bridges: the bridge command. It can handle new bridge features not available through brctl (like VLAN filtering (to enable vlan handling directly by the bridge), port isolation (similar to PVLAN) or hairpin).

Modern syntax to display bridges would be:

ip link show type bridge

or looking for/by bridge ports:

bridge link show

or

bridge link show dev <interface>

To show only the ports of a given bridge requires again the ip link command:

ip link show master <bridgename>

The results might be a bit less pretty, but can provide more informations. Newer versions of iproute2 provide the bridge command with a JSON output (same for ip link show: try for example ip -details -pretty -json link show type bridge).

4

The best way I feel is to list the contents in this directory :

/sys/class/net/<bridge-name>/brif

This helps you parse the output. brctl show and other commands will be difficult to parse

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .