• 静态路由配置


    静态路由配置

    什么是静态路由?
    静态路由是指由用户或网络管理员手工配置的路由信息。当网络的拓扑结构或链路的状态发生变化时,网络管理员需要手工去修改路由表中相关的静态路由信息。静态路由信息在缺省情况下是私有的,不会传递给其他的路由器。

    实验环境:华为模拟器eNSP
    现在有这样一个拓扑图:

    很明显路由器R1R3之间无法通信,ping一下试试。

    [R1]ping 192.168.2.2
    PING 192.168.2.2: 56  data bytes, press CTRL_C to break
        Request time out
        Request time out
        Request time out
        Request time out
        Request time out
    
    --- 192.168.2.2 ping statistics ---
        5 packet(s) transmitted
        0 packet(s) received
        100.00% packet loss
    

    全部超时,现在通过添加静态路由使R1R3之间相互通信,先来看一下R1的路由表:

    <R1>dis ip routing-table 
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Routing Tables: Public
            Destinations : 4        Routes : 4        
    
    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.1.0/24  Direct  0    0           D   192.168.1.1     Ethernet0/0/0
        192.168.1.1/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
    

    现在只有回环接口和本地IP,现在来给他添加去往R3的静态路由:

    [R1]ip route-static 192.168.2.0 255.255.255.0 192.168.1.2
    Jul 25 2018 20:37:00-08:00 R1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
    191.3.1 configurations have been changed. The current change number is 3, the ch
    ange loop count is 0, and the maximum number of records is 4095.
    

    查看一下路由表:

    <R1>dis ip routing-table 
    Route Flags: R - relay, D - download to fib
    ------------------------------------------------------------------------------
    Routing Tables: Public
            Destinations : 5        Routes : 5        
    
    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.1.0/24  Direct  0    0           D   192.168.1.1     Ethernet0/0/0
        192.168.1.1/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
        192.168.2.0/24  Static  60   0          RD   192.168.1.2     Ethernet0/0/0
    

    发现路由表中已经加进了去往R3的静态路由,现在来ping一下R3

    <R1>ping 192.168.2.2
    PING 192.168.2.2: 56  data bytes, press CTRL_C to break
        Request time out
        Request time out
        Request time out
        Request time out
        Request time out
    
    --- 192.168.2.2 ping statistics ---
        5 packet(s) transmitted
        0 packet(s) received
        100.00% packet loss
    

    看到无法ping通,因为现在只有去的路由,但是没有回来的路由,也就是说ping的数据包现在只知道怎么去,但是不知道怎么回来,那么现在来给他添加回程路由。
    回程路由配在路由器R3上面。

    [R3]ip route-static 192.168.1.0 255.255.255.0 192.168.2.1
    Jul 25 2018 20:43:10-08:00 R3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
    191.3.1 configurations have been changed. The current change number is 3, the ch
    ange loop count is 0, and the maximum number of records is 4095.
    

    现在再去R1上面ping一下R3试试。

    <R1>ping 192.168.2.2
    PING 192.168.2.2: 56  data bytes, press CTRL_C to break
        Reply from 192.168.2.2: bytes=56 Sequence=1 ttl=254 time=40 ms
        Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=254 time=60 ms
        Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=254 time=30 ms
        Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=254 time=90 ms
        Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=254 time=100 ms
    
    --- 192.168.2.2 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 30/64/100 ms
    

    发现可以ping通了,说明静态路由添加成功。
    配置静态路由的命令是ip route-static 要去网段 要去网段的子网掩码 下一跳

  • 相关阅读:
    如何在Epower工作流平台(企业流程管理平台)上建立OA系统
    工作流管理系统应按需选型
    在工作流基础上的解决方案清单
    优化IT企业基础架构
    DataGrid控件用法
    Oracle设置初始化参数 REMOTE_LOGIN_PASSWORDFILE
    淘宝网的剩余时间(倒计时)实现
    Orace sequenced 简单介绍(自增长字段)
    C#与Oracle开发中执行存储过程问题
    ASP.NET中回车触发指定按钮的事件
  • 原文地址:https://www.cnblogs.com/Timesi/p/9368283.html
Copyright © 2020-2023  润新知