A-A+

VRRP实现线路热备份的实现

2015年11月25日 站长资讯 暂无评论

一:实验要求:

1.在正常情况下 VLAN 10的成员的数据走LSW1,VLAN20 的成员 走LSW2。当某线路出现故障时,线路自动切换至另一线路上,从而不影响网络通信。

二:所需设备:

1.一台AR3260路由器 2.两台S5700交换机 3.一台S37004.两台PC机

三:技术解释:

VRRP是一种容错协议,应用于当连接主机的下一跳网关路由器出现故障时,由网络中另一台路由器代替故障路由器进行工作,从而保证网络通信的连续性和可靠性

四:实验拓扑:

五:实验步骤:

1.开启所有设备

2.配置PC机的IP地址

3.配置S3700交换机的VLAN和TRUNK

  1. [Huawei]vlan 10  
  2. [Huawei-vlan10]vlan 20  
  3. [Huawei-vlan20]inte0/0/1  
  4. [Huawei-Ethernet0/0/1]port link-type access  
  5. [Huawei-Ethernet0/0/1]port default vlan 10  
  6. [Huawei-Ethernet0/0/1]int e0/0/2  
  7. [Huawei-Ethernet0/0/2]port link-type access   
  8. [Huawei-Ethernet0/0/2]port default vlan 20       
  9. [Huawei-Ethernet0/0/2]port default vlan 20  
  10. [Huawei-Ethernet0/0/2]int e0/0/10  
  11. [Huawei-Ethernet0/0/10]port link-type trunk  
  12. [Huawei-Ethernet0/0/10]port trunk allow-pass vlan all   
  13. [Huawei-Ethernet0/0/10]int e0/0/11  
  14. [Huawei-Ethernet0/0/11]port link-type trunk  
  15. [Huawei-Ethernet0/0/11]port trunk allow-pass vlan all   
  16. [Huawei-Ethernet0/0/11]dis vlan  
  17. Thetotal number of vlans is : 3  
  18. --------------------------------------------------------------------------------  
  19. U:Up;         D: Down;         TG: Tagged;         UT: Untagged;  
  20.   
  21.   
  22. MP:Vlan-mapping;               ST:Vlan-stacking;  
  23. #:ProtocolTransparent-vlan;    *:Management-vlan;  
  24. --------------------------------------------------------------------------------  
  25. VID  Type   Ports                  
  26. --------------------------------------------------------------------------------  
  27. 1    common UT:Eth0/0/3(D)    Eth0/0/4(D)     Eth0/0/5(D)     Eth0/0/6(D)       
  28.                 Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(U)      
  29.                 Eth0/0/11(U)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)      
  30.                 Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)      
  31.                 Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)      
  32.                 GE0/0/1(D)      GE0/0/2(D)                                        
  33. 10   common UT:Eth0/0/1(U)             
  34.              TG:Eth0/0/10(U)    Eth0/0/11(U)                                      
  35. 20   common UT:Eth0/0/2(U)             
  36.              TG:Eth0/0/10(U)    Eth0/0/11(U)                                     
  37.   
  38. VID  Status Property      MAC-LRN StatisticsDescription        
  39. --------------------------------------------------------------------------------  
  40. 1    enable default       enable  disable   VLAN 0001                           
  41. 10   enable default       enable  disable   VLAN 0010                           
  42. 20   enable default       enable  disable   VLAN 0020                      

