美文网首页
HCIA学习之浮动静态路由(第八天)

HCIA学习之浮动静态路由(第八天)

作者: 又增加了奇奇怪怪的知识 | 来源:发表于2020-11-16 22:59 被阅读0次

    浮动静态路由


    浮动静态路由,在存在多条线路的情况使得数据只从一个链路上转发,即路由表中只有一个下一跳,其他线路作为备份。只有主链路失效了,备份链路才会被放入路由表。


    image.png
    • 负载均衡模式
    Routing Tables: Public
             Destinations : 20       Routes : 21       
    
    Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    
           10.0.1.0/24  Direct  0    0           D   10.0.1.1        LoopBack0
           10.0.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
         10.0.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
           10.0.2.0/24  RIP     100  1           D   10.0.123.2      GigabitEthernet0/0/0
           10.0.3.0/24  RIP     100  1           D   10.0.123.3      GigabitEthernet0/0/0
           10.0.4.0/24  Static  60   0           D   11.0.0.2        GigabitEthernet0/0/1
                        Static  60   0           D   10.0.14.1       Serial2/0/0
          10.0.14.0/24  Direct  0    0           D   10.0.14.1       Serial2/0/0
          10.0.14.1/32  Direct  0    0           D   127.0.0.1       Serial2/0/0
          10.0.14.4/32  Direct  0    0           D   10.0.14.4       Serial2/0/0
        10.0.14.255/32  Direct  0    0           D   127.0.0.1       Serial2/0/0
         10.0.123.0/24  Direct  0    0           D   10.0.123.1      GigabitEthernet0/0/0
         10.0.123.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       10.0.123.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
           11.0.0.0/24  Direct  0    0           D   11.0.0.1        GigabitEthernet0/0/1
           11.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
         11.0.0.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
          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
    255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    
    • 改变为浮动静态路由将串行链路作为备线
      (值越小越优先,思科若填写255则路由会消失)
    [R1]ip route-static 10.0.4.0 24 s 2/0/0 preference ?
      INTEGER<1-255>  Preference value range
      
      
    Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    
           10.0.1.0/24  Direct  0    0           D   10.0.1.1        LoopBack0
           10.0.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
         10.0.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
           10.0.2.0/24  RIP     100  1           D   10.0.123.2      GigabitEthernet0/0/0
           10.0.3.0/24  RIP     100  1           D   10.0.123.3      GigabitEthernet0/0/0
           10.0.4.0/24  Static  60   0           D   11.0.0.2        GigabitEthernet0/0/1
          10.0.14.0/24  Direct  0    0           D   10.0.14.1       Serial2/0/0
          10.0.14.1/32  Direct  0    0           D   127.0.0.1       Serial2/0/0
          10.0.14.4/32  Direct  0    0           D   10.0.14.4       Serial2/0/0
        10.0.14.255/32  Direct  0    0           D   127.0.0.1       Serial2/0/0
         10.0.123.0/24  Direct  0    0           D   10.0.123.1      GigabitEthernet0/0/0
         10.0.123.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       10.0.123.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
           11.0.0.0/24  Direct  0    0           D   11.0.0.1        GigabitEthernet0/0/1
           11.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
         11.0.0.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
          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
    255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    
    [R1]dis ip routing-table protocol static
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Public routing table : Static
             Destinations : 1        Routes : 2        Configured Routes : 2
    
    Static routing table status : <Active>
             Destinations : 1        Routes : 1
    
    Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    
           10.0.4.0/24  Static  60   0           D   11.0.0.2        GigabitEthernet0/0/1
    
    Static routing table status : <Inactive>
             Destinations : 1        Routes : 1
    
    Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    
           10.0.4.0/24  Static  255  0               10.0.14.1       Serial2/0/0
    
    • 测试
      (目前使用的是以太网口)
    [R1]ping 10.0.4.4
      PING 10.0.4.4: 56  data bytes, press CTRL_C to break
        Reply from 10.0.4.4: bytes=56 Sequence=1 ttl=255 time=50 ms
        Reply from 10.0.4.4: bytes=56 Sequence=2 ttl=255 time=20 ms
        Reply from 10.0.4.4: bytes=56 Sequence=3 ttl=255 time=30 ms
        Reply from 10.0.4.4: bytes=56 Sequence=4 ttl=255 time=30 ms
        Reply from 10.0.4.4: bytes=56 Sequence=5 ttl=255 time=50 ms
    
      --- 10.0.4.4 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 20/36/50 ms
        
    [R1]tracert 10.0.4.4
     traceroute to  10.0.4.4(10.0.4.4), max hops: 30 ,packet length: 40,press CTRL_C to break 
     1 11.0.0.2 110 ms  40 ms  30 ms
    
    • 关闭以太网口则自动切换备用路由
    [R1]interface g0/0/1
    [R1-GigabitEthernet0/0/1]shut
    Nov 16 2020 22:07:57-08:00 R1 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthernet0/0/1 has turned into DOWN state.
    [R1-GigabitEthernet0/0/1]
    [R1-GigabitEthernet0/0/1]
    Nov 16 2020 22:07:57-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the DOWN state. 
    [R1-GigabitEthernet0/0/1]q
    [R1]tracert 10.0.4.4
     traceroute to  10.0.4.4(10.0.4.4), max hops: 30 ,packet length: 40,press CTRL_C to break 
     1 10.0.14.4 50 ms  30 ms  30 ms 
    [R1]dis ip routing-table pro stati
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Public routing table : Static
             Destinations : 1        Routes : 1        Configured Routes : 2
    
    Static routing table status : <Active>
             Destinations : 1        Routes : 1
    
    Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
    
           10.0.4.0/24  Static  255  0           D   10.0.14.1       Serial2/0/0
    
    Static routing table status : <Inactive>
             Destinations : 0        Routes : 0
    

    相关文章

      网友评论

          本文标题:HCIA学习之浮动静态路由(第八天)

          本文链接:https://www.haomeiwen.com/subject/fedtiktx.html