VRRP实现线路热备份
一:实验要求:
1.在正常情况下 VLAN 10的成员的数据走LSW1,VLAN20 的成员 走LSW2。当某线路出现故障时,线路自动切换至另一线路上,从而不影响网络通信。
二:所需设备:
1.一台AR3260路由器 2.两台S5700交换机 3.一台S37004.两台PC机
三:技术解释:
VRRP是一种容错协议,应用于当连接主机的下一跳网关路由器出现故障时,由网络中另一台路由器代替故障路由器进行工作,从而保证网络通信的连续性和可靠性
四:实验拓扑:
五:实验步骤:
1.开启所有设备
2.配置PC机的IP地址
3.配置S3700交换机的VLAN和TRUNK
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]inte0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 20
[Huawei-Ethernet0/0/2]port default vlan 20
[Huawei-Ethernet0/0/2]int e0/0/10
[Huawei-Ethernet0/0/10]port link-type trunk
[Huawei-Ethernet0/0/10]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/10]int e0/0/11
[Huawei-Ethernet0/0/11]port link-type trunk
[Huawei-Ethernet0/0/11]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/11]dis vlan
Thetotal number of vlans is : 3
--------------------------------------------------------------------------------
U:Up; D: Down; TG: Tagged; UT: Untagged;
MP:Vlan-mapping; ST:Vlan-stacking;
#:ProtocolTransparent-vlan; *:Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/3(D) Eth0/0/4(D) Eth0/0/5(D) Eth0/0/6(D)
Eth0/0/7(D) Eth0/0/8(D) Eth0/0/9(D) Eth0/0/10(U)
Eth0/0/11(U) Eth0/0/12(D) Eth0/0/13(D) Eth0/0/14(D)
Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) Eth0/0/18(D)
Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) Eth0/0/22(D)
GE0/0/1(D) GE0/0/2(D)
10 common UT:Eth0/0/1(U)
TG:Eth0/0/10(U) Eth0/0/11(U)
20 common UT:Eth0/0/2(U)
TG:Eth0/0/10(U) Eth0/0/11(U)
VID Status Property MAC-LRN StatisticsDescription
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
4.配置S5700 LSW1的 VLAN trunk默认路由
<Huawei>sy
[Huawei]vlan10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]vlan 30
[Huawei-vlan30]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]int vlan 10
[Huawei-Vlanif10]ip add 192.168.10.10 24
[Huawei-Vlanif10]un shut
Info:Interface Vlanif10 is not shutdown.
[Huawei-Vlanif10]int vlan 20
[Huawei-Vlanif20]ip add 192.168.20.10 24
[Huawei-Vlanif20]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 30
[Huawei-GigabitEthernet0/0/2]int vlan 30
[Huawei-Vlanif30]ip add 202.106.1.1 24
[Huawei]sysname LSW1
[LSW1]ip route-static 0.0.0.0 0.0.0.0 202.106.1.2
[LSW1]dis ip int b
*down:administratively down
^down:standby
(l):loopback
(s):spoofing
Thenumber of interface that is UP in Physical is 5
Thenumber of interface that is DOWN in Physical is 1
Thenumber of interface that is UP in Protocol is 4
Thenumber of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 unassigned up down
Vlanif10 192.168.10.10/24 up up
Vlanif20 192.168.20.10/24 up up
Vlanif30 202.106.1.1/24 up up
[LSW1]dis vlan
Thetotal number of vlans is : 4
--------------------------------------------------------------------------------
U:Up; D: Down; TG: Tagged; UT: Untagged;
MP:Vlan-mapping; ST:Vlan-stacking;
#:ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/1(U) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D)
GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(D)
GE0/0/10(D) GE0/0/11(D) GE0/0/12(D) GE0/0/13(D)
GE0/0/14(D) GE0/0/15(D) GE0/0/16(D) GE0/0/17(D)
GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D)
GE0/0/22(D) GE0/0/23(D) GE0/0/24(D)
10 common TG:GE0/0/1(U)
20 common TG:GE0/0/1(U)
30 common UT:GE0/0/2(U)
TG:GE0/0/1(U)
VID Status Property MAC-LRN StatisticsDescription
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030
[LSW1]dis ip routing-table
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 202.106.1.2 Vlanif30
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.10 Vlanif10
192.168.10.10/32 Direct 0 0 D 127.0.0.1 Vlanif10
192.168.20.0/24 Direct 0 0 D 192.168.20.10 Vlanif20
192.168.20.10/32 Direct 0 0 D 127.0.0.1 Vlanif20
202.106.1.0/24 Direct 0 0 D 202.106.1.1 Vlanif30
202.106.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif30
5.配置AR1的IP地址 LoopBack 和浮动路由
<Huawei>sys
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 202.106.1.2 24
[Huawei-GigabitEthernet0/0/0]un shut
Info:Interface GigabitEthernet0/0/0 is not shutdown.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 202.106.2.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int loo 0
[Huawei-LoopBack0]ip add 1.1.1.1 32
[Huawei-LoopBack0]q
[Huawei]ip route-static 192.168.10.0 24 202.106.1.1
[Huawei]ip route-static 192.168.10.0 24 202.106.2.2 preference 70
[Huawei]ip route-static 192.168.20.0 24 202.106.2.2
[Huawei]ip route-static 192.168.20.0 24 202.106.1.1 preference 70
[Huawei]dis ip routing-table
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.10.0/24 Static 70 0 RD 202.106.2.2 GigabitEthernet0
/0/1
192.168.20.0/24 Static 60 0 RD 202.106.2.2 GigabitEthernet0
/0/1
202.106.2.0/24 Direct 0 0 D 202.106.2.1 GigabitEthernet0
/0/1
202.106.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0
/0/1
202.106.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0
/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
6.配置LSW2的VLAN Trunk 默认路由以及IP地址
<Huawei>sy
[Huawei]sysname LSW2
[LSW2]VLAN 10
[LSW2-vlan10]VLAN 20
[LSW2-vlan20]VLAN 30
[LSW2-vlan30]INT G0/0/2
[LSW2-GigabitEthernet0/0/2]port link-type access
[LSW2-GigabitEthernet0/0/2]port default vlan 30
[LSW2-GigabitEthernet0/0/2]int g0/0/1
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[LSW2-GigabitEthernet0/0/1]int vlan 10
[LSW2-Vlanif10]ip add 192.168.10.20 24
[LSW2-Vlanif10]int vlan 20
[LSW2-Vlanif20]ip add 192.168.20.20 24
[LSW2-Vlanif20]int vlan 30
[LSW2-Vlanif30]ip add 202.106.2.2 24
[LSW2-Vlanif30]dis ip int b
[LSW2-Vlanif30]q
[LSW2]ip route-static 0.0.0.0 0.0.0.0 202.106.2.1
[LSW2]dis ip int b
*down:administratively down
^down:standby
(l):loopback
(s):spoofing
Thenumber of interface that is UP in Physical is 5
Thenumber of interface that is DOWN in Physical is 1
Thenumber of interface that is UP in Protocol is 4
Thenumber of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
MEth0/0/1 unassigned down down
NULL0 unassigned up up(s)
Vlanif1 unassigned up down
Vlanif10 192.168.10.20/24 up up
Vlanif20 192.168.20.20/24 up up
Vlanif30 202.106.2.2/24 up up
[LSW2]dis vlan
Thetotal number of vlans is : 4
--------------------------------------------------------------------------------
U:Up; D: Down; TG: Tagged; UT: Untagged;
MP:Vlan-mapping; ST:Vlan-stacking;
#:ProtocolTransparent-vlan; *:Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/1(U) GE0/0/3(D) GE0/0/4(D) GE0/0/5(D)
GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(D)
GE0/0/10(D) GE0/0/11(D) GE0/0/12(D) GE0/0/13(D)
GE0/0/14(D) GE0/0/15(D) GE0/0/16(D) GE0/0/17(D)
GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D)
GE0/0/22(D) GE0/0/23(D) GE0/0/24(D)
10 common TG:GE0/0/1(U)
20 common TG:GE0/0/1(U)
30 common UT:GE0/0/2(U)
TG:GE0/0/1(U)
VID Status Property MAC-LRN StatisticsDescription
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030
[LSW2]dis ip routing-table
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 202.106.2.1 Vlanif30
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.20 Vlanif10
192.168.10.20/32 Direct 0 0 D 127.0.0.1 Vlanif10
192.168.20.0/24 Direct 0 0 D 192.168.20.20 Vlanif20
192.168.20.20/32 Direct 0 0 D 127.0.0.1 Vlanif20
202.106.2.0/24 Direct 0 0 D 202.106.2.2 Vlanif30
202.106.2.2/32 Direct 0 0 D 127.0.0.1 Vlanif30
7.配置LSW1的VRRP
[LSW1]int vlan 10
[LSW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[LSW1-Vlanif10]vrrp vrid 1 priority 110
[LSW1-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0
[LSW1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/1
[LSW1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/2
[LSW1-Vlanif10]int vlan 20
[LSW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[LSW1-Vlanif20]vrrp vrid 2 priority 95
[LSW1-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0
[LSW1-Vlanif20]dis vrrp
Vlanif10 | Virtual Router 1
State : Master
Virtual IP : 192.168.10.1
Master IP : 192.168.10.10
PriorityRun : 110
PriorityConfig : 110
MasterPriority : 110
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Track IF : GigabitEthernet0/0/1 Priority reduced : 10
IF state : UP
Track IF : GigabitEthernet0/0/2 Priority reduced : 10
IF state : UP
Create time : 2014-02-23 21:33:36 UTC-08:00
Last change time : 2014-02-23 21:33:40UTC-08:00
Vlanif20 | Virtual Router 2
State : Master
Virtual IP : 192.168.20.1
Master IP : 192.168.20.10
PriorityRun : 95
PriorityConfig : 95
MasterPriority : 95
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Create time : 2014-02-23 21:35:36 UTC-08:00
Last change time : 2014-02-23 21:35:39UTC-08:00
8.配置LSW2的VRRP
<LSW2>sy
[LSW2]int g0/0/1
[LSW2-GigabitEthernet0/0/1]int vlan 10
[LSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
[LSW2-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0
[LSW2-Vlanif10]vrrp vrid 1 priority 105
[LSW2-Vlanif10]int vlan 20
[LSW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[LSW2-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0
[LSW2-Vlanif20]vrrpvrid 2 priority 100
[LSW2-Vlanif20]vrrp vrid 2 track interface GigabitEthernet 0/0/1
[LSW2-Vlanif20]vrrp vrid 2 track interface GigabitEthernet 0/0/2
[LSW2-Vlanif20]dis vrrp
[LSW2-Vlanif20]dis vrrp
Vlanif10 | Virtual Router 1
State : Backup
Virtual IP : 192.168.10.1
Master IP : 192.168.10.10
PriorityRun : 105
PriorityConfig : 105
MasterPriority : 110
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Create time : 2014-02-23 21:39:43 UTC-08:00
Last change time : 2014-02-23 21:39:43UTC-08:00
Vlanif20 | Virtual Router 2
State : Master
Virtual IP : 192.168.20.1
Master IP : 192.168.20.20
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Track IF : GigabitEthernet0/0/1 Priority reduced : 10
IF state : UP
Track IF : GigabitEthernet0/0/2 Priority reduced : 10
IF state : UP
Create time : 2014-02-23 21:41:11 UTC-08:00
Last change time : 2014-02-23 21:41:12UTC-08:00
9.PC1测试网络
Ping 回环地址
Tracert回环地址
10.PC2 测试网络
Ping 回环地址
Tracert回环地址
11.网关路由器出现故障时
ShutdownLSW1 的GE0/0/2
PC1 ping1.1.1.1
Tracert 回环地址
线路已切换!
实验完成
孤狼
2014年2月23日23:16:35