Configure VLANs 1: You can use the show VLAN command. View VLANs Step 1 Configure Terminal Go to global configuration mode Step 2 VLAN Vlan-id Enter one. If you enter a new VLAN Idvlan, the switch creates one, and if you enter a Idvlanvlan that already exists, modify the corresponding. Step 3 Name Vlan-name (optional) to take a name. If this is not done, the VLAN switch will automatically give it a name, with the four-bit number at the beginning. For example, it is the default name of VLAN Xxxxxxxx0vlan Idvlan 0004VLAN. Step 4 End Back to Privileged Command mode Step 5 Show VLAN {ID Check to see if the configuration you just made is correct Step 6 Copy running-config startup config (optional) Save the configuration in the configuration file If you want to change the name of the VLAN back to the default name, just enter the No Name command. Here is an example of creating VLAN 888, naming it as test888, and saving it into a configuration file: switch# Configure terminal Switch (config) # VLAN 888 Switch (Config-vlan) # name test888 Switch (Config-vlan) # End
Delete a VLAN No VLAN Vlan-id Enter a VL and delete it. End Back to Privileged Command mode Show VLAN Check to see if the deletion is correct Copy running-config startup config Optionally, save the configuration in the configuration file
2: Assigning access ports to VLANs
step 1 configure terminal Enter global configuration mode Step 2 Interface interface-id Enter the vlaninterface id you want to join Step 3 switchport mode access Defines the member type of the interface (two-tier port) vlanaccess Step 4 switchport access vlan vlan-id Assign this port to a VLAN Step 5 end back to privileged command mode Step 6 show interfaces Check the interface for full information Step 7 copy running-config startup config Optionally, save the configuration in the configuration file The following example adds ETHERNET 0/10 as an access port VLAN20: switch# configure terminal Switch (config) # INTERFACE FASTETHERNET0/10 Switch (config-if) # switchport mode access Switch (config-if) # switchport access vlan 20 Switch (config-if) # end The following example shows how to check if the configuration is correct: switch# show interfaces fastethernet0/1 switchport Interface switchport mode access native protected vlan lists ---------- ---------- --------- --------- ------- -- --------- ----------- fa0/1 enabled access 1 1 enabled all If you want to switch an interface between access mode and trunk mode, use the switchport mode command: To set an interface as a modal access Switchport mode access [VLAN Vlan-id] Switchport Mode Trunk To set an interface as trunk mode As trunk, this port belongs to a native VLAN. The so-called native VLAN means that the UNTAG messages sent and received on this interface are considered to belong to this VLAN. Obviously, the default VLAN ID for this interface (that is, Pvid in IEEE 802.1Q) is the VLAN ID of the native VLAN. At the same time, sending a frame belonging to the native VLAN on the trunk is bound to take the UNTAG approach. For the specific behavior of the trunk port, see interface Management. The default native VLAN for each trunk port is VLAN 1.
Trunk Port Basic Configuration in privileged mode, the following steps can be used to configure an interface as a trunk port. Step 1 Configure Terminal go to global configuration mode Step 2 Interface Interface-id Enter the Trunkinterface ID that you want to match into a port Step 3 switchport mode Trunk defines the type of the interface as a two-layer port trunk Step 4 switchport Trunk Native VLAN Vlan-id specify a native VLAN for this port Step 5 End back to privileged Command mode Step 6 Show Interfaces Interface-id Switchport Check the full information of the interface Step 7 Show Interfaces Interface-id Trunk display the settings for this interface trunk Step 8 copy running-config startup config (optional) Save the configuration in the File startup config
If you want to reset all trunk-related properties of a trunk to their default values, use the No Switchport Trunk Interface configuration command. define the Licensing VLAN list for trunk ports a trunk port can transmit traffic for all VLANs (1-4093) supported by this switch by default. However, you can also restrict traffic to certain VLANs through this trunk port by setting a list of licensed VLANs for the trunk port. in privileged mode, the following steps can be used to modify the list of licensed VLANs for a trunk port. Step 1 Configure Terminal go to global configuration mode Step 2 Interface Interface-id Enter the Vlantrunkinterface ID of the port for which you want to modify the license list Step 3 switchport mode Trunk defines the type of the interface as a two-layer port trunk Step 4 switchport trunk allowed VLAN {all | [Add | remove | except]} Vlan-list Optionally , configure the license list for this port. The parameter trunkvlanvlan-list can be a V, or a series, with a small beginning, with a large Lanvlanvlan Idvlan end, in the middle with the id-number of connections. such as: 10–. - The license list contains all the support; Allvlanvlan indicates that the specified list is addvlan into the license list; VLAN indicates that the specified list is removed from the license list; Removevlanvlan represents the list of all join licenses except the list listed; Exceptvlanvlanvlan You cannot move out of the license list. VLAN 1VLAN Step 5 End back to privileged Command mode Step 6 Show Interfaces Interface-id Switchport Check the full information of the interface Step 7 copy running-config startup config Optionally , save the configuration in the configuration file If you want to change the trunk's license VLAN list to the default license for all VLANs, use the no switchport trunk allowed VLAN Interface configuration command. The following is an example of removing from a port: VLAN 2 0/15 Switch (config) # interface FASTETHERNET0/15 Switch (config-if) # switchport trunk allowed VLAN remove 2 Switch (config-if) # End switch# Show Interfaces Fastethernet0/15 Switchport Interface Switchport Mode Access Native Protected VLAN lists --------- ---------- --------- --------- --------- --------- ----------- FA0/15 enabled Trunk 1 1 enabled 1,3-4093 Configuring the native VLAN a trunk port can send and receive tags or untag 802.1Q frames. Where UNTAG frames are used to transmit traffic to the native VLAN. The default native VLAN is VLAN 1. in privileged mode, the following steps can be used to configure the native VLAN for a trunk port. Step 1 Configure Terminal go to global configuration mode Step 2 Interface Interface-id Enter the Vlantrunkinterface ID of the port where the configuration native Step 3 switchport Trunk Native VLAN Vlan-id Configuring the native VLAN Step 4 End back to privileged Command mode Step 5 Show Interfaces Interface-id Switchport Verifying the configuration Step 6 copy running-config startup config Optionally , save the configuration in the configuration file If you want to change the trunk's native VLAN list back to the default VLAN 1, use the no switchport trunk native VLAN interface configuration command. If a frame has the VLAN ID of the native VLAN, it is automatically stripped of the tag when it is forwarded through the trunk port. when the native VLAN of an interface is set to a nonexistent VLAN, the switch does not automatically create this VLAN. In addition, the native VLAN of an interface may not be in the License VLAN list of the interface. At this point, traffic to the native VLAN cannot pass through the interface. Show VLAN In privileged mode, you can view VLAN information. The information displayed includes VLAN vid, VLAN status, VLAN member ports, and VLAN configuration information. The relevant display commands are listed below: Command Show Vlan[id Vlan-id] In privileged mode, you can configure IP for a network interface by following these steps: Step 1 Configure Terminal Enter global configuration mode. Step 2 Interface interface_id Enter the network interface configuration mode and specify the three-tier network interface to be configured Step 3 No Switchport Remove the two-layer attribute of the interface (valid only for physical interfaces or two layers of al) Step 4 IP address ip-address address_mask IP address 172.168.1.1 255.255.255.0 [Secondary] Configure the IP address and subnet mask, each network interface can be configured with multiple IPs, with the parameter secondary to configure the slave IP address. Step 5 No shutdown Enable this network interface Step 6 End returns to privileged mode. Step 7 show interfaces [Interface-id] show IP interface [Interface-id] Show Running-config Look at the settings of the network interface. Step 8 Copy Running-config Startup-config Save the configuration. If you want to remove the IP address of a network interface, use the interface configuration command no IP addresses. Configure VLANs Enter VLAN mode Swl#vlan Database Configuring a VTP domain name SWL (VLAN) #vtp domain cctv.com Configuring VTP operating mode SWL (VLAN) #vtp server Configuring a VTP Password SWL (VLAN) #vtp password Cisco Configuring the VTP Pruning simulator cannot be configured SWL (VLAN) #vtp pruning Configuring Trunk Links SWL (config) #int FA0/1 SWL (config-if) #switchport mode trunk Create VLAN 10 20 is the number of VLANs SWL (VLAN) #vlan name Googchengbu SWL (VLAN) #vlan name Caiwubu |