实验目的:
学习在交换机1912和2924上如何划分VLAN,以及如何将接口定义为指定的VLAN。.我们今后的操作还是会以2950为主,第二学期中学习到的3550中的配置命令,基本与2950相同。
实验设备:
[attach][/attach]
1912和2924交换机
实验内容:
一:1912上VLAN的配置。
首先在SW1912上划分VLAN.
SW1(config)#vlan 10 name AAA
SW1(config)#vlan 20 name BBB
SW1(config)#vlan 30 name CCC
SW1(config)#vlan 40 name DDD
SW1(config)#vlan 50 name EEE
SW1(config)#vlan 60 name FFF
SW1(config)#vlan 70 name GGG
SW1(config)#vlan 80 name HHH
SW1(config)#vlan 90 name III
SW1(config)#vlan 100 name JJJ
查看VLAN状态
SW1#show vlan
VLAN Name Status Ports
--------------------------------------
1 default Enabled 1-24, AUI, A, B
10 AAA Enabled
20 BBB Enabled
30 CCC Enabled
40 DDD Enabled
50 EEE Enabled
60 FFF Enabled
70 GGG Enabled
80 HHH Enabled
90 III Enabled
100 JJJ Enabled
1002 fddi-default Suspended
1003 token-ring-defau Suspended
1004 fddinet-default Suspended
1005 trnet-default Suspended
--More--
VLAN Type SAID MTU Parent RingNo BridgeNo Stp Trans1 Trans2
---------------------------------------------------------------------------
1 Ethernet 100001 1500 0 0 0 Unkn 1002 1003
10 Ethernet 100010 1500 0 1 1 Unkn 0 0
20 Ethernet 100020 1500 0 1 1 Unkn 0 0
30 Ethernet 100030 1500 0 1 1 Unkn 0 0
40 Ethernet 100040 1500 0 1 1 Unkn 0 0
50 Ethernet 100050 1500 0 1 1 Unkn 0 0
60 Ethernet 100060 1500 0 1 1 Unkn 0 0
70 Ethernet 100070 1500 0 1 1 Unkn 0 0
80 Ethernet 100080 1500 0 1 1 Unkn 0 0
90 Ethernet 100090 1500 0 1 1 Unkn 0 0
100 Ethernet 100100 1500 0 1 1 Unkn 0 0
1002 FDDI 101002 1500 0 0 0 Unkn 1 1003
1003 Token-Ring 101003 1500 1005 1 0 Unkn 1 1002
1004 FDDI-Net 101004 1500 0 0 1 IEEE 0 0
1005 Token-Ring-Net 101005 1500 0 0 1 IEEE 0 0
---------------------------------------------------------------------------
为VLAN设置IP 地址:
interface VLAN1
ip address 192.168.0.65 255.255.255.0
ip default-gateway 192.168.0.24
其他VLAN同样。
将接口划入不同的VLAN。
SW1(config)#int e0/1
SW1(config-if)#vlan-membership static 10
SW1(config-if)#int e0/2
SW1(config-if)#vlan-membership static 20
SW1(config)#int e0/3
SW1(config-if)#vlan-membership static 30
SW1(config-if)#int e0/4
SW1(config-if)#vlan-membership static 40
SW1(config)#int e0/5
SW1(config-if)#vlan-membership static 50
SW1(config-if)#int e0/6
SW1(config-if)#vlan-membership static 60
SW1(config)#int e0/7
SW1(config-if)#vlan-membership static 70
SW1(config-if)#int e0/8
SW1(config-if)#vlan-membership static80
SW1(config)#int e0/9
SW1(config-if)#vlan-membership static 90
SW1(config-if)#int e0/10
SW1(config-if)#vlan-membership static 100
查看接口分配到那个VLAN
SW1#show vlan
VLAN Name Status Ports
--------------------------------------
1 default Enabled 11-24, AUI, A, B
10 AAA Enabled 1
20 BBB Enabled 2
30 CCC Enabled 3
40 DDD Enabled 4
50 EEE Enabled 5
60 FFF Enabled 6
70 GGG Enabled 7
80 HHH Enabled 8
90 III Enabled 9
100 JJJ Enabled 10
二:2924上的VLAN配置。
首先在2924上划分VLAN。
Switch>en
Switch#vlan database
Switch(vlan)#vlan 10 name aaa
VLAN 10 added:
Name: aaa
Switch(vlan)#vlan 20 name bbb
VLAN 20 added:
Name: bbb
Switch(vlan)#vlan 30 name ccc
VLAN 30 added:
Name: ccc
Switch(vlan)#vlan 40 name ddd
VLAN 40 added:
Name: ddd
Switch(vlan)#vlan 50 name eee
VLAN 50 added:
Name: eee
Switch(vlan)#exit(*注只能用EXIT命令,这样才会自动保存VLAN信息)
APPLY completed.
Exiting....
查看VLAN信息
Switch#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
10 aaa active
20 bbb active
30 ccc active
40 ddd active
50 eee 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
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
40 enet 100040 1500 - - - - - 0 0
50 enet 100050 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
将接口划分到不同的VLAN。
Switch(config)#int f0/1
Switch(config-if)#switchport access vlan 10
Switch(config)#no shut
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 20
Switch(config)#no shut
Switch(config)#int f0/3
Switch(config-if)#switchport access vlan 30
Switch(config)#no shut
Switch(config)#int f0/4
Switch(config-if)#switchport access vlan 40
Switch(config)#no shut
Switch(config)#int f0/5
Switch(config-if)#switchport access vlan 50
Switch(config)#no shut
查看接口划分到那个VLAN.
Current configuration:
!
version 12.0
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
!
!
!
!
!
!
ip subnet-zero
!
!
!
interface FastEthernet0/1
switchport access vlan 10
!
interface FastEthernet0/2
switchport access vlan 20
!
interface FastEthernet0/3
switchport access vlan 30
!
interface FastEthernet0/4
switchport access vlan 40
!
interface FastEthernet0/5
switchport access vlan 50
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
或者:
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active 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
10 aaa active Fa0/1
20 bbb active Fa0/2
30 ccc active Fa0/3
40 ddd active Fa0/4
50 eee active Fa0/5
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
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
实验总结:
本次实验的主要目的是为了能够对交换机的初始化的VLAN进行简单的配置,实验程度比较简单。