静态路由用下一跳方法配置

这篇具有很好参考价值的文章主要介绍了静态路由用下一跳方法配置。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

静态路由用下一跳方法配置

要求:用静态路由中的下一跳方法和环回接口实现三台路由器的全网可达

1.先配置三台路由总共四个物理接口的ip

<Huawei>sys
[Huawei]sys r1	
[r1]user-interface console 0
[r1-ui-console0]idle-timeout 0 0
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
Apr  7 2023 23:22:34-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
<Huawei>sys
[Huawei]sys r2
[r2]user-interface console 0
[r2-ui-console0]idle-timeout 0 0
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip ad 12.1.1.2 24
Apr  7 2023 23:23:48-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip ad 24.1.1.1 24
Apr  7 2023 23:24:33-08:00 r2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
<Huawei>sys
[Huawei]sys r3
[r3]user-interface console 0
[r3-ui-console0]idle-timeout 0 0
[r3]interface GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ip ad 24.1.1.2 24
Apr  7 2023 23:25:09-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

2.利用下一跳做好四个接口的路由

[r1]ip route-static 24.1.1.0 24 12.1.1.2
[r3]ip route-static 12.1.1.0 24 24.1.1.1

r2在中间直连r1和r3,故不用配置。路由与通信没有直接关系,在只配置一台下一跳路由时,r1有了到r3的路由,但是r3不知道r1的网段,数据从r1到r3后,r3不能将数据路由到r1,这一点需要注意。

3.创建环回接口(虚拟接口),并实现三台路由器之间的环回路由

[r1]interface LoopBack 0
[r1-LoopBack0]ip ad 1.1.1.1 24

[r2]interface LoopBack 0
[r2-LoopBack0]ip ad 2.2.2.2 24

[r3]interface LoopBack 0
[r3-LoopBack0]ip ad 3.3.3.3 24

配置三个路由器的环回接口,然后配置三个接口的路由。虽然两两之间进行了物理直连,但是虚拟接口之间并没有路由通信,所以要让互相路由。

r1配置:
[r1]ip route-static 2.2.2.0 24 12.1.1.2
[r1]ip route-static 3.3.3.0 24 12.1.1.2

r2配置:
[r2]ip route-static 1.1.1.0 24 12.1.1.1
[r2]ip route-static 3.3.3.0 24 24.1.1.2


r3配置:
[r3]ip route-static 1.1.1.0 24 24.1.1.1
[r3]ip route-static 2.2.2.0 24 24.1.1.1


4.查看路由表:

在最后养成查看路由表的习惯,其实要在每一步都要检查一下自己的路由表为及时改正错误。我这里已经直接把路由配完了。所以最后查看路由表。

r1路由表:
[r1]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
      1.1.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/0
        3.3.3.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/0
       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/0
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       24.1.1.0/24  Static  60   0          RD   12.1.1.2        GigabitEthernet
0/0/0
      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

r2路由表:
[r2]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 15       Routes : 15       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   12.1.1.1        GigabitEthernet
0/0/1
        2.2.2.0/24  Direct  0    0           D   2.2.2.2         LoopBack0
        2.2.2.2/32  Direct  0    0           D   127.0.0.1       LoopBack0
      2.2.2.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        3.3.3.0/24  Static  60   0          RD   24.1.1.2        GigabitEthernet
0/0/0
       12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/1
       12.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
       24.1.1.0/24  Direct  0    0           D   24.1.1.1        GigabitEthernet
0/0/0
       24.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     24.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      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

r3路由表:
[r3]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 13       Routes : 13       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0          RD   24.1.1.1        GigabitEthernet
0/0/1
        2.2.2.0/24  Static  60   0          RD   24.1.1.1        GigabitEthernet
0/0/1
        3.3.3.0/24  Direct  0    0           D   3.3.3.3         LoopBack0
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
      3.3.3.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
       12.1.1.0/24  Static  60   0          RD   24.1.1.1        GigabitEthernet
0/0/1
       24.1.1.0/24  Direct  0    0           D   24.1.1.2        GigabitEthernet
0/0/1
       24.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     24.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/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

5.结果:

r1:
[r1]ping 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=40 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
[r1]ping 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=40 ms
[r1]ping 24.1.1.2
  PING 24.1.1.2: 56  data bytes, press CTRL_C to break
    Reply from 24.1.1.2: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 24.1.1.2: bytes=56 Sequence=2 ttl=254 time=20 ms
    Reply from 24.1.1.2: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 24.1.1.2: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 24.1.1.2: bytes=56 Sequence=5 ttl=254 time=30 ms

r2:
[r2]ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
[r2]ping 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=10 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=40 ms

r3:
[r3]ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=254 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms
[r3]ping 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
[r3]ping 12.1.1.1
  PING 12.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 12.1.1.1: bytes=56 Sequence=1 ttl=254 time=20 ms
    Reply from 12.1.1.1: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 12.1.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 12.1.1.1: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 12.1.1.1: bytes=56 Sequence=5 ttl=254 time=40 ms

 文章来源地址https://www.toymoban.com/news/detail-508567.html

