十分钟学会三种管理交换机的方法

本文详细介绍了如何通过eNSP脚本配置交换机,包括配置两个IP地址、Console登录方式、启用SSH和Telnet访问,以及设置AAA授权和访问控制。
摘要由CSDN通过智能技术生成

一、eNSP脚本配置

拓扑

cloud配置

配置两个ip地址,可以相同

测试通信

二、Console 登录方式
Console 就是用串口线连上去直接可以访问

比如

Please Press ENTER.

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]dis cu
#
sysname Huawei
#
undo info-center enable
#
vlan batch 200
console口密码登录

这种方式通常是新交换机,一般我们对console 口也会做限制

#设置aaa授权
[Huawei]user-inter        
[Huawei]user-interface con 0     
[Huawei-ui-console0]authentication-mode aaa
[Huawei-ui-console0]quit
#创建用户名密码权限以及服务类型
[Huawei]aaa      
[Huawei-aaa]local-user console01 password cipher admin@123
Info: Add a new user.       
[Huawei-aaa]local-user console01 privilege level 15       
[Huawei-aaa]local-user console01 service-type terminal
[Huawei-aaa]quit
[Huawei]quit
<Huawei>
<Huawei>quit User interface con0 is available
#登录测试
Please Press ENTER.
Login authentication
Username:console01
Password:
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]
取消访问限制
[Huawei]user-interface console 0
[Huawei-ui-console0]di th
#
user-interface con 0
 authentication-mode aaa
user-interface vty 0 4
 authentication-mode aaa
 user privilege level 15
 protocol inbound all
#
return
      
[Huawei-ui-console0]undo authentication-mode 
[Huawei-ui-console0]
[Huawei-ui-console0]quit
[Huawei]quit
<Huawei>quit User interface con0 is available


#登录测试
Please Press ENTER.

<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]
三、配置交换机ssh访问
创建管理IP
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info en
Info: Information center is disabled.
[Huawei]vlan 200
[Huawei-vlan200]quit
[Huawei]inter vlan 200
[Huawei-Vlanif200]ip add 192.168.9.254 24
[Huawei-Vlanif200]quit
[Huawei]inter g 0/0/1

[Huawei-GigabitEthernet0/0/1]port link acc       
[Huawei-GigabitEthernet0/0/1]port default vlan 200
[Huawei-GigabitEthernet0/0/1]quit

[Huawei]dis ip interface brief 

Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           down       down      
Vlanif200                         192.168.9.254/24     up         up        
[Huawei

[Huawei]ping 192.168.9.100
  PING 192.168.9.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.9.100: bytes=56 Sequence=1 ttl=128 time=50 ms
    Reply from 192.168.9.100: bytes=56 Sequence=2 ttl=128 time=30 ms
创建ssh 登录账户
#开启stelnet功能       
[Huawei]stelnet server enable 
Info: Succeeded in starting the Stelnet server. 
#设置ssh用户admin的服务类型为stelnet      
[Huawei]ssh user admin service-type stelnet 
Info: Succeeded in adding a new SSH user.  
#设置ssh用户授权类型是密码登录     
[Huawei]ssh user admin authentication-type password 
#创建虚拟用户      
[Huawei]user-interface vty 0 4
#aaa 授权       
[Huawei-ui-vty0-4]authentication-mode aaa       
[Huawei-ui-vty0-4]protocol inbound ssh
[Huawei-ui-vty0-4]quit
[Huawei]aaa       
[Huawei-aaa]local-user admin password cipher admin@123      
[Huawei-aaa]local-user admin privilege level 15    
[Huawei-aaa]local-user admin service-type ssh
[Huawei-aaa]
[Huawei-aaa]
[Huawei-aaa]quit
#查看信息       
[Huawei]dis ssh user-information 
  User 1:
       User Name            : admin
       Authentication-type  : password
       User-public-key-name : -
       User-public-key-type : -
       Sftp-directory       : -
       Service-type         : stelnet
       Authorization-cmd    : No
[Huawei]
#
#
测试

四、配置telnet登录

配置管理网

Enter system view, return user view with Ctrl+Z.
[Huawei]undo info en
Info: Information center is disabled.
[Huawei]dis interface brief | include up
PHY: Physical
*down: administratively down
(l): loopback
(s): spoofing
(b): BFD down
(e): ETHOAM down
(dl): DLDP down
(d): Dampening Suppressed
InUti/OutUti: input utility/output utility
Interface                   PHY   Protocol InUti OutUti   inErrors  outErrors
GigabitEthernet0/0/1        up    up          0%     0%          0          0
NULL0                       up    up(s)       0%     0%          0          0
Vlanif9                     up    up          --     --          0          0
[Huawei]

#创建管理网络 vlan     
[Huawei]vlan 9
[Huawei-vlan9]quit
[Huawei]inter vlan 9
[Huawei-Vlanif9]ip add 192.168.9.1 24
[Huawei-Vlanif9]quit
#配置端口信息
[Huawei]inter g 0/0/1     
[Huawei-GigabitEthernet0/0/1]port l acc
[Huawei-GigabitEthernet0/0/1]port default vlan 9
[Huawei-GigabitEthernet0/0/1]ping 192.168.9.100
  PING 192.168.9.100: 56  data bytes, press CTRL_C to break
    Reply from 192.168.9.100: bytes=56 Sequence=1 ttl=128 time=50 ms
    Reply from 192.168.9.100: bytes=56 Sequence=2 ttl=128 time=30 ms


[Huawei-GigabitEthernet0/0/1]
配置交换机telnet
#开启telnet功能
[Huawei]
[Huawei]telnet server enable
Info: The Telnet server has been enabled.  
#访问限制只能vlan 9 能够访问     
[Huawei]telnet client-source -i Vlanif 9
Info: Succeeded in setting the source interface of the telnet client to Vlanif9.
#创建     进入VTY 0~VTY 4用户界面视图。
[Huawei]user-interface vty 0 4       
[Huawei-ui-vty0-4]authentication-mode aaa      
[Huawei-ui-vty0-4]protocol inbound telnet 
[Huawei-ui-vty0-4]quit
[Huawei]aaa     
[Huawei-aaa]local-user admin password cipher admin@123       
[Huawei-aaa]local-user admin privilege level 15     
[Huawei-aaa]local-user admin service-type telnet
[Huawei-aaa]quit
测试

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

石兴稳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值