华为eNSP配置专题-VRRP的配置

文章目录

华为eNSP配置专题-VRRP的配置

0、参考文档

1、前置环境

1.1、宿主机

笔记本电脑,配置如下:Windows10企业版,32GB内存

1.2、eNSP模拟器

eNSP1.3.00

2、基本环境搭建

2.1、基本终端构成和连接

0、总体拓扑如下:

1、1台PC。

2、3台交换机,型号为S5700。其中1台作为接入交换机。另外2台作为核心交换机,配置VRRP。

3、2台路由器,型号为AR2220。其中一台为作为内网的出口路由器,另外一台路由器模拟互联网

4、开启设备。

2.VRRP的配置

2.1、PC1的配置

1、PC1配置静态IP和网关如下:

IP:192.168.10.1

掩码:255.255.255.0

网关:192.168.10.254

2.2、接入交换机acsw的配置

1、右击接入交换机acsw-》点击"CLI",进入系统模式,改名为acsw,同时也关闭信息中心的通知消息。

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname acsw
[acsw]undo info-center enable
Info: Information center is disabled.

2、创建vlan 10:

[acsw]vlan 10
[acsw-vlan10]quit

3、配置三个接口,1个access口,2个trunk口:

[acsw]interface GigabitEthernet 0/0/3
[acsw-GigabitEthernet0/0/3]port link-type access
[acsw-GigabitEthernet0/0/3]port default vlan 10
[acsw-GigabitEthernet0/0/3]quit
[acsw]interface GigabitEthernet 0/0/1  
[acsw-GigabitEthernet0/0/1]port link-type trunk  
[acsw-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[acsw-GigabitEthernet0/0/1]quit
[acsw]interface GigabitEthernet 0/0/2
[acsw-GigabitEthernet0/0/2]port link-type trunk
[acsw-GigabitEthernet0/0/2]port trunk allow-pass vlan all

2.3、核心交换机coresw1的配置

1、右击接入交换机acsw-》点击"CLI",进入系统模式,改名,同时也关闭信息中心的通知消息。

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname coresw1
[coresw1]undo info-center enable
Info: Information center is disabled.

2、生成两个vlan,vlan10用于下联,vlan100用于上联:

[coresw1]vlan 10
[coresw1-vlan10]vlan 100

3、给三个接口配置,两个trunk口,一个access口用于上联

[coresw1]interface GigabitEthernet 0/0/1
[coresw1-GigabitEthernet0/0/1]port link-type trunk
[coresw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[coresw1-GigabitEthernet0/0/1]quit
[coresw1]interface GigabitEthernet 0/0/3
[coresw1-GigabitEthernet0/0/3]port link-type trunk
[coresw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[coresw1-GigabitEthernet0/0/3]quit
[coresw1]interface GigabitEthernet 0/0/2
[coresw1-GigabitEthernet0/0/2]port link-type access
[coresw1-GigabitEthernet0/0/2]port default vlan 100
[coresw1-GigabitEthernet0/0/2]quit

4、配置三层接口。

[coresw1]interface vlanif 10
[coresw1-Vlanif10]ip add 192.168.10.252 24
[coresw1-Vlanif10]quit
[coresw1]interface vlanif 100
[coresw1-Vlanif100]ip add 192.168.100.1 30
[coresw1-Vlanif100]quit

2.4、核心交换机coresw2的配置

1、右击接入交换机acsw-》点击"CLI",进入系统模式,改名,同时也关闭信息中心的通知消息。

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname coresw2

2、生成两个vlan,vlan10用于下联,vlan200用于上联:

[coresw2]vlan 10
[coresw2-vlan10]vlan 200

3、给三个接口配置,两个trunk口,一个access口用于上联

[coresw2-vlan200]interface GigabitEthernet 0/0/1
[coresw2-GigabitEthernet0/0/1]port link-type trunk
[coresw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[coresw2-GigabitEthernet0/0/1]quit
[coresw2]interface GigabitEthernet 0/0/3
[coresw2-GigabitEthernet0/0/3]port link-type trunk
[coresw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[coresw2-GigabitEthernet0/0/3]quit
[coresw2]interface GigabitEthernet 0/0/2
[coresw2-GigabitEthernet0/0/2]port link-type access
[coresw2-GigabitEthernet0/0/2]port default vlan 200
[coresw2-GigabitEthernet0/0/2]quit

4、配置三层接口。

[coresw2]interface vlanif 10
[coresw2-Vlanif10]ip add 192.168.10.253 24
[coresw2-Vlanif10]quit
[coresw2]interface vlanif 200
[coresw2-Vlanif200]ip add 192.168.200.1 30
[coresw2-Vlanif200]quit

5、到PC1上ping两个核心交换机,发现可以通了:

2.5、配置VRRP

1、在coresw1上作如下配置,设置虚拟IP为192.168.10.254,优先级为120(默认优先级为100,因此本交换机为主节点)。设置为抢占模式,抢占延时为20秒。

[coresw1]interface vlanif10
[coresw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[coresw1-Vlanif10]vrrp vrid 10 priority 120
[coresw1-Vlanif10]vrrp vrid 10 preempt-mode timer delay 20
[coresw1-Vlanif10]display this
#
interface Vlanif10
 ip address 192.168.10.252 255.255.255.0
 vrrp vrid 10 virtual-ip 192.168.10.254
 vrrp vrid 10 priority 120
 vrrp vrid 10 preempt-mode timer delay 20
#
return

2、在coresw2上作类似配置,但不设置优先级,默认为100。

[coresw2]interface vlanif 10
[coresw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[coresw2-Vlanif10]quit

3、在coresw1上通过display vrrp查看配置情况,可以看到coresw1的状态为Master:

4、在PC1上ping 192.168.10.254,发现可以通了,也就意味着VRRP配置成功

2.6、配置出口路由器AR1

1、右击AR1-》点击"CLI",进入系统模式,改名,同时也关闭信息中心的通知消息。

<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR1

2、配置三个接口的地址:

[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 100.1.1.2 30
[AR1-GigabitEthernet0/0/0]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 192.168.100.2 24
[AR1-GigabitEthernet0/0/1]int g0/0/2
[AR1-GigabitEthernet0/0/2]ip add 192.168.200.2 24

2.7、配置模拟互联网路由器AR1

1、右击AR2-》点击"CLI",进入系统模式,改名,同时也关闭信息中心的通知消息。

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR2

2、配置三个接口的地址:

[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 100.1.1.1 30

2.8、配置PC1可以访问模拟互联网路由器

1、在PC1上ping AR2,发现ping不通,因为PC1会把包交给默认网关coresw1,但默认网关也就是核心路由器上并没有10网段的路由,如下所示:

2、在核心交换机1上配置默认路由指向出口路由器:

[coresw1]ip route-static 0.0.0.0 0 192.168.100.2

3、在核心交换机2上配置默认路由指向出口路由器:

[coresw2]ip route-static 0.0.0.0 0 192.168.200.2

4、这时发现仍然ping不通,但是在AR2上抓包已经可以看到ICMP包,主要是AR2上没有回程的路由。

5、在AR2上配置静态路由。

[AR2]ip route-static 192.168.10.0 255.255.255.0 100.1.1.2

6、这时发现仍然ping不通,发现ICMP有回包了,主要原因是AR1上也没有回程的路由。做如下配置即可:

[AR1]ip route-static 192.168.10.0 24 192.168.100.1
[AR1]ip route-static 192.168.10.0 24 192.168.200.1

7、这时发现PC1可以ping通模拟互联网路由器了。

3、其他场景

3.1、VRRP优先级调整

1、在PC1上tracert,可以发现是从左边的coresw1走的。

2、降低coresw1的VRRP的优先级:

[coresw1]interface vlanif 10
[coresw1-Vlanif10]vrrp vrid 10 priority 90

3、此时再在PC1上tracert,可以发现是从右边的coresw2走的。

4、在coresw1查看VRRP状态,发现已经变成了BACKUP:

3.2、接口跟踪

1、在coresw1恢复已有的优先级为120,再跟踪接口g0/0/2(即接到出口网关的接口)

[coresw1]int Vlanif 10
[coresw1-Vlanif10]vrrp vrid 10 priority 120
[coresw1-Vlanif10]vrrp vrid 10 track interface g0/0/2 reduce 30

2、在PC1进行tracert查看,发觉流量走的coresw1:

3、在coresw1关闭它的g/0/0/2接口:

[coresw1]int g0/0/2
[coresw1-GigabitEthernet0/0/2]shutdown

4、在PC1进行tracert查看,发觉流量已经改走coresw2:

6、在coresw1查看VRRP状态,发现已经变成了BACKUP:

相关推荐
聪明的小脑袋瓜儿几秒前
网络安全设备——防火墙
网络·web安全·网络安全·防火墙
kinlon.liu26 分钟前
基于 Nginx + Spring Boot + Vue + JPA 的网站安全防护指南
网络·vue.js·spring boot·nginx·安全
semicolon_hello27 分钟前
使用C++编写TCP服务端程序
服务器·网络·c++·tcp/ip
灵韵设计1 小时前
学习笔记——动态路由——OSPF(认证)
网络·智能路由器·ospf邻居认证·接口认证·区域认证
斐夷所非1 小时前
静态路由配置注意事项及黑洞路由的使用
网络
炙热的大叔1 小时前
JavaEE初阶-网络编程
网络·java-ee
量化交易学徒2 小时前
403 Forbidden:深入解析 HTTP 禁止访问错误及排查方法
网络·网络协议·http
苦藤新鸡2 小时前
用网络编程完成windows和linux跨平台之间的通信(服务器)
linux·网络·windows
huaqianzkh3 小时前
传统数据处理系统存在的问题
网络·数据库·系统架构
pixle03 小时前
HarmonyOS Next系列之Echarts图表组件(折线图、柱状图、饼图等)实现(八)
华为·echarts·harmonyos