eNSP基础常用命令

本文主要收集了基础的常用ensp命令及其简写方式


基础命令

命令可通过tap键进行补全,当输入的不完整的命令能补全能匹配到的命令有且只有一个时,不进行补全亦可执行该命令
system-view:从用户模式切换成系统模式,简写为“sys”,ctrl +z 可以退回用户模式;
sysname:修改当前设备主机名;
undo info-center enable :关闭信息中心功能,关闭后,在配置过程部分配置信息不会显示;
quit:退出当前模式,逐级退出,简写为“q”;
save:保存当前设备的配置,否则设备重启后配置会恢复;
reboot:重启设备;
display current-configuration:查看当前生效配置,即当前设备所有接口的配置命令都会显示出来,按回车一行一行翻,按空格一页一页翻;
display clock:显示设备时间;
display this:可以显示当前界面配置生效的命令;
undo + 配置命令:可用于删除当前界面配置的命令;

清除整个交换机或路由器配置的命令

需要在用户视图下执行reset saved-configuration命令

<Huawei>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.
May 31 2023 22:32:17-08:00 Huawei %%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.
<Huawei>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-Ethernet0/0/1]clear configuration int e0/0/1      //清除当前端口配置
Warning: All configurations of the interface will be cleared, and its state will
 be shutdown. Continue? [Y/N] :y                         //选择y执行清除
Info: Total execute 2 command(s), 2 successful, 0 failed.
[Huawei]
May 31 2023 22:41:56-08:00 Huawei %%01PHY/1/PHY(l)[1]:    Ethernet0/0/1: change 
status to down
May 31 2023 22:41:57-08:00 Huawei 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 3, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]undo shutdown     //重启端口

保存配置

保存设备的配置信息,如不进行保存,每次重启将会恢复之前的配置,需要在用户视图下保存

<Huawei>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to the slot 0.
May 31 2023 22:48:30-08:00 Huawei %%01CFM/4/SAVE(l)[3]:The user chose Y when dec
iding whether to save the configuration to the device.
Save the configuration successfully.

接口管理命令

interface +接口 :用于进入已经存在的接口,或者创建并进入逻辑接口。简写如int g0/0/1
shutdown:用来关闭当前接口。 简写:shut
undo shutdown:用来打开当前接口。简写 undo shut

路由器

display ip interface brief :查看看接口与IP相关的简要信息。包括ip地址,子网掩码,物理链路和协议的up/down状态以及处于不同状态下接口数量;
ip address 192.168.1.1 24:为接口添加ip地址192.168.1/24。可简写为ip add 192.168.1.1 24
display ip routing-table :查看当前设备路由表;
ip route-static 192.168.1.0 24 192.168.2.1:配置静态路由,要去192.168.1.0/24这个网段的数据包要通过192.168.2.1这个地址送出去

VLAN配置

vlan 1:创建vlan1并进入vlan视图;
vlan batch 1 2:创建vlan1和vlan2,用于创建一个或批量创建多个vlan;
vlan batch 2 to 4:创建vlan2 到vlan 4,用于创建一个或批量创建多个vlan;
display vlan :查看设备所有vlan的相关信息;

设置接口为access

port link-type access
port default vlan 10    //配置接口的默认vlan并同时加入这个vlan

设置接口为trunk

port link-type trunk
port trunk allow-pass vlan 10 20    //用来配置trunk类型接口加入的vlan

设置接口为hybrid

设置端口类型为hybrid,并以untagged(不带标签)方式加入vlan中,pvid为vlan10

port link-type hybrid
port hybrid untagged vlan 10    //用来配置hybrid类型接口所属的vlan
port hyvrid pvid vlan 10         //用来设置hybrid类型接口的默认vlan id

设置端口类型为hybrid,并以tagged(带标签)方式同时加入vlan10 和vlan20

port link-type hybrid
port hybrid tagged vlan 10 20   //指定hybrid类型接口所属vlan
  • 20
    点赞
  • 130
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值