Skip to content

Layer 2 Configuration

Table 1 LAG View

CommandPurpose
show link-aggregation summaryDisplay LAG configuration.
show {ip|ipv6} interfacesDisplay IP address configuration of lag interfaces.
show interface lag lag-idDisplay information about the status of LAG interfaces.

[Command]

show link-aggregation summary

[Purpose]

Display LAG configuration.

[View]

Privileged User View

[Use Cases]

sonic# show link-aggregation summary
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
S - selected, D - deselected, * - not synced
No. Team Dev Protocol Ports
----- --------------- ----------- -------------
0001 PortChannel0001 LACP(A)(Dw) Ethernet46(D)
0002 PortChannel0002 LACP(A)(Dw) Ethernet47(D)

[Command]

show {ip|ipv6} interfaces

[Purpose]

Display IP address configuration of lag interfaces.

[View]

Privileged User View

[Use Cases]

sonic# show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
--------------- -------- ------------------- ------------ -------------- -------------
0/0.2 2.0.0.1/24 up/down N/A N/A
0/48 199.0.3.1/24 up/up N/A N/A
loopback0 10.1.0.34/32 up/up N/A N/A
lag24 24.0.0.1/24 up/down N/A N/A
mgmt 10.250.0.138/24 up/up N/A N/A

[Command]

show interfacelag lag-id

[Purpose]

Display information about the status of LAG interfaces.

[Parameters]

ParameterDescription
lag-idLAG ID, the range is from 1 to 9999.

[View]

Privileged User View

[Use Cases]

sonic# show link-aggregation summary
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
S - selected, D - deselected, * - not synced
No. Team Dev Protocol Ports Description
----- --------------- ----------- ------------- -------------
0010 lag 10 LACP(A)(Up) 0/3 (D) N/A
0/2 (S)
0/4 (D)
sonic# show interface lag 10
lag10 is up, line protocol is up
Hardware is Eth
Mac address is N/A
Interface index is 0010
Description is N/A
Mode of IPV4 address assignment: not-set
Mode of IPV6 address assignment: not-set
IP MTU 9216 bytes
LineSpeed 30.0G, CurrentSpeed 10.0G, Auto-negotiation off
Input statistics:
82 packets, 14988 octets
82 Multicasts, 0 Broadcasts, 0 Unicasts
0 error, 0 discarded
Output statistics:
1205 packets, 158858 octets
1205 Multicasts, 0 Broadcasts, 0 Unicasts
0 error, 0 discarded

Table 2 LAG Config

CommandPurpose
interface link-aggregation lag-idCreate a link-aggregation group and enter LAG Configuration View.
description descriptionSpecify the description for the lag.
link-aggregation-group lag-id [port-priority port-priority] [lacp-key lacp-key] [lacp-portid lacp-portid]Configure the lag member ports and set their attributes.
mode {dynamic|static}Set the aggregation mode.
lacp min-links min-linksSet the minimum number of active links for LACP.
lacp system-priority system-prioritySet system-priority for LACP.
lacp system-id HH:HH:HH:HH:HH:HHSet system-id for LACP.
lacp fast-rateEnable short timeout for LACP.
lacp fallbackEnable fallback for LACP.
mtu mtuConfigure the MTU value on a lag interface.
shutdownBring the lag down administratively.
ip address {A.B.C.D/M|A::B/M} [secondary]Configure IP address for the lag interface.
mac_address HH:HH:HH:HH:HH:HHSpecify a MAC address to the lag interface.
mac-address learningEnable MAC learning for the lag.
lacp graceful-downDynamic LAG disconnects LACP interactions actively.

[Command]

interface link-aggregation lag-id

[Purpose]

Create a link-aggregation group and enter LAG Configuration View.

[Parameters]

ParameterDescription
lag-idLAG ID, the range is from 1 to 9999.

[View]

Global Configuration View

[Notes]

The default aggregation mode is LACP. Run command no interface link-aggregation lag-id to delete the link-aggregation group. The member ports should be removed before deleting.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# show this
!
interface link-aggregation 3

[Command]

description description

[Purpose]

Specify the description for the lag.

[Parameters]

ParameterDescription
descriptionIn string form.

[View]

LAGIF Configuration View

[Notes]

Run command no description to delete description.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 100
sonic(config-lagif-100)# description lag100
sonic(config-lagif-100)# do show link-aggregation summary
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
S - selected, D - deselected, * - not synced
No. Team Dev Protocol Ports Description
----- --------------- --------------- --------------------------- -------------
0100 lag100 LACP(A)(Dw) lag100
Section titled “link-aggregation-group lag-id [port-priority port-priority] [lacp-key lacp-key] [lacp-portid lacp-portid]”

[Command]

link-aggregation-group lag-id [port-priority port-priority] [lacp-key lacp-key] [lacp-portid lacp-portid]

[Purpose]

Configure the lag member ports and set their attributes.

[Parameters]

ParameterDescription
lag-idLAG ID, the range is from 1 to 9999.
port-priorityPort priority, the range is 0-65535. The default is 255.
lacp-keyLACP message key value, the range is 0-65535. The default is 0.
lacp-portidInterface id value, the range is 0-65535

[View]

Physical Interface Configuration View

[Notes]

Run command no link-aggregation-group lag-id to delete aggregation member ports.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/45
sonic(config-if-0/45)# link-aggregation-group 1
sonic# show link-aggregation summary
Flags: A - active, I - inactive, Up - up, Dw - Down, N/A - not available,
S - selected, D - deselected, * - not synced
No. Team Dev Protocol Ports
----- --------------- ----------- ---------------------------
PortChanne000l LACP(A)(Dw) N/A
0001 PortChannel0001 LACP(A)(Dw) Ethernet46(D) Ethernet45(D)
0002 PortChannel0002 LACP(A)(Dw) Ethernet47(D)
sonic(config-if-0/45)# link-aggregation-group 1 port-priority 500
sonic(config-if-0/45)# link-aggregation-group 2 port-priority 500 lacp-key 10 lacp-portid 60

[Command]

mode {dynamic|static}

[Purpose]

Set the aggregation mode.

[View]

LAGIF Configuration View

[Notes]

Run commit to take effect; The default is dynamic(LACP).

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# mode dynamic
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
mode dynamic

[Command]

lacp min-links min-links

[Purpose]

Set the minimum number of active links for LACP.

[Parameters]

ParameterDescription
min-linksThe minimum number of active links, the range is 1-128.

[View]

Dynamic LAGIF Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# lacp min-links 2
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
lacp min-links 2
mode dynamic

[Command]

lacp system-priority system-priority

[Purpose]

Set system-priority for LACP.

[Parameters]

ParameterDescription
system-prioritySystem priority, the range is 0-65535.

[View]

Dynamic LAGIF Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# lacp system-priority 100
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
lacp system-priority 100
mode dynamic

[Command]

lacp system-id HH:HH:HH:HH:HH:HH

[Purpose]

Set system-id for LACP.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.

[View]

Dynamic LAGIF Configuration View

[Notes]

Run command no lacp system-id to delete system-id configuration.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# lacp system-id 00:a0:23:12:23:53
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
commit
lacp system-id 00:a0:23:12:23:53
mode dynamic

[Command]

lacp fast-rate

[Purpose]

Enable short timeout for LACP.

[View]

Dynamic LAGIF Configuration View

[Notes]

The default LACP timeout mode is long timeout. Run command no lacp fast-rate to disable short timeout for LACP.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# lacp fast-rate
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
lacp fast-rate
mode dynamic

[Command]

lacp fallback

[Purpose]

Enable fallback for LACP.

[View]

Dynamic LAGIF Configuration View

[Notes]

Run command no lacp fallback to disable fallback for LACP.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# lacp fallback
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
lacp fallback
mode dynamic

[Command]

mtu mtu

[Purpose]

Configure the MTU value on a lag interface.

[Parameters]

ParameterDescription
mtuMaximum Transmission Unit, the range is from 1312 to 9216. The default is 9216 Bytes.

[View]

LAGIF Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic (config-lagif-3)# mtu 2000
sonic (config-lagif-3)# show this
!
interface link-aggregation 3
mtu 2000

