Huawei-R&S-网络工程师实验笔记20190525-设备登录、VRP基本配置、文件系统
》Huawei-R&S-网络工程师实验笔记20190525-设备登录、VRP基本配置、文件系统(环回接口、telnet远程、AAA登录、命令行、时钟、banner、文件目录)
》》实验开始,参考《Huawei-R&S-网络工程师实验笔记20190524-XXX》中的拓扑图,使用 Huawei eNSP、Wireshark、Oracle VM VirtualBox 等工具软件,并开启了左侧分支网络的设备。以下将全部使用代码展示实验过程和理解:
The device is running! //本次使用2台设备:交换机SW1和路由器AR1 <Huawei>sy //进入系统视图管理 Enter system view, return user view with Ctrl+Z. [Huawei]sy [Huawei]sysname AR1 //照例将路由器改名,方便辨识 [AR1]int g0/0/1 //进入G0/0/1接口视图管理 [AR1-GigabitEthernet0/0/1]ip address 10.1.1.254 24 //为G0/0/1配置IP地址 May 24 2019 15:54:56-08:00 AR1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. [AR1-GigabitEthernet0/0/1]q //回退系统视图 [AR1]int loopback 0 //配置环回接口0 [AR1-LoopBack0]ip address 10.1.1.253 24 //配的IP与10.1.1.254网络冲突,因为路由是分割广播域的 Error: The specified address conflicts with another address. [AR1-LoopBack0]ip address 10.1.10.254 24 //重新配置环回接口0的IP,无反馈,但已形成2个广播域 [AR1-LoopBack0]dis ip rout [AR1-LoopBack0]dis 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.1.1.0/24 Direct 0 0 D 10.1.1.254 GigabitEthernet0/0/1 10.1.1.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1 10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1 10.1.10.0/24 Direct 0 0 D 10.1.10.254 LoopBack0 10.1.10.254/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.1.10.255/32 Direct 0 0 D 127.0.0.1 LoopBack0 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 [AR1-LoopBack0]q //退出loopback0接口
[AR1]
[AR1]ping 10.1.1.1 //检查与交换机SW1的网络是否连通 PING 10.1.1.1: 56 data bytes, press CTRL_C to break Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=70 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=10 ms Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms --- 10.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 10/30/70 ms //AR1与SW1网络相通
<SW1>sy //切换到SW1,并进入系统视图 Enter system view, return user view with Ctrl+Z. [SW1]dis ip int bri //查看设备所有接口状态 *down: administratively down ^down: standby (l): loopback (s): spoofing The number of interface that is UP in Physical is 2 The number of interface that is DOWN in Physical is 2 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 MEth0/0/1 unassigned down down NULL0 unassigned up up(s) Vlanif1 10.1.1.1/24 up up Vlanif10 10.1.10.1/24 down down
[SW1]user-interface vty ? //查询有哪几路虚拟线路可连接 INTEGER<0-4> The first user terminal interface to be configured //虚拟线路0、1、2、3、4 [SW1]user-interface vty 0 1 //开启vty虚拟线路0和1 [SW1-ui-vty0-1]authentication-mode ? //查询vty虚拟线路下有哪些登录认证模式 aaa AAA authentication //数据库认证模式 none Login without checking //空值,免认证模式(真机中没有该模式) password Authentication through the password of a user terminal interface //密码登录认证模式 [SW1-ui-vty0-1]authentication-mode password //在vty虚拟线路上配置密码登录认证模式 [SW1-ui-vty0-1]set authentication pass [SW1-ui-vty0-1]set authentication password cipher 123 //配置认证密码为123 [SW1-ui-vty0-1] May 24 2019 17:18:22-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 12, the change loop count is 0, and the maximum number of records is 4095. [SW1-ui-vty0-1]user privilege level 15 //配置用户权限等级,15级为最高级,管理员权限 [SW1-ui-vty0-1] May 24 2019 17:19:02-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 13, the change loop count is 0, and the maximum number of records is 4095. [SW1-ui-vty0-1]dis this //查看刚刚操作的命令或动作 # user-interface con 0 user-interface vty 0 1 user privilege level 15 set authentication password cipher VPK)O}H^41y~t+Byca8Y-@w# //因为cipher,故而密码不可见 user-interface vty 2 4 # return [SW1-ui-vty0-1]q [SW1]
<AR1>telnet 10.1.1.1 //直接在AR1用户视图下执行telnet远程命令,无须进入系统视图 Press CTRL_] to quit telnet mode Trying 10.1.1.1 ... Connected to 10.1.1.1 ... Login authentication //成功在AR1上远程连接到SW1 Password: //输入SW1密码123 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 2019-05-24 17:35:02. //成功远程登陆SW1 <SW1>sy <SW1>system-view //成功在AR1上进入SW1的系统视图管理 Enter system view, return user view with Ctrl+Z. <SW1>q //回退到AR1设备 Info: The max number of VTY users is 5, and the number of current VTY users on line is 0. The connection was closed by the remote host <AR1>
<SW1>sy //切换到SW1,并进入系统视图 Enter system view, return user view with Ctrl+Z. [SW1]dis users //查看正登陆的用户 User-Intf Delay Type Network Address AuthenStatus AuthorcmdFlag + 0 CON 0 00:00:00 no Username : Unspecified //本地console登陆的用户,用户名缺省 34 VTY 0 00:00:20 TEL 10.1.1.254 pass no Username : Unspecified //远程虚拟线路VTY登陆的用户,用户名缺省
[SW1]user-interface vty 0 1 //开启vty虚拟线路0和1 [SW1-ui-vty0-1]authentication-mode aaa //为vty虚拟线路0和1配置数据库认证模式 [SW1-ui-vty0-1] May 24 2019 21:58:41-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5 .25.191.3.1 configurations have been changed. The current change number is 8, the change loop count is 0, and the maximum number of records is 4095. [SW1]aaa //使用AAA登录管理 [SW1-aaa]local-user tangjun password simple 123 //在AAA配置模式下创建新用户tangjun和密码123 Info: Add a new user. [SW1-aaa] May 24 2019 21:42:41-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.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. [SW1-aaa]local-user privilege level 10 //为本地用户tangjun配置10级权限 Info: Add a new user. [SW1-aaa] May 24 2019 21:43:21-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5 .25.191.3.1 configurations have been changed. The current change number is 5, the change loop count is 0, and the maximum number of records is 4095. [SW1-aaa]local-user tangjun service-type telnet //为本地用户tangjun配置telnet协议服务 [SW1-aaa] May 24 2019 21:44:31-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5 .25.191.3.1 configurations have been changed. The current change number is 6, the change loop count is 0, and the maximum number of records is 4095.
[SW1]user-interface console 0 //进入console0接口配置 [SW1-ui-console0]idle-timeout 1000 //配置视图超时时长为1000分钟 [SW1-ui-console0] May 24 2019 22:03:31-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5 .25.191.3.1 configurations have been changed. The current change number is 9, the change loop count is 0, and the maximum number of records is 4095. [SW1-ui-console0]screen-length 0 //验证配置命令从头到尾一次显示 [SW1-ui-console0]history-command max-size 20 //配置历史命令缓存的大小为20M [SW1-ui-console0]display history-command //查看缓存的历史命令 [SW1-ui-console0]user-interface maximum 8 //配置最大的登录用户数为8 May 24 2019 22:05:21-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5 .25.191.3.1 configurations have been changed. The current change number is 10, the change loop count is 0, and the maximum number of records is 4095. [SW1]
[SW1]header login information "welcome to tangjun's switch" //配置登录前设备提示“XXX” [SW1] May 24 2019 22:34:32-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 14, the change loop count is 0, and the maximum number of records is 4095. [SW1]header shell information "Hello!You have came to our family" //配置成功登录后设备提示“XXX” [SW1] May 24 2019 22:35:32-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 15, the change loop count is 0, and the maximum number of records is 4095. [SW1]q //回退用户视图 <SW1>reboot //系统重启 Info: The system is now comparing the configuration, please wait. Warning: All the configuration will be saved to the configuration file for the next startup:, Continue?[Y/N]:y Now saving the current configuration to the slot 0. Save the configuration successfully. Info: If want to reboot with saving diagnostic information, input 'N' and then execute 'reboot save diagnostic-information'. System will reboot! Continue?[Y/N]:y May 24 2019 22:52:42-08:00 SW1 %%01CMD/4/REBOOT(l)[0]:The user chose Y when deciding whether to reboot the system. (Task=co0, Ip=**, User=**) <SW1> May 24 2019 22:52:42-08:00 SW1 %%01IFNET/4/BOARD_DISABLE(l)[1]:Board 0 has been unavailable. May 24 2019 22:52:42-08:00 SW1 %%01IFPDT/4/IF_STATE(l)[2]:GigabitEthernet0/0/1 has turned into DOWN state.
-------------------------------------------------------
welcome to tangjun's switch //设备启动时提示“XXX”
Login authentication
Username:tangjun
Password:
Hello!You have came to our family //设备登录后提示“XXX”
Info: The max number of VTY users is 8, and the number
of current VTY users on line is 1.
The current login time is 2008-07-01 08:06:46.
<SW1>
<SW1>display clock //显示时钟信息 2019-05-25 11:21:00-08:00 Saturday Time Zone(China-Standard-Time) : UTC-08:00 <SW1>clock timezone BJ add 8 //配置时区为+8区(BJ可以配置任意字符,表示地区) <SW1>clock ? //查询时钟相关命令 datetime Specify the time and date daylight-saving-time Configure daylight saving time timezone Configure time zone <SW1>clock datetime ? //查询时间配置命令的具体格式 HH:MM:SS Specify the time <SW1>clock datetime 12:30:30 ? //查询日期配置命令的具体格式,注意限制在2000-2099年 YYYY-MM-DD Specify the date from 2000 to 2099 <SW1>clock datetime 12:30:30 1997-07-01//配置时钟错误,注意限制在2000-2099年 Error: Wrong parameter found at '^' position. <SW1> <SW1>clock datetime 12:30:30 2008-07-01 //配置时钟 <SW1>dis clock //显示配置后的时钟信息 2008-07-01 12:30:36+08:00 Tuesday Time Zone(BJ) : UTC+08:00
关于文件系统方面,为了方便演示,先创建一个tangjun.cfg的文件和一个tang的文件目录:
<AR1>pwd //显示当前目录 flash: <AR1>dir //显示当前目录下所有文件信息 Directory of flash:/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 drw- - May 25 2019 12:53:03 dhcp 1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip 2 -rw- 2,263 May 25 2019 01:09:00 statemach.efs 3 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip 4 -rw- 249 May 25 2019 12:18:26 private-data.txt 1,090,732 KB total (784,448 KB free)
<AR1>mkdir tang //创建新目录tang Info: Create directory flash:/tang......Done <AR1>save ? //查询保存配置命令(save命令须在用户视图下执行) STRING<5-64> The name of specific file( *.cfg or *.zip ) all Save all configuration logfile Save logfile <cr> Please press ENTER to execute command <AR1>save tangjun.cfg //保存当前配置为tangjun.cfg文件 Are you sure to save the configuration to tangjun.cfg? (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 activated <AR1>copy tangjun.cfg tang //将tangjun.cfg文件复制到tang目录下 Copy flash:/tangjun.cfg to flash:/tang/tangjun.cfg? (y/n)[n]:y 100% complete Info: Copied file flash:/tangjun.cfg to flash:/tang/tangjun.cfg...Done
<AR1>dir //显示当前目录下所有文件信息(检查刚才的实验效果) Directory of flash:/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 drw- - May 25 2019 12:53:03 dhcp 1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip 2 drw- - May 25 2019 13:11:51 tang 3 -rw- 2,263 May 25 2019 01:09:00 statemach.efs 4 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip 5 -rw- 249 May 25 2019 12:18:26 private-data.txt 6 -rw- 846 May 25 2019 13:10:36 tangjun.cfg //验证tangjun.cfg文件已保存 1,090,732 KB total (784,436 KB free)
<AR1>cd tang //进入tang目录 <AR1>dir //显示当前目录下所有文件信息 Directory of flash:/tang/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 -rw- 846 May 25 2019 13:11:51 tangjun.cfg //验证tangjun.cfg文件已复制到tang目录下 1,090,732 KB total (784,436 KB free) <AR1>delete tangjun.cfg //删除当前目录下的tangjun.cfg文件 Delete flash:/tang/tangjun.cfg? (y/n)[n]:y Info: Deleting file flash:/tang/tangjun.cfg...succeed. <AR1>move flash:/tangjun.cfg tang/ //将根目录下的tangjun.cfg文件移动到tang目录下(注意!命令行末的“/”千万不能漏了敲) Move flash:/tangjun.cfg to flash:/tang/tangjun.cfg? (y/n)[n]:y
%Moved file flash:/tangjun.cfg to flash:/tang/tangjun.cfg.
<AR1>cd tang //进入tang目录
<AR1>dir //显示当前目录下所有文件信息
Directory of flash:/tang/
Idx Attr Size(Byte) Date Time(LMT) FileName
0 -rw- 846 May 25 2019 13:54:51 tangjun.cfg //验证根目录下的tangjun.cfg文件已移动到tang目录下
1,090,732 KB total (784,428 KB free)
<AR1>cd flash: //进入flash根目录 <AR1>dir //显示当前目录下所有文件信息(检查文件move情况) Directory of flash:/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 drw- - May 25 2019 12:53:03 dhcp 1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip 2 drw- - May 25 2019 13:14:54 tang 3 -rw- 2,263 May 25 2019 01:09:00 statemach.efs 4 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip 5 -rw- 249 May 25 2019 12:18:26 private-data.txt 1,090,732 KB total (784,432 KB free)
<AR1>rename flash:/tang/tangjun.cfg flash:/tang/yunyun.txt //文件重命名,可自由修改格式(前提:同一目录下)
Rename flash:/tang/tangjun.cfg to flash:/tang/yunyun.txt? (y/n)[n]:y //是否将tangjun.cfg重命名为yunyun.txt
Info: Rename file flash:/tang/tangjun.cfg to flash:/tang/yunyun.txt ......Done
<AR1>cd tang //进入tang目录
<AR1>rename yunyun.txt chengzi.cfg //文件重命名,文件所在的当前目录下可直接敲击文件名就OK
Rename flash:/tang/yunyun.txt to flash:/tang/chengzi.cfg? (y/n)[n]:y //是否将yunyun.txt重命名为chengzi.cfg
Info: Rename file flash:/tang/yunyun.txt to flash:/tang/chengzi.cfg ......Done
<AR1>dir //显示当前目录下所有文件信息(检查文件rename情况)
Directory of flash:/tang/
Idx Attr Size(Byte) Date Time(LMT) FileName
0 -rw- 846 May 25 2019 13:54:51 chengzi.cfg
1,090,732 KB total (784,428 KB free)
<AR1>
<AR1>delete chengzi.cfg //删除当前目录下chengzi.cfg文件
Delete flash:/tang/chengzi.cfg? (y/n)[n]:y
Info: Deleting file flash:/tang/chengzi.cfg...succeed.
<AR1>
<AR1>cd flash: //进入flash根目录
<AR1>rmdir tang //移除tang目录
Remove directory flash:/tang? (y/n)[n]:y
%Removing directory flash:/tang...Done!
<AR1>dir //显示当前目录下所有文件信息(tang目录和其下文件已删除)
Directory of flash:/
Idx Attr Size(Byte) Date Time(LMT) FileName
0 drw- - May 25 2019 12:53:03 dhcp
1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip
2 -rw- 2,263 May 25 2019 01:09:00 statemach.efs
3 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip
4 -rw- 249 May 25 2019 12:18:26 private-data.txt
1,090,732 KB total (784,448 KB free)
<AR1>undelete tangjun.cfg //恢复已被删除的文件
Undelete flash:/tangjun.cfg? (y/n)[n]:y
%Undeleted file flash:/tangjun.cfg.
<AR1>reset recycle-bin //彻底清空回收站(前提:回收站已存在删除文件)
Squeeze flash:/tangjun.cfg? (y/n)[n]:y
Clear file from flash will take a long time if needed...Done.
%Cleared file flash:/tangjun.cfg.
<AR1>
<AR1>reset saved-configuration //清空保存的配置文件 This will delete the configuration in the flash memory. The device configurations will be erased to reconfigure. Are you sure? (y/n)[n]:y Clear the configuration in the device successfully. <AR1>reboot //重新启动才能清除配置 Info: The system is comparing the configuration, please wait. Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n //这里一定要输入N,否则操作无效(易错) System will reboot! Continue ? [y/n]:y Info: system is rebooting ,please wait... <AR1>
<AR1>startup saved-configuration tangjun.cfg //指定从tangjun.cfg配置文件启动设备
This operation will take several minutes, please wait....
Info: Succeeded in setting the file for booting system
<AR1>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 activated
<AR1>reboot //重新启动以完成配置
Info: The system is comparing the configuration, please wait.
System will reboot! Continue ? [y/n]:y
Info: system is rebooting ,please wait...
<AR1>
#####################################################
<AR1>
May 26 2019 00:00:14-08:00 AR1 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEther
net0/0/1 has turned into UP state.
<AR1>dis startup //显示启动状态信息
MainBoard:
Startup system software: null
Next startup system software: null
Backup system software for next startup: null
Startup saved-configuration file: flash:/tangjun.cfg
Next startup saved-configuration file: flash:/tangjun.cfg //下次启动时调用的配置
Startup license file: null
Next startup license file: null
Startup patch package: null
Next startup patch package: null
Startup voice-files: null
Next startup voice-files: null
<AR1>
之所以开博客,纯为记录自己学习的过程,以便查缺补漏。如有参考我的博客,不清晰的地方可以留言或者加好友交流,以助共同进步。