MHuiG

「看庭前花开花落,望天上云卷云舒」

远程登录

# 远程登录

## telnet 线路认证

    [R2]telnet server enable // 开启Telent服务
    [R2]user-interface vty 0 4 // 进入虚拟终端线路配置用户
    [R2-ui-vty0-4]protocol inbound telnet // 设置用户登录方式
    [R2-ui-vty0-4]authentication-mode password // 认证模式为密码认证
    [R2-ui-vty0-4]set authentication password cipher 123456
    [R2-ui-vty0-4]user privilege level 15 // 设置用户等级

用户视图 telenet x.x.x.x

R2

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sy R2
    [R2]int g0/0/0
    [R2-GigabitEthernet0/0/0]ip add 34.1.1.2 24
    [R2-GigabitEthernet0/0/0]
    [R2-GigabitEthernet0/0/0]q
    [R2]telnet server enable
     Error: TELNET server has been enabled
    [R2]user-interface vt
    [R2]user-interface vty 0 4
    [R2-ui-vty0-4]protocol inbound telnet
    [R2-ui-vty0-4]display this
    [V200R003C00]
    #
    user-interface con 0
     authentication-mode password
    user-interface vty 0 4
    user-interface vty 16 20
    #
    return
    [R2-ui-vty0-4]authentication-mode ?
      aaa       AAA authentication
      password  Authentication through the password of a user terminal interface
    [R2-ui-vty0-4]authentication-mode password ?
      <cr>  Please press ENTER to execute command
    [R2-ui-vty0-4]authentication-mode password
    Please configure the login password (maximum length 16):123456
    [R2-ui-vty0-4]user privilege ?
      level  Set the login priority of a user terminal
    [R2-ui-vty0-4]user privilege level ?
      INTEGER<0-15>  Set a priority, the default value is 0
    [R2-ui-vty0-4]user privilege level 15
    [R2-ui-vty0-4]

R1

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sy R1
    [R1]int g0/0/0
    [R1-GigabitEthernet0/0/0]ip add 34.1.1.1 24
    Dec 21 2023 11:45:03-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
    on the interface GigabitEthernet0/0/0 has entered the UP state.
    [R1-GigabitEthernet0/0/0]q
    [R1]q
    <R1>telnet 34.1.1.2
      Press CTRL_] to quit telnet mode
      Trying 34.1.1.2 ...
      Connected to 34.1.1.2 ...

    Login authentication

    Password:
    <R2>

## telnet 本地用户认证

    [R2]telnet server enable // 开启Telent服务
    [R4]aaa
    [R4-aaa]local-user testuser password cipher 123456 // 创建用户并设置密码
    [R4-aaa]local-user testuser privilege level 2 // 设置用户等级
    [R4-aaa]local-user testuser service-type telnet // 用户的登录方式
    [R4]user-interface vty 0 4
    [R4-ui-vty0-4]authentication-mode aaa // 认证模式为aaa认证

R4

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sy R4
    [R4]int g0/0/0
    [R4-GigabitEthernet0/0/0]ip add 56.1.1.2 24
    [R4-GigabitEthernet0/0/0]q
    [R4]telnet server enable
     Error: TELNET server has been enabled
    [R4]aaa
    [R4-aaa]
    [R4-aaa]
    [R4-aaa]
    [R4-aaa]local-user testuser password cipher 123456
    Info: Add a new user.
    [R4-aaa]dis this
    [V200R003C00]
    #
    aaa
     authentication-scheme default
     authorization-scheme default
     accounting-scheme default
     domain default
     domain default_admin
     local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
     local-user admin service-type http
     local-user testuser password cipher %$%$HPm[~yFOaU!LuC#'ZSi@Pc''%$%$
    #
    return
    [R4-aaa]local-user testuser privilege level 2
    [R4-aaa]local-user testuser service-type telnet
    [R4-aaa]

    [R4-aaa]local-user test2 password cipher 456789
    Info: Add a new user.
    [R4-aaa]local-user test2 privilege level 3
    [R4-aaa]local-user test2 service-type telnet
    [R4-aaa]q
    [R4]user-interface vty 0 4
    [R4-ui-vty0-4]authentication-mode aaa

R3

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sy R3
    [R3]int g0/0/0
    [R3-GigabitEthernet0/0/0]ip add 56.1.1.1 24
    <R3>
    <R3>telnet 56.1.1.2
      Press CTRL_] to quit telnet mode
      Trying 56.1.1.2 ...
      Connected to 56.1.1.2 ...

    Login authentication

    Username:testuser
    Password:
    <R4>

## SSH

SSH: 是一种加密的远程登录协议，采 用非对称加密方式.

对称加密：两端采用同样的密钥进行数据的加密和解密，一旦密钥被泄露，则数据安全无法保障.