[Command]

shutdown

[Purpose]

Bring the lag down administratively.

[View]

LAGIF Configuration View

[Notes]

Run command no shutdown to bring the lag up administratively.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# shutdown
sonic(config-lagif-3)# show this
!
interface link-aggregation 3
shutdown

[Command]

ip address {A.B.C.D/M|A::B/M} [secondary]

[Purpose]

Configure IP address for the lag interface.

[Parameters]

ParameterDescription
A.B.C.D/MIPv4 address with prefix length.
A::B/MIPv6 address with prefix length.
secondaryThe default is Primary IP, specifying this option means configuring as Secondary IP, which requires that the Secondary IP and Primary IP be in the same network segment.

[View]

LAGIF Configuration View

[Notes]

IPv4 address with subnet mask /32 is not allowed to be configured. Addresses with subnet mask /31 is allowed. In other subnet masks, addresses with the host portion all-zeros or all-ones are not allowed. IPv6 address with subnet mask /127 or /128 is not allowed to be configured. In other subnet masks, addresses with the host portion all-zeros are not allowed, but all-ones are allowed. Run command no ip address {A.B.C.D/M|A::B/M} [secondary] to delete IP address configuration of the lag interface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# ip address 3.3.3.6/24
sonic(config-lagif-3)# show this
!
interface link-aggregation 3
ip address 3.3.3.6/24

[Command]

mac_address HH:HH:HH:HH:HH:HH

[Purpose]

Specify a MAC address to the lag interface.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address, not case sensitive.

[View]

LAGIF Configuration View

[Notes]

The default is the MAC of the switch; Run command no mac_address to restore the MAC of the lag interface to default.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# mac-address 18:17:25:37:67:af
sonic(config-lagif-3)# show this
!
interface link-aggregation 3
mac-address 18:17:25:37:67:af

[Command]

mac-address learning

[Purpose]

Enable MAC learning for the lag.

[View]

LAGIF Configuration View

[Notes]

The interface to be operated should be added to a VLAN. MAC learning is enabled by default. Run command no mac-address learning to disable MAC learning for the lag.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# no mac-address learning
sonic(config-lagif-3)# show this
!
interface link-aggregation 3
no mac-address learning

[Command]

lacp graceful-down

[Purpose]

Dynamic LAG disconnects LACP interactions actively.

[View]

LAGIF Configuration View

[Notes]

After executing the no lacp graceful-down command, the LAG resumes lacp interaction. This command is valid for a single time and will not be saved to the configuration, i.e., the LAG interface will be restored to UP after reboot or reload.

[Use Cases]

sonic# configure terminal
sonic(config)# interface link-aggregation 3
sonic(config-lagif-3)# lacp graceful-down

Table 3 LLDP View

CommandPurpose
show lldp neighbor {summary|interface interface_name}Display LLDP neighbors.
showlldp local {summary|interface interface_name}Display LLDP configuration

show lldp neighbor {summary|interface interface_name}

Section titled “show lldp neighbor {summary|interface interface_name}”

[Command]

show lldp neighbor {summary|interface interface_name}

[Purpose]

Display LLDP neighbors.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Privileged User View

[Use Cases]

sonic# show lldp neighbor summary
Capability codes: (R) Router, (B) Bridge, (O) Other
LocalPort RemoteDevice RemotePortID Capability RemotePortDescr
----------- -------------- -------------- ------------ -----------------
0/48 spine-228 C1 BR Ethernet0
0/60 sonic C6 BR Ethernet68
0/72 sonic-102 C7 BR 0/72
--------------------------------------------------
Total entries displayed: 3
sonic# show lldp neighbor interface 0/48
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface: 0/48 , via: LLDP, RID: 1, Time: 1 day, 08:51:31
Chassis:
ChassisID: mac 18:17:25:37:65:40
SysName: spine-228
SysDescr: Debian GNU/Linux 9 (stretch) Linux 4.9.0-14-2-amd64 #1 SMP Debian 4.9.246-2 (2020-12-17) x86_64
MgmtIP: 10.250.0.228
MgmtIface: 2
Capability: Bridge, on
Capability: Router, on
Capability: Wlan, off
Capability: Station, off
Port:
PortID: local C1
PortDescr: 0/0
TTL: 120
-------------------------------------------------------------------------------

show lldp local {summary|interface interface_name}

Section titled “show lldp local {summary|interface interface_name}”

[Command]

show lldp local {summary|interface interface_name}

[Purpose]

Display LLDP configuration.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Privileged User View

[Use Cases]

sonic# show lldp local summary
-------------------------------------------------------------------------------
Global configuration:
-------------------------------------------------------------------------------
Configuration:
Transmit delay: 30
Transmit delay in milliseconds: 30000
Transmit hold: 4
Maximum number of neighbors: 32
Receive mode: no
Pattern for management addresses: 10.250.0.171
Interface pattern: Ethernet*,eth0
Permanent interface pattern: (none)
Interface pattern for chassis ID: eth0
Override chassis ID with: (none)
Override description with: SONiC Software Version: SONiC.V3.1R0406P01T08 - HwSku: CX532P-N - Distribution: Debian 11.10 - Kernel: 5.10.0-8-2-amd64
Override platform with: Linux
Override system name with: sonic
Advertise version: yes
Update interface descriptions: no
Promiscuous mode on managed interfaces: no
Disable LLDP-MED inventory: yes
LLDP-MED fast start mechanism: yes
LLDP-MED fast start interval: 1
Source MAC for LLDP frames on bond slaves: local
Port ID TLV subtype for LLDP frames: unknown
Agent type: unknown
-------------------------------------------------------------------------------
sonic# show lldp local interface 0/4
-------------------------------------------------------------------------------
LLDP interfaces:
-------------------------------------------------------------------------------
Interface: Ethernet4, via: LLDP, Time: 0 day, 09:11:32
Chassis:
ChassisID: mac 74:fe:48:7b:23:1a
SysName: sonic
SysDescr: SONiC Software Version: SONiC.V3.1R0406P01T08 - HwSku: CX532P-N - Distribution: Debian 11.10 - Kernel: 5.10.0-8-2-amd64
MgmtIP: 10.250.0.171
MgmtIface: 2
Capability: Bridge, on
Capability: Router, on
Capability: Wlan, off
Capability: Station, off
Port:
PortID: local C2
PortDescr: Ethernet4
TTL: 120
-------------------------------------------------------------------------------

Table 4 LLDP Config

CommandPurpose
lldp {enable|disable}Enable or disable LLDP globally.
lldp message-transmission interval interval-timeSet the LLDP message sending interval.
lldp message-transmission hold hold-multiplierSet the multiplier for LLDP messages hold time in neighboring devices.
lldp port-id-subtype {local|mac-addreess|ifname}Set the subtype in LLDP messages.
lldp management-address-advertisements enableAdvertise the management IP address in LLDP messages.
lldp capabilities-advertisements enableAdvertise the features supported and enabled by the device in the LLDP message
lldp admin-status { tx|rx|txrx|disable}Set the operating mode of LLDP for the interface as send-only/receive-only/send and receive/ not send and receive.

[Command]

lldp {enable|disable}

[Purpose]

Enable or disable LLDP globally.

[View]

Global Configuration View

[Use Cases]

sonic(config)# lldp enable

lldp message-transmission interval interval-time

Section titled “lldp message-transmission interval interval-time”

[Command]

lldp message-transmission interval interval-time

[Function] Set the LLDP message sending interval.

[Parameters]

ParameterDescription
interval-timeInterval time, range 5-32768

[View]

Global Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# lldp message-transmission interval 10

lldp message-transmission hold hold-multiplier

Section titled “lldp message-transmission hold hold-multiplier”

[Command]

lldp message-transmission hold hold-multiplier

[Function] Set the multiplier for LLDP messages hold time in neighboring devices.

[Parameters]

ParameterDescription
hold-multiplierMultiplier of hold time, range 2-10

[View]

Global Configuration View

[Notes]

Calculation formula for multiplier of LLDP message hold time: TTL = Min (65535, (interval × hold))

[Use Cases]

