交换机实用配置技巧(一)

情景再现

软件使用 eNsp

交换机使用华为S5700

链接是 eNSP 的安装包,可自行下载

链接:https://pan.baidu.com/s/1WHbkoitd6F3Y6OdZZUJhOg?pwd=1120
提取码:1120

 

认识配置视图

1.1进入配置终端及切换视图

1)进入系统视图

    The device is running!

    <Huawei>                                             //用户视图
    <Huawei> system-view                                 //切进系统视图
    Enter system view, return user view with Ctrl+Z. 
    [Huawei]                                             //系统视图

 2)进入接口g0/0/1的接口视图

    [Huawei] interface GigabitEthernet 0/0/1             //切进接口视图
    [Huawei-GigabitEthernet0/0/1]                         //接口视图

 3)返回系统视图、返回用户视图

    [Huawei-GigabitEthernet0/0/1] quit
    [Huawei] quit
    <Huawei>

4)重新进入接口g0/0/1的接口视图,快速返回用户视图

    <Huawei>system-view
    Enter system view, return user view with Ctrl+Z.
    [Huawei]interface GigabitEthernet 0/0/1
    [Huawei-GigabitEthernet0/0/1]                     //按Ctrl+Z快捷键
    <Huawei>                                         //已快速返回到用户视图

1.2命令行编辑技巧

1)TAB补全功能

    <Huawei>sys<TAB>                                     //输入sys后按TAB键
    <Huawei>system-view                                 //自动补全完整命令

2)命令简写

    <Huawei>sys                                         //进系统视图的简写
    Enter system view, return user view with Ctrl+Z.
    [Huawei]
    [Huawei]int g0/0/1                                  //进接口模式的简写
    [Huawei-GigabitEthernet0/0/1]

3) ? 帮助的用法

    [Huawei-GigabitEthernet0/0/1]display ver?             //在命令后加 ?会提示用法
      version                                 
    [Huawei-GigabitEthernet0/0/1]display versio    
    [Huawei-GigabitEthernet0/0/1]display version ?
      slot  Slot
      |     Matching output
      <cr>  

交换机基础配置

2.1将交换机的设备名设为 yulsw1

为所有用户添加初始化命令

    <Huawei>system-view 
    Enter system view, return user view with Ctrl+Z.
    [Huawei]sys	
    [Huawei]sysname yu-lsw1                    //将设备名设置为 yu-lsw1
    [yu-lsw1]
   

2.2禁用/启用交换机上链接设备的接口(比如g0/0/1)

1)禁用g0/0/1接口

    [yu-lsw1]int	
    [yu-lsw1]interface g0/0/1                                    //进接口配置
    [yu-lsw1-GigabitEthernet0/0/1]shutdown                       //禁用接口        
    [yu-lsw1-GigabitEthernet0/0/1]
    Mar 12 2024 11:04:17-08:00 yu-lsw1 %%01PHY/1/PHY(l)[0]:        
    GigabitEthernet0/0/1: change status to down                  //此接口状态为down     
 

2)重新将连接g0/0/1接口启用

[yu-lsw1-GigabitEthernet0/0/1]undo shutdown
[yu-lsw1-GigabitEthernet0/0/1]
Mar 12 2024 11:07:30-08:00 yu-lsw1 %%01PHY/1/PHY(l)[1]:   
 GigabitEthernet0/0/1:  change status to up               //此接口状态为up

检查、保存交换机配置

3.1 配置

1)查看当前配置

<yu-lsw1>displ	
<yu-lsw1>display curr	
<yu-lsw1>display current-configuration         //查看配置
#
sysname yu-lsw1
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
 authentication-scheme default
 authorization-scheme default
 accounting-scheme default
 domain default
 domain default_admin
 local-user admin password simple admin
 local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
......
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return
<yu-lsw1>

2)保存当前配置

<yu-lsw1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
Mar 12 2024 11:11:32-08:00 yu-lsw1 %%01CFM/4/SAVE(l)[2]:The user chose Y when de
ciding whether to save the configuration to the device.
flash:/vrpcfg.zip exists, overwrite?[Y/N]:y
Mar 12 2024 11:11:47-08:00 yu-lsw1 %%01CFM/4/OVERWRITE_FILE(l)[3]:When deciding 
whether to overwrite the configuration file vrpcfg.zip, the user chose Y.
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<yu-lsw1>

使用配置技巧

4.1为交换机设置中断登陆密码 13245678

1)设置登录密码。

<yu-lsw1>system-view                                       //进系统视图
Enter system view, return user view with Ctrl+Z.
[yu-lsw1]user-inter	
[yu-lsw1]user-interface console 0                           //进终端配置
[yu-lsw1-ui-console0]set authen	
[yu-lsw1-ui-console0]set authentication pass	
[yu-lsw1-ui-console0]set authentication password ci	
[yu-lsw1-ui-console0]set authentication password cipher 13245678   
                                                     //设置终端登录密码为13245678
[yu-lsw1-ui-console0]auth	
[yu-lsw1-ui-console0]authentication-mode password     //启用密码认证
Mar 12 2024 11:17:43-08:00 yu-lsw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.
5.25.191.3.1 configurations have been changed. The current change number is 8, t
he change loop count is 0, and the maximum number of records is 4095.
[yu-lsw1-ui-console0]

2)先从用户视图quit,然后重新登录测试。

<yu-lsw1>quit User interface con0 is available



Please Press ENTER.


Login authentication


Password:            //再次进终端时,要求密码验证
<yu-lsw1>

4.2 将会话的闲置超时设为2880分钟

[yu-lsw1-ui-console0]idle	
[yu-lsw1-ui-console0]idle-timeout 3660              //将闲置超时设为2880分钟
[yu-lsw1-ui-console0]

4.3 恢复交换机出厂设置

<yu-lsw1>reset saved-configuration 
Warning: The action will delete the saved configuration in the device.
The configuration will be erased to reconfigure. Continue? [Y/N]:y     //提示是否恢复选Y

Warning: Now clearing the configuration in the device.
Mar 12 2024 11:22:52-08:00 yu-lsw1 %%01CFM/4/RST_CFG(l)[0]:The user chose Y when
 deciding whether to reset the saved configuration.
Info: Succeeded in clearing the configuration in the device.


<yu-lsw1>reboot
Info: The system is now comparing the configuration, please wait.
Warning: All the configuration will be saved to the configuration file for the n
ext startup:, Continue?[Y/N]:n              //提示是否保存选N

Info: If want to reboot with saving diagnostic information, input 'N' and then e
xecute 'reboot save diagnostic-information'.
System will reboot! Continue?[Y/N]:y        //提示是否重启选Y


.。
<Huawei>

补充

 1.关闭日志提醒

<Huawei>u t m                                  //关闭日志提示
Info: Current terminal monitor is off.    

 2.改变语言模式


<Huawei>la c                                   //改变语言模式为中文
Change language mode, confirm? [Y/N] y
提示:改变语言模式成功。

3.取消密码设置

[yu1]user-interface console 0
[yu1-ui-console0]undo set auth	
[yu1-ui-console0]undo set authentication password       //取消密码

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值