路由器基础应用

路由器

- 是一种转发各网络间数据的设备

路由器一方面为数据转发提供最佳路径,
另一方面为直连网络主机终端充当“网关”。

- 是实现网络互连的核心设备

在这里插入图片描述

路由器工作原理

- 每台路由器都有一份路由表,记录着
     1.转发数据到某网络的相应接口
     2.到达下一个路由器(或主机终端)的地址
- 工作原理
     1.检查数据包的目标IP地址
     2.通过路由表查找到达目标的路线,并选择最佳路线
     3.由最佳路线转发数据包

在这里插入图片描述

路由器基本配置

配置设备名与接口地址

设备名(sysname )
接口地址(ip address IP地址 掩码位数)

配置命令:
<:Huawei>system-view //进入系统视图
[Huawei]sysname ar1 //配置设备名为ar1
[ar1]interface g0/0/1 //进入接口g0/0/1配置视图
[ar1-GigabitEthernet0/0/1]ip address 192.168.1.254 24//配置IP地址
[ar1-GigabitEthernet0/0/1]quit
[ar1]int g0/0/2
[ar1-GigabitEthernet0/0/2]ip address 192.168.2.254 24

查看路由表

display ip routing-table
[ar1]display ip routing-table

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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.254 GigabitEthernet
0/0/1
192.168.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.2.0/24 Direct 0 0 D 192.168.2.254 GigabitEthernet
0/0/2
192.168.2.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

保存路由器配置

save
<:ar1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y //提示继续时选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>

猜你喜欢

转载自blog.csdn.net/weixin_44520274/article/details/86573965
今日推荐