sonic# configure terminal
sonic(config)# lldp message-transmission hold 10

lldp port-id-subtype {local|mac-addreess|ifname}

Section titled “lldp port-id-subtype {local|mac-addreess|ifname}”

[Command]

lldp port-id-subtype {local|mac-addreess|ifname}

[Function] Set the subtype in LLDP messages.

[View]

Global Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# lldp port-id-subtype local

lldp management-address-advertisements enable

Section titled “lldp management-address-advertisements enable”

[Command]

lldp management-address-advertisements enable

[Function] Advertise the management IP address in LLDP messages.

[View]

Global Configuration View

[Notes]

The default configuration is to enable management IP address advertisement. Run commandno lldp management-address-advertisements enable command to disable the advertisement of management IP address in LLDP messages.

[Use Cases]

sonic# configure terminal
sonic(config)# lldp management-address-advertisements enable

[Command]

lldp capabilities-advertisements enable

[Function] Advertise the features supported and enabled by the device in the LLDP message

[View]

Global Configuration View

[Notes]

The default configuration is to enable LLDP capabilities-advertisements Run command no lldp capabilities-advertisements enable to disable LLDP capabilities-advertisements.

[Use Cases]

sonic# configure terminal
sonic(config)# lldp capabilities-advertisements enable

[Command]

lldp admin-status {tx|rx|txrx|disable}

[Purpose]

Set the operating mode of LLDP for the interface as send-only/receive-only/send and receive/not send and receive.

[View]

Physical Interface Configuration View

[Notes]

The default mode is txrx.

[Use Cases]

sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# lldp admin-status rx

Table 5 STP View

CommandPurpose
show mstp bridgeDisplay MSTI status.
show mstp brief [{ethernet|link-aggregation} interface_name]Display information about the port status in CIST.
show mstp interface [{ethernet|link-aggregation} interface_name]Display detailed information about the status of the ports in CIST.
show mstp mstconfidDisplay summary information about the MST domain configuration currently in effect.
show mstp statusDisplay status of MSTP.
show mstp tree instance-idDisplay MSTI status of the specified MSTP instance.
show mstp treeport {ethernet|link-aggregation} interface_name instance instance-idDisplays MSTI port status details.

[Command]

show mstp bridge

[Purpose]

Display MSTI status.

[View]

Privileged User View

[Use Cases]

sonic# show mstp bridge
Bridge CIST info
enabled yes
bridge id 8.000.00:00:01:02:03:04
designated root 8.000.00:00:01:02:03:04
regional root 8.000.00:00:01:02:03:04
root port none
path cost 0 internal path cost 0
max age 20 bridge max age 20
forward delay 15 bridge forward delay 15
tx hold count 6 max hops 20
hello time 2 ageing time 300
force protocol version mstp
time since topology change 2497
topology change count 9
topology change no
topology change port Ethernet64
last topology change port PortChannel0111
Section titled “show mstp brief [{ethernet|link-aggregation} interface_name]”

[Command]

show mstp brief [{ethernet|link-aggregation} interface_name]

[Purpose]

Display information about the status of ports in CIST.

[Parameters]

ParameterDescription
interface_nameinterface name

[View]

Privileged User View

[Use Cases]

sonic# show mstp brief
port bridge point-to-point oper-edge-port port-id enabled state role designated-bridge designated-port designated-root
--------------- -------- ---------------- ---------------- --------- --------- ---------- ---------- ----------------------- ----------------- -----------------------
0/8 Bridge yes yes 8.002 yes forwarding Designated 8.000.60:EB:5A:01:06:6D 8.002 8.000.60:EB:5A:01:06:6D
lag111 Bridge no no 8.003 no discarding Disabled 8.000.60:EB:5A:01:06:6D 0 8.000.60:EB:5A:01:06:6D
Section titled “show mstp interface [{ethernet|link-aggregation} interface_name]”

[Command]

show mstp interface [{ethernet|link-aggregation} interface_name]

[Purpose]

Display detailed information about the status of the ports in CIST.

[Parameters]

ParameterDescription
interface_nameinterface name

[View]

Privileged User View

[Use Cases]

sonic# show mstp interface
Bridge:0/2 CIST info
enabled no role Disabled
port id 8.006 state discarding
external port cost 200000000 admin external cost 0
internal port cost 200000000 admin internal cost 0
designated root 8.000.60:EB:5A:01:10:C9 dsgn external cost 0
dsgn regional root 8.000.60:EB:5A:01:10:C9 dsgn internal cost 0
designated bridge 8.000.60:EB:5A:01:10:C9 designated port 0.000
admin edge port no auto edge port yes
oper edge port no topology change ack no
point-to-point no admin point-to-point auto
restricted role no restricted TCN no
port hello time 2 disputed no
bpdu guard port no bpdu guard error no
network port no BA inconsistent no
bpdu filter port no Num RX BPDU Filtered 0
Num TX BPDU 0 Num TX TCN 0
Num RX BPDU 0 Num RX TCN 0
Num Transition FWD 0 Num Transition BLK 1
Rcvd BPDU no Rcvd STP no
Rcvd RSTP no Send RSTP yes
Rcvd TC Ack no Rcvd TCN no

[Command]

show mstp mstconfid

[Purpose]

Display summary information about the MST domain configuration currently in effect.

[View]

Privileged User View

[Use Cases]

sonic# show mstp mstconfid
Bridge MST Configuration Identifier:
Format Selector: 0
Configuration Name: test
Revision Level: 0
Configuration Digest: F3B784B6F462AE5FE28E6578DBF77D2E

[Command]

show mstp status

[Purpose]

Display status of MSTP.

[View]

Privileged User View

[Use Cases]

sonic# show mstp status
role Flags: Root - Root, Desg - Designated, Altn - Alternate, Back - Backup, Mstr - Master, Disa - Disabled
state Flags: disc - Discard/Blocking/Listening, lear - Learning, forw - Forwarding
Spanning-tree Mode: mstp
vlan mst instance port_role_state
------- -------------- -------------------------------------------------------
vlan10 0 lag5(Desg)(forw) lag9(Desg)(forw)
vlan20 0

[Command]

show mstp tree instance-id

[Purpose]

Display MSTI status of the specified MSTP instance.

[Parameters]

ParameterDescription
instance-idMSTP instance ID.

[View]

Privileged User View

[Use Cases]

sonic# show mstp tree 0
Bridge MSTI 0 info
bridge id 8.000.00:00:01:02:03:04
regional root 8.000.00:00:01:02:03:04
root port none
internal path cost 0
time since topology change 2560
topology change count 9
topology change no
topology change port Ethernet64
last topology change port PortChannel0111
sonic# show mstp tree 1
Bridge MSTI 1 info
bridge id 8.001.00:00:01:02:03:04
regional root 8.001.00:00:01:02:03:04
root port none
internal path cost 0
time since topology change 2563
topology change count 9
topology change no
topology change port Ethernet64
last topology change port PortChannel0111
Section titled “show mstp treeport {ethernet|link-aggregation} interface_name instance instance-id”

[Command]

show mstp treeport {ethernet|link-aggregation} interface_name instance instance-id

[Purpose]

Displays MSTI port status details.

[Parameters]

ParameterDescription
interface_nameinterface name
instance-idMSTP instance ID.

[View]

Privileged User View

[Use Cases]

sonic# show mstp treeport ethernet 0/64 instance 1
Bridge:0/64 MSTI 1 info
role Designated port id 8.00A
state forwarding disputed no
internal port cost 200 admin internal cost 0
dsgn regional root 8.001.00:00:01:02:03:04 dsgn internal cost 0
designated bridge 8.001.00:00:01:02:03:04 designated port 8.00A
sonic# show mstp treeport ethernet 0/64 instance 3
Bridge:0/64 MSTI 3 info
role Root port id 8.00A
state forwarding disputed no
internal port cost 200 admin internal cost 0
dsgn regional root 0.003.60:EB:5A:01:14:CC dsgn internal cost 0
designated bridge 0.003.60:EB:5A:01:14:CC designated port 8.004

Table 6 STP config

