跳转到内容
Ask AI

VLAN

此内容尚不支持你的语言。

Table 1 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 vlan all

[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 2 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 3 QinQ Config

CommandPurpose
dot1q-tunnel enableEnable QinQ
dot1q-tunnelEnable QinQ on the interface
dot1q-tunnel ethertype tpidConfigure QinQ’s TPID

[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# configure
sonic(config)# dot1q-tunnel enable

[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# configure
sonic(config)# interface ethernet 0/8
sonic(config-if-0/8)# dot1q-tunnel

[Command]

dot1q-tunnel ethertype tpid

[Purpose]

Configure QinQ’s TPID

[Parameters]

ParameterDescription
tpidSet 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# configure
sonic(config)# interface ethernet 0/8
sonic(config-if-0/8)# dot1q-tunnel ethertype 9200