vlan配置命令(VLAN configuration command)
VLAN configuration command
9.2.2.1 VLAN
Command: VLAN [vlan-id]
No VLAN [vlan-id]
Function: create VLAN and enter VLAN configuration mode; in VLAN mode, the user can configure the VLAN name and assign the switch port to the VLAN; the no operation of this command is to delete the specified vlan.
Argument: [vlan-id] is the VLAN of the vid to create / delete, with a range of 1~4094.
Command mode: global configuration mode
Default: the switch defaults to only vlan1.
Instruction: vlan1 is the default VLAN for the switch, and the user cannot configure and delete vlan1. The
total number of VLAN configurations allowed is 255. Another reminder is that you cannot use this command to delete the dynamic GVRP you learned through vlan.
Example: create vlan100 and enter the vlan100 configuration mode.
Switch (config) #vlan 100
Switch (config-vlan100) #
9.2.2.2 name
Command: name [vlan-name]
No name
Function: Specifies the name for the VLAN; the name of the VLAN is a descriptive string to the VLAN; the no operation of this command is to delete the name of the vlan.
Argument: [vlan-name] is the specified VLAN name string.
Command mode: VLAN configuration mode
delete inDefault: VLAN the default VLAN name is vlanxxx, where XXX is vid.
Instruction: the switch provides functions that specify names for different VLAN, which help users remember VLAN and facilitate management.
For example: specify the name "testvlan" for vlan100.
Switch (config-vlan100) #name testvlan
9.2.2.3 switchport access VLAN
Command: switchport, access, VLAN, [vlan-id]
No switchport access VLAN
Function: adds the current access port to the specified VLAN; this command no operates to remove the current port from the vlan.
Parameter: [vlan-id] is the VLAN vid to be added to the current port, and the range is 1~4094.
Command mode: port configuration mode
Default: all ports default to vlan1.
Usage guide: only ports that belong to access mode can be added to the specified VLAN, and the access port can only be added to a vlan.
Example: set up a access port and add vlan100.
Switch (config) #interface Ethernet 0/0/8
Switch (config-ethernet0/0/8) #switchport mode access
Switch (config-ethernet0/0/8) #switchport access VLAN 100
Switch (config-ethernet0/0/8) #exit
9.2.2.4 switchport interface
Command: switchport interface [interface-list]
No switchport interface [interface-list]
Function: assign the Ethernet port command to VLAN; the no operation of this command is to delete one or a group of ports within the specified vlan.
Parameter: [interface-list] to add or delete a list of ports, support, "" - ", such as: Ethernet, 0/0/1; 2; 5 or Ethernet 0/0/1-6; 8.
Command mode: VLAN configuration mode
Default: the newly established VLAN does not contain any ports by default.
Directions: the access port is an ordinary port. You can add VLAN, but only one VLAN is added.
For example: vlan100 distribution of Fast Ethernet ports 1, 3, 4-7, 8.
Switch (config-vlan100), #switchport, interface, Ethernet, 0/0/1; 3; 4-7; 8
9.2.2.5 switchport mode
Command: switchport mode {trunk|access}
Function: set the port of switch to access mode or trunk mode.
Command mode: port configuration mode
Parameter: trunk indicates that the port allows traffic through multiple VLAN; access is port, only one vlan.
Command mode: port configuration mode
Default: the port defaults to access mode.
Directions: work in the trunk mode port called trunk port, trunk port through a number of VLAN traffic through trunk interconnection between ports, communication can achieve the same VLAN on the different switch;
The port working under access mode is called the access port, and the access port can be assigned to a VLAN and can only be assigned to an vlan.
ATTENTION: 802.1x authentication is not allowed on the trunk port.
Example: port 5 is set to trunk mode and port 8 is set to access mode.
Switch (config) #interface Ethernet 0/0/5
Switch (config-ethernet0/0/5) #switchport mode trunk
Switch (config-ethernet0/0/5) #exit
Switch (config) #interface Ethernet 0/0/8

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。