bridge
[ OPTIONS ] OBJECT { COMMAND |
help }
OBJECT := {
link | fdb | mdb | vlan | monitor }
OPTIONS := {
-V[ersion] |
-s[tatistics] |
-n[etns] name |
-b[atch] filename |
-c[lor] |
-p[retty] |
-j[son] |
-o[neline] }
bridge link set
dev
DEV [
cost
COST ] [
priority
PRIO ] [
state
STATE ] [
guard { on | off } ] [
hairpin { on | off } ] [
fastleave { on | off } ] [
root_block { on | off } ] [
learning { on | off } ] [
learning_sync { on | off } ] [
flood { on | off } ] [
hwmode { vepa | veb } ] [
mcast_flood { on | off } ] [
mcast_to_unicast { on | off } ] [
neigh_suppress { on | off } ] [
vlan_tunnel { on | off } ] [
isolated { on | off } ] [
backup_port
DEVICE ] [
nobackup_port ] [
self ] [ master ]
bridge link [ show ] [
dev
DEV ]
bridge fdb { add | append | del | replace }
LLADDR
dev
DEV {
local | static | dynamic } [
self ] [ master ] [ router ] [ use ] [ extern_learn ] [ sticky ] [
src_vni
VNI ] { [
dst
IPADDR ] [
vni
VNI ] [
port
PORT ] [
via
DEVICE ] |
nhid
NHID }
bridge fdb [ [ show ] [
br
BRDEV ] [
brport
DEV ] [
vlan
VID ] [
state
STATE ] [
dynamic
] ]
bridge fdb get [
to
]
LLADDR [
br
BRDEV ]
{ brport | dev }
DEV [
vlan
VID ] [
vni
VNI ] [
self ] [ master ] [ dynamic ]
bridge mdb { add | del }
dev
DEV
port
PORT
grp
GROUP [
src
SOURCE ] [
permanent | temp ] [
vid
VID ]
bridge mdb show [
dev
DEV ]
bridge vlan { add | del }
dev
DEV
vid
VID [
tunnel_info
TUNNEL_ID ] [
pvid ] [ untagged ] [
self ] [ master ]
bridge vlan [ show | tunnelshow ] [
dev
DEV ]
bridge monitor [ all | neigh | link | mdb ]
ip netns exec NETNS bridge [ OPTIONS ] OBJECT { COMMAND | help }
to
bridge -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }
Specifies the action to perform on the object. The set of possible actions depends on the object type. As a rule, it is possible to add, delete and show (or list ) objects, but some objects do not allow all of these operations or have some additional commands. The help command is available for all objects. It prints out a list of available commands and argument syntax conventions.
If no command is given, some default command is assumed. Usually it is list or, if the objects of this class cannot be listed, help.
link objects correspond to the port devices of the bridge.
The corresponding commands set and display port status and bridge specific attributes.
0 - port is in STP DISABLED state. Make this port completely inactive for STP. This is also called BPDU filter and could be used to disable STP on an untrusted port, like a leaf virtual devices.
1 - port is in STP LISTENING state. Only valid if STP is enabled on the bridge. In this state the port listens for STP BPDUs and drops all other traffic frames.
2 - port is in STP LEARNING state. Only valid if STP is enabled on the bridge. In this state the port will accept traffic only for the purpose of updating MAC address tables.
3 - port is in STP FORWARDING state. Port is fully active.
4 - port is in STP BLOCKING state. Only valid if STP is enabled on the bridge. This state is used during the STP election process. In this state, port will only process STP BPDUs.
If running Spanning Tree on bridge, hostile devices on the network may send BPDU on a port and cause network failure. Setting guard on will detect and stop this by disabling the port. The port will be restarted if link is brought down, or removed and reattached. For example if guard is enable on eth0:
ip link set dev eth0 down; ip link set dev eth0 up
This feature is also called root port guard. If BPDU is received from a leaf (edge) port, it should not be elected as root port. This could be used if using STP on a bridge and the downstream bridges are not fully trusted; this prevents a hostile guest from rerouting traffic.
vepa - Data sent between HW ports is sent on the wire to the external switch.
veb - bridging happens in hardware.
This is done by copying the packet per host and changing the multicast destination MAC to a unicast one accordingly.
mcast_to_unicast works on top of the multicast snooping feature of the bridge. Which means unicast copies are only delivered to hosts which are interested in it and signalized this via IGMP/MLD reports previously.
This feature is intended for interface types which have a more reliable and/or efficient way to deliver unicast packets than broadcast ones (e.g. WiFi).
However, it should only be enabled on interfaces where no IGMPv2/MLDv1 report suppression takes place. IGMP/MLD report suppression issue is usually overcome by the network daemon (supplicant) enabling AP isolation and by that separating all STAs.
Delivery of STA-to-STA IP multicast is made possible again by enabling and utilizing the bridge hairpin mode, which considers the incoming port as a potential outgoing port, too (see hairpin option). Hairpin mode is performed after multicast snooping, therefore leading to only deliver reports to STAs running a multicast router.
This command displays port configuration and flags for all bridges.
To display port configuration and flags for a specific bridge, use the "ip link show master <bridge_device>" command.
fdb objects contain known Ethernet addresses on a link.
The corresponding commands display fdb entries, add new entries, append entries, and delete old ones.
This command creates a new fdb entry.
local - is a local permanent fdb entry
static - is a static (no arp) fdb entry
dynamic - is a dynamic reachable age-able fdb entry
self - the address is associated with the port drivers fdb. Usually hardware.
master - the address is associated with master devices fdb. Usually software (default).
router - the destination address is associated with a router. Valid if the referenced device is a VXLAN type device and has route short circuit enabled.
use - the address is in use. User space can use this option to indicate to the kernel that the fdb entry is in use.
extern_learn - this entry was learned externally. This option can be used to indicate to the kernel that an entry was hardware or user-space controller learnt dynamic entry. Kernel will not age such an entry.
sticky - this entry will not change its port due to learning.
The next command line parameters apply only when the specified device DEV is of type VXLAN.
The arguments are the same as with bridge fdb add.
The arguments are the same as with bridge fdb add.
The arguments are the same as with bridge fdb add.
This command displays the current forwarding table.
With the -statistics option, the command becomes verbose. It prints out the last updated and last used time for each entry.
lookup a bridge forwarding table entry.
mdb objects contain known IP multicast group addresses on a link.
The corresponding commands display mdb entries, add new entries, and delete old ones.
This command creates a new mdb entry.
permanent - the mdb entry is permanent
temp - the mdb entry is temporary (default)
The arguments are the same as with bridge mdb add.
This command displays the current multicast group membership table. The table is populated by IGMP and MLD snooping in the bridge driver automatically. It can be altered by bridge mdb add and bridge mdb del commands manually too.
With the -details option, the command becomes verbose. It prints out the ports known to have a connected router.
With the -statistics option, the command displays timer values for mdb and router port entries.
vlan objects contain known VLAN IDs for a link.
The corresponding commands display vlan filter entries, add new entries, and delete old ones.
This command creates a new vlan filter entry.
The arguments are the same as with bridge vlan add. The pvid and untagged flags are ignored.
This command displays the current VLAN filter table.
With the -statistics option, the command displays per-vlan traffic statistics.
This command displays the current vlan tunnel info mapping.
The bridge utility can monitor the state of devices and addresses continuously. This option has a slightly different format. Namely, the monitor command is the first in the command line and then the object list follows:
bridge monitor [ all | OBJECT-LIST ]
OBJECT-LIST is the list of object types that we want to monitor. It may contain link, fdb, and mdb. If no file argument is given, bridge opens RTNETLINK, listens on it and dumps state changes in the format described in previous sections.
If a file name is given, it does not listen on RTNETLINK, but opens the file containing RTNETLINK messages saved in binary format and dumps them.
Although the forwarding table is maintained on a per-bridge device basis the bridge device is not part of the syntax. This is a limitation of the underlying netlink neighbour message protocol. When displaying the forwarding table, entries for all bridges are displayed. Add/delete/modify commands determine the underlying bridge device based on the bridge to which the corresponding ethernet device is attached.