Command Line Reference
Layer 2 Configuration
VLAN
27 min
vlan view vlan view table 1 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 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 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 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 300 vlan id 300 route interface name vlan 300 tagged ports untagged ports 0/0 mac learning enable show vlan all show vlan all \[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 show {ip|ipv6} interfaces 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 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 show counters vlan 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 vlan vlan name packets in packets out \ vlan1011 100 100 vlan1012 0 0 vlan config table 2 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 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 terminal sonic(config)# vlan 300 sonic(config vlan 300)# show this ! vlan 300 description description 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 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 mac address learning 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 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} {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 counter enable 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 terminal sonic(config)# vlan 10 sonic(config vlan 10)# counter enable interface vlan 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 terminal sonic(config)# interface vlan 300 sonic(config vlanif 300)# ip address { 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 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 mtu 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 terminal sonic(config)# interface vlan 300 sonic(config vlanif 300)# mtu 2000 sonic(config vlanif 300)# show this ! vlan 300 mtu 2000 shutdown 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 terminal sonic(config)# interface vlan 300 sonic (config vlanif 3)# shutdown sonic (config vlanif 3)# show this ! interface vlan 300 shutdown mac address mac address hh\ hh\ hh\ hh\ hh\ hh \[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 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 switchport {trunk|access} vlan switchport {trunk|access} vlan vlan id \[command] \[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 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 vlan range 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 terminal sonic(config)# vlan range 10 20,4000 switchport trunk range vlan 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 terminal sonic(config)# interface ethernet 0/4 sonic(config if 0/4)# switchport trunk range vlan 10 20,4000
