华为网络——浮动路由与VRRP原理

内容要点

1、浮动路由
2、VRRP

注意事项

1、浮动路由默认是优先级是60,越小越优先,如果是第二条路由
优先级是比默认的要大,一般配置60以上

2、VRRP :(公有协议)
在多个路由器之间运行,
可以虚拟出一个或者多个网关IP地址(虚拟路由器);
从而实现内网不同网段之间的互通;

3、VRRP的工作过程:
●运行VRRP的“多个”路由器之间通过 VRRP 报文的交互,从而选择
出一个最牛的路由器,作为 Master 路由器 ,以后就用来这个设备来转发数据包;
●Master 路由器,仅仅只有一个;其他的路由器称之为 backup 路由器;
●同时,Master 和 Backup 路由器,会产生一个虚拟的路由器,也就是一个

主:配虚拟IP地址、优先级(默认100、链路down减10)一般120、监听上层口和下层口
备:配虚拟IP地址、优先级(默认100、链路down减10)一般115、不需要监听上层口和下层口

拓扑结构

华为网络——浮动路由与VRRP原理_第1张图片

配置步骤

第一步:配置设备名为LSW1的三层交换机

<SW1>sys
[Huawei]sysname SW1
[SW1]vlan batch 10 20 100
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type trunk 
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all 
[SW1-GigabitEthernet0/0/2]un sh
[SW1-GigabitEthernet0/0/2]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access
[SW1-GigabitEthernet0/0/1]port default vlan 100
[SW1-GigabitEthernet0/0/1]un sh
[SW1-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 100
#


[SW1]int vlanif10
[SW1-Vlanif10]ip add 192.168.10.10 24	
[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
##创建虚拟IP
[SW1-Vlanif10]vrrp vrid 1 priority 120
##设定优先级为120
[SW1-Vlanif10]vrrp vrid 1 track interface g0/0/1
[SW1-Vlanif10]vrrp vrid 1 track interface g0/0/2
##监听自身的两个接口状态
[SW1-Vlanif10]dis this
#
interface Vlanif10
 ip address 192.168.10.10 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.10.1
 vrrp vrid 1 priority 120
 vrrp vrid 1 track interface GigabitEthernet0/0/1
 vrrp vrid 1 track interface GigabitEthernet0/0/2
#


[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip add 192.168.20.10 24
[SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[SW1-Vlanif20]vrrp vrid 2 priority 115
##配置优先级为115
[SW1]int vlanif 100
[SW1-Vlanif100]ip add 11.0.0.2 30
[SW1-Vlanif100]q
[SW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1
##配置默认路由

第二步:配置设备名为LSW2的三层交换机

<Huawei>sys
[Huawei]sysname SW2	
[SW2]vlan batch 10 20 100
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]port link-type trunk
[SW2-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/2]un sh
[SW2-GigabitEthernet0/0/2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type access
[SW2-GigabitEthernet0/0/1]port default vlan 100
[SW2-GigabitEthernet0/0/1]un sh
[SW2-GigabitEthernet0/0/1]int vlanif 10
[SW2-Vlanif10]ip add 192.168.10.20 24
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[SW2-Vlanif10]vrrp vrid 1 priority 115
[SW2-Vlanif10]int vlanif 20
[SW2-Vlanif20]ip add 192.168.20.20 24
[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[SW2-Vlanif20]vrrp vrid 2 priority 120
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/1
[SW2-Vlanif20]vrrp vrid 2 track interface g0/0/2
[SW2]int vlanif 100
[SW2-Vlanif100]ip add 12.0.0.2 30
[SW2-Vlanif100]q	
[SW2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

第三步:配置设备名R1的路由器

<Huawei>sys
[Huawei]sysname R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.1 30
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.0.0.1 30
[R1-GigabitEthernet0/0/1]un sh 
[R1-GigabitEthernet0/0/0]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]q
[R1]ip route-static 192.168.10.0 24 11.0.0.2
[R1]ip route-static 192.168.10.0 24 12.0.0.2 preference 70
[R1]ip route-static 192.168.20.0 24 12.0.0.2 
[R1]ip route-static 192.168.20.0 24 11.0.0.2 preference 70

第四步:配置设备名LSW3的二层交换机

<Huawei>sys
[Huawei]sysname sw3
[SW3]vlan batch 10 20 
[SW3]int e0/0/1
[SW3-Ethernet0/0/1]port link-type access 
[SW3-Ethernet0/0/1]port default vlan 10
[SW3-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[SW3-Ethernet0/0/1]int e0/0/2
[SW3-Ethernet0/0/2]port link-type access 	
[SW3-Ethernet0/0/2]port default vlan 20
[SW3-Ethernet0/0/2]un sh
Info: Interface Ethernet0/0/2 is not shutdown.
[SW3-Ethernet0/0/2]int g0/0/1
[SW3-GigabitEthernet0/0/1]port link-type trunk 	
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all 
[SW3-GigabitEthernet0/0/1]un sh
[SW3-GigabitEthernet0/0/1]int g0/0/2
[SW3-GigabitEthernet0/0/2]port link-type trunk 
[SW3-GigabitEthernet0/0/2]port trunk allow-pass vlan all 
[SW3-GigabitEthernet0/0/2]un sh	

第五步:测试网络互通性

PC1>ping 1.1.1.1 

Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=254 time=93 ms
From 1.1.1.1: bytes=32 seq=2 ttl=254 time=47 ms
From 1.1.1.1: bytes=32 seq=3 ttl=254 time=47 ms
From 1.1.1.1: bytes=32 seq=4 ttl=254 time=62 ms
From 1.1.1.1: bytes=32 seq=5 ttl=254 time=63 ms

--- 1.1.1.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/62/93 ms

PC2>ping 1.1.1.1

Ping 1.1.1.1: 32 data bytes, Press Ctrl_C to break
From 1.1.1.1: bytes=32 seq=1 ttl=254 time=109 ms
From 1.1.1.1: bytes=32 seq=2 ttl=254 time=63 ms
From 1.1.1.1: bytes=32 seq=3 ttl=254 time=62 ms
From 1.1.1.1: bytes=32 seq=4 ttl=254 time=63 ms
From 1.1.1.1: bytes=32 seq=5 ttl=254 time=47 ms

--- 1.1.1.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/68/109 ms

第六步:模拟线网主链路故障,另一条链路替代运行

[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]shutdown

华为网络——浮动路由与VRRP原理_第2张图片

你可能感兴趣的:(华为网络)