CommandPurpose
bridge mac HH:HH:HH:HH:HH:HHConfigure Bridge MAC address.
mstp enableEnable MSTP globally.
mstp {forward_delay|hello|max_age|name} valueSet the attributes of MSTP.
mstp cost interface {ethernet|link-aggregation} interface_name cost_valueSet the external path cost.
mstp instance instance-idCreate a MSTP instance and enter MSTP Instance Configuration View.
priority prioritySet the priority of the MSTP instance.
interface priority priority interface {ethernet|link-aggregation} interface_nameSet the interface priority of all member ports under the MSTP instance.
vlan vlan-id (MSTP Instance Configuration View)Bind the VLAN to the MSTP instance.
mstp cost interface {ethernet|link-aggregation} interface_name cost_valueSet the internal path csot of the instance.
mstp auto-edge enable interface {ethernet|link-aggregation} interface_nameEnable MSTP auto edge for the interface.
mstp edge-port enable interface {ethernet|link-aggregation} interface_nameEnable MSTP manual edge for the interface.
mstp bpdu-filter enable interface {ethernet|link-aggregation} interface_nameEnable BPDU filtering for the interface.
mstp bpdu-guard enable interface {ethernet|link-aggregation} interface_nameEnable BPDU guard for the interface.

[Command]

bridge mac HH:HH:HH:HH:HH:HH

[Purpose]

Configure Bridge MAC address.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.

[View]

Global Configuration View

[Notes]

The default is the MAC of the switch; Run command no bridge mac to restore the Bridge MAC address to default.

[Use Cases]

sonic(config)# bridge mac 00:44:55:66:77:88

[Command]

mstp enable

[Purpose]

Enable MSTP globally.

[View]

Global Configuration View

[Notes]

Run command mstpdisable to disable MSTP.

[Use Cases]

sonic(config)# mstp enable

mstp {forward_delay|hello|max_age|name} value

Section titled “mstp {forward_delay|hello|max_age|name} value”

[Command]

mstp {forward_delay|hello|max_age|name} value

[Purpose]

Set the attributes of MSTP.

[Parameters]

ParameterDescription
forward_delaySpecify the port state changing time in seconds. The range is [4,30], and the default is 15.
helloSpecify the interval of sending BPDUs in seconds. The range is [1,10], and the default is 2.
max_ageSpecify the maximum aging value in seconds. The range is [10,1000000], and the default is 20.
nameSpecify the domain name of the Bridge in string form.
valueThe value of the attribute.

[View]

Global Configuration View

[Notes]

MSTP should be enabled before configuration. Run command no mstp {forward_delay|hello|max_age|name} to restore to default configuration.

[Use Cases]

sonic(config)# mstp hello 5
sonic(config)# mstp name region1
Section titled “mstp cost interface {ethernet|link-aggregation} interface_name cost_value”

[Command]

mstp cost interface {ethernet|link-aggregation} interface_name cost_value

[Purpose]

Set the external path cost.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)
cost_valueSpecify the cost, and the range is [1,200000000]

[View]

Global Configuration View

[Notes]

MSTP should be enabled before configuration. The default cost can be calculated as: cost = 200000000 / link speed (in 100Kbps). Run command no mstp cost interface {ethernet|link-aggregation} interface_name to restore to default cost.

[Use Cases]

sonic(config)# mstp cost interface ethernet 0/0 10

[Command]

mstp instance instance-id

[Purpose]

Create a MSTP instance and enter MSTP Instance Configuration View.

[Parameters]

ParameterDescription
instance-idMSTP instance ID, the range is [1,255].

[View]

Global Configuration View

[Notes]

MSTP should be enabled before configuration. Instance 0 is the default instance, cannot be created or deleted. Run command no mstp instance instance-id to delete MSTP instance.

[Use Cases]

sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)#

[Command]

priority priority

[Purpose]

Set the priority of the MSTP instance.

[Parameters]

ParameterDescription
prioritySpecify the priority of the instance, the range is [0,15]. The default is 8. The smaller the value, the higher the priority.

[View]

MSTP Instance Configuration View

[Notes]

MSTP should be enabled before configuration. Run command no priority to restore to default priority.

[Use Cases]

sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# priority 1
Section titled “interface priority priority interface {ethernet|link-aggregation} interface_name”

[Command]

interface priority priority interface {ethernet|link-aggregation} interface_name

[Purpose]

Set the interface priority under the MSTP instance.

[Parameters]

ParameterDescription
prioritySpecify the priority of the interfaces, the range is [0,15]. The default is 8. The smaller the value, the higher the priority.

[View]

MSTP Instance Configuration View

[Notes]

MSTP should be enabled before configuration. Run command no interface priority interface {ethernet|link-aggregation} interface_name to restore to default priority.

[Use Cases]

sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# interface priority 1 interface ethernet 0/0

vlan vlan-id (MSTP Instance Configuration View)

Section titled “vlan vlan-id (MSTP Instance Configuration View)”

[Command]

vlan vlan-id

[Purpose]

Bind the VLAN to the MSTP instance.

[Parameters]

ParameterDescription
vlan-idVLAN ID, the range is [1,4094].

[View]

MSTP Instance Configuration View

[Notes]

MSTP should be enabled before configuration. Run command no vlan vlan-id to unbind the VLAN from the MSTP instance.

[Use Cases]

sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# vlan 100
Section titled “cost interface {ethernet|link-aggregation} interface_name cost_value”

[Command]

cost interface {ethernet|link-aggregation} interface_name cost_value

[Purpose]

Set the internal path csot of the instance.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)
cost_valueSpecify the cost, and the range is [1,200000000]

[View]

MSTP Instance Configuration View

[Notes]

MSTP should be enabled before configuration. The default cost can be calculated as: cost = 200000000 / link speed (in 100Kbps). Run command no cost interface {ethernet|link-aggregation} interface_nam to restore to default cost.

[Use Cases]

sonic(config)# mstp instance 0
sonic(config-mstp-instance-0)# cost interface ethernet 0/0 10
Section titled “mstp auto-edge enable interface {ethernet|link-aggregation} interface_name”

[Command]

mstpauto-edge enable interface {ethernet|link-aggregation} interface_name

[Purpose]

Enable MSTP auto edge for the interface.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Global Configuration View

[Notes]

The auto-edge interface feature is enabled by default on all Layer 2 ports. An interface with auto-edge enabled does the following things when its state changes from down to up: waiting for 3 seconds and trying to receive BPDUs; If no BPDU is received, it becomes an edge port and will lose edge port role the first time it receives a BPDU thereafter. Run command mstp auto-edge disable interface {ethernet|link-aggregation} interface_name to disable auto edge port, after that, if you do not assign it as a manual edge port, it will lose edge port role.

[Use Cases]

sonic(config)# mstp auto-edge enable interface link-aggregation 99
Section titled “mstp edge-port enable interface {ethernet|link-aggregation} interface_name”

[Command]

mstp edge-port enable interface {ethernet|link-aggregation} interface_name

[Purpose]

Enable MSTP manual edge for the interface.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Global Configuration View

[Notes]

Manual edge port is disabled by default on all Layer 2 ports. When a manual edge port is enabled on an interface, it immediately becomes an edge port until it receives a BPDU message. The priority of manual edge port configuration is higher than auto edge port, that is, when manual edge port is enabled, auto edge port configuration is invalid. Run command mstp edge-port disable interface {ethernet|link-aggregation} interface_name to disable MSTP manual edge port feature.

[Use Cases]

sonic(config)# mstp edge-port enable interface link-aggregation 99
Section titled “mstp bpdu-filter enable interface {ethernet|link-aggregation} interface_name”

[Command]

mstp bpdu-filter enable interface {ethernet|link-aggregation} interface_name

[Purpose]

Enable BPDU filtering for the interface.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Global Configuration View

[Notes]

This command will enable MSTP at interface level and determines whether the interface participates in MSTP protocol operation. The interface to be operated should be a Layer 2 port, and MSTP should be enabled before configuration. By default, MSTP is enabled on all Layer 2 interfaces. After this function is enabled, the interface will not participate in MSTP protocol operation, and there will be a risk of loops, therefore, please take caution. Run command mstp bpdu-filter disable interface {ethernet|link-aggregation} interface_name to disable BPDU filtering.