4.配置S5700 LSW1的 VLAN trunk默认路由

  1. <Huawei>sy  
  2. [Huawei]vlan10  
  3. [Huawei-vlan10]vlan 20  
  4. [Huawei-vlan20]vlan 30  
  5. [Huawei-vlan30]int g0/0/1  
  6. [Huawei-GigabitEthernet0/0/1]port link-type trunk  
  7. [Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all   
  8. [Huawei-GigabitEthernet0/0/1]int vlan 10  
  9. [Huawei-Vlanif10]ip add 192.168.10.10 24  
  10. [Huawei-Vlanif10]un shut  
  11. Info:Interface Vlanif10 is not shutdown.  
  12. [Huawei-Vlanif10]int vlan 20  
  13. [Huawei-Vlanif20]ip add 192.168.20.10 24  
  14. [Huawei-Vlanif20]int g0/0/2  
  15. [Huawei-GigabitEthernet0/0/2]port link-type access   
  16. [Huawei-GigabitEthernet0/0/2]port default vlan 30  
  17. [Huawei-GigabitEthernet0/0/2]int vlan 30  
  18. [Huawei-Vlanif30]ip add 202.106.1.1 24  
  19. [Huawei]sysname LSW1   
  20. [LSW1]ip route-static 0.0.0.0 0.0.0.0 202.106.1.2  
  21. [LSW1]dis ip int b  
  22. *down:administratively down  
  23. ^down:standby  
  24. (l):loopback  
  25. (s):spoofing  
  26. Thenumber of interface that is UP in Physical is 5   
  27. Thenumber of interface that is DOWN in Physical is 1  
  28. Thenumber of interface that is UP in Protocol is 4  
  29. Thenumber of interface that is DOWN in Protocol is 2  
  30. Interface                         IP Address/Mask      Physical  Protocol    
  31. MEth0/0/1                         unassigned           down      down        
  32. NULL0                             unassigned           up         up(s)       
  33. Vlanif1                           unassigned           up         down       
  34.   
  35.   
  36. Vlanif10                          192.168.10.10/24     up        up          
  37. Vlanif20                          192.168.20.10/24     up        up          
  38. Vlanif30                          202.106.1.1/24       up         up          
  39. [LSW1]dis vlan  
  40. Thetotal number of vlans is : 4  
  41. --------------------------------------------------------------------------------   
  42. U:Up;         D: Down;         TG: Tagged;         UT: Untagged;  
  43. MP:Vlan-mapping;               ST:Vlan-stacking;  
  44. #:ProtocolTransparent-vlan;    *: Management-vlan;  
  45. --------------------------------------------------------------------------------  
  46. VID  Type   Ports                  
  47. --------------------------------------------------------------------------------  
  48. 1    common UT:GE0/0/1(U)      GE0/0/3(D)      GE0/0/4(D)      GE0/0/5(D)        
  49.                 GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)        
  50.                 GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)       
  51.                 GE0/0/14(D)     GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)       
  52.                 GE0/0/18(D)     GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)       
  53.                 GE0/0/22(D)     GE0/0/23(D)     GE0/0/24(D)                       
  54. 10   common TG:GE0/0/1(U)              
  55. 20   common TG:GE0/0/1(U)              
  56. 30   common UT:GE0/0/2(U)              
  57.              TG:GE0/0/1(U)             
  58.   
  59. VID  Status Property      MAC-LRN StatisticsDescription        
  60. --------------------------------------------------------------------------------  
  61. 1    enable default       enable  disable   VLAN 0001                           
  62. 10   enable default       enable  disable   VLAN 0010                           
  63. 20   enable default       enable  disable   VLAN 0020                           
  64. 30   enable default       enable  disable   VLAN 0030                          
  65.   
  66. [LSW1]dis ip routing-table   
  67. RouteFlags: R - relay, D - download to fib  
  68. ------------------------------------------------------------------------------  
  69. RoutingTables: Public  
  70.          Destinations : 9        Routes : 9         
  71.   
  72. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  73.   
  74.         0.0.0.0/0   Static 60   0          RD  202.106.1.2     Vlanif30  
  75.       127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0  
  76.       127.0.0.1/32  Direct 0    0           D   127.0.0.1       InLoopBack0  
  77.    192.168.10.0/24  Direct 0    0           D  192.168.10.10   Vlanif10  
  78.   192.168.10.10/32  Direct 0    0           D  127.0.0.1       Vlanif10  
  79.    192.168.20.0/24  Direct 0    0           D  192.168.20.10   Vlanif20   
  80.   192.168.20.10/32  Direct 0    0           D  127.0.0.1       Vlanif20  
  81.     202.106.1.0/24  Direct 0    0           D  202.106.1.1     Vlanif30  
  82.     202.106.1.1/32  Direct 0    0           D  127.0.0.1       Vlanif30  

