》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// //进入G0/0/1接口视图管理
[AR1-GigabitEthernet0//]ip address 10.1.1.254 //为G0/0/1配置IP地址
May ::-: AR1 %%01IFNET//LINK_STATE(l)[]:The line protocol IP on the interface GigabitEthernet0// has entered the UP state.
[AR1-GigabitEthernet0//]q //回退系统视图
[AR1]int loopback //配置环回接口0
[AR1-LoopBack0]ip address 10.1.1.253 //配的IP与10.1.1.254网络冲突,因为路由是分割广播域的
Error: The specified address conflicts with another address.
[AR1-LoopBack0]ip address 10.1.10.254 //重新配置环回接口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 : Routes :
Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/ Direct D 10.1.1.254 GigabitEthernet0//
10.1.1.254/ Direct D 127.0.0.1 GigabitEthernet0//
10.1.1.255/ Direct D 127.0.0.1 GigabitEthernet0//
10.1.10.0/ Direct D 10.1.10.254 LoopBack0
10.1.10.254/ Direct D 127.0.0.1 LoopBack0
10.1.10.255/ Direct D 127.0.0.1 LoopBack0
127.0.0.0/ Direct D 127.0.0.1 InLoopBack0
127.0.0.1/ Direct D 127.0.0.1 InLoopBack0
127.255.255.255/ Direct D 127.0.0.1 InLoopBack0
255.255.255.255/ Direct D 127.0.0.1 InLoopBack0 [AR1-LoopBack0]q //退出loopback0接口
[AR1]
[AR1]ping 10.1.1.1       //检查与交换机SW1的网络是否连通
PING 10.1.1.1: data bytes, press CTRL_C to break
Reply from 10.1.1.1: bytes= Sequence= ttl= time= ms
Reply from 10.1.1.1: bytes= Sequence= ttl= time= ms
Reply from 10.1.1.1: bytes= Sequence= ttl= time= ms
Reply from 10.1.1.1: bytes= Sequence= ttl= time= ms
Reply from 10.1.1.1: bytes= Sequence= ttl= time= ms
--- 10.1.1.1 ping statistics ---
packet(s) transmitted
packet(s) received
0.00% packet loss
round-trip min/avg/max = // 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
The number of interface that is DOWN in Physical is
The number of interface that is UP in Protocol is
The number of interface that is DOWN in Protocol is Interface IP Address/Mask Physical Protocol
MEth0// unassigned down down
NULL0 unassigned up up(s)
Vlanif1 10.1.1.1/ up up
Vlanif10 10.1.10.1/ down down
[SW1]user-interface vty ?    //查询有哪几路虚拟线路可连接
INTEGER<-> The first user terminal interface to be configured //虚拟线路0、1、2、3、4 [SW1]user-interface vty //开启vty虚拟线路0和1
[SW1-ui-vty0-]authentication-mode ? //查询vty虚拟线路下有哪些登录认证模式
aaa AAA authentication //数据库认证模式
none Login without checking //空值,免认证模式(真机中没有该模式)
password Authentication through the password of a user terminal interface //密码登录认证模式 [SW1-ui-vty0-]authentication-mode password //在vty虚拟线路上配置密码登录认证模式
[SW1-ui-vty0-]set authentication pass
[SW1-ui-vty0-]set authentication password cipher //配置认证密码为123
[SW1-ui-vty0-]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.
.191.3. configurations have been changed. The current change number is , the
change loop count is , and the maximum number of records is .
[SW1-ui-vty0-]user privilege level //配置用户权限等级,15级为最高级,管理员权限
[SW1-ui-vty0-]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.
.191.3. configurations have been changed. The current change number is , the
change loop count is , and the maximum number of records is .
[SW1-ui-vty0-]dis this //查看刚刚操作的命令或动作
#
user-interface con
user-interface vty
user privilege level
set authentication password cipher VPK)O}H^41y~t+Byca8Y-@w# //因为cipher,故而密码不可见
user-interface vty
#
return
[SW1-ui-vty0-]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 , and the number
of current VTY users on line is .
The current login time is -- ::. //成功远程登陆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 , and the number of current VTY users on line is .
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
+ CON :: no
Username : Unspecified //本地console登陆的用户,用户名缺省 VTY :: TEL 10.1.1.254 pass no
Username : Unspecified //远程虚拟线路VTY登陆的用户,用户名缺省
[SW1]user-interface vty       //开启vty虚拟线路0和1
[SW1-ui-vty0-]authentication-mode aaa //为vty虚拟线路0和1配置数据库认证模式
[SW1-ui-vty0-]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is . [SW1]aaa //使用AAA登录管理
[SW1-aaa]local-user tangjun password simple //在AAA配置模式下创建新用户tangjun和密码123
Info: Add a new user.
[SW1-aaa]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is . [SW1-aaa]local-user privilege level //为本地用户tangjun配置10级权限
Info: Add a new user.
[SW1-aaa]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is . [SW1-aaa]local-user tangjun service-type telnet //为本地用户tangjun配置telnet协议服务
[SW1-aaa]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is .
[SW1]user-interface console     //进入console0接口配置
[SW1-ui-console0]idle-timeout //配置视图超时时长为1000分钟
[SW1-ui-console0]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is .
[SW1-ui-console0]screen-length //验证配置命令从头到尾一次显示
[SW1-ui-console0]history-command max-size //配置历史命令缓存的大小为20M
[SW1-ui-console0]display history-command //查看缓存的历史命令
[SW1-ui-console0]user-interface maximum //配置最大的登录用户数为8
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is , the change
loop count is , and the maximum number of records is .
[SW1]
[SW1]header login information "welcome to tangjun's switch"    //配置登录前设备提示“XXX”
[SW1]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.
.191.3. configurations have been changed. The current change number is , the
change loop count is , and the maximum number of records is . [SW1]header shell information "Hello!You have came to our family" //配置成功登录后设备提示“XXX”
[SW1]
May ::-: SW1 DS//DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.
.191.3. configurations have been changed. The current change number is , the
change loop count is , and the maximum number of records is .
[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 .
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 ::-: SW1 %%01CMD//REBOOT(l)[]:The user chose Y when deciding whether to reboot the system. (Task=co0, Ip=**, User=**)
<SW1>
May ::-: SW1 %%01IFNET//BOARD_DISABLE(l)[]:Board has been unavailable.
May ::-: SW1 %%01IFPDT//IF_STATE(l)[]:GigabitEthernet0// 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     //显示时钟信息
-- ::-:
Saturday
Time Zone(China-Standard-Time) : UTC-:
<SW1>clock timezone BJ add //配置时区为+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 :: ? //查询日期配置命令的具体格式,注意限制在2000-2099年
YYYY-MM-DD Specify the date from to
<SW1>clock datetime :: --//配置时钟错误,注意限制在2000-2099年
Error: Wrong parameter found at '^' position.
<SW1>
<SW1>clock datetime :: -- //配置时钟
<SW1>dis clock //显示配置后的时钟信息
-- ::+:
Tuesday
Time Zone(BJ) : UTC+:

关于文件系统方面,为了方便演示,先创建一个tangjun.cfg的文件和一个tang的文件目录:

<AR1>pwd     //显示当前目录
flash:
<AR1>dir //显示当前目录下所有文件信息
Directory of flash:/ Idx Attr Size(Byte) Date Time(LMT) FileName
drw- - May :: dhcp
-rw- , May :: portalpage.zip
-rw- , May :: statemach.efs
-rw- , May :: sslvpn.zip
-rw- May :: private-data.txt ,, KB total (, KB free)

<AR1>mkdir tang //创建新目录tang
Info: Create directory flash:/tang......Done
<AR1>save ? //查询保存配置命令(save命令须在用户视图下执行)
STRING<-> 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 % 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
drw- - May :: dhcp
-rw- , May :: portalpage.zip
drw- - May :: tang
-rw- , May :: statemach.efs
-rw- , May :: sslvpn.zip
-rw- May :: private-data.txt
-rw- May :: tangjun.cfg //验证tangjun.cfg文件已保存
,, KB total (, KB free)

<AR1>cd tang //进入tang目录
<AR1>dir //显示当前目录下所有文件信息
Directory of flash:/tang/ Idx Attr Size(Byte) Date Time(LMT) FileName
-rw- May :: tangjun.cfg //验证tangjun.cfg文件已复制到tang目录下
,, KB total (, 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
drw- - May :: dhcp
-rw- , May :: portalpage.zip
drw- - May :: tang
-rw- , May :: statemach.efs
-rw- , May :: sslvpn.zip
-rw- May :: private-data.txt
,, KB total (, 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>
05-13 14:42