(packet tracer模拟器)
6.1)实验拓扑
//绿色:通;橙色:不通
//sw0是根桥:全通
Pc0:ip 192.168.1.1 Pc1: ip 192.168.1.2 Pc2:ip 192.168.1.1 Pc3: ip 192.168.1.2
S0:s0==s1 接口号:21,22 s0==s2 接口号:23,24
S1:s1==s0 接口号:21,22 s1==s2 接口号:23,24
S2:s2==s0 接口号:21,22 s2==s1 接口号:23,24
6.2)实验需求
利用trunk-link ,VTP, VLAN 保证 PC0和PC2 通讯 PC1 和PC3通讯
6.3)实验步骤
Step1:设备配置
S0:
Switch>enable
Switch#conf t
Switch(config)#hostname s0
S1:
Switch>enable
Switch#conf t
Switch(config)#hostname s1
S2:
Switch>enable
Switch#conf t
Switch(config)#hostname s2
Step2:trunk-link
S0:
s0#conf t
s0(config)#int rang f0/21-24 //全称 interface range fastethernet0/21-24
s0(config-if-range)#switchport mode trunk //exit退出 end结束到特权模式
S1:
s1#conf t
s1(config)#int rang f0/21-24
s1(config-if-range)#switchport mode trunk
S2:
s2#conf t
s2(config)#int rang f0/21-24
s2(config-if-range)#switchport mode trunk
Step3:VTP
S2:
s2#vlan database //又不是配置,只是进入数据库
s2(vlan)#vtp se
s2(vlan)#vtp server
s2(vlan)#vtp domain a //必须!
s2(vlan)#vtp password a
S0:
s0#vlan database
s0(vlan)#vtp client
s0(vlan)#vtp domain a //必须!
s0(vlan)#vtp password a
S1:
s1#vlan database
s1(vlan)#vtp client
s1(vlan)#vtp domain a //必须!
s1(vlan)#vtp password a
Step4:vlan 配置
S2:
s2#vlan database
s2(vlan)#vlan 10 name CHINA
s2(vlan)#vlan 20 name USA
s2(vlan)#exit //保存并退出到上一级?
Step5:接口进vlan(s0,s1)
S0:
s0#conf t
s0(config)#int f0/1
s0(config-if)#switchport mode access //可以无该行命令,因为接口默认
s0(config-if)#switchport access vlan 10 //接口进入vlan10
s0(config-if)#int f0/2
s0(config-if)#switchport mode access
s0(config-if)#switchport access vlan 20
s0(config-if)#exit
s1:
s1# conf t
s1(config)#int f0/1
s1(config-if)#switchport mode access
s1(config-if)#switchport access vlan 10
s1(config-if)#int f0/2
s1(config-if)#switchport mode access
s1(config-if)#sw acc vlan 20
s1(config-if)#exit
出错点:
1)检查交换机之间的连线是否为虚线(交叉线)
2)检查交换机与pc之间的连线是否为直线(直通线)
3)交换机与交换机间的 接口都要设置trunk-link
4)VTP s2是server s1,s0都是client s0,s1,s2都要相同的vtp域名(域名相同说明设备处于同一个网络,才能同步)
5)只在s2里设置vlan , s1 s0接口进vlan!
6)4台主机必须在同一网段!!