利用vrrp协议及单臂路由实现vlan间高可用性通讯
单臂路由实现高可用性vlan间通讯
实验背景:
位于同于同于网络中的多台机器在不同的vlan之间
实验目的:
通过单臂路由实现vlan间高可用性vlan通讯
实验原理:
为了实现vlan之间通讯的高可用性及稳定性,本次试验才用双设备实现,及两组设备互为备份,又各有分工,实现vlan10通讯时路由器ar1和交换机lsw1为主设备ar2和lsw2为备份设备,当主设备发生故障造成通讯失败时备份设备开始启用,继续保证vlan通讯正常进行,当主设备修复之后备份设备又保持断开不工作状态,同理ar2和lsw2为vlan20 通讯的主设备,原理同上.
主要协议:vrrp协议
实验简述:
本次试验共需要路由器两台,交换机两台,pc 四台, ar1的 eth0/0/0接口划分为两个子接口eth0/0/0.10和eth0/0/0.20,其中 eth0/0/0.10 的ip 地址:192.168.10.1 255.255.255.0 vlan10 优先级为120,eth0/0/0.20的ip 192.168.20.1 255.255.255.0 vlan 20 优先级为100
ar2的 eth0/0/0接口划分为两个子接口eth0/0/0.10和eth0/0/0.20,其中 eth0/0/0.10 的ip 地址:192.168.10.2 255.255.255.0 vlan10 优先级为100,eth0/0/0.20的ip 192.168.20.2 255.255.255.0 vlan 20 优先级为120,路由器与交换机之间以及交换机和交换机之间为 trunk链路
Ar1配置:
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/0.10
[Huawei-Ethernet0/0/0.10]vlan-type dot1q 10 ---------封装
[Huawei-Ethernet0/0/0.10]int e0/0/0.20
[Huawei-Ethernet0/0/0.20]vlan-type dot1q 20 ---------封装
[Huawei-Ethernet0/0/0.10]ip add 192.168.10.1 24------------管理ip
[Huawei-Ethernet0/0/0.10]int e0/0/0.20
[Huawei-Ethernet0/0/0.20]ip add 192.168.20.1 24------------管理ip
[Huawei-Ethernet0/0/0.20]dis ip rou---------------查看路由表
路由标志: R - 迭代路由, D - 下发到转发表
------------------------------------------------------------------------------
路由表: Public
目的地址个数 : 6 路由条数 : 6
目的地址/掩码 协议 优先级 花费 标志 下一跳 接口
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 Ethernet0/0/0.10
192.168.10.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.10
192.168.20.0/24 Direct 0 0 D 192.168.20.1 Ethernet0/0/0.20
192.168.20.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.20
[Huawei-Ethernet0/0/0.20]int e0/0/0.10
[Huawei-Ethernet0/0/0.10]vrrp vrid 10 virtual-ip 192.168.10.254 -----启用vrrp协议并进行ip管理
[Huawei-Ethernet0/0/0.10]vrrp vrid 10 priority 120 ---------设置优先级
[Huawei-Ethernet0/0/0.10]vrrp vrid 10 preempt-mode timer delay 0
[Huawei-Ethernet0/0/0.10]int e0/0/0.20
[Huawei-Ethernet0/0/0.20]vrrp vrid 20 virtual-ip 192.168.20.254
[Huawei-Ethernet0/0/0.20]vrrp vrid 20 priority 100
R2配置:
<Huawei>un te mo
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/0.10
[Huawei-Ethernet0/0/0.10]vlan-type dot1q 10
[Huawei-Ethernet0/0/0.10]ip add 192.168.10.2 24
[Huawei-Ethernet0/0/0.10]int e0/0/0.20
[Huawei-Ethernet0/0/0.20]vlan-type dot1q 20
[Huawei-Ethernet0/0/0.20]ip add 192.168.20.2 24
[Huawei-Ethernet0/0/0.20]dis ip rou
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Direct 0 0 D 192.168.10.2 Ethernet0/0/0.10
192.168.10.2/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.10
192.168.20.0/24 Direct 0 0 D 192.168.20.2 Ethernet0/0/0.20
192.168.20.2/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.20
[Huawei-Ethernet0/0/0.20]int e0/0/0.10
[Huawei-Ethernet0/0/0.10]vrrp vrid 10 virtual-ip 192.168.10.254
[Huawei-Ethernet0/0/0.10]vrrp vrid 10 priority 100
[Huawei-Ethernet0/0/0.10]int e0/0/0.20
[Huawei-Ethernet0/0/0.20]vrrp vrid 20 virtual-ip 192.168.20.254
[Huawei-Ethernet0/0/0.20]vrrp vrid 20 priority 120
[Huawei-Ethernet0/0/0.20]vrrp vrid 20 preempt-mode timer delay 0-----------设置争抢时间为零秒
Sw1配置:
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access ---------把vlan10 加入端口
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access ---------把vlan20 加入端口
[Huawei-Ethernet0/0/3]port default vlan 20
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-type trunk --------------设置trunk
[Huawei-Ethernet0/0/4]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/4]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all --------------设置trunk
Sw2 配置
[Huawei]vlan 10
Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 10
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 20
[Huawei-Ethernet0/0/4]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type trunk
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan all
测试结果: