任务 5:配置基于“用户名+密码”的远程登录控制
步骤 1:登录到 R3 的命令行界面
步骤 2:进入全局配置模式,创建用户名 yangbang,密码为 ccna
R3>enable R3#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R3(config)#username yangbang password ccna R3(config)#
步骤 3:进入 VTY 0 到 4(共 5 个虚拟终端),开启这 5 个虚拟终端的认证机制,使用本地数据库认证
R3(config)#line vty 0 4 R3(config-line)#login local R3(config-line)#exit
步骤 4:使用 R1 和 R2 远程登录到 R3,输入用户名和密码后,可以登录
R1>telnet 192.168.1.3 Trying 192.168.1.3 ... Open User Access Verification Username: yangbang Password: //输入 ccna R3>
R2>telnet 192.168.1.3 Trying 192.168.1.3 ... Open User Access Verification Username: yangbang Password: R3>
步骤 5:在 R3 上使用 show users,检查谁在登录 R3
R3#show users Line User Host(s) Idle Location * 0 con 0 idle 00:00:00 196 vty 0 yangbang idle 00:01:15 192.168.1.1 197 vty 1 yangbang idle 00:00:41 192.168.1.2 Interface User Mode Idle Peer Address
步骤 6:在 R3 上使用 clear 命令,将 R1 的登录关闭
R3#clear line vty 0 [confirm] [OK] R3#
步骤 7:检查 R1,看到对 R3 的连接被关闭了
R3> [Connection to 192.168.1.3 closed by foreign host] R1>
步骤 8:在 R3 上把 R2 的连接也关掉,避免影响后面的实验
R3#clear line vty 1 [confirm] [OK] R3#
备注:PT模拟无VTY关闭命令