非对称加密：双方都拥有自己的公钥和私钥，双方都将自己的公钥告知对方，并要求对方使用自己的公钥加密，通过公钥加密的数据只能通过对应的私钥解密，公钥可以被传递到网络中，私钥只能本地保存，不能被传递.

PC

    [PC]rsa local-key-pair create // 创建密钥对
    [PC]ssh client first-time enable // 开启首次登录
    [PC]stelnet x.x.x.x

SSH_SERVER

    [SSH_SERVER]stelnet server enable // 开启ssh服务
    // 创建SSH认证登录所需的用户信息.
    [SSH_SERVER]aaa
    [SSH_SERVER-aaa]local-user sshuser password cipher 123456
    [SSH_SERVER-aaa]local-user sshuser privilege level 3
    [SSH_SERVER-aaa]local-user sshuser service-type ssh //设置用户为SSH用户
    // 配置vty线路认证
    [SSH_SERVER]user-interface vty 0 4
    [SSH_SERVER-ui-vty0-4]authentication-mode aaa
    [SSH_SERVER-ui-vty0-4]protocol inbound ssh
    // 通过RSA算法生成密钥对
    [SSH_SERVER]rsa local-key-pair create

R2

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sy SSH_SERVER
    [SSH_SERVER]int g0/0/0
    [SSH_SERVER-GigabitEthernet0/0/0]ip add 12.1.1.2 24

    [SSH_SERVER]stelnet server enable
    Info: Succeeded in starting the STELNET server.
    [SSH_SERVER]

    [SSH_SERVER]aaa
    [SSH_SERVER-aaa]local-user sshuser password cipher 123456
    Info: Add a new user.
    [SSH_SERVER-aaa]local-user sshuser privilege level 3
    [SSH_SERVER-aaa]local-user sshuser service-type ssh
    [SSH_SERVER-aaa]q
    [SSH_SERVER]user-interface vty 0 4
    [SSH_SERVER-ui-vty0-4]authentication-mode aaa
    [SSH_SERVER-ui-vty0-4]protocol inbound ?
      all     All protocols
      ssh     SSH protocol
      telnet  Telnet protocol
    [SSH_SERVER-ui-vty0-4]protocol inbound ssh

    [SSH_SERVER]rsa local-key-pair create
    The key name will be: Host
    % RSA keys defined for Host already exist.
    Confirm to replace them? (y/n)[n]:y
    The range of public key size is (512 ~ 2048).
    NOTES: If the key modulus is greater than 512,
           It will take a few minutes.
    Input the bits in the modulus[default = 512]:1024
    Generating keys...
    ...................++++++
    ..........................++++++
    .............++++++++
    .++++++++
    [SSH_SERVER]

R1

    <Huawei>sy
    Enter system view, return user view with Ctrl+Z.
    [Huawei] sy PC
    [PC]int g0/0/0
    [PC-GigabitEthernet0/0/0]ip add 12.1.1.1 24
    [PC]
    [PC]rsa local-key-pair create
    The key name will be: Host
    % RSA keys defined for Host already exist.
    Confirm to replace them? (y/n)[n]:y
    The range of public key size is (512 ~ 2048).
    NOTES: If the key modulus is greater than 512,
           It will take a few minutes.
    Input the bits in the modulus[default = 512]:1024
    Generating keys...
    .++++++
    ........++++++
    ......++++++++
    ......................++++++++

    [PC]
    [PC]ssh client first-time enable

    [PC]stelnet 12.1.1.2
    Please input the username:sshuser
    Trying 12.1.1.2 ...
    Press CTRL+K to abort
    Connected to 12.1.1.2 ...
    The server is not authenticated. Continue to access it? (y/n)[n]:y
    Dec 21 2023 15:02:27-08:00 PC %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[0]:The server ha
    d not been authenticated in the process of exchanging keys. When deciding whethe
    r to continue, the user chose Y.
    [PC]
    Save the server's public key? (y/n)[n]:y
    The server's public key will be saved with the name 12.1.1.2. Please wait...

    Dec 21 2023 15:02:32-08:00 PC %%01SSH/4/SAVE_PUBLICKEY(l)[1]:When deciding wheth
    er to save the server's public key 12.1.1.2, the user chose Y.
    [PC]
    Enter password:
    <SSH_SERVER>

IP路由基础

IP 路由基础 IP 路由基础 路由路由：指导报文转发的路径信息，通过路由可以确认 IP 报文的转发路径. 路由表：路由信息库 (RIB) 每台路由器都维护着一张全局路由表，另外路由器...

实现VLAN间通信

实现 VLAN 间通信 实现 VLAN 间通信 使用路由器物理接口 R1<Huawei>sy[Huawei]sy R1[R1]int g0/0/0[R1-GigabitEt...

推荐阅读
DHCP 数据转发过程 IP路由基础 NAT网络地址转换 OSPF路由计算 实现VLAN间通信

留言区

Notes
数据通信网络
Are You A Robot?