一、配置通过Console口登录设备
1.1 简介
通过Console口登录设备是指使用专门的Console通信线缆将用户PC的串口(USB接口/Type-C接口/蓝牙等方式)与网络设备的Console口相连,在进行相应的配置后实现在本地管理网络。
该方式是登录网络设备的最基本方式,也是其他登录方式(如:Telnet、STelnet)的基础,适用于首次登录网络设备或无法远程登录网络设备的场景。
1.2 组网拓扑
1.3 操作步骤
PC和网络设备接线
-
将Console通信电缆的一端插入PC机的串口(USB接口)中,再将RJ-45端插入设备的Console口中。
说明如果使用的Console线缆一端是如图所示的D型连接器(9PIN-公头,COM口),可以再使用一跟转接线将COM转换为USB接口。
Console线缆目前有多种形式,连接PC端的接口可以是USB接口、Type-C接口、蓝牙接口等,可以根据自己PC的情况选择购买。如果不是COM的Console线缆一般需要安装驱动,驱动的安装可以根据Console线缆的说明书操作,或询问卖家。
查看Console线缆是否正确连接
-
在PC上打开”设备管理器”,查看”端口(COM和LPT)“中是否新增”设备”,如果没有新增可能是驱动没有安装。

配置终端仿真软件并登录网络设备
-
在PC上打开终端仿真软件(以SecureCRT为例),新建连接,设置连接的接口以及通信参数与网络设备Console口缺省配置相同。
Console口缺省配置:
参数 默认值 传输速率 9600bit/s 流控方式 不进行流控 停止位 1 数据位 8 -
打开终端仿真软件,点击”新建连接”。

-
设置连接的接口以及通信参数。连接的接口请根据实际情况进行选择。根据在”设备管理器”中查看到的端口信息,选择连接的接口。

-
连接成功后,如果需要输入密码则会出现提示信息,提示用户输入用户名和密码,首次登录系统提示必须重新设置密码。
说明设备的登录密码,查询对应设备的产品文档获取。
V200R009及之前版本,缺省不进行校验。V200R010及之后版本,缺省为AAA,默认的用户名为admin,密码为admin@huawei.com。
An initial password is required for the first login via the console.Continue to set it? [Y/N]: y #配置登录密码。Set a password and keep it safe. Otherwise you will not be able to login via the console. Please configure the login password (8-16)Enter Password:Confirm Password:<HUAWEI>Login authentication Username:adminPassword: #输入缺省密码admin@huawei.com。Warning: The default password poses security risks.The password needs to be changed. Change now? [Y/N]: y #修改登录密码。Please enter old password: #输入缺省密码admin@huawei.com。Please enter new password: #输入新密码。Please confirm new password: #再次输入新密码。The password has been changed successfully<HUAWEI>密码为字符串形式,区分大小写,长度范围是8~16。输入的密码至少包含两种类型字符,包括大写字母、小写字母、数字及特殊字符。特殊字符不包括”?“和空格。
采用交互方式输入的密码不会在终端屏幕上显示出来。
用户界面密码配置成功后,如果用户没有修改验证方式及验证密码,当用户再次登录设备时,用户验证密码即为初次登录时所配置的验证密码。
查看和配置网络设备的基本信息
- 查看设备版本信息。
<HUAWEI>display versionHuawei Versatile Routing Platform SoftwareVRP (R) software, Version 5.160 (AR651C V300R019C00SPC100)Copyright (C) 2011-2016 HUAWEI TECH CO., LTDHuawei AR651C Router uptime is 0 week, 0 day, 0 hour, 53 minutesBKP 0 version information:1. PCB Version : AR01BAK2C VER.B2. If Supporting PoE : No3. Board Type : AR651C4. MPU Slot Quantity : 15. LPU Slot Quantity : 1- 设置日期、时间、时区及名称。
<HUAWEI> clock timezone BJ add 08:00:00 #其中BJ为设置的时区名称。08:00:00表示当地时间是在系统默认的UTC时区基础上加8。<HUAWEI> clock datetime 10:10:00 2024-12-29 #设置当前时间和日期。设置当前时间前,请务必确认所在时区,设置正确的时区偏移时间,以保证本地时间正确。<HUAWEI> system-view[HUAWEI] sysname ictstu #配置网络设备名称为ictstu。- 进入接口配置接口的IP地址。
[ictstu]inter #输入TAB补全命令[ictstu]interface #"interface"是唯一可选的关键字[ictstu]interface g #输入TAB补全命令[ictstu]interface GigabitEthernet #"GigabitEthernet"是唯一可选的关键字[ictstu]interface GigabitEthernet 0/0/1 #手动补全命令- 配置Console用户界面的认证方式为AAA认证,并创建本地用户。
[ictstu] user-interface console 0[ictstu-ui-console0] authentication-mode aaa #设置Console用户认证方式为AAA认证。[ictstu-ui-console0] quit[ictstu] aaa[ictstu-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789 #创建名为admin1234的本地用户,设置其登录密码为Helloworld@6789。V200R003之前的版本,不支持irreversible-cipher,仅支持cipher关键字。[ictstu-aaa] local-user admin1234 privilege level 15 #配置用户级别为15级。[ictstu-aaa] local-user admin1234 service-type terminal #配置接入类型为terminal,即:Console用户。[ictstu-aaa] quit- 保存设备当前配置。
[ictstu]quit #返回到用户视图<ictstu>saveThe current configuration will be written to the device.Are you sure to continue? (y/n)[n]:y #需要输入y来确认继续It will take several minutes to save configuration file, please wait.......Configuration file had been saved successfullyNote: The configuration file will take effect after being activated<ictstu>- 重启设备。
<ictstu>rebootInfo: The system is comparing the configuration, please wait.System will reboot! Continue ? [y/n]:y #需要输入y来确认继续Info: system is rebooting ,please wait...二、配置通过Telnet方式登录设备
2.1 简介
通过Telnet登录网络设备便于对网络设备进行远程管理和维护,不需要为每一台网络设备都连接一个终端。缺省情况下,用户不能直接通过Telnet方式登录网络设备,而是需要先通过Console口登录网络设备配置Telnet功能。
2.2 组网拓扑
2.3 操作步骤
-
配置PC的IP地址。PC端网卡的IP地址需要和网络设备连接接口的IP地址在同网段,或者路由可达。

