Possible to list members of a network bridge?
Solution 1:
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
Solution 2:
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
).