配置VTY用户界面示例
组网需求
用户使用Telnet协议从VTY通道登录远程设备。设备管理员可以根据使用需求或出于对设备安全性的考虑,配置VTY用户界面的相关属性。
配置VTY用户界面的用户级别为2,对从VTY登录的用户进行Password验证,用户登录时需要输入密码“Helloworld@6789”。同时需要允许IP地址为10.1.1.1的用户登录设备。
登录后,如果用户超过30分钟未对设备进行操作,将断开与设备的连接。
配置思路
采用如下的思路配置登录设备:
配置VTY用户界面的最大个数为8。
配置VTY用户界面的呼入呼出限制,实现允许某一IP地址或地址段的用户登录设备。
配置VTY用户界面的终端属性。
配置VTY用户界面的用户级别。
配置VTY用户界面的验证方式和验证密码。
操作步骤
- 配置VTY用户界面的最大个数
<HUAWEI> system-view
[~HUAWEI] user-interface maximum-vty 8
- 配置VTY用户界面的呼入呼出限制类型
[*HUAWEI] acl 2000
[*HUAWEI-acl4-basic-2000] rule permit source 10.1.1.1 0
[*HUAWEI-acl4-basic-2000] quit
[*HUAWEI] user-interface vty 0 7
[*HUAWEI-ui-vty0-7] acl 2000 inbound
- 配置VTY用户界面的终端属性
[*HUAWEI-ui-vty0-7] shell
[*HUAWEI-ui-vty0-7] idle-timeout 30
[*HUAWEI-ui-vty0-7] screen-length 30
[*HUAWEI-ui-vty0-7] history-command max-size 20
- 配置VTY用户界面的用户级别
[*HUAWEI-ui-vty0-7] user privilege level 2
- 配置VTY用户界面的用户验证方式为密码验证
[*HUAWEI-ui-vty0-7] authentication-mode password
[*HUAWEI-ui-vty0-7] set authentication password Please configure the login password (8-16) Enter Password: Confirm Password:
[*HUAWEI-ui-vty0-7] commit
[~HUAWEI-ui-vty0-7] quit
VTY用户界面配置完成后,用户可以通过Telnet使用Password方式登录设备,实现本地或者远程维护。用户登录设备的具体过程请参见配置用户通过Telnet登录设备。
- 验证配置结果
# 使用Telnet方式登录,检查新的密码是否生效。
# 使用10.1.1.1的IP地址通过Telnet方式登录设备,可以登录。
# 使用user-interface vty 0 7进入VTY界面视图,执行display this命令检查VTY界面配置。
[~HUAWEI] user-interface vty 0 7
[~HUAWEI-ui-vty0-7] display this
# user-interface vty 0 7 acl 2000 inbound authentication-mode password user privilege level 2 set authentication password cipher $2a$JNWQ*Vz)SP$Cc>T80W$d8;&w2+$KR.<A3f<9[}0t&No0V:o!o."$ history-command max-size 20 idle-timeout 30 0 screen-length 30 # return
配置文件
#
acl number 2000
rule 5 permit source 10.1.1.1 0
#
user-interface maximum-vty 8
#
user-interface vty 0 7
acl 2000 inbound
authentication-mode password
user privilege level 2
set authentication password cipher $2a$JNWQ*Vz)SP$Cc>T80W$d8;&w2+$KR.<A3f<9[}0t&No0V:o!o."$
history-command max-size 20
idle-timeout 30 0
screen-length 30
#
return