Files
docs/软件or平台使用/ensp配置.md
2026-01-14 11:27:47 +08:00

299 lines
10 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### 用户模式命令
***
clock timezone 时区名字 add 当地时区时间 #设置系统时区
clock datatime 08:00:00 2021-04-19 #设置系统时间
reset saved-configuration #清空配置文件
display current-configuration #显示系统配置
startup system-software 文件名 #使用新的vrp系统文件启动
BOOTROM菜单默认密码huawei高版本Admin@huawei
reset recycle-bin #清空回收站文件
display saved-configuration #查看保存的配置文件
display startup #查看下次启动使用的配置文件
save #保存配置
### 系统模式命令 "system"
sysname 名字 #给设备重命名
header shell information "内容" #设置登录内容
display ip routing-table #查看路由表
telnet server port 端口号 #设置Telnet远程端口号
### 接口模式命令 "interface 接口"
***
undo portswitch #将二层口切换到三层口
### 同时配置多个端口
int range G0/0/1 to G0/0/5
> 华为设备只有三层口可以直接配置IP,二层只能通过vlan,低级设备只有wan口是三层
undo shutdown #启用接口
shutdown #关闭接口
display this #显示接口配置
description 内容 #设置接口的描述信息
ip address IP地址 掩码 sub #环回接口下,配置子地址
### 用户界面模式命令 "user-interface 接口"
***
authentication-mode 验证方式 #设置登录方式为password,aaa,空
idle-timeout N分钟 #用户接口模式下,设置登录超时时间,0为永不超时,等同于undo idle-timeout
set authentication password cipher 密码 #设置登录密码
user privilege level 级别 #为接口设置用户级别
> 用户级别:0参观级;1监控级;2配置级;3-15管理级命令级别:0参观级;0、1监控级0/1/2配置级0/1/2/3管理级
### 路由协议模式命令
***
### VLAN模式命令
批量创建vlan
vlan batch 10 20 30
***
### 通用模式命令(在所有模式都可使用)
display ip interface brief #查看端口配置信息
### STP(生成树协议)命令
***
stp enable #开启stp协议
stp mode stp #切换stp协议,华为默认为mstp协议
stp root primary #设置主要根桥
stp root secondary #设置次要根桥
undo stp root #设置根桥
stp priority 数字 #设置根桥优先级,数字越小级别越高
undo stp priority #恢复stp缺省优先级
stp port priority 数字 #在接口模式下,设置端口优先级,数字越小优先级越高
undo stp port priority #在接口模式下,恢复端口缺省优先级
stp cost 数字 #在接口模式下,修改端口的开销值
undo stp cost #在接口模式下,恢复端口缺省开销值
display stp #查看根桥信息
display stp brief #查看stp接口信息
### RSTP(快速生成树协议)命令
***
stp edged-port enable #在接口模式下,配置端口为边缘端口
stp bpdu-protection #配置bpdu保护功能
stp loop-protection #在非根桥交换机的根端口和Alternate口配置环路保护功能
### 静态路由
***
ip route-static 目的网络 子网掩码 下一跳ip #系统模式下,配置静态路由,需双向配置
ip route-static 目的网络 子网掩码 下一跳ip preference 80 #系统模式下,通过降低优先级,配置备份静态路由,缺省优先级为60
undo ip route-static 目的网络 子网掩码 下一跳ip preference 80 #系统模式下,删除此静态路由
ip route-static 0.0.0.0 0 下一跳ip preference 80 #配置备份缺省路由,双向配置
### RIP(距离矢量型路由协议)
***
interface LoopBack 数字 #系统模式下,进入虚拟环回接口,需要配置IP
ip address ip地址 掩码 sub #在环回接口下,配置子环回地址
rip 进程号 #系统模式下,进入rip协议,进程号默认为1,删除rip进程,在命令前加undo
version 2 #在rip协议下,使用RIP协议版本2
rip summary-address 网络地址 子网掩码 #在接口模式下,配置路由汇总,减小路由表
undo summary #接口模式下,取消RIP协议自动汇总
network 直连网络 #rip协议模式下,通告本路由的直连网络,输入网络地址,如:10.0.0.0
reset ip routing-table statistics protocol rip #清除错误的RIP路由信息
display ip routing-table protocol rip #查看RIP协议的路由表
silent-interface 端口 #在rip协议下,使端口进入沉默模式,只接受其他路由发送的通告,不向其他路由发送通告,解除方式在命令前加undo
rip authentication-mode simple 密码 #在接口模式下,配置rip明文认证,相连的两个接口要设置同一认证方式
rip authentication-mode md5 usual 密码 #在接口模式下,配置rip的MD5认证
undo rip authentication-mode #删除rip认证配置
rip version 1 #接口模式下,对使用rip2协议的路由同时兼容rip1协议
debugging rip 1 #用户模式下,开启RIP调试功能
> display debugging #用户模式下,显示当前调试信息terminal debugging #用户模式下,将debug信息在终端显示undo debugging rip 进程号 #用户模式下,关闭debug调试,undo debugging all #关闭调试功能debugging rip 1 event #用户模式下,查看路由器发出和收到的定期更新事件"过多开起debug命令,会大量占用路由器资源,甚至导致宕机"
### OSPF(开放式最短路径优先协议"ospf属于链路状态型路由协议")
***
ospf 进程号 router-id 路由器ID(环回地址) #系统模式下,进入ospf配置模式,进程号默认为1,进程号只有本地意义.
area 区域号(数字) #ospf协议模式下.进入区域配置视图
network 10.1.1.1 反掩码 #区域配置模式下,通告设备接口的网络,反掩码将正掩码取反(255.255.255.0的反掩码就是0.0.0.255),取消单个通告在命令前加undo
authentication-mode md5 1 cipher 密码 #区域配置模式下,设置ospf协议的md5认证
display ip routing-table protocol ospf #查看ospf协议的路由表
display ospf brief #查看ospf配置的具体信息
display ospf peer brief #查看ospf的邻居关系
display ospf lsdb #查看LSA信息的链路状态数据库
display ospf interface 端口 #查看ospf的hello和dead时间
ospf cost 数字 #接口模式下,调整接口的开销值
bandwidth-reference 数字 #ospf协议模式下,修改带宽值(可以影响开销值),数字为10的整数倍,所有路由都要配置相同带宽值
silent-interface 接口 #在路由协议模式下,配置被动接口,既不接受路由信息,也不发送路由信息,通常配置在连接终端设备的接口
ospf timer hello 数字 #接口模式下,调整hello的值,调整hello和dead的值可以影响ospf路由建立邻居关系
ospf timer dead 数字 #接口模式下,调整dead的值
preference 数字 #ospf协议下修改ospf路由优先级
preference ase 数字 #ospf协议下修改ospf外部导入路由优先级
ospf dr-priority 数字 #接口模式下,修改路由的DR值,改变路由的优先级,默认情况下DR/BDR通过非抢占式选举,修改后需要重置ospf的邻居关系才会生效,例如:关闭某个端口,在打开.
import-route 路由类型 #ospf协议模式下,导入外部路由,direct为直连路由
ospf enable 进程号 area 区域号 #接口模式下,将接口地址宣告到对应的区域
> 多区域ospf配置OSPF虚链路配置
abr-summary 路由汇总后地址 汇总后掩码 #ospf区域模式下,配置路由汇总,适用于边界路由
asbr-summary 路由汇总后地址 汇总后掩码 #ospf协议模式下,配置路由汇总,适用于自治 边界路由
default-route-advertise always #ospf协议下,配置默认路由
ospf配置缺省路由并发布
> ip route-static 0.0.0.0 0.0.0.0 LoopBack 1 #系统模式下,配置缺省路由default-route-advertise #在ospf协议下,发布缺省路由到ospf域
### DHCP服务配置
***
dhcp enable #系统模式下,开启DHCP服务
ip pool name #系统模式下,创建名为name的地址池,并进入dhcp配置模式
network IP起始范围 mask 24 #dhcp模式下,设置地址池及子网掩码
gateway-list 网关IP #dhcp模式下,配置网关地址
excluded-ip-address 起始地址 终止地址 #DHCP模式下,设置不分配的IP
lease day 0 hour 8 #dhcp模式下,设置dhcp租期为0天8小时
dhcp select global #接口模式下,设置dhcp为全局范围,interface为接口,relay为中继
dhcp select interface #接口模式下,开启接口的dhcp功能
display ip pool name 地址池名称 #查看地址池的参数
> 交换机DHCP配置dhcp enable #系统模式下,启用dhcp功能interface Vlanif 1 #系统模式下,进入缺省管理端口ip address dhcp-alloc #缺省管理接口下,向dhcp服务器申请IP地址display ip interface brief #查看接口信息
### 3A认证用户创建及配置
***
aaa #系统模式,进入3A认证
local-user 用户名 password cipher 密码 #3A模式下,创建本地用户名和密码
local-user 用户名 service-type ftp #3A模式下,设置用户为ftp用户,或ssh用户
local-user 用户名 privilege level 级别(1-15) #3A模式想,设置用户级别
local-user 用户名 ftp-directory 目录 #3A模式下,设置用户目录
local-user 用户名 idle-timeout 时间 #3A模式下,设置ftp终端登录超时时间
### FTP服务配置
***
ftp server enable #系统模式下,启动ftp功能
set default ftp-directory 目录 #系统模式下,设置ftp服务目录
display ftp-server #显示ftp服务器信息
binary #ftp客户端下,配置文件传输模式
创建用户参考3A创建用户
get 文件名 #客户端下,从服务器下载文件,可一次输入多个文件名用空格隔开
put 文件名 #客户端下,上传文件到服务器
bye #ftp客户端下,关闭ftp连接
### SSH配置
***
rsa local-key-pair create #系统模式下,创建秘钥,选择秘钥长度
stelnet server enable #系统模式下,启动SSH服务器
user-interface vty 0 #系统模式下,进入vty接口
authentication-mode aaa #vty接口下,指定认证方式为3A
protocol inbound ssh #vty接口下,指明入站协议为ssh
ssh user 用户名 authentication-type password #将ssh协议与用户和密码关联起来,创建用户参考3A创建用户