华为热备份路由协议 vrrp 双主双备


拓扑图:


华为热备份路由协议 vrrp 双主双备_第1张图片


实验要求

 

PC1属于vlan10  PC2属于vlan20 pc1流量通过r1pc2 流量通过SW2走,当主路由器挂了,流量可以自动切换通过备路由器通信

 

配置文件

 

[r2]int g0/0/0

[r2-GigabitEthernet0/0/0]ip add 12.0.0.2 24

 

[r2-GigabitEthernet0/0/0]int g0/0/1

[r2-GigabitEthernet0/0/1]ip add 22.0.0.2 24

 

[r2-GigabitEthernet0/0/1]int loo 0

[r2]rip

[r2-rip-1]version 2

[r2-rip-1]undo summary

[r2-rip-1]network 12.0.0.0

[r2-rip-1]network 22.0.0.0

[r2-rip-1]network 1.0.0.0

 

 

[sw1]vlan bat 10 20

[sw1]int e0/0/1

[sw1-Ethernet0/0/1]port link-type access

[sw1-Ethernet0/0/1]port default vlan 10

 

[sw1-Ethernet0/0/1]int e0/0/2

[sw1-Ethernet0/0/2]port hybrid untagged vlan 20

 

[sw1-GigabitEthernet0/0/1]int g0/0/2

[sw1-GigabitEthernet0/0/2]port hybrid tagged vlan 10 20

 

 

 

[r1]

[r1]int g0/0/1

[r1]rip

[r1-rip-1]version 2

[r1-rip-1]undo summary

[r1-rip-1]network 12.0.0.0

[r1-rip-1]network 192.168.10.0

[r1-rip-1]network 192.168.20.0

 

[r1]int g0/0/0.10

[r1-GigabitEthernet0/0/0.10]dot1q termination vid 10

[r1-GigabitEthernet0/0/0.10]arp broadcast enable

[r1-GigabitEthernet0/0/0.10]ip add 192.168.10.10 24

[r1-GigabitEthernet0/0/0.10]vrrp vrid 1 virtual-ip 192.168.10.1虚拟网关

[r1-GigabitEthernet0/0/0.10]vrrp vrid 1 preempt-mode timer delay 0

[r1-GigabitEthernet0/0/0.10]vrrp vrid 1  track interface g0/0/1  跟踪上行口   

默认的优先级是100 不用配置

 

[r1]dis vrrp brief

Total:1     Master:1     Backup:0     Non-active:0      

VRID  State        Interface                Type     Virtual IP     

----------------------------------------------------------------

1     Master       GE0/0/0.10               Normal   192.168.10.1   

 

[r1]int g0/0/0.20

[r1-GigabitEthernet0/0/0.20]dot1q termination vid 20

[r1-GigabitEthernet0/0/0.20]arp broadcast  enable

[r1-GigabitEthernet0/0/0.20]ip add 192.168.20.20 24

[r1-GigabitEthernet0/0/0.20]vrrp vrid 2 virtual-ip 192.168.20.1

[r1-GigabitEthernet0/0/0.20]vrrp vrid 2 priority 95  

[r1]dis vrrp brief

Total:2     Master:1     Backup:1     Non-active:0      

VRID  State        Interface                Type     Virtual IP     

----------------------------------------------------------------

1     Master       GE0/0/0.10               Normal   192.168.10.1   

2     Backup       GE0/0/0.20               Normal   192.168.20.1   

 

 

 

[sw2]vlan bat 10 20 100

[sw2]int g0/0/2

[sw2-GigabitEthernet0/0/2]port link-type access

[sw2-GigabitEthernet0/0/2]port default vlan 100

[sw2-GigabitEthernet0/0/2]int vlan 100

[sw2-Vlanif100]ip add 22.0.0.1 24

[sw2]rip

[sw2-rip-1]version 2

[sw2-rip-1]undo summary

[sw2-rip-1]network 22.0.0.0

[sw2-rip-1]network 192.168.10.0

[sw2-rip-1]network 192.168.20.0

 

[sw2]int g0/0/1

[sw2-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20

 

[sw2]int vlan 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 95

 

VRID  State        Interface                Type     Virtual IP     

----------------------------------------------------------------

1     Backup       Vlanif10                 Normal   192.168.10.1   

----------------------------------------------------------------

Total:1     Master:0     Backup:1     Non-active:0  

 

[sw2]int vlan 20

[sw2-Vlanif20]ip add 192.168.20.10 24

[sw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1

[sw2-Vlanif20]vrrp vrid 2 track interface GigabitEthernet 0/0/2

[sw2-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0

 

[sw2]dis vrrp brief

VRID  State        Interface                Type     Virtual IP     

----------------------------------------------------------------

1     Backup       Vlanif10                 Normal   192.168.10.1   

2     Master       Vlanif20                 Normal   192.168.20.1   

----------------------------------------------------------------

Total:2     Master:1     Backup:1     Non-active:0     

 

测试:

Pc1 IP地址 192.168.10.100 255.255.255.0 192.168.10.1

Pc1 ping r1环回口1.1.1.1

华为热备份路由协议 vrrp 双主双备_第2张图片

查看流量路径:

华为热备份路由协议 vrrp 双主双备_第3张图片

R1 上行口关闭 :

华为热备份路由协议 vrrp 双主双备_第4张图片

PC2的测试和pc1方法相同。




你可能感兴趣的:(华为,思科设配)