VLAN
VLAN View
Section titled “VLAN View”Table 1 VLAN View
| Command | Purpose |
|---|---|
| show vlan summary | Display summary information about VLANs. |
| show vlan summary vlan-id | Display specific VLAN summary information |
| show vlan vlan-id | Display specific information about the VLAN. |
| show vlan all | Display detailed information about all VLANs. |
| show {ip|ipv6} interfaces | Display IP address configuration of VLAN interfaces. |
| show counters vlan | Display VLAN interfaces statistics. |
show vlan summary
Section titled “show vlan summary”[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 | | | | |+-----------+----------------+-----------+----------------+-----------------------+show vlan summary vlan-id
Section titled “show vlan summary vlan-id”[Command]
show vlan summary vlan-id
[Purpose]
Display specific VLAN summary information.
[Parameters]
| Parameter | Description |
|---|---|
| vlan-id | VLAN 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 |+-----------+----------------+-----------+----------------+-----------------------+show vlan vlan-id
Section titled “show vlan vlan-id”[Command]
show vlan vlan-id
[Purpose]
Display specific information about the VLAN.
[Parameters]
| Parameter | Description |
|---|---|
| vlan-id | VLAN ID, the range is [1,4094]. |
[View]
Privileged User View
[Use Cases]
sonic(config)# show vlan 300VLAN ID: 300Route interface:Name: VLAN 300Tagged ports:Untagged ports: 0/0MAC-learning: enableshow vlan all
Section titled “show vlan all”[Command]
show vlan all
[Purpose]
Display detailed information about all VLANs.
[View]
Privileged User View
[Use Cases]
sonic(config)# show vlan allVLAN ID: 300Route interface:Name: VLAN 300Tagged ports:Untagged ports: 0/0MAC-learning: enableshow {ip|ipv6} interfaces
Section titled “show {ip|ipv6} interfaces”[Command]
show {ip|ipv6} interfaces
[Purpose]
Display IP address configuration of VLAN interfaces.
[View]
Privileged User View
[Use Cases]
sonic# show ip interfacesInterface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP----------- -------- ------------------- ------------ -------------- -------------0/48 199.0.3.1/24 up/up N/A N/Aloopback0 10.1.0.34/32 up/up N/A N/Avlan100 Vrf123 100.100.0.1/24 up/up N/A N/Avlan200 Vrf123 200.200.0.1/24 up/up N/A N/Avlan300 Vrf123 200.230.0.1/24 up/down N/A N/Avlan400 200.240.0.1/24 up/down N/A N/Avlan4094 99.0.0.1/24 up/up N/A N/Amgmt 10.250.0.138/24 up/up N/A N/Ashow counters vlan
Section titled “show counters vlan”[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 vlanVLAN NAME PACKETS IN PACKETS OUT----------- ------------ -------------vlan1011 100 100vlan1012 0 0VLAN Config
Section titled “VLAN Config”Table 2 VLAN Config
| Command | Purpose |
|---|---|
| vlan vlan-id | Create a VLAN and enter VLAN Configuration View. |
| description description | Specify the description for the VLAN. |
| mac-address learning | Enable MAC learning for the VLAN. |
| {broadcast|unknown-multicast|unknown-unicast} {drop|flood} | Set BUM suppression. |
| counter enable | Enable VLAN interfaces statistics. |
| interface vlan vlan-id | Enter VLANIF Configuration View. |
| ip address {A.B.C.D/M|A::B/M} [secondary] | Configure IP address for the VLAN interface. |
| mtu mtu | Configure the MTU value on a VLAN interface. |
| shutdown | Bring the VLANIF down administratively. |
| mac_address HH:HH:HH:HH:HH:HH | Specify a MAC address to the VLAN interface. |
| switchport {trunk|access} vlan vlan-id | Add member port to the VLAN. |
| vlan range vlan-list | Create a bulk of VLANs. |
| switchport trunk range vlan vlan-list | Add member port to a bulk of VLANs. |
vlan vlan-id
Section titled “vlan vlan-id”[Command]
vlan vlan-id
[Purpose]
Create a VLAN and enter VLAN Configuration View.
[Parameters]
| Parameter | Description |
|---|---|
| vlan-id | VLAN 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 terminalsonic(config)# vlan 300sonic(config-vlan-300)# show this!vlan 300description description
Section titled “description description”[Command]
description description
[Purpose]
Specify the description for the VLAN.
[Parameters]
| Parameter | Description |
|---|---|
| description | In string form. |
[View]
VLAN Configuration View
[Notes]
Run command no description to delete description.
[Use Cases]
sonic# configure terminalsonic(config)# vlan 200sonic(config-vlan-200)# description vlan-200sonic(config-vlan-200)# do show vlan 200VLAN ID: 200Description: vlan-200Route interface:Name: VLAN 200Tagged ports:Untagged ports:MAC-learning: enablemac-address learning
Section titled “mac-address learning”[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 terminalsonic(config)# vlan 300sonic(config-vlan-300)# no mac-address learningsonic(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 terminalsonic(config)# vlan 10sonic(config-vlan-10)# broadcast dropcounter enable
Section titled “counter enable”[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 terminalsonic(config)# vlan 10sonic(config-vlan-10)# counter enableinterface vlan vlan-id
Section titled “interface vlan vlan-id”[Command]
interface vlan vlan-id
[Purpose]
Enter VLANIF Configuration View
[Parameters]
| Parameter | Description |
|---|---|
| vlan-id | VLAN 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 terminalsonic(config)# interface vlan 300sonic(config-vlanif-300)#ip address {A.B.C.D/M|A::B/M} [secondary]
Section titled “ip address {A.B.C.D/M|A::B/M} [secondary]”[Command]
ip address {A.B.C.D/M|A::B/M} [secondary]
[Purpose]
Configure IP address for the VLAN interface.
[Parameters]
| Parameter | Description |
|---|---|
| A.B.C.D/M | IPv4 address with prefix length. |
| A::B/M | IPv6 address with prefix length. |
| secondary | The 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 terminalsonic(config)# interface vlan 300sonic(config-vlanif-300)# ip address 3.3.3.6/24sonic(config-vlanif-300)# show this!vlan 300ip address 3.3.3.6/24mtu mtu
Section titled “mtu mtu”[Command]
mtu mtu
[Purpose]
Configure the MTU value on a VLAN interface.
[Parameters]
| Parameter | Description |
|---|---|
| mtu | Maximum Transmission Unit, the range is from 1312 to 9216. The default is 9216 Bytes. |
[View]
VLANIF Configuration View
[Use Cases]
sonic# configure terminalsonic(config)# interface vlan 300sonic(config-vlanif-300)# mtu 2000sonic(config-vlanif-300)# show this!vlan 300 mtu 2000shutdown
Section titled “shutdown”[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 terminalsonic(config)# interface vlan 300sonic (config-vlanif-3)# shutdownsonic (config-vlanif-3)# show this!interface vlan 300 shutdownmac_address
Section titled “mac_address”[Command]
mac_address HH:HH:HH:HH:HH:HH
[Purpose]
Specify a MAC address to the VLAN interface.
[Parameters]
| Parameter | Description |
|---|---|
| HH:HH:HH:HH:HH:HH | MAC 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 terminalsonic(config)# interface vlan 300sonic(config-vlanif-300)# mac-address 18:17:25:37:67:afsonic(config-vlan-300)# show this!vlan 300 mac-address 18:17:25:37:67:afswitchport {trunk|access} vlan vlan-id
Section titled “switchport {trunk|access} vlan vlan-id”[Command]
switchport {trunk|access} vlan vlan-id
[Purpose]
Add member port to the VLAN.
[Parameters]
| Parameter | Description |
|---|---|
| access | Add to VLAN as untagged. |
| trunk | Add to VLAN as tagged. |
| vlan-id | VLAN 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 terminalsonic(config)# interface ethernet 0/0sonic(config-if-0/0)# switchport access vlan 300sonic(config-if-0/0)# show this!interface ethernet 0/0 switchport access vlan 300vlan range vlan-list
Section titled “vlan range vlan-list”[Command]
vlan range vlan-list
[Purpose]
Create a bulk of VLANs.
[Parameters]
| Parameter | Description |
|---|---|
| vlan-list | Use ’-’ 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 terminalsonic(config)# vlan range 10-20,4000switchport trunk range vlan vlan-list
Section titled “switchport trunk range vlan vlan-list”[Command]
switchport trunk range vlan vlan-list
[Purpose]
Add member port to a bulk of VLANs.
[Parameters]
| Parameter | Description |
|---|---|
| vlan-list | Use ’-’ 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 terminalsonic(config)# interface ethernet 0/4sonic(config-if-0/4)# switchport trunk range vlan 10-20,4000QinQ Config
Section titled “QinQ Config”Table 3 QinQ Config
| Command | Purpose |
|---|---|
| dot1q-tunnel enable | Enable QinQ |
| dot1q-tunnel | Enable QinQ on the interface |
| dot1q-tunnel ethertype tpid | Configure QinQ’s TPID |
dot1q-tunnel enable
Section titled “dot1q-tunnel enable”[Command]
dot1q-tunnel enable
[Purpose]
Enable QinQ
[View]
Global Configuration View
[Notes]
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature. Execute the no dot1q-tunnel enable command to disable QinQ.
[Use Cases]
sonic# configuresonic(config)# dot1q-tunnel enabledot1q-tunnel
Section titled “dot1q-tunnel”[Command]
dot1q-tunnel
[Purpose]
Enable QinQ on the interface
[View]
Interface Configuration View
[Notes]
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature. This command needs to be executed under the physical interface configured with access vlan. Execute the no dot1q-tunnel command to disable QinQ.
[Use Cases]
sonic# configuresonic(config)# interface ethernet 0/8sonic(config-if-0/8)# dot1q-tunneldot1q-tunnel ethertype tpid
Section titled “dot1q-tunnel ethertype tpid”[Command]
dot1q-tunnel ethertype tpid
[Purpose]
Configure QinQ’s TPID
[Parameters]
| Parameter | Description |
|---|---|
| tpid | Set tpid;optional parameters include0x8100, 0x9100, 0x9200, 0x88A8. |
[View]
Interface Configuration View
[Notes]
Currently, only CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 devices support this feature. This command needs to be executed under the physical interface configured with access vlan. Execute the no dot1q-tunnel ethertype command to restore the default configuration of QinQ tpid.
[Use Cases]
sonic# configuresonic(config)# interface ethernet 0/8sonic(config-if-0/8)# dot1q-tunnel ethertype 9200