祖瑞科技 全国计算机 网络IT运维社区!

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 7772|回复: 0

HCNA-19 全网全通静态路由及默认路由配置

[复制链接]

205

主题

218

帖子

1286

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1286
发表于 2021-2-5 16:29:12 | 显示全部楼层 |阅读模式
HCNA-19 全网全通静态路由及默认路由配置

<Huawei>system-view
[Huawei]sysnamer1
[r1]interfaceGigabitEthernet 0/0/2
[r1-GigabitEthernet0/0/2]ipaddress 172.16.10.1 24
[r1-GigabitEthernet0/0/2]quit
[r1]interfaceGigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ipaddress 172.16.12.1 24
[r1-GigabitEthernet0/0/0]quit
[r1]iproute-static 172.16.23.0 24 172.16.12.2  //配置静态路由目标网段+掩码+下一跳地址
[r1]iproute-static 172.16.30.0 24 172.16.12.2
[r1]displayip interface brief  //查看IP接口摘要信息
<Huawei>system-view
[Huawei]sysname  
[Huawei]sysnamer2
[r2]interfaceGigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ipaddress 172.16.12.2 24
[r2-GigabitEthernet0/0/0]quit
[r2]interfaceGigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ipaddress 172.16.23.2 24
[r2-GigabitEthernet0/0/1]quit
[r2]iproute-static 172.16.10.0 24 172.16.12.1
[r2]iproute-static 172.16.30.0 24 172.16.23.3
[r2]displayip interface brief
<Huawei>system-view
[Huawei]sysnamer3
[r3]interfaceGigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]ipaddress 172.16.23.3 24
[r3-GigabitEthernet0/0/1]quit
[r3]interfaceGigabitEthernet 0/0/2
[r3-GigabitEthernet0/0/2]ipaddress 172.16.30.1 24
[r3-GigabitEthernet0/0/2]quit
[r3]displayip interface brief
[r1]displayip routing-table   //查看IP路由表
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
         Destinations : 12       Routes : 12      
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
……
    172.16.23.0/24  Static 60   0          RD  172.16.12.2     GigabitEthernet
0/0/0
    172.16.30.0/24  Static 60   0          RD  172.16.12.2     GigabitEthernet
0/0/0
255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
[r2]displayip routing-table
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
         Destinations : 12       Routes : 12      
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
      127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0
   ……
    172.16.10.0/24  Static 60   0          RD  172.16.12.1     GigabitEthernet
  ……
    172.16.30.0/24  Static 60   0          RD  172.16.23.3     GigabitEthernet
0/0/1
255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
[r3]displayip routing-table
RouteFlags: R - relay, D - download to fib
------------------------------------------------------------------------------
RoutingTables: Public
         Destinations : 12       Routes : 12      
Destination/Mask    Proto  Pre  Cost      Flags NextHop         Interface
      127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0
……
    172.16.10.0/24  Static 60   0          RD  172.16.23.2     GigabitEthernet
0/0/1
    172.16.12.0/24  Static 60   0          RD  172.16.23.2     GigabitEthernet
0/0/1
…..
255.255.255.255/32  Direct 0    0           D  127.0.0.1       InLoopBack0
PC>ping172.16.30.100  //PC1Ping 测试PC2
Ping172.16.30.100: 32 data bytes, Press Ctrl_C to break
Requesttimeout!
Requesttimeout!
From172.16.30.100: bytes=32 seq=3 ttl=125 time=16 ms
From172.16.30.100: bytes=32 seq=4 ttl=125 time=31 ms
From172.16.30.100: bytes=32 seq=5 ttl=125 time=16 ms
---172.16.30.100 ping statistics ---
  5 packet(s) transmitted
  3 packet(s) received
  40.00% packet loss
  round-trip min/avg/max = 0/21/31 ms
PC>tracert172.16.30.100  //路由追踪
tracerouteto 172.16.30.100, 8 hops max
(ICMP),press Ctrl+C to stop
1 172.16.10.1   15 ms  16 ms 16 ms
2 172.16.12.2   15 ms  31 ms 16 ms
3 172.16.23.3   78 ms  16 ms 31 ms
4 172.16.30.100   31 ms  32 ms 15 ms
下面配置默认路由
[r1]undoip route-static 172.16.23.0 24 172.16.12.2  //取消原有静态路由
[r1]undoip route-static 172.16.30.0 24 172.16.12.2
[r1]iproute-static 0.0.0.0 0.0.0.0 172.16.12.2 //配置默认路由目标掩码是全0
PC>ping172.16.30.100
Ping172.16.30.100: 32 data bytes, Press Ctrl_C to break
From172.16.30.100: bytes=32 seq=1 ttl=125 time=15 ms
From172.16.30.100: bytes=32 seq=2 ttl=125 time=32 ms
From172.16.30.100: bytes=32 seq=3 ttl=125 time=15 ms
From172.16.30.100: bytes=32 seq=4 ttl=125 time=16 ms
From172.16.30.100: bytes=32 seq=5 ttl=125 time=15 ms
---172.16.30.100 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/18/32 ms
再配置R3默认路由
[r3]undoip route-static 172.16.12.0 24 172.16.23.2
[r3]undoip route-static 172.16.10.0 24 172.16.23.2
[r3]iproute-static 0.0.0.0 0.0.0.0 172.16.23.2
PC>ping172.16.10.100
Ping172.16.10.100: 32 data bytes, Press Ctrl_C to break
From 172.16.10.100:bytes=32 seq=1 ttl=125 time=16 ms
From172.16.10.100: bytes=32 seq=2 ttl=125 time=31 ms
From172.16.10.100: bytes=32 seq=3 ttl=125 time=16 ms
From172.16.10.100: bytes=32 seq=4 ttl=125 time=31 ms
From172.16.10.100: bytes=32 seq=5 ttl=125 time=16 ms
---172.16.10.100 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 16/22/31 ms

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
祖瑞(上海)网络科技有限公司
我们在全国范围提供企业IT运维、网络工程、弱电安装、监控安防、计算机产品收售、办公设备耗材等服务!
期待与您的合作!
邮箱:sanne@zurkj.com
电话:021-51850021 18918292296
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

公司网站

QQ|Archiver|手机版|小黑屋|祖瑞科技 全国计算机 网络IT运维社区! ( 沪ICP备16021636号-2 )

GMT+8, 2024-11-26 03:40 , Processed in 0.040722 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表