目录
1.查看实验编址表
2.配置PC1的IP地址
3.配置PC2的IP地址
4.配置路由器R1接口IP地址
5.验证路由器R1配置结果
6.配置路由器R1接口IP地址
7.验证路由器R1的IP配置结果
8.查看路由器R1配置信息
9.测试路由器R1与PC间的连通性
10.测试PC-1与PC-2间的连通性
11.保存
本实验模拟简单的企业网络场景,某公司购买了新的路由器和交换机。交换机S1连接客服部PC-1,S2连接市场部PC-2,路由器R1连接S1和S2两台交换机。网络管理员需要首先熟悉设备的使用,包括基础的IP配置和查看命令。
1.查看实验编址表
2.配置PC1的IP地址
根据实验编址表,配置PC1的IP地址,如下图。
3.配置PC2的IP地址
根据实验编址表,配置PC2的IP地址,如下图。
4.配置路由器R1接口IP地址
在系统视图下进入接口视图,在该视图下可以配置接口相关的物理属性、链路层特性及IP地址等重要参数。使用interface 命令进入路由器相应的接口视图GE 0/0/0 。在路由器的接口视图下配置路由器接口IP地址和掩码。注意,华为设备上的物理接口默认都处于开启状态。
system-view
sysname R1
interface GigabitEthernet 0/0/0
ip address 10.0.1.254 255.255.255.0
5.验证路由器R1配置结果
配置完成后,使用display ip interface brief命令查看接口与IP相关摘要信息。
[R1-GigabitEthernet0/0/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 2
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.1.254/24 up up
GigabitEthernet0/0/1 unassigned up down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
可以观察到,路由器接口GE 0/0/0的IP地址已经配置完成,“Physical”为UP,即接口的物理状态处于正常启动的状态,“Protocol”为UP,即接口的链路协议状态处于正常启动的状态。
display ip interface brief
6.配置路由器R1接口IP地址
同上配置路由器GE 0/0/1的IP地址。如果在配置过程中对命令非常熟悉,可以使用简写的方式配置。(注意,即便是简写,也要保证所输入的命令关键字是唯一的,否则不会成功。)
int g0/0/1
ip add 10.0.2.254 24
return
7.验证路由器R1的IP配置结果
配置完成后,再次确认接口与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)
可以观察到,路由器的GE 0/0/0与GE 0/0/1的接口IP地址已经配置完成。物理接口工作正常,“Physical”为UP,即接口的物理状态处于正常启动的状态,“Protocol”为UP,即接口的链路协议状态处于正常启动的状态。
display ip interface brief
8.查看路由器R1配置信息
经过以上步骤的配置,路由器接口的IP地址已经配置完成,可以使用命令display ip routing-table查看IPv4路由表的信息。
执行命令
<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 GigabitEthernet0/0/0
10.0.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
10.0.2.0/24 Direct 0 0 D 10.0.2.254 GigabitEthernet0/0/1
10.0.2.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
10.0.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/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在GE 0/0/0接口上直连了一个10.0.1.0/24的网段,在G0/0/1接口上直连了一个10.0.2.0/24的网段。其中“Route Flags”为路由标记,“R”表示该路由是迭代路由,“D”表示该路由下发到FIB表。“Routing Tables:Public”表示此路由表是公网路由表,如果是私网路由表,则显示私网的名称,如Routing Tables: ABC。“Destinations”表示显示目的网络/主机的总数。“Routes”表示显示路由的总数。“Destination/Mask”表示显示目的网络/主机的地址和掩码长度。“Proto”表示接收此路由的路由协议,“Direct”表示直连路由。“Pre”表示此路由的优先级。“Cost”表示此路由的路由开销值。“Next Hop”表示此路由的下一跳地址。“Interface”表示此路由下一跳的出接口。
display ip routing-table
9.测试路由器R1与PC间的连通性
使用Ping命令测试路由器R1与PC间的连通性,以测试去往PC-1的连通性为例。
执行命令:
<R1>ping 10.0.1.1
显示为以下结果,则表明测试连通性正常:
PING 10.0.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.0.1.1: bytes=56 Sequence=1 ttl=128 time=200 ms
Reply from 10.0.1.1: bytes=56 Sequence=2 ttl=128 time=70 ms
Reply from 10.0.1.1: bytes=56 Sequence=3 ttl=128 time=40 ms
Reply from 10.0.1.1: bytes=56 Sequence=4 ttl=128 time=1 ms
Reply from 10.0.1.1: bytes=56 Sequence=5 ttl=128 time=10 ms
--- 10.0.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 1/64/200 ms
显示为下述结果,则表示连通性测试失败,即R1与PC-1连通性异常:
PING 10.0.1.1: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 10.0.1.1 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
return
ping 10.0.1.1
10.测试PC-1与PC-2间的连通性
直连网段连通性测试完毕后,测试非直连设备的连通性,即PC-1与PC-2的连通性。
执行命令:
PC>ping 10.0.2.1
显示以下结果,说明PC-1与PC-2之间能正常通信:
Ping 10.0.2.1: 32 data bytes, Press Ctrl_C to break
From 10.0.2.1: bytes=32 seq=1 ttl=127 time=47 ms
From 10.0.2.1: bytes=32 seq=2 ttl=127 time=47 ms
From 10.0.2.1: bytes=32 seq=3 ttl=127 time=47 ms
From 10.0.2.1: bytes=32 seq=4 ttl=127 time=62 ms
From 10.0.2.1: bytes=32 seq=5 ttl=127 time=32 ms
--- 10.0.2.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 32/47/62 ms
文章来源:https://www.toymoban.com/news/detail-762754.html
ping 10.0.2.1
11.保存
完成实验后,将路由器执行Save命令保存配置文件
<R1>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 activate文章来源地址https://www.toymoban.com/news/detail-762754.html
save
到了这里,关于熟悉常用的IP相关命令-新版(2)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!