-
先通过Console方式登录网络设备,然后进行接下来的配置。
-
配置网络设备的IP地址。
[ictstu] vlan 10[ictstu-vlan10] interface vlanif 10 #配置VLANIF10作为管理接口。[ictstu-Vlanif10] ip address 192.168.1.1 24[ictstu-Vlanif10] quit[ictstu] interface gigabitethernet 0/0/1 #GE0/0/1为使用Web网管登录ictstu的PC与ictstu相连的物理接口编号,请按照实际现网情况进行选择。[ictstu-GigabitEthernet0/0/1] port link-type access #配置接口类型为access。[ictstu-GigabitEthernet0/0/1] port default vlan 10 #配置接口GE0/0/1加入VLAN 10。[ictstu-GigabitEthernet0/0/1] quit- 使能telnet功能,并配置VTY用户界面。
[ictstu] telnet server enable #使能Telnet功能。[ictstu] user-interface vty 0 4 #进入VTY 0~VTY 4用户界面视图。[ictstu-ui-vty0-4] user privilege level 15 #配置VTY 0~VTY 4的用户级别为15级。[ictstu-ui-vty0-4] authentication-mode aaa #配置VTY 0~VTY 4的用户认证方式为AAA认证。[ictstu-ui-vty0-4] quit- 配置AAA认证方案,并创建登录用户。
[ictstu] aaa[ictstu-aaa] local-user admin123 password irreversible-cipher Huawei@6789 #创建名为admin123的本地用户,设置其登录密码为Huawei@6789。V200R003之前的版本,不支持irreversible-cipher,仅支持cipher关键字。[ictstu-aaa] local-user admin123 privilege level 15 #配置用户级别为15级。[ictstu-aaa] local-user admin123 service-type telnet #配置接入类型为telnet,即:Telnet用户。[ictstu-aaa] quit-
配置完成后,用户可以通过Telnet登录网络设备。

Login authentication Username:admin123Password:Info: The max number of VTY users is 8, and the number of current VTY users on line is 2. The current login time is 2024-12-29 09:54:02+08:00.<ictstu>三、配置通过STelnet方式登录设备
3.1 简介
SSH(Secure Shell)协议实现在不安全网络上提供安全的远程登录,保证了数据的完整性和可靠性,实现了数据的安全传输。STelnet基于SSH协议,提供安全的信息保障和强大认证功能,保护网络设备不受IP欺骗等攻击。缺省情况下,用户不能直接通过STelnet方式登录网络设备,而是需要先通过Console口或Telnet方式登录网络设备,并配置STelnet功能及用户界面参数。
3.2 组网拓扑
3.3 操作步骤
-
配置PC的IP地址。PC端网卡的IP地址需要和网络设备连接接口的IP地址在同网段,或者路由可达。

