静态路由设置

本文通过具体的路由器配置示例,展示了如何设置静态路由以实现不同网络间的ping通。在R1上设置静态路由到达10.10.10.2,而在R5上设置静态路由到达192.168.0.2,从而确保了网络间的通信。路由表的设置涉及下一跳地址的确定,这对于理解网络路由原理至关重要。
摘要由CSDN通过智能技术生成

学习路由表(静态路由)

如下图的拓扑图;

设置各个路由的ip地址

R1: eth0:192.168.0.2

R2: eth0:192.168.0.3

R2:eth1:10.10.10.1

R5:eth0:10.10.10.2

谁要ping通谁,地址设置:

要求:

(1)登录到R1:ping 10.10.10.2           

(2)登录到 R5: ping 192.168.0.2

写路由表:

R1:192.168.0.0/24    192.168.0.3/32

R2:192.168.0.0/24   192.168.0.2/32    10.10.10.0/24    10.10.10.2/32

R3:10.10.10.0/24  10.10.10.1/32

问题:网络路由是寻找下一跳的,那么我们怎么设置ip route-static呢! IP route=static 目的地址,32,网关

其中的网关就是根据路由表来设置的。

R1设置

[Huawei]display this 
#
sysname Huawei
#
ip route-static 10.10.10.2 255.255.255.255 192.168.0.3
#
return
[Huawei]in	
[Huawei]inter	
[Huawei]interface Eth	
[Huawei]interface Ethernet0/0/0
[Huawei-Ethernet0/0/0]
[Huawei-Ethernet0/0/0]dis	
[Huawei-Ethernet0/0/0]display th	
[Huawei-Ethernet0/0/0]display this 
#
interface Ethernet0/0/0
 ip address 192.168.0.2 255.255.255.0
#
return
[Huawei-Ethernet0/0/0]

[Huawei-Ethernet0/0/0]q
[Huawei]
[Huawei]
[Huawei]ping 10.10.10.2
  PING 10.10.10.2: 56  data bytes, press CTRL_C to break
    Reply from 10.10.10.2: bytes=56 Sequence=1 ttl=254 time=60 ms
    Reply from 10.10.10.2: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 10.10.10.2: bytes=56 Sequence=3 ttl=254 time=50 ms
    Reply from 10.10.10.2: bytes=56 Sequence=4 ttl=254 time=60 ms
    Reply from 10.10.10.2: bytes=56 Sequence=5 ttl=254 time=70 ms

  --- 10.10.10.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/54/70 ms

R2 设置

<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]inter	
[Huawei]interface Ether	
[Huawei]interface Ethernet0/0/0
[Huawei-Ethernet0/0/0]displ	
[Huawei-Ethernet0/0/0]display thi	
[Huawei-Ethernet0/0/0]display this 
#
interface Ethernet0/0/0
 ip address 192.168.0.3 255.255.255.0
#
return
[Huawei-Ethernet0/0/0]q
[Huawei]interface Ethernet0/0/1
[Huawei-Ethernet0/0/1]display this
#
interface Ethernet0/0/1
 ip address 10.10.10.1 255.255.255.0
#
return
[Huawei-Ethernet0/0/1]

R5 设置:

  1. <Huawei>system-view 
    Enter system view, return user view with Ctrl+Z.
    [Huawei]display this
    #
    sysname Huawei
    #
    ip route-static 192.168.0.2 255.255.255.255 10.10.10.1
    #
    return
    [Huawei]interface Ether	
    [Huawei]interface Ethernet0/0/0
    [Huawei-Ethernet0/0/0]display th	
    [Huawei-Ethernet0/0/0]display this 
    #
    interface Ethernet0/0/0
     ip address 10.10.10.2 255.255.255.0
    #
    return
    [Huawei-Ethernet0/0/0]q
    [Huawei]ping 192.168.0.2
      PING 192.168.0.2: 56  data bytes, press CTRL_C to break
        Reply from 192.168.0.2: bytes=56 Sequence=1 ttl=254 time=80 ms
        Reply from 192.168.0.2: bytes=56 Sequence=2 ttl=254 time=60 ms
        Reply from 192.168.0.2: bytes=56 Sequence=3 ttl=254 time=60 ms
        Reply from 192.168.0.2: bytes=56 Sequence=4 ttl=254 time=60 ms
        Reply from 192.168.0.2: bytes=56 Sequence=5 ttl=254 time=40 ms
    
      --- 192.168.0.2 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 40/60/80 ms
    
    [Huawei]
    

     

    写路由表:

R1:Ethernet0/0/0 192.168.0.2 

R2:Ethernet0/0/0 192.168.0.4 

R2:Ethernet0/0/1 10.10.10.1 

R5:Ethernet0/0/0 10.10.10.3

R5:Ethernet0/0/1 1.1.1.2

R7:Ethernet0/0/1 1.1.1.5

根据上面的ip 写出上面图的路由表以及他的路由设置。

R1:192.168.0.0/24  192.168.0.3/32

R2:192.168.0.0/24 192.168.0.2/24   10.10.10.2/32 10.10.10.0/24

R5:10.10.10.0/24 10.10.10.1/32 1.1.1.4/32 1.1.1.0/24

R7:1.1.1.0/24 1.1.1.2/32

设置路由:

r1设置:

ip route-static 192.168.0.3 255.255.255.255 1.1.1.4

r2:设置:

ip route-static 10.10.10.2 255.255.255.255 1.1.1.4

r5设置:

ip route-static 10.10.10.1 255.255.255.255 192.168.0.2

r7设置:

ip route-static 1.1.1.2 255.255.255.255 192.168.0.2

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陌上花开缓缓归以

你的鼓励将是我创作的最大动力,

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值