目的:验证不同处于VLAN的主机可以通信
拓扑图:
实验步骤:
1、配置三层交换机switchA
Switch>enable
Switch#config
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet0/3
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastEthernet0/8
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#interface fastEthernet0/24
Switch(config-if)#switchport mode trunk
2、配置三层交换机switchB
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet0/5
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastEthernet0/24
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
3、设置三个主机的IP和子网掩码
pc0可以和pc2联通
pc0不能和pc1联通
pc1不能和pc2联通
4、配置虚拟接口VLAN 10 和VLAN 20 的地址
Switch(config)#interface vlan 10
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#interface vlan 20
state to upSwitch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#exit
5、配置三台主机的网关
完成测试:
pc0可以和pc1互通
pc1可以和pc2互通
即不同vlan也可以互通