到了这里,关于静态路由用下一跳方法配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 四种静态路由配置方法

    四种静态路由配置方法

    拓扑图如下: 接口IP地址如拓扑图所示,配置过程省略,ar1和ar3都开启了dhcp。过程省略。 ar1的路由表: 此时只有直连的1.0和2.0网段的IP。没有3.0网段的。 那怎么有3.0网段的呢?接下来介绍四种方法。 方法一:递归查找出接口 [r1]ip route-static 192.168.3.0 24 192.168.2.2 我们可以发现

    2024年02月05日
    浏览(6)
  • 静态路由和默认路由详解及配置方法️

    静态路由和默认路由详解及配置方法️

    目录 一.路由详解 1.路由器工作原理: 2.路由表形成: 3.直连路由: 4.非直连路由: 二.静态路由 1.静态路由详解: 2.配置静态路由 三. 默认路由: 1.默认路由详解 2.配置默认路由方法:     四.总结 1.路由器工作原理:                     路由器通过“路由表”转发数据

    2024年02月09日
    浏览(6)
  • 如何配置静态路由?这个实例详解交换机的静态路由配置

    如何配置静态路由?这个实例详解交换机的静态路由配置

    静态路由 是一种 路由的方式 ,它需要通过 手动配置。 静态路由与动态路由不同, 静态路由是固定的,不会改变。 一般来说,静态路由是由网络管理员逐项加入路由表,简单来说,就是需要手动添加的。 问:手动添加有什么好处呢? 答:稳定,可靠 静态路由在交换机中有

    2024年02月04日
    浏览(4)
  • 静态路由基础配置(IP地址的规划、静态路由的配置),实现全网可达。

    静态路由基础配置(IP地址的规划、静态路由的配置),实现全网可达。

     按照图中的拓扑设计,实现全网可达。 首先我们要了解路由器的作用及原理    路由器的作用: 不同网络间的互联 为它所承载的数据做路径的选择 --- 选路 路由器的工作原理: 当数据包进入路由器后,先查看目标IP地址,然后查询本地的路由表,若表中存在记录,将 无条

    2024年02月08日
    浏览(9)
  • 路由器配置-静态路由

    路由器配置-静态路由

    目录 静态路由与动态路由优缺点 静态路由 优点 缺点 动态路由 缺点 优点 总结 静态路由 路由环路 拓展配置 获取未知网段的路由信息方法: 1,静态路由:由网络管理员手工填写的路由信息。 2,动态路由:所有路由器运行相同路由协议,之后,通过路由器之间的沟通,协商

    2024年02月16日
    浏览(7)
  • 配置静态路由与默认路由

    配置静态路由与默认路由

    项目引入:了解静态路由与默认路 项目任务: 任务1.静态路由 任务2.浮动静态路由 任务3.静态路由负载分担 任务4.默认路由 项目引入 •   静态路由 是指用户手动配置在路由器上的路由,告诉路由器如何   根据目的IP地址转发数据包。相比较于动态路由协议,静态路由   的

    2024年02月04日
    浏览(10)
  • 静态路由与动态路由协议OSPF、RIP简介及静态路由配置命令

    - 静态路由协议: 静态路由(Static routing)一般来说,是由网络管理员逐项加入路由表。即使网络状况已经改变或是重新被组态,静态路由也不会发生变化。静态路由的一个好处是网络安全保密性高。动态路由因为需要路由器之间频繁地交换各自的路由表,而对路由表的分析

    2024年02月08日
    浏览(5)
  • 路由器静态路由的配置

    路由器静态路由的配置

    路由器静态路由的配置步骤如下: 进入系统视图。输入命令 sys 进入系统视图。 配置路由器的接口IP地址。命令格式为 int g0/0/0 ,其中 g0/0/0 表示路由器的接口,可以根据实际情况进行修改。然后使用命令 ip add 配置接口的IP地址。 配置下一跳地址。在静态路由配置中,需要指

    2024年02月04日
    浏览(11)
  • 静态路由和默认路由的配置

    静态路由和默认路由的配置

    我们在学习配置路由的时候,得先知道路由是什么。 多层交换机既便宜,接口又多,可连接的设备又多,但是为什么路由器还没有被淘汰?         交换机工作的原理是根据mac地址转发,而且mac地址表会刷新,这就存在一个现象:如果数据接收方改变了,就需要”拆掉“

    2024年02月03日
    浏览(6)
  • 路由之静态路由原理及配置

    路由之静态路由原理及配置

    目录 一、什么是路由 二、路由表的形成 1、什么是路由表 2、路由表形成 三、静态路由 四、默认路由 1、什么是默认路由 2、默认路由的配置 五、路由器转发数据包的封装过程 六、静态路由和默认路由的配置 1、静态路由配置 1.1配置PC2、PC3、PC4主机的IP地址、子网掩码、网关

    2024年02月13日
    浏览(7)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包