设备基础配置
学习目标
• 掌握设备系统参数的配置方法,包括设备名称、系统时间及系统时区
• 掌握Console口空闲超时时长的配置方法
• 掌握登录信息的配置方法
• 掌握登录密码的配置方法
• 掌握保存配置文件的方法
• 掌握配置路由器接口IP地址的方法
• 掌握测试两台直连路由器连通性的方法
• 掌握重启设备的方法
拓扑图
场景
你是公司的网络管理员,现在公司购买了两台华为AR G3系列路由器。路由器在使用之
前,需要先配置路由器的设备名称、系统时间及登录密码等管理信息。
操作步骤
步骤一 查看系统信息
执行display version命令,查看路由器的软件版本与硬件信息。
命令回显信息中包含了VRP版本,设备型号和启动时间等信息。
步骤二 修改系统时间
VRP系统会自动保存时间,但如果时间不正确,可以在用户视图下执行clock timezone命令和clock datetime命令修改系统时间。
您可以修改Local字段为当前地区的时区名称。如果当前时区位于UTC+0时区的西部,需要把add字段修改为minus。
执行display clock命令查看生效的新系统时间。
步骤三 帮助功能和命令自动补全功能
在系统中输入命令时,问号是通配符,Tab键是自动补全命令的快捷键。
display ?
在输入信息后输入“?”可查看以输入字母开头的命令。如输入“dis?”,设备将输出所有以dis开头的命令。
在输入的信息后增加空格,再输入“?”,这时设备将尝试识别输入的信息所对应的命令,然后输出该命令的其他参数。例如输入“dis ?”,如果只有display命令是以dis开头的,那么设备将输出display命令的参数;如果以dis开头的命令还有其他的,设备将报错。
另外可以使用键盘上Tab键补全命令,比如键入“dis”后,按键盘“Tab”键可以将命令补全为“display”。如有多个以“dis”开头的命令存在,则在多个命令之间循环切换。
命令在不发生歧义的情况下可以使用简写,如“display”可以简写为“dis”或“disp”等,“interface”可以简写为“int”或“inter”等。
步骤四 进入系统视图
使用system-view命令可以进入系统视图,这样才可以配置接口、协议等内容。
步骤五 修改设备名称
配置设备时,为了便于区分,往往给设备定义不同的名称。如下我们依照实验拓扑图,修改设备名称。
修改R1路由器的设备名称为R1。
步骤六 配置登录信息
配置登陆标语信息来进行提示或进行登陆警告。执行header shell information命令配置登录信息。
退出路由器命令行界面,再重新登录命令行界面,查看登录信息是否已经修改。
步骤七 配置Console口参数
默认情况下,通过Console口登陆无密码,任何人都可以直接连接到设备,进行配置。
为避免由此带来的风险,可以将Console接口登录方式配置为密码认证方式,密码为密文形式的“Huawei@123”。
空闲时间指的是经过没有任何操作的一定时间后,会自动退出该配置界面,再次登陆会根据系统要求,提示输入密码进行验证。
设置空闲超时时间为20分钟,默认为10分钟。
执行display this命令查看配置结果。
退出系统,并使用新配置的密码登录系统。需要注意的是,在路由器第一次初始化启动时,也需要配置密码。
[R1-ui-console0]return
quit
Configuration console exit, please press any key to log on
Login authentication
Password:
Welcome to Huawei certification lab
步骤八 配置接口IP地址和描述信息
配置R1上GigabitEthernet 0/0/0接口的IP地址。使用点分十进制格式(如255.255.255.0)或根据子网掩码前缀长度配置子网掩码。
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 10.0.13.1 24
[R1-GigabitEthernet0/0/0]description This interface connects to R3-G0/0/0
在当前接口视图下,执行display this命令查看配置结果。
[R1-GigabitEthernet0/0/0]display this
执行display interface命令查看接口信息。
[R1]display interface GigabitEthernet0/0/0
从命令回显信息中可以看到,接口的物理状态与协议状态均为Up,表示对应的物理层与数据链路层均可用。
配置R3上GigabitEthernet 0/0/0接口的IP地址与描述信息。
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 10.0.13.3 255.255.255.0 [R3-GigabitEthernet0/0/0]description This interface connects to R1-G0/0/0
配置完成后,通过执行ping命令测试R1和R3间的连通性。
ping 10.0.13.3
步骤九 配置远程登陆参数
默认情况下,设备无法通过远程登陆设备,可以通过VTY接口实现远程登陆设备。
将VTY接口登录方式配置为密码认证方式,密码为密文形式的“Huawei@123”。
[R1]user-interface vty 0 4
[R1-]authentication-mode password
[R1-ui-vty0-4]set authentication password cipher
Warning: The “password” authentication mode is not secure, and it is strongly recommended to use “aaa” authentication mode.
Enter Password(<8-128>):
Confirm password:
执行display this命令查看配置结果。
[R1-ui-vty0-4]display this
在R3上退出系统视图,使用telnet登录R1。
[R3]quit
telnet 10.0.13.1
步骤十 查看当前设备上存储的文件列表
在用户视图下执行dir命令,查看当前目录下的文件列表。
步骤十一 管理设备配置文件
执行display saved-configuration命令查看保存的配置文件。
display saved-configuration
There is no correct configuration file in FLASH
系统中没有已保存的配置文件。执行save命令保存当前配置文件。
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
重新执行display saved-configuration命令查看已保存的配置信息。
display saved-configuration
[V200R007C00SPC600]
sysname R1
header shell information “Welcome to Huawei certification lab”
board add 0/1 1SA
board add 0/2 1SA
……output omit……
执行display current-configuration命令查看当前配置信息。
display current-configuration
[V200R007C00SPC600]
sysname R1
header shell information “Welcome to Huawei certification lab”
board add 0/1 1SA
board add 0/2 1SA
board add 0/3 2FE
……output omit……
一台路由器可以存储多个配置文件。执行display startup命令查看下次启动时使用的配置文件。
display startup
删除闪存中的配置文件。
reset _________
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.
reset _________
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.
执行display startup命令查看下次启动时使用的配置文件。此时下次启动的文件应该为null。
display startup
步骤十二 重启设备
执行reboot命令重启路由器。
reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n
System will reboot! Continue ? [y/n]:y
Info: system is rebooting ,please wait…
reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the next startup configuration. Continue ? [y/n]:n
System will reboot! Continue ? [y/n]:y
系统提示是否保存当前配置,可根据实验要求决定是否保存当前配置。如果无法确定是否保存,则不保存当前配置。