-
先通过Console方式登录网络设备,然后进行接下来的配置。
-
配置网络设备的IP地址。
[ictstu] vlan 10[ictstu-vlan10] interface vlanif 10 #配置VLANIF10作为管理接口。[ictstu-Vlanif10] ip address 192.168.1.1 24[ictstu-Vlanif10] quit[ictstu] interface gigabitethernet 0/0/1 #GE0/0/1为使用Web网管登录ictstu的PC与ictstu相连的物理接口编号,请按照实际现网情况进行选择。[ictstu-GigabitEthernet0/0/1] port link-type access #配置接口类型为access。[ictstu-GigabitEthernet0/0/1] port default vlan 10 #配置接口GE0/0/1加入VLAN 10。[ictstu-GigabitEthernet0/0/1] quit- 使能STelnet功能并配置VTY用户界面。
[ictstu] stelnet server enable #使能STelnet服务器功能。[ictstu] user-interface vty 0 4 #进入VTY 0~VTY 4用户界面视图。[ictstu-ui-vty0-14] user privilege level 15 #配置VTY 0~VTY 4的用户级别为15级。[ictstu-ui-vty0-14] authentication-mode aaa #配置VTY 0~VTY 4的用户认证方式为AAA认证。[ictstu-ui-vty0-14] protocol inbound ssh #配置VTY 0~VTY 4的用户界面支持SSH协议。[ictstu-ui-vty0-14] quit- 配置AAA认证方案,并创建用户。
[ictstu] aaa[ictstu-aaa] local-user admin123 password irreversible-cipher Huawei@6789 #创建名为admin123的本地用户,设置其登录密码为Huawei@6789。V200R003之前的版本,不支持irreversible-cipher,仅支持cipher关键字。[ictstu-aaa] local-user admin123 privilege level 15 #配置用户级别为15级。[ictstu-aaa] local-user admin123 service-type ssh #配置接入类型为ssh,即:ssh用户。[ictstu-aaa] quit- 配置SSH用户admin的认证方式为Password认证、服务方式为STelnet。
[ictstu] ssh user admin123 authentication-type password #配置SSH用户admin的认证方式为Password认证。[ictstu] ssh user admin123 service-type stelnet #配置SSH用户admin的服务方式为STelnet。-
配置完成后,用户可以通过STelnet登录网络设备。

login as: admin123 password: Info: The max number of VTY users is 8, and the number of current VTY users online is 2. The current login time is 2024-12-29 09:54:02+08:00.<ictstu>四、通过登录系统进行文件操作
4.1 简介
用户使用Console口、Telnet或STelnet方式登录设备后,可以对存储器、目录、文件进行管理操作,特别是对存储器的管理,只能通过登录系统进行操作。采用登录系统对存储器、目录和文件进行操作,方便快捷,但是只能对本地文件进行操作,无法进行文件传输。如果需要进行文件传输,可以通过FTP、TFTP、SCP、FTPS方式。
4.2 操作步骤
- 查看当前目录下的文件及子目录。
<HUAWEI> system-view[HUAWEI] sysname ictstu[ictstu] quit<ictstu> dirDirectory of flash:/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 drw- - Dec 28 2024 19:05:30 dhcp 1 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip 2 -rw- 2,263 Dec 28 2024 19:05:24 statemach.efs 3 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip 4 -rw- 249 Dec 28 2024 19:28:20 private-data.txt 5 -rw- 614 Dec 28 2024 19:28:19 vrpcfg.zip 1,090,732 KB total (784,448 KB free)<ictstu>- 创建目录test。
<ictstu> mkdir testInfo: Create directory flash:/test......Done.- 复制vrpcfg.zip至test目录下,并命名为backup.zip。
<ictstu> copy vrpcfg.zip flash:/test/backup.zip #如果不指定目标文件名,则默认目标文件与源文件同名,修改目标文件名为backup.zip。Copy flash:/vrpcfg.zip to flash:/test/backup.zip?[Y/N]:y100% complete/Info: Copied file flash:/vrpcfg.zip to flash:/test/backup.zip...Done.- 进入test目录,查看当前的工作路径。
<ictstu> cd test<ictstu> pwdflash:/test- 查看test目录下的文件。
<ictstu> dirDirectory of flash:/test/ Idx Attr Size(Byte) Date Time(LMT) FileName 0 -rw- 614 Dec 28 2024 19:29:08 backup.zip 1,090,732 KB total (784,448 KB free)<ictstu>五、常用快捷键
| 功能键 | 作用 |
|---|---|
| 【Ctrl+A】 | 将光标移动到当前行的开头 |
| 【Ctrl+B】 | 将光标向左移动一个字符 |
| 【Ctrl+C】 | 停止当前正在执行的功能 |
| 【Ctrl+D】 | 删除当前光标所在位置的字符 |
| 【Ctrl+E】 | 将光标移动到最后一行的末尾 |
| 【Ctrl+F】 | 将光标向右移动一个字符 |
| 【Ctrl+H】 | 删除光标左侧的一个字符 |
| 【Ctrl+K】 | 在连接建立阶段终止呼出的连接 |
| 【Ctrl+N】或↓光标 | 显示历史命令缓冲区中的后一条命令 |
| 【Ctrl+P】或↑光标 | 显示历史命令缓冲区中的前一条命令 |
| 【Ctrl+T】 | 输入问号”?” |
| 【Ctrl+W】 | 删除光标左侧的一个字符串(字) |
| 【Ctrl+X】 | 删除光标左侧所有的字符 |
| 【Ctrl+Y】 | 删除光标所在位置及其右侧所有的字符 |
| 【Ctrl+Z】 | 返回到用户视图 |
| 【Ctrl+]】 | 终止呼入的连接或重定向连接 |
| 【Esc+B】 | 将光标向左移动一个字符串(字) |
| 【Esc+D】 | 删除光标右侧的一个字符串(字) |
| 【Esc+F】 | 将光标向右移动一个字符串(字) |