目录
(文末有实验所需要的文件包和空白文件,需要自取)
1.1交换机的端口分类
交换机(二层交换机和三层交换机)的端口可以分为以下两类:
(1)二层交换机所有端口都是二层端口,即不支持转发
(2)三层交换机所有端口可通过设置可以成为三层端口,没有设置时默认为二层端口
在二层交换机上只有二层端口,而三层交换机上既可以有二层端口也可以有三层端口
1.2连接拓扑图
1.3配置步骤
(1)配置4台主机的IP地址和网关如下:
PC0:192.168.10.1 网关:192.168.10.254
PC1:192.168.10.2 网关:192.168.10.254
PC2:192.168.20.1 网关:192.168.20.254
PC3:192.168.20.2 网关:192.168.20.254
(2)配置三层交换机:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip routing
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#int f0/2
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#int f0/3
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#int f0/4
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
ip address 192.168.10.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
ip address 192.168.20.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#
1.4测试结果
在主机PC0上ping 192.168.10.1、192.168.10.2、192.168.20.1、192.168.20.2,若都能ping通说明三层交换机上不同VLAN之间能够互通。结果如下图所示:
文件包下载链接:https://download.youkuaiyun.com/download/lg120/87785343 (解压密码请私信我获取)