[Use Cases]

sonic(config)# mstp bpdu-filter enable interface link-aggregation 99
Section titled “mstp bpdu-guard enable interface {ethernet|link-aggregation} interface_name”

[Command]

mstp bpdu-guard enable interface {ethernet|link-aggregation} interface_name

[Purpose]

Enable BPDU guard for the interface.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Global Configuration View

[Notes]

When the interface is enabled with BPDU message protection, it will be admin down if received a BPDU. Run command mstp bpdu-guard disable interface {ethernet|link-aggregation} interface_name to disable BPDU guard.

[Use Cases]

sonic(config)# mstp bpdu-guard enable interface link-aggregation 99

Table 7 VLAN View

CommandPurpose
show vlan summaryDisplay summary information about VLANs.
show vlan summary vlan-idDisplay specific VLAN summary information
show vlan vlan-idDisplay specific information about the VLAN.
show vlan allDisplay detailed information about all VLANs.
show {ip|ipv6} interfacesDisplay IP address configuration of VLAN interfaces.
show counters vlanDisplay VLAN interfaces statistics.

[Command]

show vlan summary

[Purpose]

Display summary information about VLANs.

[View]

Privileged User View

[Use Cases]

sonic# show vlan summary
+-----------+----------------+-----------+----------------+-----------------------+
| VLAN ID | IP Address | Ports | Port Tagging | DHCP Helper Address |
+===========+================+===========+================+=======================+
| 1000 | 192.168.0.1/21 | Ethernet0 | untagged | 192.0.0.1 |
| | | Ethernet1 | untagged | 192.0.0.2 |
| | | Ethernet2 | untagged | 192.0.0.3 |
| | | Ethernet3 | untagged | 192.0.0.4 |
+-----------+----------------+-----------+----------------+-----------------------+
| 1200 | | | | |
+-----------+----------------+-----------+----------------+-----------------------+

[Command]

show vlan summary vlan-id

[Purpose]

Display specific VLAN summary information.

[Parameters]

ParameterDescription
vlan-idVLAN ID

[View]

Privileged User View

[Use Cases]

sonic# show vlan summary 1000
+-----------+----------------+-----------+----------------+-----------------------+
| VLAN ID | IP Address | Ports | Port Tagging | DHCP Helper Address |
+===========+================+===========+================+=======================+
| 1000 | 192.168.0.1/21 | Ethernet0 | untagged | 192.0.0.1 |
| | | Ethernet1 | untagged | 192.0.0.2 |
| | | Ethernet2 | untagged | 192.0.0.3 |
| | | Ethernet3 | untagged | 192.0.0.4 |
+-----------+----------------+-----------+----------------+-----------------------+

[Command]

show vlan vlan-id

[Purpose]

Display specific information about the VLAN.

[Parameters]

ParameterDescription
vlan-idVLAN ID, the range is [1,4094].

[View]

Privileged User View

[Use Cases]

sonic(config)# show vlan 300
VLAN ID: 300
Route interface:
Name: VLAN 300
Tagged ports:
Untagged ports:
0/0
MAC-learning: enable

[Command]

show vlanall

[Purpose]

Display detailed information about all VLANs.

[View]

Privileged User View

[Use Cases]

sonic(config)# show vlan all
VLAN ID: 300
Route interface:
Name: VLAN 300
Tagged ports:
Untagged ports:
0/0
MAC-learning: enable

[Command]

show {ip|ipv6} interfaces

[Purpose]

Display IP address configuration of VLAN interfaces.

[View]

Privileged User View

[Use Cases]

sonic# show ip interfaces
Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP
----------- -------- ------------------- ------------ -------------- -------------
0/48 199.0.3.1/24 up/up N/A N/A
loopback0 10.1.0.34/32 up/up N/A N/A
vlan100 Vrf123 100.100.0.1/24 up/up N/A N/A
vlan200 Vrf123 200.200.0.1/24 up/up N/A N/A
vlan300 Vrf123 200.230.0.1/24 up/down N/A N/A
vlan400 200.240.0.1/24 up/down N/A N/A
vlan4094 99.0.0.1/24 up/up N/A N/A
mgmt 10.250.0.138/24 up/up N/A N/A

[Command]

show counters vlan

[Purpose]

Display VLAN interfaces statistics.

[View]

Privileged User View

[Notes]

Only supported on CX308P-48Y-N-V2 and CX532P-N-V2 (support two VLANIFs at most), other models are not supported yet. Run command clear counters vlan to clear VLANIFs statistics.

[Use Cases]

sonic# show counters vlan
VLAN NAME PACKETS IN PACKETS OUT
----------- ------------ -------------
vlan1011 100 100
vlan1012 0 0

Table 8 VLAN Config

CommandPurpose
vlan vlan-idCreate a VLAN and enter VLAN Configuration View.
description descriptionSpecify the description for the VLAN.
mac-address learningEnable MAC learning for the VLAN.
{broadcast|unknown-multicast|unknown-unicast} {drop|flood}Set BUM suppression.
counter enableEnable VLAN interfaces statistics.
interface vlan vlan-idEnter VLANIF Configuration View.
ip address {A.B.C.D/M|A::B/M} [secondary]Configure IP address for the VLAN interface.
mtu mtuConfigure the MTU value on a VLAN interface.
shutdownBring the VLANIF down administratively.
mac_address HH:HH:HH:HH:HH:HHSpecify a MAC address to the VLAN interface.
switchport {trunk|access} vlan vlan-idAdd member port to the VLAN.
vlan range vlan-listCreate a bulk of VLANs.
switchport trunk range vlan vlan-listAdd member port to a bulk of VLANs.

[Command]

vlan vlan-id

[Purpose]

Create a VLAN and enter VLAN Configuration View.

[Parameters]

ParameterDescription
vlan-idVLAN ID, the range is [1,4094].

[View]

Global Configuration View

[Notes]

Run command no vlan vlan-id to delete the VLAN

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 300
sonic(config-vlan-300)# show this
!
vlan 300

[Command]

description description

[Purpose]

Specify the description for the VLAN.

[Parameters]

ParameterDescription
descriptionIn string form.

[View]

VLAN Configuration View

[Notes]

Run command no description to delete description.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 200
sonic(config-vlan-200)# description vlan-200
sonic(config-vlan-200)# do show vlan 200
VLAN ID: 200
Description: vlan-200
Route interface:
Name: VLAN 200
Tagged ports:
Untagged ports:
MAC-learning: enable

[Command]

mac-address learning

[Purpose]

Enable MAC learning for the VLAN.

[View]

VLAN Configuration View

[Notes]

MAC learning is enabled by default. Run command no mac-address learning to disable MAC learning for the VLAN.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 300
sonic(config-vlan-300)# no mac-address learning
sonic(config-vlan-300)# show this
!
vlan 300
no mac-address learning

{broadcast|unknown-multicast|unknown-unicast} {drop|flood}

Section titled “{broadcast|unknown-multicast|unknown-unicast} {drop|flood}”

[Command]

{broadcast|unknown-multicast|unknown-unicast} {drop|flood}

[Purpose]

Set BUM suppression.

[View]

VLAN Configuration View

[Notes]

By default, the policy for BUM messages is flooding.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# broadcast drop

[Command]

counter enable

[Purpose]

Enable VLAN interfaces statistics.

[View]

VLAN Configuration View

[Notes]

Only supported on CX308P-48Y-N-V2 and CX532P-N-V2 (support two VLANIFs at most), other models are not supported yet. Run command no counter enable to disable VLAN interfaces statistics.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# counter enable

[Command]

interface vlan vlan-id

[Purpose]

Enter VLANIF Configuration View

[Parameters]

ParameterDescription
vlan-idVLAN ID, the range is [1,4094].

[View]

Global Configuration View

[Notes]

Run command no interface vlan vlan-id to delete VLAN interface. You should remove the member ports from it before deleting.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)#

[Command]

ip address {A.B.C.D/M|A::B/M} [secondary]

[Purpose]

Configure IP address for the VLAN interface.

