交换机专题2( 二 )


Exiting....
3524XL#
Step 3 Make sure that the VLAN is created by running the show vlan command.
3524XL#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4,
Fa0/5, Fa0/6, Fa0/7, Fa0/8,
Fa0/9, Fa0/10, Fa0/11, Fa0/12,
Fa0/13, Fa0/14, Fa0/15, Fa0/16,
Fa0/17, Fa0/18, Fa0/19, Fa0/20,
Fa0/21, Fa0/22, Fa0/23, Fa0/24,
Gi0/1, Gi0/2
2 cisco_vlan_2 active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
2 enet 100002 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 IBM - 0 0
1005 trnet 101005 1500 - - 1 IBM - 0 0
Step 4 You may want to add the ports (interfaces) in the newly created VLAN. You have to go to interface configuration mode for each of the interfaces that you want to add into the new VLAN. Use the following set of commands in the privileged mode to add a particular interface in the VLAN.
3524XL#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
3524XL(config)#interface fastEthernet 0/2
3524XL(config-if)#switchport Access ?
vlan Set VLAN when interface is in access mode
3524XL(config-if)#switchport access vlan ?
VLAN ID of the VLAN when this port is in access mode
dynamic When in access mode, this interfaces VLAN is controlled by VMPS
3524XL(config-if)#switchport access vlan 2!-- Assigning interface fa0/2 to vlan 2
3524XL(config-if)#exit
3524XL(config)#interface fastEthernet 0/3
3524XL(config-if)#switchport access vlan 2!-- Assigning interface fa0/3 to vlan 2
3524XL(config-if)#end
3524XL#
00:55:26: %SYS-5-CONFIG_I: Configured from console by console
3524XL#wr mem!-- Saving the configuration
Building configuration...
Step 5 Verify VLAN configuration by using show vlan command.
3524XL#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6,
Fa0/7, Fa0/8, Fa0/9, Fa0/10,
Fa0/11, Fa0/12, Fa0/13, Fa0/14,
Fa0/15, Fa0/16, Fa0/17, Fa0/18,
Fa0/19, Fa0/20, Fa0/21, Fa0/22,
Fa0/23, Fa0/24, Gi0/1, Gi0/2
2 cisco_vlan_2 active Fa0/2, Fa0/3
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 1002 1003
2 enet 100002 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 1 1003
1003 tr 101003 1500 1005 0 - - srb 1 1002
1004 fdnet 101004 1500 - - 1 IBM - 0 0
1005 trnet 101005 1500 - - 1 IBM - 0 0
To remove ports from the VLAN, use the no switchport access vlancommand in the interface configuration mode. Once the port is removed from the VLAN that is not VLAN 1 (the default VLAN), that port is automatically added back to the default VLAN.
For example, if you want to remove interface Fa0/2 from cisco_vlan_2 (VLAN 2), use the following set of commands in the privileged mode:
3524XL#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
3524XL(config)#interface fastEthernet 0/2
3524XL(config-if)#no switchport access vlan 2!
-- Removing interface fa0/2 from vlan 2
3524XL(config-if)#end

推荐阅读