综合实验2

发布时间 2024-01-06 17:32:22作者: KE-XI

综合实验2

拓扑

image-20240105185149195

1.实验目的

这次综合实验主要是为了练习冗余备份和负载分担,vrrp和mstp。还有让两边的pc之间能通信

2.实验分析

两个vlan,模拟两个内网比如财务部和纪检部。四台交换机之间配置多生成树。两台核心交换机之间做链路聚合增加数据传输可靠性,并做冗余备份。路由器就作为一个简单的出口路由器

3.具体步骤

第一步配置相关vlan划分区域,IP地址并允许相关vlan通过

LSW1
vlan batch 10 20 2
int e0/0/3
p l a
p d v 10
int e0/0/4
p l a 
p d v 10
int e0/0/1
p l t
port trunk allow-pass vlan 2 10 20
int e0/0/2
p l t
port trunk allow-pass vlan 2 10 20

LSW2
vlan batch 10 20 2
int e0/0/3
p l a
p d v 20
int e0/0/4
p l a 
p d v 20
int e0/0/1
p l t
port trunk allow-pass vlan 2 10 20
int e0/0/2
p l t
port trunk allow-pass vlan 2 10 20

LSW3
vlan batch 10 20 2
int g0/0/4
p l t
p t a v 2 10 20
int g0/0/5
p l t
p t a v 2 10 20
int g0/0/1
p l a
p d v 2
int vlan 10
ip ad 192.168.1.3 24
int vlan 20
ip ad 192.168.2.3 24
int vlan 2
ip ad 192.168.13.1

LSW4
vlan batch 10 20 2
int g0/0/4
p l t
p t a v 2 10 20
int g0/0/5
p l t
p t a v 2 10 20
int g0/0/1
p l a
p d v 2
q
int vlan 10
ip ad 192.168.1.4 24
int vlan 20
ip ad 192.168.2.4 24
int vlan 2
ip ad 192.168.14.1 30

AR1
int g0/0/0
ip ad 192.168.13.2 30
int g0/0/1
ip ad 192.168.14.2 30

第二步在两台核心上面来配置eth-thrunk

LSW3
int Eth-trunk 1
trunkport GigabitEthernet 0/0/2 to 0/0/3
p l t
p t a v 2 10 20
LSW4
int Eth-trunk 1
trunkport GigabitEthernet 0/0/2 to 0/0/3
p l t
p t a v 2 10 20

第三步上层路由打通

LSW3
rip 1
v 2
network 192.168.1.0
network 192.168.2.0
network 192.168.13.0

LSW4
rip 1
v 2
network 192.168.1.0
network 192.168.2.0
network 192.168.14.0

AR1
rip 1
v 2
network 192.168.13.0
network 192.168.14.0

第四步配置冗余备份vrrp

LSW3
int vlan 10
vrrp vrid 10 virtual-ip 192.168.1.254
vrrp vrid 10 priority 120
int vlan 20
vrrp vrid 20 virtual-ip 192.168.2.254

LSW4
int vlan 10
vrrp vrid 10 virtual-ip 192.168.1.254
int vlan 20
vrrp vrid 20 virtual-ip 192.168.2.254
vrrp vrid 20 priority 120

第五步配置mstp

LSW3
dis stp b   //这里看到Eth-trunk 1 也就是两台核心的链路阻塞了
stp mode mstp
stp region-configuration
region-name rg1
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
q
stp instance 10 root primary
stp instance 20 root secondary

LSW4
stp mode mstp
stp region-configuration
region-name rg1
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
q
stp instance 20 root primary
stp instance 10 root secondary

LSW1
stp mode mstp
stp region-configuration
region-name rg1
instance 10 vlan 10
instance 20 vlan 20
active region-configuration

LSW2
stp mode mstp
stp region-configuration
region-name rg1
instance 10 vlan 10
instance 20 vlan 20
active region-configuration

第六步配置dhcp

LSW3
ip pool 10
 gateway-list 192.168.1.254
 network 192.168.1.0 mask 255.255.255.0
q
int vlan 10 
dhcp select global

LSW4
ip pool 20
 gateway-list 192.168.2.254
 network 192.168.2.0 mask 255.255.255.0
q
int vlan 20 
dhcp select global

4.遇到的问题

两台核心和出口路由器做了rip,但是两台核心学习不到,vrrp两台都是master。

解决方法:在LSW3上dis stp b 找到原因,ethtrunk口被阻塞了,配置mstp就解决了,详情请看上面第五步

5.优化

1、rip改用成ospf

LSW3
ospf 1 router-id 3.3.3.3
a 0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.13.0 0.0.0.255
LSW4
ospf 1 router-id 4.4.4.4
a 0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.13.0 0.0.0.255
AR1
ospf 1 router-id 1.1.1.1
network 192.168.13.0 0.0.0.255
network 192.168.14.0 0.0.0.255

2、链路聚合改成自动lacp

int Eth-trunk 1
mode lacp
max active-linknumber 要设置活动的数量
trunkport 加入的端口
q
lacp priority 30000  //设置优先级,越小越优先
dis eth-trunk 1 //查看trunk链路状态
两边都要配置,主导的把优先级加大就行,小的那个不用

3、两台核心都做dhcp服务器,防止一边出问题。然后地址池各给一半就行了

LSW3
excluded-id-address 192.168.1.177 192.168.1.255
LSW4
excluded-id-address 192.168.1.1 192.168.1.176

6.总结

​ 这次主要是心跳线出了问题卡了很久一直找不到原因。后面根据rip学习路由的情况,发现两边缺了两个路由,都是去往上行方向的路由。由此想到应该是两台核心之间的线出了问题,又去查找rip和vrrp的相关资料,最后才找到是生成树的问题。希望在以后的实验也会出现相关的问题,这样才能多解决一些问题,锻炼思维和检索的能力。