5.配置AR1的IP地址 LoopBack 和浮动路由

  1. <Huawei>sys  
  2. [Huawei]int  g0/0/0  
  3. [Huawei-GigabitEthernet0/0/0]ip add 202.106.1.2 24   
  4. [Huawei-GigabitEthernet0/0/0]un shut  
  5. Info:Interface GigabitEthernet0/0/0 is not shutdown.  
  6. [Huawei-GigabitEthernet0/0/0]int g0/0/1  
  7. [Huawei-GigabitEthernet0/0/1]ip add 202.106.2.1 24  
  8. [Huawei-GigabitEthernet0/0/1]q  
  9. [Huawei]int loo 0  
  10. [Huawei-LoopBack0]ip add 1.1.1.1 32  
  11. [Huawei-LoopBack0]q  
  12. [Huawei]ip route-static 192.168.10.0 24 202.106.1.1  
  13. [Huawei]ip route-static 192.168.10.0 24 202.106.2.2 preference 70  
  14. [Huawei]ip route-static 192.168.20.0 24 202.106.2.2  
  15. [Huawei]ip route-static 192.168.20.0 24 202.106.1.1 preference 70  
  16. [Huawei]dis ip routing-table   
  17. RouteFlags: R - relay, D - download to fib  
  18. ------------------------------------------------------------------------------  
  19. RoutingTables: Public  
  20.          Destinations : 10       Routes : 10        
  21.   
  22. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  23.   
  24.         1.1.1.1/32  Direct 0    0           D  127.0.0.1       LoopBack0  
  25.       127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0  
  26.       127.0.0.1/32  Direct 0    0           D  127.0.0.1       InLoopBack0  
  27. 127.255.255.255/32  Direct  0   0           D   127.0.0.1       InLoopBack0  
  28.    192.168.10.0/24  Static 70   0          RD  202.106.2.2     GigabitEthernet0  
  29.   
  30.   
  31. /0/1  
  32.    192.168.20.0/24  Static 60   0          RD  202.106.2.2     GigabitEthernet0  
  33. /0/1  
  34.     202.106.2.0/24  Direct 0    0          D   202.106.2.1     GigabitEthernet0  
  35. /0/1  
  36.     202.106.2.1/32  Direct 0    0           D  127.0.0.1       GigabitEthernet0  
  37. /0/1  
  38.   202.106.2.255/32  Direct 0    0           D  127.0.0.1       GigabitEthernet0  
  39. /0/1  
  40. 255.255.255.255/32  Direct  0   0           D   127.0.0.1       InLoopBack0  

