VLAN Configuration Commands I Table of Contents Table of Contents Chapter 1 VLAN Configuration Commands........................................................................................ 1 1.1 VLAN Configuration Commands............................................................................................ 1 1.1.1 vlan.................................................................................................................................. 1 1.1.2 name................................................................................................................................1 1.1.3 dot1q-tunnel................................................................................................................... 2 1.1.4 switchport pvid............................................................................................................... 3 1.1.5 switchport mode............................................................................................................ 3 1.1.6 switchport trunk..............................................................................................................5 1.1.7 show vlan........................................................................................................................6 1.1.8 show interface vlan....................................................................................................... 7 II VLAN Configuration Commands Chapter 1 VLAN Configuration Commands 1.1 VLAN Configuration Commands The VLAN configuration commands include:  vlan  name  dot1q-tunnel  switchport pvid  switchport mode  switchport trunk  show vlan  show interface vlan 1.1.1 vlan Syntax [no] vlan vlan-id To add a VLAN, run vlan vlan-id. To delete a VLAN, run [no] vlan vlan-id. Parameters Parameters Description vlan-id Defines the ID of the VLAN. Value range: 1-4094. Default Value The default value is 1. Command Mode Global configuration mode Usage Guidelines After this command is run, the system enters the VLAN configuration mode and then you can modify some VLAN attributes. Example The following example shows how to add the VLAN whose ID is 2: Switch_config# Switch_config#vlan 2 Switch_config_vlan2#exit 1.1.2 name 1 VLAN Configuration Commands Syntax To name a VLAN, run name str. [no] name str Parameters Parameters Description str Defines the name of the VLAN. Value range: 1-32 characters. Default Value The default VLAN name is ‘Default’. Other VLAN's name is VLANxxxx (xxxx is 4-digit stack ID) Command Mode VLAN configuration mode Usage Guidelines This command can be used to modify the VLAN name to symbolize a specific VLAN. Example The following example shows how to set the name of VLAN200 to main405: Switch_config# Switch_config# Switch_config#vlan 200 Switch_config_vlan200#name ? WORD The ascii name of VLAN(32bytes) Switch_config_vlan200#name main405 1.1.3 dot1q-tunnel Syntax dot1q-tunnel no dot1q-tunnel To enable or disable the Dot1q tunnel globally, run the following commands. Parameters None Default Value Dot1q Tunnel is not enabled globally. Command Mode Global configuration mode 2 VLAN Configuration Commands Usage Guidelines After Qot1Q Tunnel is globally enabled, all ports serve as the downlink ports of Qot1Q Tunnel by default and put the SPVLAN tag on the incoming packets. Example The following example shows how to enable Dot1q tunnel in the global configuration mode. Switch_config#dot1q-tunnel 1.1.4 switchport pvid Syntax To configure VLAN of the access-mode port, run switchport pvid vlan-id. switchport pvid vlan-id no switchport pvid Parameters Parameters Description vlan-id VLAN ID which the port belongs to, ranging between 1 and 4049 Value range: 1-4094 Default Value All ports belong to VLAN 1. Command Mode Port configuration mode Usage Guidelines If vlan which pvid belongs does not exist before the command, it will be created with the creation of pvid. The port can be configured in the access mode or the relay mode. Example The following example shows how to set port GigaEthernet 0/1 to the access port of VLAN10: Switch_config#interface g0/1 Switch_config_g0/1#switchport pvid 10 1.1.5 switchport mode Syntax switchport mode {access | trunk | dot1q-tunnel-uplink | dot1q-translating-tunnel no switchport mode To configure the mode of the port, run the following command. 3 VLAN Configuration Commands Parameters Parameters Description access Access mode trunk Relay mode dot1q-tunnel-uplink VLAN tunnel uplink mode dot1q-translating-tun VLAN translating tunnel mode nel Default Value Access mode Command Mode Port configuration mode Usage Guidelines The switch's port supports the following modes: the access mode, the relay mode, the VLAN tunnel mode, the VLAN translating tunnel mode and the VLAN tunnel uplink mode. The access mode indicates that the port belongs to just one VLAN; only the untagged Ethernet frame can be transmitted and received. The relay mode indicates that the port connects other switches and the tagged Ethernet frame can be transmitted and received. The VLAN translating tunnel mode is a sub mode based on the relay mode. The port looks up the VLAN translation table according to the VLAN tag of received packets to obtain corresponding SPVLAN, and then the switching chip replaces the original tag with SPVLAN or adds the SPVLAN tag to the outside layer of the original tag. When the packets is forwarded out of the port, the SPVLAN will be replaced by the original tag or the SPVLAN tag will be removed mandatorily. Hence, the switch omits different VLAN partitions that access the network, and then passes them without change to the other subnet that connects the other port of the same client, realizing transparent transmission. The VLAN tunnel uplink mode is a sub mode based on the relay mode. The SPVLAN should be set when packets are forwarded out of the port. When the packets are received by the port, their TPIDs will be checked. If difference occurs or they are untagged packets, the SPVLAN tag which contains their own TPID will be added to them as their outer-layer tag.When the packets are received by the port, their TPIDs will be checked. If difference occurs or they are untagged packets, the SPVLAN tag which contains their own TPID will be added to them as their outer-layer tag. The port mode collides with the 802.1X protocol. The 802.1X protocol cannot be configured in relay mode (including the VLAN translating tunnel mode and the VLAN tunnel uplink mode); the port on which the 802.1X protocol is configured cannot be set to the relay mode. That is to say, the 802.1X protocol can be effective only on the access-mode port (including the VLAN tunnel mode). 4 VLAN Configuration Commands The 802.1X standard does not support authentication on the trunk port. The reason is that the authentication object regulated in the standard is not the port. As to port multiplexing, if user authentication is approved in one VLAN, all other VLAN users who multiplex this port are also authorized correspondingly, therefore, the trunk port does not support authentication. Example The following example shows how to configure the port to VLAN tunnel uplink port mode. Switch_config_g0/1#switchport mode dot1q-tunnel-uplink 1.1.6 switchport trunk Syntax To configure the attributes of the relay port, run the following command. [no] switchport trunk { {vlan-allowed vlan-list} | {vlan-untagged vlan-list } } Parameters Parameters Description vlan-allowed VLAN ID which can be received and transmitted by the port Value Range: 1-4094 vlan-untagged Frame that will be transmitted without adding the VLAN tag Value Range: 1-4094 Default Value The native VLAN ID of all relay ports is 1. The allowable value for all VLANs ranges between 1 and 4094. Command Mode Port configuration mode Usage Guidelines No matter the port is in access mode or in relay mode, you can run this command on the port. However, the port is in relay mode when this command functions. The vlan-allowed parameter is used to control theVLANrange of the port; the vlan-untagged parameter is used to decide which packets need be added with theVLANtag when a port transmits these packets. When the vlan list is used, you can add, remove or set (none, all, except) the lists of the existingVLAN. The entered lists are separated by the comma or the hyphen. For example, “1, 3, 5, 7” stands for "vlan 1, vlan 3, vlan 5, vlan 7”, while “1, 3-5, 7” stands for "vlan 1, vlan 3, vlan 4, vlan -5, vlan 7”. 5 VLAN Configuration Commands Example The following example shows how to set the allowable VLAN range to 1-10, and the untagged VLAN range to 2-1000. Switch_config_g0/1#switchport trunk vlan-allowed 1-10 Switch_config_g0/1#switchport trunk vlan-untagged 2-1000 1.1.7 show vlan Syntax To display relative information about all VLANs, run the following command. show vlan [ id vlan-id | interface intf-id | dot1q-tunnel [interface intf] |mac-vlan | subnet | protocol-vlan |dot1q-translating-tunnel|flat-translation-table] Parameters Parameters Description Id vlan-id Displays the designated VLAN. Value range: 1-4094 Interface Intf-id Displays the designated port. dot1q-tunnel [interface Displays the global information and statistics intf] information about Dot1Q tunnel, or displays the detailed information about Dot1Q tunnel of the designated port. mac-vlan Displays the configured MAC VLAN entries. subnet Displays the configured IP-subnet VLAN entries. protocol-vlan Displays the configured protocol VLAN template or entry. dot1q-translating-tunnel Displays the port vlan tunnel translation information flat-translation-table Checks the configured items of flat translation Default Value None Command Mode Global configuration mode, port configuration and EXEC configuration mode Usage Guidelines None Example The following example shows how to display relative information about all VLANs. Switch#show vlan VLAN Status Name Ports 6 VLAN Configuration Commands ---- ------- ---------------- ------------------------------------------------- 1 Static Default g0/1, g0/2, g0/4…… 2 Static VLAN0002 g0/3 3 Static VLAN0003 g0/3 4 Static VLAN0004 g0/3 5 Static VLAN0005 g0/3 The status parameter stands for the VLAN generation source; the static parameter means that VLAN is generated through configuration; the dynamic parameter means that VLAN is generated dynamically through the GVRP protocol. The following example shows the detailed information about a VLAN: Switch#show vlan id 1 VLAN id: 1, Name: default, TotalPorts:11 Ports Atttributes ----------------------------------------------------------------- g0/1 Trunk,Untagged g0/2 Access The following example shows relative information about aVLANon a port: Switch#show vlan int g0/6 Interface VLAN Name Property PVID Vlan-Map uTagg-VLan-Map -------------------- -------- ---- ---------------- ---------------- GigaEthernet0/2 Trunk 1 3,5,7,9,11,13,15 none 17,19 Switch#show vlan int g0/7 Interface VLAN Name Property PVID Vlan-Map uTagg-VLan-Map GigaEthernet 0/3 Access 7 7 ---- 1.1.8 show interface vlan Syntax To display relative information about the VLAN interface, run the following command. show interface vlan intf-id Parameters Parameters Notes: Value Range Intf-id Displays the designated port. 1-4094 7 VLAN Configuration Commands Default Value None Command Mode Global configuration mode, port configuration and EXEC configuration mode Usage Guidelines None Example The following example shows how to display the information about interface VLAN 1. Switch#show int vlan 1 VLAN1 is up, line protocol is up Hardware is EtherSVI, Address is 00e0.0f42.0071(00e0.0f42.0071) MTU 1500 bytes, BW 1000000 kbit, DLY 2000 usec Encapsulation ARPA, loopback not set 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 0 packets input, 0 bytes, 0 no buffer Received 0 broadcasts, 0 multicasts 0 input errors, 0 input discards 0 packets output, 0 bytes, 0 underruns Transmited 0 broadcasts, 0 multicasts 0 output errors, , 0 discards ARP type: ARPA, ARP timeout 04:00:00 The statistics values are explained as follows: Packets input means the input of all packets, including broadcast packets, multicast packets and unicast packets. Bytes means the byte volume of all packets. Broadcasts means received broadcast packets. Broadcasts means received broadcast packets. Input errors means received error packets. Input discards means that the received packets are dropped, such as the received packets when the interface protocol is down. Packets output means the output of all packets, including broadcast packets, multicast packets and unicast packets. Bytes means the byte volume of all transmitted packets. Broadcasts means transmitted broadcast packets. Multicasts means transmitted multicast packets. Output errors means transmitting error packets. Output discards means that the transmitted packets are dropped, such as the transmitted packets when the interface protocol is down. 8 VLAN Configuration Commands 9