个人专栏:华为ensp
🚀欢迎关注:👍点赞⬆️留言收藏
理论知识:Cisco
目录
VLAN(Virtual Local Area Network)
VRRP(Virtual Router Redundancy Protocol)
前言
VLAN(Virtual Local Area Network)
- 定义:VLAN是一种在物理网络上逻辑划分的技术,允许将一个物理交换机分割成多个虚拟交换机。
- 目的:提高网络性能,隔离广播域,增强安全性,简化网络管理。
链路聚合(Link Aggregation)
- 定义:链路聚合是将多个物理链路组合成一个逻辑链路,以提供更高的带宽和冗余性。
- 实现标准:通常使用IEEE 802.3ad(LACP - Link Aggregation Control Protocol)或静态配置。
- 目的:增加网络带宽,提高链路可靠性。
STP(Spanning Tree Protocol)
- 定义:STP是一种网络协议,用于在物理上存在环路的网络环境中提供冗余路径,同时防止报文环路。
- 角色:根交换机(Root Bridge)、指定交换机(Designated Bridge)、非指定交换机(Non-Designated Bridge)。
- 目的:确保网络中无环路,防止广播风暴。
PortFast (快速生成树)
- 定义:PortFast是STP的一个特性,允许交换机的端口跳过正常的生成树转发延迟,直接进入转发状态。
- 目的:加快终端设备接入网络的速度。
VRRP(Virtual Router Redundancy Protocol)
- 定义:VRRP是一种网络协议,用于在多个路由器之间提供默认网关冗余。
- 角色:主网关(Master Router)、备份网关(Backup Router)。
- 目的:提高网络的可靠性,确保在主网关故障时能够快速切换到备份网关。
- 虚拟IP地址:每个VLAN都有一个虚拟IP地址,作为该VLAN的默认网关。
- 优先级:VRRP路由器根据优先级来选举主网关,优先级高的成为主网关。
- 抢占模式:允许备份网关在优先级高于当前主网关时抢占成为新的主网关。
上行链路跟踪(Uplink Tracking)
- 定义:上行链路跟踪是一种机制,用于监控上行链路的健康状况,并在链路故障时触发VRRP优先级的改变。
- 目的:确保在主上行链路故障时,能够自动将流量切换到备份链路,并相应地调整VRRP角色。
理论知识归纳
- 网络冗余:通过STP和VRRP实现网络路径和网关的冗余,确保网络的高可用性。
- 故障转移:VRRP提供快速的网关故障转移,上行链路跟踪确保链路故障时能够快速响应。
- 带宽管理:链路聚合通过聚合多个物理链路来增加带宽,提高网络性能。
- 网络管理:VLAN和PortFast简化了网络配置和管理,提高了网络的可管理性。
一、任务
本拓扑中有四个VLAN:VLAN10、VLAN20、VLAN30、VLAN40。
SWA与SWB之间启用链路聚合,将双链路所在端口加入channel-group 1。
SWA为根交换机,SWB为备份根交换机,交换机上所有PC端口配置为portfast端口。
SWA为VLAN10、VLAN20的主网关、VLAN30、VLAN40的备份网关,SWB为VLAN30、VLAN40的主网关、VLAN10、VLAN20的备份网关。VLAN10、VLAN20、VLAN30、VLAN40的虚拟网关地址分别为192.168.10.254、192.168.20.254、192.168.30.254、192.168.40.254。VLAN10和VLAN20的主网关配置上行链路跟踪。
实现VRRP主备网关切换。
实施步骤概述
- 配置VLAN:在SWA和SWB上创建并配置VLAN10、VLAN20、VLAN30和VLAN40。
- 配置链路聚合:在SWA和SWB之间配置链路聚合,创建channel-group 1。
- 配置STP:设置SWA为根交换机,SWB为备份根交换机。
- 配置PortFast:将所有PC端口配置为PortFast端口。
- 配置VRRP:在SWA和SWB上为每个VLAN配置VRRP,设置主备网关。
- 配置上行链路跟踪:为VLAN10和VLAN20的主网关配置上行链路跟踪。
二、拓扑图
三、代码
AR1
[AR1]int GigabitEthernet0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.10.1 30
[AR1]ospf 1
[AR1-ospf-1]area 0.0.0.0
[AR1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.3
AR2
[AR2]int GigabitEthernet0/0/0
[AR2-GigabitEthernet0/0/0]ip address 192.168.10.5 30
[AR2]ospf 1
[AR2-ospf-1]area 0.0.0.0
[AR2-ospf-1-area-0.0.0.0]network 192.168.10.4 0.0.0.3
SWA
[SWA]interface Vlan-interface10
[SWA-Vlanif10]ip add 192.168.10.1 255.255.255.0
[SWA-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[SWA-Vlanif10]vrrp vrid 10 priority 120
[SWA-Vlanif10]vrrp vrid 10 preempt-mode timer delay 30
[SWA]interface Vlan-interface20
[SWA-Vlanif20]ip add 192.168.20.1 255.255.255.0
[SWA-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[SWA-Vlanif20]vrrp vrid 20 priority 120
[SWA-Vlanif20]vrrp vrid 20 preempt-mode timer delay 30
[SWA]interface Vlan-interface30
[SWA-Vlanif30]ip add 192.168.30.1 255.255.255.0
[SWA-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[SWA-Vlanif30]vrrp vrid 30 preempt-mode timer delay 30
[SWA]interface Vlan-interface40
[SWA-Vlanif40]ip add 192.168.40.1 255.255.255.0
[SWA-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[SWA-Vlanif40]vrrp vrid 40 preempt-mode timer delay 30
[SWA]stp mode mstp //STP模式设置为MSTP(多生成树协议)
[SWA]stp region-configuration //开始配置MSTP的区域设置
[SWA-mst-region]region-name hc //MSTP区域设置一个名称,这里设置为"hc"
[SWA-mst-region]revision-level 1 //设置MSTP区域的修订级别为1
[SWA-mst-region]instance 1 vlan 10 20 //将VLAN 10和VLAN 20映射到MSTP实例1
[SWA-mst-region]instance 2 vlan 30 40 //VLAN 30和VLAN 40映射到MSTP实例2
[SWA-mst-region]active region-configuration //激活当前配置的MSTP区域设置
[SWA]stp instance 1 root primary //设置为MSTP实例1的根交换机
[SWA]stp instance 2 root secondary //设置为MSTP实例2的备份根交换机
[SWA]interface GigabitEthernet0/0/1
[SWA-GigabitEthernet0/0/1]ip address 192.168.10.2 30
[SWA-GigabitEthernet0/0/1]ospf enable 1 //启用OSPF(开放最短路径优先)协议,进程为1
[SWA-GigabitEthernet0/0/1]ospf timer hello 10 //设置了OSPF的Hello定时器为10秒
[SWA-GigabitEthernet0/0/1]ospf cost 10 //设置了该接口的OSPF开销值为10,开销值越低,路径越优先
[SWA-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher huawei123 //OSPF协议配置了MD5加密认证。1是认证区域ID,cipher huawei123是用于加密认证的密码
[SWA]ospf 1
[SWA-ospf-1]area 0.0.0.0
[SWA-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.3
[SWA-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[SWA-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[SWA-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[SWA-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[SWA]int GigabitEthernet0/0/4
[SWA-GigabitEthernet0/0/4]port link-type trunk
[SWA-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SWA-GigabitEthernet0/0/4]q
[SWA]int Eth-Trunk 1
[SWA-Eth-Trunk1]port link-type trunk
[SWA-Eth-Trunk1]port trunk allow-pass vlan all
[SWA-Eth-Trunk1]bpdu enable
[SWA-Eth-Trunk1]mode lacp-static
[SWA-Eth-Trunk1]q
[SWA]int g0/0/2
[SWA-GigabitEthernet0/0/2]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA-GigabitEthernet0/0/2]q
[SWA]int g0/0/3
[SWA-GigabitEthernet0/0/3]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA-GigabitEthernet0/0/3]q
SWB
[SWB]interface Vlan-interface10
[SWB-Vlanif10]ip add 192.168.10.2 255.255.255.0
[SWB-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[SWB-Vlanif10]vrrp vrid 10 preempt-mode timer delay 30
[SWB]interface Vlan-interface20
[SWB-Vlanif20]ip add 192.168.20.2 255.255.255.0
[SWB-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[SWB-Vlanif20]vrrp vrid 20 preempt-mode timer delay 30
[SWB]interface Vlan-interface30
[SWB-Vlanif30]ip add 192.168.30.2 255.255.255.0
[SWB-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[SWB-Vlanif30]vrrp vrid 30 priority 120
[SWB-Vlanif30]vrrp vrid 30 preempt-mode timer delay 30
[SWB]interface Vlan-interface40
[SWB-Vlanif40]ip add 192.168.40.2 255.255.255.0
[SWB-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[SWB-Vlanif40]vrrp vrid 40 priority 120
[SWB-Vlanif40]vrrp vrid 40 preempt-mode timer delay 30
stp mode mstp
stp region-configuration
region-name hc
revision-level 1
instance 1 vlan 10 20
instance 2 vlan 30 40
active region-configuration
stp instance 2 root primary
stp instance 1 root secondary
[SWB]interface GigabitEthernet0/0/1
[SWB-GigabitEthernet0/0/1]ip address 192.168.10.6 30
[SWB-GigabitEthernet0/0/1]ospf enable 1
[SWB-GigabitEthernet0/0/1]ospf timer hello 10
[SWB-GigabitEthernet0/0/1]ospf cost 10
[SWB-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher huawei123
[SWB]ospf 1
[SWB-ospf-1]area 0.0.0.0
[SWB-ospf-1-area-0.0.0.0]network 192.168.1.4 0.0.0.3
[SWB-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[SWB-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[SWB-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[SWB-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[SWB]int GigabitEthernet0/0/4
[SWB-GigabitEthernet0/0/4]port link-type trunk
[SWB-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[SWB-GigabitEthernet0/0/4]q
[SWB]int Eth-Trunk 1
[SWB-Eth-Trunk1]port link-type trunk
[SWB-Eth-Trunk1]port trunk allow-pass vlan all
[SWB-Eth-Trunk1]bpdu enable
[SWB-Eth-Trunk1]mode lacp-static
[SWB-Eth-Trunk1]q
[SWB]int g0/0/2
[SWB-GigabitEthernet0/0/2]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWB-GigabitEthernet0/0/2]q
[SWB]int g0/0/3
[SWB-GigabitEthernet0/0/3]eth-trunk 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWB-GigabitEthernet0/0/3]q
SWC
[SWC]vlan batch 10 20 30 40
[SWC]interface Ethernet0/0/3
[SWC-Ethernet0/0/3]port access vlan 10
[SWC]interface Ethernet0/0/4
[SWC-Ethernet0/0/4]port access vlan 20
[SWC]interface Ethernet0/0/1
[SWC-Ethernet0/0/1]port link-type trunk
[SWC-Ethernet0/0/1]port trunk allow-pass vlan all
[SWC]interface Ethernet0/0/2
[SWC-Ethernet0/0/2]port link-type trunk
[SWC-Ethernet0/0/2]port trunk allow-pass vlan all
SWD
[SWD]vlan batch 10 20 30 40
[SWD]interface Ethernet0/0/3
[SWD-Ethernet0/0/3]port access vlan 30
[SWD]interface Ethernet0/0/4
[SWD-Ethernet0/0/4]port access vlan 40
[SWD]interface Ethernet0/0/1
[SWD-Ethernet0/0/1]port link-type trunk
[SWD-Ethernet0/0/1]port trunk allow-pass vlan all
[SWD]interface Ethernet0/0/2
[SWD-Ethernet0/0/2]port link-type trunk
[SWD-Ethernet0/0/2]port trunk allow-pass vlan all
四、OSPF基本概念
- 路由协议:OSPF是一种内部网关协议(IGP),用于在单个自治系统(AS)内部交换路由信息。
- 链路状态:OSPF路由器通过交换链路状态信息来构建网络的完整拓扑图,然后使用迪杰斯特拉算法计算到达每个网络的最短路径。
这里配置提到了OSPF(最短路径优先协议) ,下一章会给大家讲解OSPF,这里先做一个铺垫。
五、总结
这篇文章主要介绍了华为ENSP(Enterprise Network Simulation Platform)中VRRP(Virtual Router Redundancy Protocol,虚拟路由器冗余协议)和上行链路跟踪的配置和管理。文章首先介绍了相关的网络理论知识,包括VLAN、链路聚合、STP(Spanning Tree Protocol,生成树协议)、PortFast和VRRP等。
文章的实施步骤概述部分,详细说明了如何在华为交换机上配置VLAN、链路聚合、STP、PortFast、VRRP和上行链路跟踪。通过具体的配置命令和步骤,展示了如何实现VRRP主备网关的切换和链路故障时的快速响应。
文章还提供了详细的配置代码,包括AR1、AR2、SWA、SWB、SWC和SWD的配置示例。这些代码展示了如何在华为交换机上设置VLAN、链路聚合组、VRRP虚拟路由器、STP区域配置等。
此外,文章还简要介绍了OSPF(Open Shortest Path First,开放最短路径优先)的基本概念,包括其作为内部网关协议的作用,以及如何通过交换链路状态信息来构建网络的完整拓扑图。
总体而言,这篇文章为读者提供了在华为ENSP平台上配置VRRP和上行链路跟踪的详细指导,对于学习和实践网络管理技术非常有帮助。