6.配置LSW2的VLAN Trunk 默认路由以及IP地址

  1. <Huawei>sy  
  2. [Huawei]sysname LSW2  
  3. [LSW2]VLAN 10  
  4. [LSW2-vlan10]VLAN 20  
  5. [LSW2-vlan20]VLAN 30  
  6. [LSW2-vlan30]INT G0/0/2  
  7. [LSW2-GigabitEthernet0/0/2]port link-type access  
  8. [LSW2-GigabitEthernet0/0/2]port default vlan 30  
  9. [LSW2-GigabitEthernet0/0/2]int g0/0/1  
  10. [LSW2-GigabitEthernet0/0/1]port link-type trunk   
  11. [LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all   
  12. [LSW2-GigabitEthernet0/0/1]int vlan 10  
  13. [LSW2-Vlanif10]ip add 192.168.10.20 24  
  14. [LSW2-Vlanif10]int vlan 20  
  15. [LSW2-Vlanif20]ip add 192.168.20.20 24  
  16. [LSW2-Vlanif20]int vlan 30  
  17. [LSW2-Vlanif30]ip add 202.106.2.2 24  
  18. [LSW2-Vlanif30]dis ip int b  
  19. [LSW2-Vlanif30]q  
  20. [LSW2]ip route-static 0.0.0.0 0.0.0.0 202.106.2.1  
  21. [LSW2]dis ip int b  
  22. *down:administratively down  
  23. ^down:standby  
  24. (l):loopback  
  25. (s):spoofing  
  26. Thenumber of interface that is UP in Physical is 5   
  27. Thenumber of interface that is DOWN in Physical is 1  
  28. Thenumber of interface that is UP in Protocol is 4  
  29. Thenumber of interface that is DOWN in Protocol is 2  
  30.   
  31. Interface                         IP Address/Mask      Physical  Protocol    
  32. MEth0/0/1                         unassigned           down      down        
  33. NULL0                             unassigned           up         up(s)       
  34. Vlanif1                           unassigned           up         down       
  35.   
  36.   
  37. Vlanif10                          192.168.10.20/24     up        up          
  38. Vlanif20                          192.168.20.20/24     up        up          
  39. Vlanif30                          202.106.2.2/24       up         up          
  40. [LSW2]dis vlan  
  41. Thetotal number of vlans is : 4  
  42. --------------------------------------------------------------------------------   
  43. U:Up;         D: Down;         TG: Tagged;         UT: Untagged;  
  44. MP:Vlan-mapping;               ST:Vlan-stacking;  
  45. #:ProtocolTransparent-vlan;    *:Management-vlan;  
  46. --------------------------------------------------------------------------------  
  47. VID  Type   Ports                  
  48. --------------------------------------------------------------------------------  
  49. 1    common UT:GE0/0/1(U)      GE0/0/3(D)      GE0/0/4(D)      GE0/0/5(D)        
  50.                 GE0/0/6(D)      GE0/0/7(D)      GE0/0/8(D)      GE0/0/9(D)        
  51.                 GE0/0/10(D)     GE0/0/11(D)     GE0/0/12(D)     GE0/0/13(D)       
  52.                 GE0/0/14(D)     GE0/0/15(D)     GE0/0/16(D)     GE0/0/17(D)      
  53.   
  54.   
  55.                 GE0/0/18(D)     GE0/0/19(D)     GE0/0/20(D)     GE0/0/21(D)       
  56.                 GE0/0/22(D)     GE0/0/23(D)     GE0/0/24(D)                       
  57. 10   common TG:GE0/0/1(U)              
  58. 20   common TG:GE0/0/1(U)              
  59. 30   common UT:GE0/0/2(U)              
  60.              TG:GE0/0/1(U)             
  61. VID  Status Property      MAC-LRN StatisticsDescription        
  62. --------------------------------------------------------------------------------  
  63. 1    enable default       enable  disable   VLAN 0001                           
  64. 10   enable default       enable  disable   VLAN 0010                           
  65. 20   enable default       enable  disable   VLAN 0020                           
  66. 30   enable default       enable  disable   VLAN 0030                           
  67. [LSW2]dis ip routing-table   
  68. RouteFlags: R - relay, D - download to fib  
  69. ------------------------------------------------------------------------------  
  70. RoutingTables: Public  
  71.          Destinations : 9        Routes : 9         
  72.   
  73. Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface  
  74.   
  75.         0.0.0.0/0   Static 60   0          RD  202.106.2.1     Vlanif30  
  76.       127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0  
  77.       127.0.0.1/32  Direct 0    0           D  127.0.0.1       InLoopBack0  
  78.    192.168.10.0/24  Direct 0    0           D  192.168.10.20   Vlanif10  
  79.   192.168.10.20/32  Direct 0    0           D  127.0.0.1       Vlanif10  
  80.    192.168.20.0/24  Direct 0    0           D  192.168.20.20   Vlanif20  
  81.   
  82.   
  83.   192.168.20.20/32  Direct 0    0           D  127.0.0.1       Vlanif20  
  84.     202.106.2.0/24  Direct 0    0           D  202.106.2.2     Vlanif30  
  85.     202.106.2.2/32  Direct 0    0           D  127.0.0.1       Vlanif30  

7.配置LSW1的VRRP

  1. [LSW1]int vlan 10  
  2. [LSW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1  
  3. [LSW1-Vlanif10]vrrp vrid 1 priority 110  
  4. [LSW1-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0  
  5. [LSW1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/1  
  6. [LSW1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet 0/0/2  
  7. [LSW1-Vlanif10]int vlan 20  
  8. [LSW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1  
  9. [LSW1-Vlanif20]vrrp vrid 2 priority 95  
  10. [LSW1-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0  
  11.   
  12. [LSW1-Vlanif20]dis vrrp  
  13.  Vlanif10 | Virtual Router 1  
  14.     State : Master  
  15.     Virtual IP : 192.168.10.1  
  16.     Master IP : 192.168.10.10  
  17.     PriorityRun : 110  
  18.     PriorityConfig : 110  
  19.     MasterPriority : 110  
  20.     Preempt : YES   Delay Time : 0 s  
  21.     TimerRun : 1 s  
  22.     TimerConfig : 1 s  
  23.     Auth type : NONE  
  24.     Virtual MAC : 0000-5e00-0101  
  25.     Check TTL : YES  
  26.     Config type : normal-vrrp  
  27.     Track IF : GigabitEthernet0/0/1   Priority reduced : 10  
  28.     IF state : UP  
  29.     Track IF : GigabitEthernet0/0/2   Priority reduced : 10  
  30.     IF state : UP  
  31.     Create time : 2014-02-23 21:33:36 UTC-08:00  
  32.   
  33.   
  34.     Last change time : 2014-02-23 21:33:40UTC-08:00  
  35.   Vlanif20 | Virtual Router 2  
  36.     State : Master  
  37.     Virtual IP : 192.168.20.1  
  38.     Master IP : 192.168.20.10  
  39.     PriorityRun : 95  
  40.     PriorityConfig : 95  
  41.     MasterPriority : 95  
  42.     Preempt : YES   Delay Time : 0 s  
  43.     TimerRun : 1 s  
  44.     TimerConfig : 1 s  
  45.     Auth type : NONE  
  46.     Virtual MAC : 0000-5e00-0102  
  47.     Check TTL : YES  
  48.     Config type : normal-vrrp  
  49.     Create time : 2014-02-23 21:35:36 UTC-08:00  
  50.     Last change time : 2014-02-23 21:35:39UTC-08:00  

8.配置LSW2的VRRP

  1. <LSW2>sy  
  2. [LSW2]int g0/0/1  
  3. [LSW2-GigabitEthernet0/0/1]int vlan 10  
  4. [LSW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1  
  5. [LSW2-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0   
  6. [LSW2-Vlanif10]vrrp vrid 1 priority 105  
  7. [LSW2-Vlanif10]int vlan 20  
  8. [LSW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1  
  9. [LSW2-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0  
  10. [LSW2-Vlanif20]vrrpvrid 2 priority 100  
  11. [LSW2-Vlanif20]vrrp vrid 2 track interface GigabitEthernet 0/0/1  
  12. [LSW2-Vlanif20]vrrp vrid 2 track interface GigabitEthernet 0/0/2  
  13. [LSW2-Vlanif20]dis vrrp  
  14.   
  15. [LSW2-Vlanif20]dis vrrp  
  16.  Vlanif10 | Virtual Router 1  
  17.     State : Backup  
  18.     Virtual IP : 192.168.10.1  
  19.     Master IP : 192.168.10.10  
  20.     PriorityRun : 105  
  21.     PriorityConfig : 105  
  22.     MasterPriority : 110  
  23.     Preempt : YES   Delay Time : 0 s  
  24.     TimerRun : 1 s  
  25.     TimerConfig : 1 s  
  26.     Auth type : NONE  
  27.     Virtual MAC : 0000-5e00-0101  
  28.     Check TTL : YES  
  29.     Config type : normal-vrrp  
  30.     Create time : 2014-02-23 21:39:43 UTC-08:00  
  31.     Last change time : 2014-02-23 21:39:43UTC-08:00  
  32.   
  33.   Vlanif20 | Virtual Router 2  
  34.     State : Master  
  35.     Virtual IP : 192.168.20.1  
  36.     Master IP : 192.168.20.20  
  37.     PriorityRun : 100  
  38.     PriorityConfig : 100  
  39.     MasterPriority : 100  
  40.     Preempt : YES   Delay Time : 0 s  
  41.     TimerRun : 1 s  
  42.     TimerConfig : 1 s  
  43.     Auth type : NONE  
  44.     Virtual MAC : 0000-5e00-0102  
  45.     Check TTL : YES  
  46.     Config type : normal-vrrp  
  47.     Track IF : GigabitEthernet0/0/1   Priority reduced : 10  
  48.     IF state : UP  
  49.     Track IF : GigabitEthernet0/0/2   Priority reduced : 10  
  50.     IF state : UP  
  51.     Create time : 2014-02-23 21:41:11 UTC-08:00  
  52.     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 回环地址

线路已切换!

实验完成。

标签:

给我留言