[Parameters]

ParameterDescription
A.B.C.D/MIPv4 address with prefix length.
A::B/MIPv6 address with prefix length.
secondaryThe default is Primary IP, specifying this option means configuring as Secondary IP, which requires that the Secondary IP and Primary IP be in the same network segment.

[View]

VLANIF Configuration View

[Notes]

IPv4 address with subnet mask /32 is not allowed to be configured. Addresses with subnet mask /31 is allowed. In other subnet masks, addresses with the host portion all-zeros or all-ones are not allowed. IPv6 address with subnet mask /127 or /128 is not allowed to be configured. In other subnet masks, addresses with the host portion all-zeros are not allowed, but all-ones are allowed. Run command no ip address {A.B.C.D/M|A::B/M} [secondary] to delete IP address configuration of the VLAN interface.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# ip address 3.3.3.6/24
sonic(config-vlanif-300)# show this
!
vlan 300
ip address 3.3.3.6/24

[Command]

mtu mtu

[Purpose]

Configure the MTU value on a VLAN interface.

[Parameters]

ParameterDescription
mtuMaximum Transmission Unit, the range is from 1312 to 9216. The default is 9216 Bytes.

[View]

VLANIF Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# mtu 2000
sonic(config-vlanif-300)# show this
!
vlan 300
mtu 2000

[Command]

shutdown

[Purpose]

Bring the VLANIF down administratively.

[View]

VLANIF Configuration View

[Notes]

Run command no shutdown to bring the VLANIF up administratively.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 300
sonic (config-vlanif-3)# shutdown
sonic (config-vlanif-3)# show this
!
interface vlan 300
shutdown

[Command]

mac_address HH:HH:HH:HH:HH:HH

[Purpose]

Specify a MAC address to the VLAN interface.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address, not case sensitive.

[View]

VLANIF Configuration View

[Notes]

The default is the MAC of the switch; Run command no mac_address to restore the MAC of the VLAN interface to default.

[Use Cases]

sonic# configure terminal
sonic(config)# interface vlan 300
sonic(config-vlanif-300)# mac-address 18:17:25:37:67:af
sonic(config-vlan-300)# show this
!
vlan 300
mac-address 18:17:25:37:67:af

[Command]

switchport {trunk|access} vlan vlan-id

[Purpose]

Add member port to the VLAN.

[Parameters]

ParameterDescription
accessAdd to VLAN as untagged.
trunkAdd to VLAN as tagged.
vlan-idVLAN ID, the range is [1,4094].

[View]

Physical Interface Configuration View/LAGIF Configuration View

[Notes]

An interface can only be added to one VLAN as untagged, but it can be added to multiple VLANs as tagged. The VLAN ID of the untagged VLAN will be set as PVID of the interface; Run command no switchport vlan vlan-id to remove the interface from specified VLAN; Run command no switchport to remove the interface from all VLANs and change to Layer 3 port.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# switchport access vlan 300
sonic(config-if-0/0)# show this
!
interface ethernet 0/0
switchport access vlan 300

[Command]

vlan range vlan-list

[Purpose]

Create a bulk of VLANs.

[Parameters]

ParameterDescription
vlan-listUse ’-’ and ’,’ to separate VLAN ids e.g. 1-20,30,40

[View]

Global Configuration View

[Notes]

Run command no vlan range vlan-list to delete VLANs.

[Use Cases]

sonic# configure terminal
sonic(config)# vlan range 10-20,4000

[Command]

switchport trunk range vlan vlan-list

[Purpose]

Add member port to a bulk of VLANs.

[Parameters]

ParameterDescription
vlan-listUse ’-’ and ’,’ to separate VLAN ids e.g. 1-20,30,40

[View]

Physical Interface Configuration View/LAGIF Configuration View

[Notes]

Run command no switchport vlan range vlan-list to remove member port from a bulk of VLANs.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/4
sonic(config-if-0/4)# switchport trunk range vlan 10-20,4000

Table 9 MAC View

CommandPurpose
show mac-address [{ethernet|link-aggregation} interface_name|all]Display MAC address table.
clear mac-address [{ethernet|link-aggregation} interface_name|vlan vlan-id] {static|dynamic|all}Clear MAC entries.
show mac-limitDisplay MAC limit configuration.
Section titled “show mac-address [{ethernet|link-aggregation} interface_name|all]”

[Command]

show mac-address [{ethernet|link-aggregation} interface_name|all]

[Purpose]

Display MAC address table.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

Privileged User View

[Use Cases]

sonic# show mac-address
No. Vlan MacAddress Port Type
----- ------ ----------------- --------- ---------
1 100 E2:8C:56:85:4A:11 0/0 Static
Total number of entries 1
sonic# show mac-address all
No. Vlan MacAddress Port Type
----- ------ ----------------- ----------- -------
1 200 AA:BB:CC:11:22:33 0/129 Dynamic
Total number of entries 1
+--------+-------------------+--------------+-------+--------+
| VLAN | MAC | RemoteVTEP | VNI | Type |
+========+===================+==============+=======+========+
| 200 | 60:EB:5A:01:10:B1 | 10.193.2.102 | 200 | Static |
+--------+-------------------+--------------+-------+--------+
Total count : 1
Aging time for switch is 1800 seconds
Section titled “clear mac-address [{ethernet|link-aggregation} interface_name|vlan vlan-id] {static|dynamic|all}”

[Command]

clear mac-address [{ethernet|link-aggregation} interface_name|vlan vlan-id] {static|dynamic|all}

[Purpose]

Clear MAC entries.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)
vlan-idVLAN ID, the range is [1,4094].

[View]

Privileged User View

[Use Cases]

sonic# clear mac-address dynamic

[Command]

show mac-limit

[Purpose]

Display MAC limit configuration.

[View]

Privileged User View

[Use Cases]

sonic# show mac-limit
Interface Mac-limit
----------- -----------
0/1 100
0/2 200

Table 10 MAC Config

CommandPurpose
mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id {ethernet|link-aggregation} interface_nameConfigure a static MAC entry.
mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackholeConfigure a blackhole MAC entry.
mac-address timer {aging aging-time|no-aging}Set MAC aging time.
mac-limit dynamic mac-limit-valueSet a limit to the number of dynamic MAC table entries.
Section titled “mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id {ethernet|link-aggregation} interface_name”

[Command]

mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id {ethernet|link-aggregation} interface_name

[Purpose]

Configure a static MAC entry.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.
vlan-idVLAN ID, the range is [1,4094].
interface_nameInterface name (eg.0/1)

[View]

Global Configuration View

[Notes]

Run command no mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id to delete a static MAC entry.

[Use Cases]

sonic# configure terminal
sonic(config)# mac-address static aa:aa:aa:aa:aa:aa vlan 4 ethernet 0/4

mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackhole

Section titled “mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id blackhole”

[Command]

mac-addressstatic HH:HH:HH:HH:HH:HH vlan vlan-id blackhole

[Purpose]

Configure a blackhole MAC entry.

[Parameters]

ParameterDescription
HH:HH:HH:HH:HH:HHMAC address.
vlan-idVLAN ID, the range is [1,4094].

[View]

Global Configuration View

[Notes]

Run command no mac-address static HH:HH:HH:HH:HH:HH vlan vlan-id to delete a blackhole MAC entry.

[Use Cases]

sonic# configure terminal
sonic(config)# mac-address aa:bb:bb:bb:bb:bb vlan 5 blackhole

mac-address timer {aging aging-time|no-aging}

Section titled “mac-address timer {aging aging-time|no-aging}”

[Command]

mac-address timer {aging aging-time|no-aging}

[Purpose]

Set MAC aging time.

[Parameters]

ParameterDescription
aging-timeSpecify the aging time in seconds, the default is 1800, and the range is from 30 to 7200.

[View]

Global Configuration View

[Notes]

MAC aging time is a parameter that affects MAC self-learning on the switch. Dynamic MAC entries will be automatically discarded after aging; and static MAC entries are not affected by MAC aging time. Run command mac-address timer no-aging to disable MAC aging.

[Use Cases]

