# BRIDGE(8) - man - phpMan

[BRIDGE(8)](https://www.chedong.com/phpMan.php/man/BRIDGE/8/markdown)                                       Linux                                      [BRIDGE(8)](https://www.chedong.com/phpMan.php/man/BRIDGE/8/markdown)



## NAME
       bridge - show / manipulate bridge addresses and devices

## SYNOPSIS
       **bridge** [ _OPTIONS_ ] _OBJECT_ { _COMMAND_ | **help** }


       _OBJECT_ := { **link** | **fdb** | **mdb** | **vlan** | **monitor** }


       _OPTIONS_ := { **-V**[_ersion_] | **-s**[_tatistics_] | **-n**[_etns_] name | **-b**[_atch_] filename | **-c**[_olor_] |
               **-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** } ] [ **hw**‐‐
               **mode** { **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** **set** **dev** _DEV_ **vid** _VID_ [ **state** _STP_STATE_ ]

       **bridge** **vlan** [ **show** | **tunnelshow** ] [ **dev** _DEV_ ]

       **bridge** **monitor** [ **all** | **neigh** | **link** | **mdb** | **vlan** ]


## OPTIONS
### -V -Version
              print the version of the **bridge** utility and exit.


### -s -stats -statistics
              output more information. If this option is given multiple times, the amount of infor‐
              mation increases.  As a rule, the information is statistics or some time values.


### -d -details
              print detailed information about bridge vlan filter entries or MDB router ports.


### -n -net -netns
              switches **bridge** to the specified network namespace _NETNS_.  Actually it just simplifies
              executing of:

              **ip** **netns** **exec** _NETNS_ **bridge** [ _OPTIONS_ ] _OBJECT_ { _COMMAND_ | **help** }

              to

              **bridge** -n[etns] _NETNS_ [ _OPTIONS_ ] _OBJECT_ { _COMMAND_ | **help** }


### -b -batch
              Read commands from provided file or standard input and invoke them.  First failure
              will cause termination of bridge command.


### -force
              ing execution of the commands, the application return code will be non zero.


### -c
              Configure color output. If parameter is omitted or **always**, color output is enabled re‐
              gardless of stdout state. If parameter is **auto**, stdout is checked to be a terminal be‐
              fore enabling color output. If parameter is **never**, color output is disabled. If speci‐
              fied multiple times, the last one takes precedence. This flag is ignored if **-json** is
              also given.


### -j -json
              Output results in JavaScript Object Notation (JSON).


### -p -pretty
              When combined with -j generate a pretty JSON output.


### -o -oneline
              output each record on a single line, replacing line feeds with the **'\'** character. This
              is convenient when you want to count records with [**wc**(1)](https://www.chedong.com/phpMan.php/man/wc/1/markdown) or to [**grep**(1)](https://www.chedong.com/phpMan.php/man/grep/1/markdown) the output.



## BRIDGE - COMMAND SYNTAX
   _OBJECT_
       **link**   - Bridge port.


       **fdb**    - Forwarding Database entry.


       **mdb**    - Multicast group database entry.


       **vlan**   - VLAN filter list.


   _COMMAND_
       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** com‐
       mand 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 ob‐
       jects of this class cannot be listed, **help**.


### bridge link - bridge port
       **link** objects correspond to the port devices of the bridge.


       The corresponding commands set and display port status and bridge specific attributes.


### bridge link set - set bridge specific attributes on a port
       **dev** _NAME_
              interface name of the bridge port


       **cost** _COST_
              the STP path cost of the specified port.


       **priority** _PRIO_
              the STP port priority. The priority value is an unsigned 8-bit quantity (number be‐
              tween 0 and 255). This metric is used in the designated port an droot port selection
              algorithms.


       **state** _STATE_
              the operation state of the port. Except state 0 (disable STP or BPDU filter feature),
              this is primarily used by user space STP/RSTP implementation. One may enter port state
              name (case insensitive), or one of the numbers below. Negative inputs are ignored, and
              unrecognized names return an error.

              **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 ta‐
              bles.


              **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.



       **guard** **on** or **guard** **off**
              Controls whether STP BPDUs will be processed by the bridge port. By default, the flag
              is turned off allowed BPDU processing. Turning this flag on will disables the bridge
              port if a STP BPDU packet is received.

              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 dis‐
              abling 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**


       **hairpin** **on** or **hairpin** **off**
              Controls whether traffic may be send back out of the port on which it was received.
              This option is also called reflective relay mode, and is used to support basic VEPA
              (Virtual Ethernet Port Aggregator) capabilities.  By default, this flag is turned off
              and the bridge will not forward traffic back out of the receiving port.


       **fastleave** **on** or **fastleave** **off**
              This flag allows the bridge to immediately stop multicast traffic on a port that re‐
              ceives IGMP Leave message. It is only used with IGMP snooping is enabled on the
              bridge. By default the flag is off.


       **root**___**block** **on** or **root**___**block** **off**
              Controls whether a given port is allowed to become root port or not. Only used when
              STP is enabled on the bridge. By default the flag is off.

              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.


       **learning** **on** or **learning** **off**
              Controls whether a given port will learn MAC addresses from received traffic or not.
              If learning if off, the bridge will end up flooding any traffic for which it has no
              FDB entry. By default this flag is on.


       **learning**___**sync** **on** or **learning**___**sync** **off**
              Controls whether a given port will sync MAC addresses learned on device port to bridge
              FDB.


       **flood** **on** or **flood** **off**
              Controls whether unicast traffic for which there is no FDB entry will be flooded to‐
              wards this given port. By default this flag is on.


       **hwmode** Some network interface cards support HW bridge functionality and they may be config‐
              ured in different modes. Currently support modes are:

              **vepa** - Data sent between HW ports is sent on the wire to the external switch.

              **veb** - bridging happens in hardware.


       **mcast**___**flood** **on** or **mcast**___**flood** **off**
              Controls whether multicast traffic for which there is no MDB entry will be flooded to‐
              wards this given port. By default this flag is on.


       **mcast**___**to**___**unicast** **on** or **mcast**___**to**___**unicast** **off**
              Controls whether a given port will replicate packets using unicast instead of multi‐
              cast. By default this flag is off.

              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 sig‐
              nalized this via IGMP/MLD reports previously.

              This feature is intended for interface types which have a more reliable and/or effi‐
              cient way to deliver unicast packets than broadcast ones (e.g. WiFi).

              However, it should only be enabled on interfaces where no IGMPv2/MLDv1 report suppres‐
              sion 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.


       **neigh**___**suppress** **on** or **neigh**___**suppress** **off**
              Controls whether neigh discovery (arp and nd) proxy and suppression is enabled on the
              port. By default this flag is off.


       **vlan**___**tunnel** **on** or **vlan**___**tunnel** **off**
              Controls whether vlan to tunnel mapping is enabled on the port. By default this flag
              is off.


       **isolated** **on** or **isolated** **off**
              Controls whether a given port will be isolated, which means it will be able to commu‐
              nicate with non-isolated ports only.  By default this flag is off.


       **backup**___**port** _DEVICE_
              If the port loses carrier all traffic will be redirected to the configured backup port


       **nobackup**___**port**
              Removes the currently configured backup port


       **self**   link setting is configured on specified physical device


       **master** link setting is configured on the software bridge (default)


### -t -timestamp
              display current time when using monitor option.


### bridge link show - list ports configuration for all bridges.
       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.


### bridge fdb - forwarding database management
       **fdb** objects contain known Ethernet addresses on a link.


       The corresponding commands display fdb entries, add new entries, append entries, and delete
       old ones.


### bridge fdb add - add a new fdb entry
       This command creates a new fdb entry.


       **LLADDR** the Ethernet MAC address.


       **dev** _DEV_
              the interface to which this address is associated.

              **local** - is a local permanent fdb entry, which means that the bridge will not forward
              frames with this destination MAC address and VLAN ID, but terminate them locally. This
              flag is default unless "static" or "dynamic" are explicitly specified.


              **permanent** - this is a synonym for "local"


              **static** - is a static (no arp) fdb entry


              **dynamic** - is a dynamic reachable age-able fdb entry


              **self** - the operation is fulfilled directly by the driver for the specified network de‐
              vice. If the network device belongs to a master like a bridge, then the bridge is by‐
              passed and not notified of this operation (and if the device does notify the bridge,
              it is driver-specific behavior and not mandated by this flag, check the driver for
              more details). The "bridge fdb add" command can also be used on the bridge device it‐
              self, and in this case, the added fdb entries will be locally terminated (not for‐
              warded). In the latter case, the "self" flag is mandatory. The flag is set by default
              if "master" is not specified.


              **master** - if the specified network device is a port that belongs to a master device
              such as a bridge, the operation is fulfilled by the master device's driver, which may
              in turn notify the port driver too of the address. If the specified device is a master
              itself, such as a bridge, this flag is invalid.


              **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 en‐
              try. 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.

       **dst** _IPADDR_
              the IP address of the destination VXLAN tunnel endpoint where the Ethernet MAC ADDRESS
              resides.


       **src**___**vni** _VNI_
              the src VNI Network Identifier (or VXLAN Segment ID) this entry belongs to. Used only
              when the vxlan device is in external or collect metadata mode. If omitted the value
              specified at vxlan device creation will be used.


       **vni** _VNI_
              the VXLAN VNI Network Identifier (or VXLAN Segment ID) to use to connect to the remote
              VXLAN tunnel endpoint.  If omitted the value specified at vxlan device creation will
              be used.


       **port** _PORT_
              the UDP destination PORT number to use to connect to the remote VXLAN tunnel endpoint.
              If omitted the default value is used.


       **via** _DEVICE_
              device name of the outgoing interface for the VXLAN device driver to reach the remote
              VXLAN tunnel endpoint.


       **nhid** _NHID_
              ecmp nexthop group for the VXLAN device driver to reach remote VXLAN tunnel endpoints.


### bridge fdb append - append a forwarding database entry
       This command adds a new fdb entry with an already known _LLADDR_.  Valid only for multicast
       link layer addresses.  The command adds support for broadcast and multicast Ethernet MAC ad‐
       dresses.  The Ethernet MAC address is added multiple times into the forwarding database and
       the vxlan device driver sends a copy of the data packet to each entry found.


       The arguments are the same as with **bridge** **fdb** **add**.


### bridge fdb delete - delete a forwarding database entry
       This command removes an existing fdb entry.


       The arguments are the same as with **bridge** **fdb** **add**.


### bridge fdb replace - replace a forwarding database entry
       If no matching entry is found, a new one will be created instead.


       The arguments are the same as with **bridge** **fdb** **add**.


### bridge fdb show - list forwarding entries.
       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.


### bridge fdb get - get bridge forwarding entry.
       lookup a bridge forwarding table entry.


       **LLADDR** the Ethernet MAC address.


       **dev** _DEV_
              the interface to which this address is associated.


       **brport** _DEV_
              the bridge port to which this address is associated. same as dev above.


       **br** _DEV_ the bridge to which this address is associated.


       **self**   - the address is associated with the port drivers fdb. Usually hardware.


       **master** - the address is associated with master devices fdb. Usually software (default).



### bridge mdb - multicast group database management
       **mdb** objects contain known IP or L2 multicast group addresses on a link.


       The corresponding commands display mdb entries, add new entries, and delete old ones.


### bridge mdb add - add a new multicast group database entry
       This command creates a new mdb entry.


       **dev** _DEV_
              the interface where this group address is associated.


       **port** _PORT_
              the port whose link is known to have members of this multicast group.


       **grp** _GROUP_
              the multicast group address (IPv4, IPv6 or L2 multicast) whose members reside on the
              link connected to the port.

              **permanent** - the mdb entry is permanent. Optional for IPv4 and IPv6, mandatory for L2.


              **temp** - the mdb entry is temporary (default)



       **src** _SOURCE_
              optional source IP address of a sender for this multicast group. If IGMPv3 for IPv4,
              or MLDv2 for IPv6 respectively, are enabled it will be included in the lookup when
              forwarding multicast traffic.


       **vid** _VID_
              the VLAN ID which is known to have members of this multicast group.


### bridge mdb delete - delete a multicast group database entry
       This command removes an existing mdb entry.


       The arguments are the same as with **bridge** **mdb** **add**.


### bridge mdb show - list multicast group database entries
       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.


       **dev** _DEV_
              the interface only whose entries should be listed. Default is to list all bridge in‐
              terfaces.


       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 en‐
       tries.


### bridge vlan - VLAN filter list
       **vlan** objects contain known VLAN IDs for a link.


       The corresponding commands display vlan filter entries, add new entries, and delete old ones.


### bridge vlan add - add a new vlan filter entry
       This command creates a new vlan filter entry.


       **dev** _NAME_
              the interface with which this vlan is associated.


       **vid** _VID_
              the VLAN ID that identifies the vlan.


       **tunnel**___**info** _TUNNEL_ID_
              the TUNNEL ID that maps to this vlan. The tunnel id is set in dst_metadata for every
              packet that belongs to this vlan (applicable to bridge ports with vlan_tunnel flag
              set).


       **pvid**   the vlan specified is to be considered a PVID at ingress.  Any untagged frames will be
              assigned to this VLAN.


### untagged
              the vlan specified is to be treated as untagged on egress.


       **self**   the vlan is configured on the specified physical device. Required if the device is the
              bridge device.


       **master** the vlan is configured on the software bridge (default).


### bridge vlan delete - delete a vlan filter entry
       This command removes an existing vlan filter entry.


       The arguments are the same as with **bridge** **vlan** **add**.  The **pvid** and **untagged** flags are ignored.


### bridge vlan set - change vlan filter entry's options
       This command changes vlan filter entry's options.


       **dev** _NAME_
              the interface with which this vlan is associated.


       **vid** _VID_
              the VLAN ID that identifies the vlan.


       **state** _STP_STATE_
              the operation state of the vlan. One may enter STP state name (case insensitive), or
              one of the numbers below. Negative inputs are ignored, and unrecognized names return
              an error. Note that the state is set only for the vlan of the specified device, e.g.
              if it is a bridge port then the state will be set only for the vlan of the port.

              **0** - vlan is in STP **DISABLED** state. Make this vlan completely inactive for STP. This is
              also called BPDU filter and could be used to disable STP on an untrusted vlan.


              **1** - vlan is in STP **LISTENING** state. Only valid if STP is enabled on the bridge. In
              this state the vlan listens for STP BPDUs and drops all other traffic frames.


              **2** - vlan is in STP **LEARNING** state. Only valid if STP is enabled on the bridge. In this
              state the vlan will accept traffic only for the purpose of updating MAC address ta‐
              bles.


              **3** - vlan is in STP **FORWARDING** state. This is the default vlan state.


              **4** - vlan 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, the vlan will only
              process STP BPDUs.



### bridge vlan show - list vlan configuration.
       This command displays the current VLAN filter table.


       With the **-details** option, the command becomes verbose. It displays the per-vlan options.


       With the **-statistics** option, the command displays per-vlan traffic statistics.


### bridge vlan tunnelshow - list vlan tunnel mapping.
       This command displays the current vlan tunnel info mapping.


### bridge monitor - state monitoring
       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**,
       **vlan** 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 RT‐
       NETLINK messages saved in binary format and dumps them.


## NOTES
       This command uses facilities added in Linux 3.0.

       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 pro‐
       tocol. 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.



## SEE ALSO
       [**ip**(8)](https://www.chedong.com/phpMan.php/man/ip/8/markdown)

## BUGS
       Please direct bugreports and patches to: **<<netdev@vger.kernel.org>>**


## AUTHOR
       Original Manpage by Stephen Hemminger



iproute2                                    1 August 2012                                  [BRIDGE(8)](https://www.chedong.com/phpMan.php/man/BRIDGE/8/markdown)
