ENSP路由器的基本命令操作(第十六课)
1-1 代码重点回顾
1 ipconfig 查看 pc机的IP地址
2 ping 连接的IP地址
3 system-view 进入系统视图
4 [Huawei]interface GigabitEthernet 0/0/1 进入接口视图 过0/0/1
5 quit 返回上一层视图
6 ctrl+Z 快速返回用户视图
7 [sy]sysname tedu-ntd-lswl 进入系统视图改名字
8 shutdown 禁用
9 undo shutdown 启用
10 display current-configuration 查看当前配置
11 save 保存配置
12 [tedu-ntd-lsw1] user-interface console 0 //进终端配置
13 [tedu-ntd-lsw1-ui-console0] set authentication password cipher Taren1 //设置终端登录密码为 Taren1
14 [tedu-ntd-lsw1-ui-console0] authentication-mode password //启用密码认证
15 [tedu-ntd-lsw1-ui-console0] idle-timeout 2880 //将闲置超时设为2880分钟
16 <tedu-ntd-lsw1> reset saved-configuration
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:Y //提示是否恢复选Y
<tedu-ntd-lsw1> reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the configuration file for the n
ext startup:, Continue?[Y/N]:N //提示是否保存选N
Info: If want to reboot with saving diagnostic information, input 'N' and then e
xecute 'reboot save diagnostic-information'.
System will reboot! Continue?[Y/N]:Y //提示是否重启选Y
.. ..
<Huawei> //重启完毕后,已恢复出厂设置
17 <Huawei>u t m //关闭日志提醒
18 <Huawei>sys //进入系统视图
19 [Huawei]sys lsw1 //设置交换机名字lsw1
20 [lsw1]inter vlan 1 //进虚接口vlan1配置
21 [lsw1-Vlanif1]ip addr 192.168.1.251 24 //设置IP地址
22 [lsw1-Vlanif1]dis cu //验证操作
23 <lsw2 > telnet 192.168.1.251 //连接指定地址的交换机
1-2上面的代码实操回顾
1.2.1 操作命令 ipconfig
elcome to use PC Simulator!
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe0e:3bb
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-0E-03-BB
DNS server........................:
PC>ipconfig /all
Usage: ipconfig [?] [/renew] [/release] [/renew6] [/release6]
Options:
? Display this help message
/renew Renew the IPv4 address
/release Release the IPv4 address
/renew6 Renew the IPv6 address
/release6 Release the IPv6 address
PC>
1.2.2 操作命令二 使用交换机 将之前的命令写上一遍
<Huawei> sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/1
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]quit
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]quit
<Huawei>sysn
<Huawei>sysn
^
Error: Unrecognized command found at '^' position.
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sysn
[Huawei]sysname look-lswsa
[look-lswsa]
Jul 16 2023 22:18:30-08:00 look-lswsa DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.20
11.5.25.191.3.1 configurations have been changed. The current change number is 4
, the change loop count is 0, and the maximum number of records is 4095.
[look-lswsa] dis
[look-lswsa]display cu
[look-lswsa]display current-configuration
#
sysname look-lswsa
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
[look-lswsa]
[look-lswsa]save
[look-lswsa]save
^
Error: Unrecognized command found at '^' position.
[look-lswsa]
<look-lswsa>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Jul 16 2023 22:19:35-08:00 look-lswsa %%01CFM/4/SAVE(l)[0]:The user chose Y when
deciding whether to save the configuration to the device.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<look-lswsa>
<look-lswsa>u t m
Info: Current terminal monitor is off.
<look-lswsa>
1-3 路由器的学习 路由器的ENSP基本命令操作 (重点 难点 直连路由)
1-3.1 路由器的定义
路由器是一种网络设备,用于将网络数据包从一个网络接口路由到另一个网络接口。它能够连接多个设备,为它们提供网络连接和管理网络流量。路由器通常用于家庭、办公室和企业环境中,用于连接多个计算机、智能手机、平板电脑、网络打印机等设备,并将它们连接到互联网上。路由器通过连接到互联网的调制解调器,将网络设备中的数据包传输到互联网上,并从互联网上路由数据包到正确的目标设备,使网络设备可以互相通信。
1-3.2 路由器的相关的知识
11) 路由:数据从一个网络到另外一个网络之间转发数据包的过程称为路由
2) 路由器:连接不同网络,实现不同网段之间的通信
3)路由表:路由器选择数据的传输路径的依据
路由器的工作原理 如下
1 路由器接收数据包 检查数据包中的目标IP
2 在路由表中查找与目标IP相匹配的路由条目
3 路由表中找到与目标IP相匹配的路由条目后,按照此条目所指的方向将数据转发出去
1-3.3远程管理交换机
交换机A
The device is running!
//交换机一
<Huawei> u t m
Info: Current terminal monitor is off.
<Huawei> sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sys
[Huawei]sysname lws6
[lws6]
[lws6]in
[lws6]int
[lws6]interface vlan 1
[lws6-Vlanif1]
[lws6-Vlanif1]ip address 192.168.1.251 24
[lws6-Vlanif1]dis cu
[lws6-Vlanif1]dis current-configuration
#
sysname lws6
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
ip address 192.168.1.251 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
。。。。。。。。。。。。。
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
[lws6-Vlanif1]
<lws6>sys
<lws6>system-view
Enter system view, return user view with Ctrl+Z.
[lws6]user
[lws6]user-in
[lws6]user-interface vty 0 4
[lws6-ui-vty0-4] set authentication password cipher 123456
[lws6-ui-vty0-4]user privilege level 3
[lws6-ui-vty0-4]
交换机A 重点代码操作
<Huawei>u t m //关闭日志提醒
<Huawei>system-view //进入系统视图
[Huawei]sysname lws6 // 进入系统视图改名字
[lws6]interface vlan 1 //进入虚拟接口
[lws6-Vlanif1]ip address 192.168.1.251 24 // //设置IP地址
[lws6-Vlanif1]dis current-configuration // 查看当前配置
[lws6]user-interface vty 0 4 //进远程登录配置视图
[lws6-ui-vty0-4] set authentication password cipher 123456 //启用密码认证
[lws6-ui-vty0-4]user privilege level 3 //设置权限级别
交换机B
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname lsw7
[lsw7]int
[lsw7]interface vlsn 1
^
Error: Wrong parameter found at '^' position.
[lsw7]int
[lsw7]interface vlan 1
[lsw7-Vlanif1]ip addr
[lsw7-Vlanif1]ip address
^
Error:Incomplete command found at '^' position.
[lsw7-Vlanif1]ip add
[lsw7-Vlanif1]ip address 192.168.1.252 24
[lsw7-Vlanif1]dis cu
[lsw7-Vlanif1]dis current-configuration
#
sysname lsw7
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
ip address 192.168.1.252 255.255.255.0
#
interface MEth0/0/1
。。。。。。。。。
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
[lsw7-Vlanif1]
[lsw7-Vlanif1]
<lsw7> te
<lsw7>terminal 192.168.1.251
^
Error: Unrecognized command found at '^' position.
<lsw7>tel
<lsw7>telnet 192.168.1.251
Trying 192.168.1.251 ...
Press CTRL+K to abort
Connected to 192.168.1.251 ...
Login authentication
Password:
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 1.
The current login time is 2023-07-16 16:03:02.
<lws6>
交换机B 重点代码操作
<Huawei>u t m //关闭日志提醒
<Huawei>system-view //进入系统视图
[Huawei]sysname lws6 // 进入系统视图改名字
[lws6]interface vlan 1 //进入虚拟接口
[lws6-Vlanif1]ip address 192.168.1.251 24 // //设置IP地址
[lws6-Vlanif1]dis current-configuration // 查看当前配置
[lws6]user-interface vty 0 4 //进远程登录配置视图
[lws6-ui-vty0-4] set authentication password cipher 123456 //启用密码认证
[lws6-ui-vty0-4]user privilege level 3 //设置权限级别
<lsw2 > telnet 192.168.1.251 //连接指定地址的交换机
Password: Taren1 //输入正确密码,实际不显示
Info: The max number of VTY users is 5, and the number
of current VTY users on line is 1.
<lsw1> //成功连接
<lsw1>sys
Enter system view, return user view with Ctrl+Z.
1-3-4 路由器连多个网段 实现多网段互通
Welcome to use PC Simulator!
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe0c:1bf6
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-0C-1B-F6
DNS server........................:
在路由器上操在 配置 路由的两个网关地址
The device is running!
<Huawei>u t m
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sys
[Huawei]sysname ar1
[ar1]interface g0/0/1
[ar1-GigabitEthernet0/0/1]
[ar1-GigabitEthernet0/0/1]ip addr
[ar1-GigabitEthernet0/0/1]ip address 192.168.1.254 24
[ar1-GigabitEthernet0/0/1]quit
[ar1]interface g0/0/2
[ar1-GigabitEthernet0/0/2] ip addr
[ar1-GigabitEthernet0/0/2]ip address 192.168.2.254 24
[ar1-GigabitEthernet0/0/2]quit
[ar1]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
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
[ar1]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.1: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.2.1: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.2.1: bytes=32 seq=4 ttl=127 time=63 ms
From 192.168.2.1: bytes=32 seq=5 ttl=127 time=62 ms
--- 192.168.2.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/62/78 ms
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.2: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.2.2: bytes=32 seq=3 ttl=127 time=62 ms
From 192.168.2.2: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.2.2: bytes=32 seq=5 ttl=127 time=78 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/66/78 ms
PC>ping 192.168.1.2
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.2: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.1.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/47 ms
难度升级 原理同样
C>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.1: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.2.1: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.2.1: bytes=32 seq=4 ttl=127 time=63 ms
From 192.168.2.1: bytes=32 seq=5 ttl=127 time=62 ms
--- 192.168.2.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/62/78 ms
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.2: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.2.2: bytes=32 seq=3 ttl=127 time=62 ms
From 192.168.2.2: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.2.2: bytes=32 seq=5 ttl=127 time=78 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/66/78 ms
PC>ping 192.168.1.2
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.2: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.1.2: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/47 ms
<ar1>sys
<ar1>system-view
Enter system view, return user view with Ctrl+Z.
[ar1] int
[ar1]interface go/0/3
[ar1]interface go/0/3
^
Error: Wrong parameter found at '^' position.
[ar1]int
[ar1]interface g0/0/3
[ar1]interface g0/0/3
^
Error: Wrong parameter found at '^' position.
[ar1]in
[ar1]int
[ar1]interface g0/0/0
[ar1]interface g0/0/0
[ar1-GigabitEthernet0/0/0] ip
[ar1-GigabitEthernet0/0/0]ip add
[ar1-GigabitEthernet0/0/0]ip address 192.168.3.254 24
Jul 16 2023 14:58:40-08:00 ar1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[ar1-GigabitEthernet0/0/0]
[ar1-GigabitEthernet0/0/0] dis
[ar1-GigabitEthernet0/0/0]disp
[ar1-GigabitEthernet0/0/0]display ip
[ar1-GigabitEthernet0/0/0]display ip r
[ar1-GigabitEthernet0/0/0]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
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
192.168.3.0/24 Direct 0 0 D 192.168.3.254 GigabitEthernet
0/0/0
192.168.3.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[ar1-GigabitEthernet0/0/0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
PC> ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe0c:1bf6
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.1
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-0C-1B-F6
DNS server........................:
PC>ping 192.168.1.2
Ping 192.168.1.2: 32 data bytes, Press Ctrl_C to break
From 192.168.1.2: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.1.2: bytes=32 seq=3 ttl=128 time=32 ms
From 192.168.1.2: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.1.2: bytes=32 seq=5 ttl=128 time=46 ms
--- 192.168.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/47 ms
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
From 192.168.2.1: bytes=32 seq=1 ttl=127 time=63 ms
From 192.168.2.1: bytes=32 seq=2 ttl=127 time=47 ms
From 192.168.2.1: bytes=32 seq=3 ttl=127 time=62 ms
From 192.168.2.1: bytes=32 seq=4 ttl=127 time=94 ms
From 192.168.2.1: bytes=32 seq=5 ttl=127 time=78 ms
--- 192.168.2.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/68/94 ms
PC>ping192.168.3.2
Invalid command!
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.3.2: bytes=32 seq=2 ttl=127 time=63 ms
From 192.168.3.2: bytes=32 seq=3 ttl=127 time=62 ms
From 192.168.3.2: bytes=32 seq=4 ttl=127 time=94 ms
From 192.168.3.2: bytes=32 seq=5 ttl=127 time=47 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/66/94 ms
PC>