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的三层交换机

dis cu                                //查看配置
#
sysname SW1
#
vlan batch 10 20 100
#
interface Vlanif10
 ip address 192.168.10.10 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.10.1                    //创建虚拟IP
 vrrp vrid 1 priority 120                               //设定优先级为120
 vrrp vrid 1 track interface GigabitEthernet0/0/1
 vrrp vrid 1 track interface GigabitEthernet0/0/2       //监听自身的两个接口状态
#
interface Vlanif20
 ip address 192.168.20.10 255.255.255.0
 vrrp vrid 2 virtual-ip 192.168.20.1
 vrrp vrid 2 priority 115
#
interface Vlanif100
 ip address 11.0.0.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
ip route-static 0.0.0.0 0.0.0.0 11.0.0.1

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

dis cu
#
sysname SW2
#
vlan batch 10 20 100
#
interface Vlanif10
 ip address 192.168.10.20 255.255.255.0
 vrrp vrid 1 virtual-ip 192.168.10.1
 vrrp vrid 1 priority 115
#
interface Vlanif20
 ip address 192.168.20.20 255.255.255.0
 vrrp vrid 2 virtual-ip 192.168.20.1
 vrrp vrid 2 priority 120
 vrrp vrid 2 track interface GigabitEthernet0/0/1
 vrrp vrid 2 track interface GigabitEthernet0/0/2
#
interface Vlanif100
 ip address 12.0.0.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 100
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

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

dis cu
#
sysname R1
#
interface GigabitEthernet0/0/0
 ip address 11.0.0.1 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 12.0.0.1 255.255.255.252
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.0
#
ip route-static 192.168.10.0 255.255.255.0 11.0.0.2
ip route-static 192.168.10.0 255.255.255.0 12.0.0.2 preference 70
ip route-static 192.168.20.0 255.255.255.0 12.0.0.2
ip route-static 192.168.20.0 255.255.255.0 11.0.0.2 preference 70

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

dis cu
#
sysname SW3
#
vlan batch 10 20
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 10 20

第五步:测试网络互通性

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张图片

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