sonic# configure terminal
sonic(config)# mac-address timer aging 3600
sonic(config)# mac-address timer no-aging

[Command]

mac-limit dynamic mac-limit-value

[Purpose]

Set a limit to the number of dynamic MAC table entries.

[Parameters]

ParameterDescription
mac-limit-valueThe range is from 1 to 131072.

[View]

VLAN Configuration View/Physical Interface Configuration View

[Notes]

Only CX308P-48Y-N-V2 and CX532P-N-V2 support this feature. Only VLAN or VLAN member ports are allowed to configure the MAC number limit. Run command no mac-limit dynamic to delete MAC limit configuration.

[Use Cases]

sonic# configure terminal
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# mac-limit dynamic 1000
sonic(config-if-0/0)# exit
sonic(config)# vlan 30
sonic(config-vlan-30)# mac-limit dynamic 2000

Table 11 DHCP Relay View

CommandPurpose
show dhcp_relayDisplay DHCP Relay configuration.

[Command]

show dhcp_relay

[Purpose]

Display DHCP Relay configuration.

[View]

Privileged User View

[Use Cases]

sonic# show dhcp_relay
+------------------------------+-------------+-----------+------------+----------+--------+
| Name | down link | up link | loopback | server | vrf |
+==============================+=============+===========+============+==========+========+
| test__v4(v4) | NA | NA | NA | NA | NA |
+------------------------------+-------------+-----------+------------+----------+--------+
| test_dhcp_over_vxlan__v4(v4) | vlan20 | 0/2 | NA | 21.0.0.2 | vrf 123|
+------------------------------+-------------+-----------+------------+----------+--------+
| test_dhcp_over_vxlan__v6(v6) | vlan20 | 0/2 | NA | 2123::2 | vrf 123|
+------------------------------+-------------+-----------+------------+----------+--------+

Table 12 DHCP Relay Config

CommandPurpose
feature dhcp state enableEnable feature DHCP.
dhcp-relay name {v4|v6} [vrf vrf_name]Create an IPv4 or IPv6 DHCP Relay instance.
downlink vlan vlan-id [giaddr A.B.C.D | option82_sub5 A.B.C.D]Specify the VLAN for DHCP Relay (on DHCP Client side).
giaddr loopback loopback-idSpecify the gateway IP address.
server dhcp_server_ipSet DHCP Server IP.
uplink {ethernet|link-aggregation|vlan} interface_nameSpecify the uplink port ( on DHCP Server side) of DHCP Relay.

[Command]

feature dhcp state enable

[Purpose]

Enable feature DHCP.

[View]

Global Configuration View

[Notes]

Run command feature dhcp state disable to disable DHCP feature.

[Use Cases]

sonic# configure terminal
sonic(config)# feature dhcp state enable

[Command]

dhcp-relay name {v4|v6} [vrf vrf_name]

[Purpose]

Create an IPv4 or IPv6 DHCP Relay instance.

[Parameters]

ParameterDescription
nameName of DHCP Relay instance.
vrf_nameVRF name, specifying the VRF where the DHCP Relay instance is located

[View]

Global Configuration View

[Notes]

Please run feature dhcp state enable to enable DHCP before you configure DHCP Relay.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
Section titled “downlink vlan vlan-id [giaddr A.B.C.D | option82_sub5 A.B.C.D]”

[Command]

downlink vlan vlan-id [giaddr A.B.C.D | option82_sub5 A.B.C.D]

[Purpose]

Specify the VLAN for DHCP Relay (on DHCP Client side).

[Parameters]

ParameterDescription
vlan-idVLAN ID, the range is [1,4094].
giaddrRelay agent address
option82_sub5Set option82

[View]

DHCP Relay Instance Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# downlink vlan 10 giaddr 10.0.0.1

[Command]

giaddr loopback loopback-id

[Purpose]

Specify the gateway IP address.

[Parameters]

ParameterDescription
loopback-idLoopback interface number, integer form, range from 0 to 999.

[View]

DHCP Relay Instance Configuration View

[Notes]

By default, the switch will set the giaddr to the IP address of the host VLAN interface when it receives a DHCP request.

[Use Cases]

sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# giaddr loopback 0

[Command]

server dhcp_server_ip

[Purpose]

Set DHCP Server IP.

[Parameters]

ParameterDescription
dhcp_server_ipSpecify the DHCP server IP address.

[View]

DHCP Relay Instance Configuration View

[Use Cases]

sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# server 10.248.0.1
Section titled “uplink {ethernet|link-aggregation|vlan} interface_name”

[Command]

uplink {ethernet|link-aggregation|vlan} interface_name

[Purpose]

Specify the uplink port ( on DHCP Server side) of DHCP Relay.

[Parameters]

ParameterDescription
interface_nameInterface name (eg.0/1)

[View]

DHCP Relay Instance Configuration View

[Use Cases]

sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test)# uplink ethernet 0/2

Table 13 DHCP Server View

CommandPurpose
show dhcp pool info [ip-version {v4|v6}]Display DHCP Server pool information.
show dhcp pool ip-use [ip-version {v4|v6}]Display the address assigned to clients by DHCP Server.
show dhcp pool expired [ip-version {v4|v6}]Display DHCP Server expired ip information.
show dhcp classDisplay DHCP Server User Class configuration.
show dhcp option-groupDisplay DHCP Server option group configuration.

[Command]

show dhcp pool info [ip-version {v4|v6}]

[Purpose]

Display DHCP Server pool infomation.

[View]

Privileged User View

[Notes]

When no IP address version is specified, default view of IPv4 version address pool information

[Use Cases]

sonic# show dhcp pool info
--------------------------------------------------
Pool-name : t1
Network : 201.0.0.0
Mask : 255.255.255.0
Lease : 201.0.0.20 - 201.0.0.50
Lease_default_time : 600
Lease_max_time : 7200
Used Lease : 0
Total Lease : 72

show dhcp pool ip-use [ip-version {v4|v6}]

Section titled “show dhcp pool ip-use [ip-version {v4|v6}]”

[Command]

show dhcp pool ip-use [ip-version {v4|v6}]

[Purpose]

Display the addresses assigned to clients by DHCP Server.

[View]

Privileged User View

[Notes]

When no IP address version is specified, the default view is the IP address information assigned by the IPv4 version

[Use Cases]

sonic# show dhcp pool ip-in-use ip-version v4
Reading leases from /var/lib/dhcp/dhcpd.leases
IP MAC hostname binding state starts ends
==================================================================================================================
total lease :0

show dhcp pool expired [ip-version {v4|v6}]

Section titled “show dhcp pool expired [ip-version {v4|v6}]”

[Command]

show dhcp pool expired [ip-version {v4|v6}]

[Purpose]

Display DHCP Server expired ip information.

[View]

Privileged User View

[Notes]

When no IP address version is specified, the default view is the IP address information reclaimed by IPv4 version

[Use Cases]

sonic# show dhcp pool expired
Reading leases from /var/lib/dhcp/dhcpd.leases
IP MAC hostname binding state starts ends
==================================================================================================================
201.0.0.35 18:17:25:37:64:40 -NA- free 2024-10-21 03:07:01 2024-10-21 03:09:07
total lease :1

[Command]

show dhcp class

[Purpose]

Display DHCP Server User Class configuration.

[View]

Privileged User View

[Use Cases]

sonic# show dhcp class
!
dhcp class t1
!
dhcp class test1
if-match rule 1 option 93 hex ffff

[Command]

show dhcp option-group

[Purpose]

Display DHCP Server option group configuration.

[View]

Privileged User View

[Use Cases]

sonic# show dhcp option-group
!
dhcp option-group 1
option43 hex 01 force

Table 14 DHCP Server Config

