telnet
首页 / 文章 / telnet

telnet

一、Telnet 远程登录配置

远程登录前需要满足 3 个前提:

  1. 设备已经配置好 IP 地址
  2. 两端网络连通正常
  3. 被登录设备已经开启远程登录认证

二、VTY 远程登录认证方式

1. Password 密码认证

配置流程

  1. 进入用户接口视图
  2. 选择认证模式为 password
  3. 设置登录密码
  4. 设置用户权限等级

命令格式

user-interface vty 0 1
authentication-mode password
set authentication password simple 123
user privilege level 3

示例

[AR3] telnet server enable
[AR3] user-interface vty 0 1
[AR3-ui-vty0-1] authentication-mode password
Please configure the login password (maximum length 16): 123
[AR3-ui-vty0-1] user privilege level 3

说明

  • telnet server enable:开启 Telnet 服务

  • user-interface vty 0 1:进入远程登录接口配置视图

  • authentication-mode password:认证方式为密码认证

  • user privilege level 3:登录后权限等级为 3


2. AAA 用户名 + 密码认证

配置流程

  1. 进入用户接口视图

  2. 选择认证模式为 aaa

  3. 进入 AAA 视图

  4. 配置本地用户名和密码

  5. 设置用户权限等级

  6. 指定用户可使用的服务类型

配置步骤

[ZAQ] user-interface vty 0 1
[ZAQ-ui-vty0-1] authentication-mode aaa

[ZAQ] aaa
[ZAQ-aaa] local-user huawei password cipher 123456
[ZAQ-aaa] local-user huawei service-type telnet
[ZAQ-aaa] local-user huawei privilege level 3

说明

  • authentication-mode aaa:开启 AAA 认证

  • local-user huawei password cipher 123456:创建本地用户并设置密码

  • service-type telnet:允许该用户通过 Telnet 登录

  • privilege level 3:设置用户权限等级


三、远程登录认证方式总结

认证方式

none ;不认证
password; 仅密码认证
aaa; 用户名 + 密码认证


四、Password 认证方式笔记整理

基本步骤

  1. 进入用户接口视图
    user-interface vty 接口编号

  2. 选择认证模式为 password

  3. 设置密码

  4. 设置权限等级

示例

[AR3] telnet server enable
[AR3] user-interface vty 0 1
[AR3-ui-vty0-1] authentication-mode password
Please configure the login password (maximum length 16):123
[AR3-ui-vty0-1] user privilege level 3

查看当前登录用户

[ZAQ] display users

五、Router 远程登录示例

Password 认证

1. [PC2] telnet server enable
2. [PC2] user-interface vty 0
3. [PC2-ui-vty0] authentication-mode password
4. [PC2-ui-vty0] set authentication password simple 123

密码两种写法

set authentication password simple 123
set authentication password cipher 123

区别

  • simple:明文显示

  • cipher:密文显示


六、AAA 认证笔记整理

配置流程

  1. 进入用户接口视图
    user-interface vty 接口编号

  2. 选择认证模式为 aaa

  3. 进入 AAA 配置视图

  4. 设置用户名和密码

  5. 设置用户权限等级

  6. 指定用户名对应的服务类型

典型命令

[ZAQ] user-interface vty 0 1
[ZAQ-ui-vty0-1] authentication-mode aaa

[ZAQ] aaa
[ZAQ-aaa] local-user huawei password cipher 123456
[ZAQ-aaa] local-user huawei service-type telnet
[ZAQ-aaa] local-user huawei privilege level 3

关键命令说明

  • local-user huawei service-type telnet

    • 指定本地用户 huawei 可用于 Telnet 登录
  • local-user huawei privilege level 3

    • 设置该用户登录后的权限等级

七、本地登录配置流程(Console 登录)

本地登录指通过 console 口直接登录设备。


1. Password 认证方式

配置流程

  1. 进入 console 接口视图

  2. 选择认证模式为 password

  3. 设置密码

  4. 设置权限等级

示例

[ZAQ] user-interface console 0
[ZAQ-ui-console0] authentication-mode password
Please configure the login password (maximum length 16):123
[ZAQ-ui-console0] user privilege level 15

2. AAA 认证方式

配置流程

  1. 进入 console 0

  2. 选择认证模式为 aaa

  3. 进入 AAA 视图

  4. 创建本地用户名和密码

  5. 设置权限等级

  6. 设置服务类型为 terminal

示例

[ZAQ] user-interface console 0
[ZAQ-ui-console0] authentication-mode aaa

[ZAQ] aaa
[ZAQ-aaa] local-user admin password cipher 123
[ZAQ-aaa] local-user admin service-type terminal
[ZAQ-aaa] local-user admin privilege level 15

说明

  • service-type terminal

    • 说明该用户可用于本地控制台登录

八、本地登录配置总结

Password 方式

[ZAQ] user-interface console 0
[ZAQ-ui-console0] authentication-mode password
Please configure the login password (maximum length 16):123
[ZAQ-ui-console0] user privilege level 15

AAA 方式

[ZAQ] user-interface console 0
[ZAQ-ui-console0] authentication-mode aaa

[ZAQ] aaa
[ZAQ-aaa] local-user admin password cipher 123
[ZAQ-aaa] local-user admin service-type terminal
[ZAQ-aaa] local-user admin privilege level 15

九、辅助命令

1. 查看接口 MAC 地址

[R1] display interface g0/0/1

2. 查看当前登录用户

[ZAQ] display users

十一、学习总结

远程登录

远程登录要记住三点:

  1. 设备必须有 IP 地址

  2. 网络要能互通

  3. 远程服务必须开启并配置认证

远程认证方式

  • none

  • password

  • aaa


本地登录

本地登录就是对 console 0 配置认证,常用:

  • password

  • aaa

AAA 更安全,因为支持:

  • 用户名

  • 密码

  • 权限等级

  • 服务类型控制

分享这篇:
扫码阅读本文 扫码用手机阅读 / 分享

评论