HCIA 静态路由&默认路由的配置

本文详细介绍了华为路由器的工作原理,重点讲解了静态路由的配置,包括实验一和实验二的配置过程,并通过浮动路由展示了负载均衡。接着解释了默认路由的概念,演示了如何配置默认路由以实现数据包的外网访问。
摘要由CSDN通过智能技术生成

大家好! 我是C07,在这里跟大家讲一下静态路由&动态路由的相关配置~

文章目录

  • 路由器工作原理
  • 路由是什么?
  • 静态路由
    • 什么是静态路由
    • 静态路由的配置
  • 默认路由
    • 什么是静态路由
    • 静态路由的配置

一、路由器的工作原理

    一台路由器当收到数据包时,会由下往上进行解封装。当解封装到数据链路层时,只有在目的MAC为自己时才会接收(不是则丢弃),再进行解封装,当解封装到网络层时,发现目的IP地址不是给自己的,路由器则会查询路由表进行转发,如果路由表中不存在则丢弃。

华为路由器设备查询路由表的命令:

display ip routing-table

二、路由是什么?

简单来说,路由就像我们的导航一样,将一个个目的地写在一张地图中,路由是网络中的导航,指导数据包从起源到目的地的访问

就像我们的某某导航,会将我们想去的地方一个个的罗列出来,下一站该怎么走(是高铁还是大巴还是步行)
 会在最上面列出一个最优的方案(而我们的路由表也是如此,但有些不一致的是路由器只会将同一目的地最优的路由列出来)

二、静态路由

我们的实验会从简单到难,循序渐进

实验一:

实验设备清单:

        AR1220*3

拓扑图:

#AR1路由器配置

#从用户视图切换成系统视图
[Huawei]system-view

#将我们的路由器命名为AR1
[Huawei]sysname AR1

#配置AR1接口g0/0/0 将接口IP地址配置成12.1.1.1/24
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
#从接口视图切换成用户视图
[AR1-GigabitEthernet0/0/0]return
#保存我们的配置
<AR1>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<AR1>


#AR2路由器配置

#从用户视图切换成系统视图
[Huawei]system-view

#将我们的路由器命名为AR2
[Huawei]sysname AR2

#配置AR2接口g0/0/0 将接口IP地址配置成12.1.1.2/24
[AR2]interface g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 12.1.1.2 24

#配置AR2接口g0/0/1 将接口IP地址配置成24.1.1.2/24
[AR2]interface g0/0/1
[AR2-GigabitEthernet0/0/0]ip add 24.1.1.2 24

#从接口视图切换成用户视图
[AR2-GigabitEthernet0/0/0]return
#保存我们的配置
<AR2>save
  The current configuration will be written to the device. 
  Are you sure to continue? (y/n)[n]:y
  It will take several minutes to save configuration file, please wait.......
  Configuration file had been saved successfully
  Note: The configuration file will take effect after being activated
<AR2>

#我们也可以通过display ip interface brief来查看我们所配置的接口IP地址以及状态是否UP
<AR2>display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask 
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值