实验目的
利用三层交换机的SVI(交换机虚拟接口)实现不同VLAN间的通信,并通过telnet对交换机进行管理
实验设备
Cisco Switch 2960 二台
Cisco Switch 3560 一台
PC 两台
均为直连线
实验过程
配置PC的相关参数配置
IP地址 | 子网掩码 | 网关 | |
---|---|---|---|
PC0 | 192.168.20.2 | 255.255.255.0 | 192.168.20.1 |
PC1 | 192.168.30.2 | 255.255.255.0 | 192.168.30.1 |
配置二层交换机
进入全局配置模式
enable
configure terminal (conf t)
(config)
fa 0/1-0/23 加入vlan20(使用range命令批处理改变多个端口的设置)
(config)
vlan 20
exit
interface range fa 0/1-23
switchport access vlan 20
exit
把fa 0/24配置为trunk模式
(config)
interface fa 0/24
switchport mode trunk
exit
设置telnet登录的用户名和密码以及特权密码
(config)
username admin password 123
enable secret qwe
line vty 0 4
login local
exit
为交换机设置管理ip
(config)
interface vlan 1
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
注意:每台交换机的管理ip各不相同,因为每台交换机至少有一个管理员。
为交换机设置默认网关并保存当前设置
ip default-gateway 192.168.1.3 // 设置默认网关
end
write // 保存设置
另一台二层交换机的设置与第一台类似,设置时需要注意:
- 根据预设,第一台二层交换机对应vlan20,另一台二层交换机对应vlan30,设置时需要留意;
- 设置管理ip时需要设置一个新的ip,与前一台二层交换机不同。
配置三层交换机
打开三层交换机的路由模式
(config)
ip routing
创建vlan(vlan20、vlan30)
vlan 20
exit
vlan 30
exit
设置trunk口
// 左侧二层交换机
interface fa 0/1
(config-if)
switchport trunk encapsulation dot1q // 设置封装IEEE802.1Q帧格式
switchport mode trunk // 设置端口的工作模式为trunk
exit
// 右侧二层交换机
interface fa 0/2
(config-if)
switchport trunk encapsulation dot1q // 设置封装IEEE802.1Q帧格式
switchport mode trunk // 设置端口的工作模式为trunk
exit
设置vlan20、vlan30的接口IP(vlan20、vlan30的网关)
// 对应左侧二层交换机的vlan
interface vlan 20
ip address 192.168.20.1 255.255.255.0
no shutdown
exit
// 对应右侧二层交换机的vlan
interface vlan 30
ip address 192.168.30.1 255.255.255.0
no shutdown
exit
设置telnet登录的用户名和密码以及特权密码
username admin password 123
enable secret qwe
line vty 0 4
login local
exit
为交换机设置管理ip并保存
interface vlan 1
ip address 192.168.1.3 255.255.255.0
no shutdown
exit
write // 保存设置
实验分析
实验拓扑图
交换机的网络设置情况
三层交换机
二层交换机
左侧交换机
右侧交换机
各交换机的管理ip设置
交换机名 | 管理ip |
---|---|
Multilayer Switch1(3) | 192.168.1.3 |
switch 0(2L) | 192.168.1.1 |
switch 1(2R) | 192.168.1.2 |
本次实验感想
本次实验与前几次实验类似,都是针对交换机间的数据交换和各交换机的带内管理所进行的设置。在复习前面所学知识的时候,我新学会了一个命令"range",这个命令的效果是如果你需要在交换机的许多个端口上进行相同的操作,不需要一个一个端口的设置,只需要这一个命令就可以了。<br /> 示例代码:
interface range fa 0/1-23
no shutdown