如图所示的组网图
配置了vrrp虚拟网关协议
核心2 vlan 2 3 为主
核心3 vlan 4 5 为主
想要连通外网该如何配置路由
(0)
可参考
· VLAN 2内主机的缺省网关为10.1.1.100/25;VLAN 3内主机的缺省网关为10.1.1.200/25;
· Switch A和Switch B同时属于虚拟IP地址为10.1.1.100/25的备份组1和虚拟IP地址为10.1.1.200/25的备份组2;
· 在备份组1中Switch A的优先级高于Switch B,在备份组2中Switch B的优先级高于Switch A,从而保证VLAN 2和VLAN 3内的主机分别通过Switch A和Switch B通信,当Switch A或Switch B出现故障时,主机可以通过另一台设备继续通信,避免通信中断。
图1-10 多个VLAN中的VRRP备份组配置组网图
(1) 配置Switch A
# 配置VLAN 2。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port gigabitethernet 1/0/5
[SwitchA-vlan2] quit
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 255.255.255.128
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.100。
[SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
# 设置Switch A在备份组1中的优先级为110,高于Switch B的优先级100,以保证在备份组1中Switch A成为Master负责转发流量。
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 110
[SwitchA-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchA] vlan 3
[SwitchA-vlan3] port gigabitethernet 1/0/6
[SwitchA-vlan3] quit
[SwitchA] interface vlan-interface 3
[SwitchA-Vlan-interface3] ip address 10.1.1.130 255.255.255.128
# 创建备份组2,并配置备份组2的虚拟IP地址为10.1.1.200。
[SwitchA-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
(2) 配置Switch B
# 配置VLAN 2。
<SwitchB> system-view
[SwitchB] vlan 2
[SwitchB-vlan2] port gigabitethernet 1/0/5
[SwitchB-vlan2] quit
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address 10.1.1.2 255.255.255.128
# 创建备份组1,并配置备份组1的虚拟IP地址为10.1.1.100。
[SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.100
[SwitchB-Vlan-interface2] quit
# 配置VLAN 3。
[SwitchB] vlan 3
[SwitchB-vlan3] port gigabitethernet 1/0/6
[SwitchB-vlan3] quit
[SwitchB] interface vlan-interface 3
[SwitchB-Vlan-interface3] ip address 10.1.1.131 255.255.255.128
# 创建备份组2,并配置备份组2的虚拟IP地址为10.1.1.200。
[SwitchB-Vlan-interface3] vrrp vrid 2 virtual-ip 10.1.1.200
# 设置Switch B在备份组2中的优先级为110,高于Switch A的优先级100,以保证在备份组2中Switch B成为Master负责转发流量。
[SwitchB-Vlan-interface3] vrrp vrid 2 priority 110
可以通过display vrrp verbose命令查看配置后的结果。
# 显示Switch A上备份组的详细信息。
[SwitchA-Vlan-interface3] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Standard
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 0
Auth Type : None
Virtual IP : 10.1.1.100
Virtual MAC : 0000-5e00-0101
Master IP : 10.1.1.1
Interface Vlan-interface3
VRID : 2 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 0
Become Master : 203ms left
Auth Type : None
Virtual IP : 10.1.1.200
Virtual MAC : 0000-5e00-0102
Master IP : 10.1.1.131
# 显示Switch B上备份组的详细信息。
[SwitchB-Vlan-interface3] display vrrp verbose
IPv4 Virtual Router Information:
Running Mode : Standard
Total number of virtual routers : 2
Interface Vlan-interface2
VRID : 1 Adver Timer : 100
Admin Status : Up State : Backup
Config Pri : 100 Running Pri : 100
Preempt Mode : Yes Delay Time : 0
Become Master : 211ms left
Auth Type : None
Virtual IP : 10.1.1.100
Virtual MAC : 0000-5e00-0101
Master IP : 10.1.1.1
Interface Vlan-interface3
VRID : 2 Adver Timer : 100
Admin Status : Up State : Master
Config Pri : 110 Running Pri : 110
Preempt Mode : Yes Delay Time : 0
Auth Type : None
Virtual IP : 10.1.1.200
Virtual MAC : 0000-5e00-0102
Master IP : 10.1.1.131
以上显示信息表示在备份组1中Switch A为Master,Switch B为Backup,缺省网关为10.1.1.100/25的主机通过Switch A访问Internet;备份组2中Switch A为Backup,Switch B为Master,缺省网关为10.1.1.200/25的主机通过Switch B访问Internet。
(1)
您好,请知:
以下是VRRP的典型配置案例,有切换演练:
组网说明:
本案例采用H3C HCL模拟器来模拟IPV6 VRRP典型组网配置。为了确保网络的冗余,将SW2和SW3开启VRRP作为网关冗余。SW2为主设备,SW3为备用设备。SW2、SW3与R1的互联采用ospf路由协议互通。当断开SW2的GI1/0/2上联口是,物理机能走SW3方向去往R1。
1、按照网络拓扑图正确配置IP地址和VLAN划分
2、SW2和SW3配置VRRP
3、SW2配置track,方便VRRP的检测与切换
4、SW2、SW3、R1运行OSPF路由协议
SW1:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]sysname SW1
[SW1]vlan 10
[SW1-vlan10]quit
[SW1]int range gi 1/0/1 to gi 1/0/2
[SW1-if-range]port link-type trunk
[SW1-if-range]undo port trunk permit vlan 1
[SW1-if-range]port trunk permit vlan 10
[SW1-if-range]quit
[SW1]int gi 1/0/3
[SW1-GigabitEthernet1/0/3]port link-type access
[SW1-GigabitEthernet1/0/3]port access vlan 10
[SW1-GigabitEthernet1/0/3]quit
[SW1]ip unreachables enable
[SW1]ip ttl-expires enable
SW2:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]sysname SW2
[SW2]vlan 10
[SW2-vlan10]quit
[SW2]int range gi 1/0/1 gi 1/0/3
[SW2-if-range]port link-type trunk
[SW2-if-range]undo port trunk permit vlan 1
[SW2-if-range]port trunk permit vlan 10
[SW2-if-range]quit
[SW2]track 1 interface GigabitEthernet 1/0/2
[SW2-track-1]quit
[SW2]int gi 1/0/2
[SW2-GigabitEthernet1/0/2]port link-mode route
[SW2-GigabitEthernet1/0/2]des <connect to R1>
[SW2-GigabitEthernet1/0/2]ip address 10.0.0.1 30
[SW2-GigabitEthernet1/0/2]quit
[SW2]track 1 interface GigabitEthernet 1/0/2
[SW2-track-1]quit
[SW2]int vlan 10
[SW2-Vlan-interface10]ip address 192.168.1.252 24
[SW2-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.1.254
[SW2-Vlan-interface10]vrrp vrid 1 priority 120
[SW2-Vlan-interface10]vrrp vrid 1 track 1 priority reduced 30
[SW2-Vlan-interface10]quit
[SW2]int loopback 0
[SW2-LoopBack0]ip address 1.1.1.1 32
[SW2-LoopBack0]quit
[SW2]ospf 1 router-id 1.1.1.1
[SW2-ospf-1]silent-interface Vlan-interface 10
[SW2-ospf-1]area 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[SW2-ospf-1-area-0.0.0.0]quit
[SW2-ospf-1]quit
[SW2]ip unreachables enable
[SW2]ip ttl-expires enable
SW3:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]sysname SW3
[SW3]int loopback 0
[SW3-LoopBack0]ip address 2.2.2.2 32
[SW3-LoopBack0]quit
[SW3]vlan 10
[SW3-vlan10]quit
[SW3]int range gi 1/0/1 gi 1/0/3
[SW3-if-range]port link-type trunk
[SW3-if-range]undo port trunk permit vlan 1
[SW3-if-range]port trunk permit vlan 10
[SW3-if-range]quit
[SW3]int gi 1/0/2
[SW3-GigabitEthernet1/0/2]port link-mode route
[SW3-GigabitEthernet1/0/2]des <connect to R1>
[SW3-GigabitEthernet1/0/2]ip address 10.0.0.5 30
[SW3-GigabitEthernet1/0/2]ospf cost 200
[SW3-GigabitEthernet1/0/2]quit
[SW3]int vlan 10
[SW3-Vlan-interface10]ip address 192.168.1.253 24
[SW3-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.1.254
[SW3-Vlan-interface10]quit
[SW3]ospf 1 router-id 2.2.2.2
[SW3-ospf-1]silent-interface Vlan-interface 10
[SW3-ospf-1]area 0.0.0.0
[SW3-ospf-1-area-0.0.0.0]network 10.0.0.5 0.0.0.0
[SW3-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[SW3-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[SW3-ospf-1-area-0.0.0.0]quit
[SW3-ospf-1]quit
[SW3]ip unreachables enable
[SW3]ip ttl-expires enable
R1:
<H3C>sys
System View: return to User View with Ctrl+Z.
[H3C]sysname R3
[R3]int loopback 0
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]quit
[R3]int gi 0/0
[R3-GigabitEthernet0/0]des <connect to SW2>
[R3-GigabitEthernet0/0]ip address 10.0.0.2 30
[R3-GigabitEthernet0/0]quit
[R3]int gi 0/1
[R3-GigabitEthernet0/1]des <connect to SW3>
[R3-GigabitEthernet0/1]ip address 10.0.0.6 30
[R3-GigabitEthernet0/1]ospf cost 200
[R3-GigabitEthernet0/1]quit
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 10.0.0.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]quit
[R3]ip unreachables enable
[R3]ip ttl-expires enable
查看SW2的VRRP显示信息为master:
查看SW3的VRRP显示信息为backup:
查看SW2的OSPF邻居信息:
查看SW3的OSPF邻居信息:
查看R1的OSPF邻居信息:
查看SW2的路由表:
查看SW3的路由表:
查看R1的路由表:
物理机设置IP地址:
物理机能PING通3.3.3.3
路由追踪,走SW2方向去往3.3.3.3
关闭SW2的GI 1/0/2端口:
[SW2]int gi 1/0/2
[SW2-GigabitEthernet1/0/2]shutdown
查看SW2和SW3的VRRP状态:
SW2的VRRP状态为backup
SW3的VRRP状态为main
此时物理机依然可以PING通3.3.3.3
使用trecert -d 3.3.3.3,物理机去往3.3.3.3已经走SW3方向:
根据测试结果得知,VRRP能正常切换,同时在切换后VLAN10走的是SW3方向去往3.3.3.3。
(1)
暂无评论
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论