CommandPurpose
dhcp serverEnable interface DHCP Server function.
dhcp pool name [v6]Create a DHCP server address pool and enter the DHCP pool configuration view.
dhcp class nameCreate DHCP Server user class and enter DHCP user class configuration view.
dhcp option-group idCreate a DHCP Server option group and enter the option group configuration view.
network {A.B.C.D A.B.C.D|A::B A::B}Configure the network of the address pool.
address-pool start_ip end_ipConfigure address pool IP range.
lease-time default_time max_timeConfigure lease time.
bootfile nameConfigure bootfile option.
dns {A.B.C.D|A::B}Configure DNS option.
next-server {A.B.C.D|A::B}Configure next server option
tftp-server {A.B.C.D|A::B}Configure tftp server option
capwap-ac A.B.C.DConfigure capwap-ac option
routers A.B.C.DConfigure routers option
option43 hex value forceConfigure option43 option
class name address-pool start_ip end_ipConfigure user class IP range
class name option-group idBind class and option-group
if-match rule rule_id option option_idCreate user class matching rule
dhcp failover nameEnable DHCP Server failover
adddress {A.B.C.D|loopback 0}Configure failover local IP
peer address A.B.C.DConfigure failover peer IP
auto-partner-down timeConfigure peer offline time
max-response-delay timeConfigure maximum communication interruption time
role {primary|secondary}Configure primary and secondary roles

[Command]

dhcp server

[Purpose]

Enable interface DHCP Server function.

[View]

Physical Interface / VLANIF Configuration View

[Notes]

Run command no dhcp server to disable interface DHCP Server fuction.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1

[Command]

dhcp pool name [v6]

[Purpose]

Create a DHCP server address pool and enter the DHCP pool configuration view.

[Parameters]

ParameterDescription
nameDHCP Server pool name.

[View]

Global Configuration View

[Notes]

Default creation of IPv4 type address pool, with v6 parameter, creates IPv6 type address pool Run command no dhcp pool name [v6] to delete DHCP pool.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1

[Command]

dhcp class name

[Purpose]

Create DHCP Server user class and enter DHCP user class configuration view.

[Parameters]

ParameterDescription
nameDHCP Server class name.

[View]

Global Configuration View

[Notes]

Run command no dhcp class name to delete DHCP class.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp class t1

[Command]

dhcp option-group id

[Purpose]

Create a DHCP Server option group and enter the option group configuration view.

[Parameters]

ParameterDescription
idDHCP Server option group ID, with a value range of 1-65535.

[View]

Global Configuration View

[Notes]

Run command no dhcp option-group id to delete DHCP option-group.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp option-group 1

[Command]

network {A.B.C.D A.B.C.D|A::B A::B}

[Purpose]

Configure the network of the address pool.

[Parameters]

ParameterDescription
A.B.C.D A.B.C.DIPv4 address and mask.
A:;B A::BIPv6 address and mask.

[View]

DHCP pool Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# network 100.0.0.1 255.255.255.0

[Command]

address-pool start_ip end_ip

[Purpose]

Configure address pool IP range.

[Parameters]

ParameterDescription
start_ipStart_ip.
end_ipEnd_ip

[View]

DHCP pool Configuration View

[Notes]

The end_ip address must be after the start_ip address

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# address-pool 100.0.0.10 100.0.0.100

[Command]

lease-time default_time max_time

[Purpose]

Configure lease time.

[Parameters]

ParameterDescription
default_timeDefault lease time, in seconds, with a value range greater than 300, default value is 600.
max_timeThe maximum lease time, in seconds, needs to be greater than the default lease time, the default value is 7200

[View]

DHCP pool Configuration View

[Notes]

Run command no lease-time to restore lease time to default value

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# lease-time 300 1000

[Command]

bootfile name

[Purpose]

Configure bootfile option.

[Parameters]

ParameterDescription
nameFile name.

[View]

DHCP pool Configuration View/DHCP option-group Configuration View

[Notes]

Run command no bootfile to delete bootfile option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# bootfile-name test.txt

[Command]

dns {A.B.C.D|A::B}

[Purpose]

Configure DNS option.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.
A::BIPv6 address

[View]

DHCP pool Configuration View/ DHCP option-group Configuration View

[Notes]

Run command no dns to delete DNS option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# dns 8.8.8.8

[Command]

next-server {A.B.C.D|A::B}

[Purpose]

Configure next-server option.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.
A::BIPv6 address

[View]

DHCP pool Configuration View

[Notes]

Run command no next-server to delete next-server option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# next-server 1.1.1.1

[Command]

tftp-server {A.B.C.D|A::B}

[Purpose]

Configure tftp-server option.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.
A::BIPv6 address

[View]

DHCP pool Configuration View/DHCP option-group Configuration View

[Notes]

Run command no tftp-server to delete tftp-server option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# tftp-server 2.2.2.2

[Command]

capwap-ac A.B.C.D

[Purpose]

Configure capwap-ac option.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.

[View]

DHCP pool Configuration View/DHCP option-group Configuration View

[Notes]

Run command no capwap-ac to delete capwap-ac option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# capwap-ac 3.3.3.3

[Command]

routers A.B.C.D

[Purpose]

Configure routers option.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.

[View]

DHCP pool Configuration View/DHCP option-group Configuration View

[Notes]

Only supports IPv4 addresses Run command no routers to delete routers option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# routers 100.0.0.1

[Command]

option43 hex value force

[Purpose]

Configure option43 option.

[Parameters]

ParameterDescription
valueHexadecimal number.

[View]

DHCP pool Configuration View/DHCP option-group Configuration View

[Notes]

Run command no option43 to delete routers option

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# option43 hex 10 force

[Command]

class name address-pool start_ip end_ip

[Purpose]

Configure DHCP user class IP range.

[Parameters]

ParameterDescription
nameClass name
start_ipStart_ip
end_ipEnd_ip

[View]

DHCP pool Configuration View

[Notes]

Run command no class name address-pool to delete DHCP user class IP range

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# class test1 address-pool 100.0.0.110 100.0.0.150

[Command]

class name option-group id

[Purpose]

Bind class and option-group.

[Parameters]

ParameterDescription
nameClass name.
idOption-group ID

[View]

DHCP pool Configuration View

[Notes]

Run command no class name option-group to unbind class and option-group

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp pool test1
sonic(config-dhcp-pool-t1)# class test1 option-group 1

[Command]

if-match rule rule_id option option_id

[Purpose]

Create user class matching rule.

[Parameters]

ParameterDescription
rule_idRule id, also indicating priority, with a value range of 1-16. The larger the value, the higher the priority.
option_idOption ID, currently only supports 82 and 93

[View]

DHCP class Configuration View

[Notes]

Run command no if-match rule rule_id to delete user class matching rule.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp class test1
sonic(config-dhcp-class-test1)# if-match rule 1 option 93 hex ffff

[Command]

dhcp failover name

[Purpose]

Enable DHCP Server failover.

[Parameters]

ParameterDescription
nameInstance name.

[View]

Global Configuration View

[Notes]

Run command no dhcp failover name to disable DHCP Server failover.

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456

[Command]

adddress {A.B.C.D|loopback 0}

[Purpose]

Configure local IP.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.

[View]

DHCP failover Configuration View

[Notes]

Run command no address to delete local IP

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# address 20.0.0.1

[Command]

peer address A.B.C.D

[Purpose]

Configure peer IP.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.

[View]

DHCP failover Configuration View

[Notes]

Run command no peer address to delete peer IP

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# peer address 20.0.0.2

[Command]

auto-partner-down time

[Purpose]

Configure peer offline time.

[Parameters]

ParameterDescription
timePeer offline time, in seconds and ranging from 1 to 3600. By default, peers will not go offline.

[View]

DHCP failover Configuration View

[Notes]

Run command auto-partner-down to disable peer offline function

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# auto-partner-down 100

[Command]

max-response-delay time

[Purpose]

Configure maximum communication interruption time.

[Parameters]

ParameterDescription
timeThe maximum communication interruption time, measured in seconds, ranges from 30 to 3600, with a default value of 60.

[View]

DHCP failover Configuration View

[Notes]

Run command nomax-response-delay to restore maximum communication time to default value

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# max-response-delay 100

[Command]

role {primary|secondary}

[Purpose]

Configure primary and secondary roles.

[Parameters]

ParameterDescription
A.B.C.DIPv4 address.

[View]

DHCP failover Configuration View

[Use Cases]

sonic# configure terminal
sonic(config)# dhcp failover t456
sonic(config-dhcp-failover-t456)# role primary