实验编址
打开R1的命令行界面,默认是用户视图,在用户视图下,用户可以完成查看运行状态和统计信息等功能。
<Huawei>
路由器主机名默认是Huawei
更改主机名要先进入系统视图
<Huawei>system-view
[Huawei]
[Huawei]sysname R1
输完以后退出当前模式
[R1]quit
保存配置用sav
<R1>save
<R1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
输入y,就可以保存了
配置路由器接口IP地址
[R1]interface GigabitEthernet0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.1.254 255.255.255.0
华为设备上的物理接口默认都是开启状态。
配置完成以后,使用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 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.1.254/24 up up
GigabitEthernet0/0/1 10.0.2.254/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
同样的方法设置GE 0/0/1的IP地址
[R1]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.0.2.254 255.255.255.0
如果忘记命令可以输入inter?再按tab键补齐
配置完成后,再次确认接口与IP相关摘要信息
<R1>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 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.1.254/24 up up
GigabitEthernet0/0/1 10.0.2.254/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
路由器接口的IP地址已经配置完成,可以使用display ip routing-table
<R1>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.1.0/24 Direct 0 0 D 10.0.1.254 GigabitEthernet
0/0/0
10.0.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.0.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.0.2.0/24 Direct 0 0 D 10.0.2.254 GigabitEthernet
0/0/1
10.0.2.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.0.2.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
可以看到路由器R1在GE0/0/0接口上直连了一个10.0.1.0/24的网段,在GE0/0/1接口上直连了一个10.0.2.0/24的网段
"Route Flags"为路由标记。“R”表示该路由是迭代路由,"D"表示该路由下发到FIB表。
“Route Tables:Public”表示此路由表是公网路由表,如果是私网路由表,则显示私网的名称
如“Route Tables:ABC”
Destinations 目标网络主机的总数
“Routes“表示路由总数
”Proto“表示接受此路由的路由协议,”Direct"表示直连路由
“NextHop”表示此路由的下一跳地址
“Interface”路由的下一跳的出接口
思考题:
简化display ip interface brief
答:可以直接输 dis ip in br