熟悉常用的IP相关命令-新版(2)

目录

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-1S2连接市场部PC-2,路由器R1连接S1S2两台交换机。网络管理员需要首先熟悉设备的使用,包括基础的IP配置和查看命令。

1.查看实验编址表

2.配置PC1IP地址

根据实验编址表,配置PC1IP地址,如下图。

3.配置PC2IP地址

根据实验编址表,配置PC2IP地址,如下图。

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/0IP地址已经配置完成,“Physical”为UP,即接口的物理状态处于正常启动的状态,“Protocol”为UP,即接口的链路协议状态处于正常启动的状态。

display ip interface brief

6.配置路由器R1接口IP地址

同上配置路由器GE 0/0/1IP地址。如果在配置过程中对命令非常熟悉,可以使用简写的方式配置。(注意,即便是简写,也要保证所输入的命令关键字是唯一的,否则不会成功。)

int g0/0/1
ip add 10.0.2.254 24
return

7.验证路由器R1IP配置结果

配置完成后,再次确认接口与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/0GE 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


可以观察到,路由器R1GE 0/0/0接口上直连了一个10.0.1.0/24的网段,在G0/0/1接口上直连了一个10.0.2.0/24的网段。其中“Route Flags”为路由标记,“R”表示该路由是迭代路由,“D”表示该路由下发到FIB表。“Routing TablesPublic”表示此路由表是公网路由表,如果是私网路由表,则显示私网的名称,如Routing Tables: ABC。“Destinations”表示显示目的网络/主机的总数。“Routes”表示显示路由的总数。“Destination/Mask”表示显示目的网络/主机的地址和掩码长度。“Proto”表示接收此路由的路由协议,“Direct”表示直连路由。“Pre”表示此路由的优先级。“Cost”表示此路由的路由开销值。“Next Hop”表示此路由的下一跳地址。“Interface”表示此路由下一跳的出接口。

display ip routing-table

9.测试路由器R1PC间的连通性

使用Ping命令测试路由器R1PC间的连通性,以测试去往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


显示为下述结果,则表示连通性测试失败,即R1PC-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-1PC-2间的连通性

直连网段连通性测试完毕后,测试非直连设备的连通性,即PC-1PC-2的连通性。
执行命令:

PC>ping 10.0.2.1

显示以下结果,说明PC-1PC-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

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

save
  • 17
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值