eNSP(Enterprise Network Simulation Platform)是华为的网络模拟器,其设备配置命令基于华为的 VRP(Versatile Routing Platform) 操作系统。由于“命令大全”范围极广,以下整理一份按功能分类的核心命令参考,涵盖基础、接口、VLAN、路由、安全和维护等常用场景。


1. 系统基础命令

命令 说明
system-view 进入系统视图(全局配置模式)
sysname [name] 修改设备名称
display current-configuration 显示当前配置
display saved-configuration 显示已保存的配置
save 保存配置
reboot 重启设备
display version 查看系统版本和硬件信息
display clock 查看系统时间
clock datetime [time] 设置时间
display users 查看当前在线用户
super [password] 切换用户权限级别
display this 查看当前视图下的配置

2. 接口配置

2.1 常用接口命令

命令 说明
interface [type] [number] 进入接口视图
ip address [ip] [mask] 配置IP地址
undo shutdown 开启接口(默认关闭)
shutdown 关闭接口
description [text] 添加接口描述
display ip interface brief 查看接口IP摘要
display interface [type] [number] 查看接口详细状态
mtu [size] 修改MTU(最大传输单元)

2.2 链路聚合(Eth-Trunk)

shell

interface Eth-Trunk 1
mode manual load-balance   # 手工模式
trunkport GigabitEthernet 0/0/1 to 0/0/2   # 加入成员端口

3. VLAN配置(二层交换机)

命令 说明
vlan [vlan-id] 创建VLAN
description [text] VLAN描述
port link-type access 设置接口为Access模式
port default vlan [vlan-id] 将接口加入VLAN(Access)
port link-type trunk 设置接口为Trunk模式
port trunk allow-pass vlan [vlan-list] 允许特定VLAN通过Trunk
port trunk pvid vlan [vlan-id] 设置Trunk的Native VLAN
display vlan 查看VLAN信息
display vlan summary 查看VLAN汇总信息

4. IP路由

4.1 静态路由

shell

ip route-static [目标网络] [掩码] [下一跳/出接口]
# 示例
ip route-static 192.168.2.0 255.255.255.0 10.0.0.2

4.2 动态路由(以OSPF为例)

shell

ospf 1 router-id 1.1.1.1
 area 0.0.0.0
  network 10.0.0.0 0.0.0.255   # 宣告网段

4.3 路由查看

shell

display ip routing-table
display ip routing-table [网段]

5. 网络安全常用

5.1 ACL(访问控制列表)

shell

acl 3000
 rule 5 deny ip source 192.168.1.0 0.0.0.255 destination 10.0.0.0 0.0.0.255
# 应用到接口
interface GigabitEthernet0/0/0
 traffic-filter inbound acl 3000

5.2 NAT(网络地址转换)

shell

acl 2000
 rule permit source 192.168.1.0 0.0.0.255

interface GigabitEthernet0/0/1
 nat outbound 2000   # 出方向NAT(Easy IP)

6. DHCP配置

6.1 基于接口

shell

interface GigabitEthernet0/0/0
 dhcp select interface
 dhcp server dns-list 8.8.8.8

6.2 全局DHCP

shell

dhcp enable
ip pool vlan10
 gateway-list 192.168.10.1
 network 192.168.10.0 mask 255.255.255.0
 dns-list 8.8.8.8

interface GigabitEthernet0/0/0
 dhcp select global

7. 远程管理(Telnet/SSH)

7.1 Telnet配置

shell

user-interface vty 0 4
 authentication-mode password
 set authentication password simple huawei
 user privilege level 15

7.2 SSH配置

shell

rsa local-key-pair create
ssh user admin authentication-type password
ssh user admin service-type stelnet
user-interface vty 0 4
 authentication-mode aaa
 protocol inbound ssh

8. 维护与故障排查

命令 用途
ping [ip] 连通性测试
tracert [ip] 路由跟踪
display arp 查看ARP表
display mac-address 查看MAC地址表
display logbuffer 查看日志缓存
display diagnostic-information 收集设备诊断信息(重要)
reset counters interface 清空接口计数

9. 常用模式切换

命令 说明
system-view 从用户视图进入系统视图
quit 返回上一级视图
return 从任何视图直接返回用户视图
Ctrl+Z 等价于return
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