带你了解配置管理VLAN实现远程管理设备

发表于:2024-3-15 09:28

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:佚名    来源:今日头条

  配置管理VLAN实现远程管理设备
  1 组网需求
  如图 1 所示,用户希望安全地登录到Switch进行远程管理,Switch上没有空闲管理网口。
图 1 配置通过管理VLAN实现远程管理设备组网图
  2 配置思路
  用户可以通过管理网口或管理VLAN的VLANIF接口远程登录到设备进行管理。设备上没有空闲的管理网口,需要采用管理VLAN实现。同时,为了用户安全登录,采用STelnet登录方式。配置思路如下:
  ·在Switch上配置管理VLAN,并将接口加入VLAN。
  · 在Switch上配置VLANIF并指定IP地址。
  · 在Switch上开启STelnet服务功能,并配置SSH用户。
  · 用户PC以STelnet方式登录Switch。
  3 操作步骤
  【1】配置管理VLAN,并将接口加入VLAN
  # 在Switch上创建VLAN10,并指定为管理VLAN,然后将接口GE1/0/1以Tagged方式加入VLAN10。
  <HUAWEI> system-view
  [HUAWEI] sysname Switch
  [Switch] vlan 10
  [Switch-vlan10] management-vlan
  [Switch-vlan10] quit
  [Switch] interface gigabitethernet 1/0/1
  [Switch-GigabitEthernet1/0/1] port link-type trunk
  [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
  [Switch-GigabitEthernet1/0/1] quit
  【2】配置VLANIF接口及其IP地址
  # 在Switch上创建VLANIF10,并配置其IP地址为10.10.10.2/24。
  [Switch] interface vlanif 10
  [Switch-Vlanif10] ip address 10.10.10.2 24
  [Switch-Vlanif10] quit
  【3】启用STelnet服务,并配置SSH用户
  #在Switch上生成本地密钥对
  [Switch]rsa local-key-pair create
  The key name will be: Switch_Host
  The range of public key size is (2048 ~ 2048).
  NOTES: If the key modulus is greater than 512,
   it will take a few minutes.
  Input the bits in the modulus[default = 2048]:     //按Enter键
  Generating keys...
  ...................+++++
  ........................++
  ....++++
  ...........++
  #配置SSH用户 在Switch上配置VTY用户界面。
  [Switch] user-interface vty 0 14
  [Switch-ui-vty0-14] authentication-mode aaa
  [Switch-ui-vty0-14] protocol inbound ssh
  [Switch-ui-vty0-14] quit
  # 在Switch上新建用户名为client001的SSH用户,且认证方式为password。
  [Switch] aaa
  [Switch-aaa] local-user client001 password irreversible-cipher Huawei@123
  [Switch-aaa] local-user client001 privilege level 3
  [Switch-aaa] local-user client001 service-type ssh
  [Switch-aaa] quit
  [Switch] ssh user client001 authentication-type password
  # 在Switch上开启STelnet服务功能。
  [Switch] stelnet server enable
  # 配置SSH用户client001的服务方式为STelnet
  [Switch] ssh user client001 service-type stelnet
  【4】验证配置结果
  配置完成后,用户PC即可采用password认证方式登录Switch。
  # 在用户PC上运行putty软件,出现如图 3 所示对话框,输入Switch的IP地址10.10.10.2,选择协议类型为SSH。
图 2 配置通过管理VLAN实现远程管理设备组网图
  # 点击“Open”,Switch上出现如下界面,输入用户名和密码,并按Enter键。
  login as: client001
  SSH server: User Authentication
  Using keyboard-interactive authentication.
  Password:
  Info: The max number of VTY users is 10, and the number
        of current VTY users on line is 1.
        The current login time is 2021-11-30 05:45:41+00:00.
  <Switch>
  至此,用户PC已成功登录到Switch,可以对Switch进行远程管理。
  4 配置文件
  Switch的配置文件
  #
  sysname Switch
  #
  vlan batch 10
  #
  vlan 10
   management-vlan
  #
  aaa
   local-user client001 password irreversible-cipher $1a$EqZEVTq=/@T2XM0q0W{Ec[Fs2@&4YII@-=(lbr[K>4Dq76]3#BgqMOAxu^%$$
   local-user client001 privilege level 3
   local-user client001 service-type ssh
  #
  interface Vlanif10
   ip address 10.10.10.2 255.255.255.0
  #
  interface GigabitEthernet1/0/1
   port link-type trunk
   port trunk allow-pass vlan 10
  # 
  stelnet server enable
  ssh user client001
  ssh user client001 authentication-type password
  ssh user client001 service-type stelnet
  # 
  user-interface vty 0 14
   authentication-mode aaa
  #
  return
  本文内容不用于商业目的,如涉及知识产权问题,请权利人联系51Testing小编(021-64471599-8017),我们将立即处理
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号