198366809 发表于 2021-5-19 19:39:39

华为/思科/华三基本命令对比

前面我们发布了关于总结:华为、H3C、锐捷三家交换机配置命令详解,有很多朋友反映,对华为/思科/华三交换机配置命令有些分不清楚,那么本期弱电君和大家来看下他们的区别在哪里,这里对命令做了个汇总,平时对命令不熟的朋友这次可以看下。
CISCOH3CHUAWEI描述
noundoundo取消、关闭当前设置
showdisplaydisplay显示查看
exitquitquit退回上级
hostnamesysnamesysname设置主机名
en, config terminalsystem-viewsystem-view进入全局模式
deletedeletedelete删除文件
reloadrebootreboot重启
writesavesave保存当前配置
usernamelocal-userlocal-user创建用户
shutdownshutdownshutdown禁止、关闭 端口
show versiondisplay versiondisplay version显示当前系统版本
show startup-configdisplaysaved-configurationdisplaysaved-configuration查看已保存过的配置
show running-configdisplaycurrent-configurationdisplaycurrent-configuration显示当前配置
no debug allctrl+dctrl+d取消所有debug命令
erase startup-configreset saved-configurationreset saved-configuration删除配置
endreturnreturn退到用户视图
exitlogoutlogout登出
logginginfo-centerinfo-center指定信息中心配置信息
lineuser-interfaceuser-interface进入线路配置(用户接口)模式
start-configsaved-configurationsaved-configuration启动配置
running-configcurrent-configurationcurrent-configuration当前配置
hostip hostip hosthost名字和ip地址对应
交换部分
enable passwordset authenticationpassword simpleset authenticationpassword simple配置明文密码
interface type/numberinterface type/numberinterface type/number进入接口
interface vlan 1interface vlan 1interface vlan 1进入vlan配置vlan管理地址
interface ranginterface ethID to IDinterface ethID to ID定议多个端口的组
enabl esecretsuper passwordsuper password设置特权口令
duplex (half|full|auto)duplex (half|full|auto)duplex (half|full|auto)配置接口状态
speed (10/100/1000)speed (10/100/1000)speed (10/100/1000)配置端口速率
switchport mode trunkport link-type trunkport link-type trunk配置trunk
vlan ID /no vlan IDvlan batch ID /undo vlan batch IDvlan batch ID /undo vlan batch ID添加、删除vlan
switchport accessvlanport default vlan IDport acces vlan ID将端口接入vlan
show interfacedisplay interfacedisplay interface查看接口
show vlan IDdisplay vlan IDdisplay vlan ID查看vlan
encapsulationlink-protocollink-protocol封装协议
channel-group 1 mode onport link-aggregationgroup 1port link-aggregationgroup 1链路聚合
ip routing默认开启默认开启开启三层交换的路由功能
no switchport不支持不支持开启接口三层功能
vtp domainGVRPGVRP对跨以太网交换机的VLAN进行动态注册和删除
spanning-tree vlan IDroot primarystp instance id root primarystp instance id root primarystp配置根网桥
spanning-tree vlan IDprioritystp primary vlauestp primary vlaue配置网桥优先级
show spanning-treedis stp briefdis stp brief查看STP配置
路由部分
ip route 0.0.0.00.0.0.0ip route-static0.0.0.0 0.0.0.0ip route-static0.0.0.0 0.0.0.0配置默认路由
ip route 目标网段+掩码 下一跳ip route-static 目标网段+掩码 下一跳ip route-static 目标网段+掩码 下一跳配置静态路由
show ip routedisplay iprouting-tabledisplay iprouting-table查看路由表
router rip /network 网段rip /network 网段rip /network 网段启用rip、并宣告网段
router ospfospfospf启用ospf
network ip 反码 area <area-id>area<area-id>area<area-id>配置OSPF区域
no auto-summaryrip split-horizonrip split-horizon配置RIP V2水平分割
show ip protocoldisplay ip protocoldisplay ip protocol查看路由协议
access-list 1-99permit/deny IPrule id permit sourceIPrule id permit sourceIP标准访问控制列表
access-list 100-199permit/deny protocol source IP+反码destination IP+反码 operator operanrule{normal|special}{permit|deny}{tcp|udp}source {<ip wild>|any}destination<ip wild>|any}rule{normal|special}{permit|deny}{tcp|udp}source {<ip wild>|any}destination<ip wild>|any}扩展访问控制列表
standby group-numberip virtual-ipvrrp vrid numbervirtual-ipvrrp vrid numbervirtual-ip配置HSRP组
standby group-numberpriorityvrrp vrid numberpriorityvrrp vrid numberpriority配置HSRP优先级
standby group-numberpreemptvrrp vrid numberpreempt-modevrrp vrid numberpreempt-mode配置HSRP占先权
standby group-numbertrack配置端口跟踪
ip nat inside sourcestaticnat server global<ip> inside <ip> port nat server global<ip> inside <ip> port 配置静态地址转换

另外我们来看下华为与H3C的命令情况,方便大家进行对比。
一、华为交换机基础配置命令1、创建vlan:<Quidway>   //用户视图,也就是在Quidway模式下运行命令。
<Quidway>system-view      //进入配置视图
vlan 10       //创建vlan 10,并进入vlan10配置视图,如果vlan10存在就直接进入vlan10配置视图
quit   //回到配置视图
vlan 100   //创建vlan 100,并进入vlan100配置视图,如果vlan10存在就直接进入vlan100配置视图 quit   //回到配置视图
2、将端口加入到vlan中: interface GigabitEthernet2/0/1    (10G光口)
port link-type access    //定义端口传输模式
port default vlan 100   //将端口加入vlan100
quit       //回到配置视图 interface GigabitEthernet1/0/0       //进入1号插槽上的第一个千兆网口配置视图中。0代表1号口
port link-type access   //定义端口传输模式
port default vlan 10   //将这个端口加入到vlan10中
quit

3、将多个端口加入到VLAN中<Quidway>system-view
vlan 10
port GigabitEthernet 1/0/0 to 1/0/29   //将0到29号口加入到vlan10中
quit

4、交换机配置IP地址 interface Vlanif100   // 进入vlan100接口视图与vlan 100命令进入的地方不同
ip address 119.167.200.90 255.255.255.252      // 定义vlan100管理IP三层 交换网关路由
quit       //返回视图
interface Vlanif10    // 进入vlan10接口视图与vlan 10命令进入的地方不同
ip address 119.167.206.129 255.255.255.128    // 定义vlan10管理IP三层交换网关路由 quit
5、配置默认网关:ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。
6、 交换机保存设置和重置命令<Quidway>save      //保存配置信息
<Quidway>reset saved-configuration   //重置交换机的配置
<Quidway>reboot      //重新启动交换机
7、交换机常用的显示命令用户视图模式下:
<Quidway>display current-configuration   //显示现在交换机正在运行的配置明细
<Quidway>display device       //显示各设备状态
<Quidway>display interface ?    //显示个端口状态,用?可以查看后边跟的选项
<Quidway>display version      //查看交换机固件版本信息
<Quidway>display vlan ?      // 查看vlan的配置信息
8、恢复交换机出厂设置<Quidway>reset saved-configuration    //重置交换机的配置
二、H3C交换机的基本配置我们先来了解下h3c的配置命令与功能,都是常用的,基本上大部分网络配置都少不了这些命令。
1、基本配置<H3C>         //用户直行模式提示符,用户视图 <H3C>system-view      //进入配置视图
sysname xxx   //设置主机名成为xxx这里使用修改特权用户密码
2、用户配置<H3C>system-viewsuper password H3C         //设置用户分级密码undo superpassword         //删除用户分级密码localuser bigheap 1234561         //Web网管用户设置,1为管理级用户undo localuser bigheap      //删除Web网管用户user-interface aux 0         //只支持0idle-timeout 250         //设置超时为2分50秒,若为0则表示不超时,默认为5分钟
undoidle-timeout         //恢复默认值user-interface vty 0         //只支持0和1idle-timeout 250         //设置超时为2分50秒,若为0则表示不超时,默认为5分钟undoidle-timeout         //恢复默认值set authentication password123456         //设置telnet密码,必须设置undo set authenticationpassword      //取消密码displayusers         //显示用户displayuser-interface         //用户界面状态
3、vlan配置vlan 2                //创建VLAN2undo vlanall         //删除除缺省VLAN外的所有VLAN,缺省VLAN不能被删除port Ethernet 0/4 to Ethernet0/7         //将4到7号端口加入到VLAN2中,此命令只能用来加access端口,不能用来增加trunk或者hybrid端口
port-isolate enable       //打开VLAN内端口隔离特性,不能二层转发,默认不启用该功能
port-isolate uplink-portvlan 2       //设置4为VLAN2的隔离上行端口,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置
display vlan all         //显示所有VLAN的详细信息
user-group 20         //创建user-group 20,默认只存在user-group 1
port Ethernet 0/4 toEthernet 0/7         //将4到7号端口加入到VLAN20中,初始时都属于user-group 1中display user-group 20         //显示user-group 20的相关信息

四、交换机ip配置
vlan 20                //创建vlanmanagement-vlan 20          //管理vlaninterface vlan-interface 20         //进入并管理vlan20undo interface vlan-interface 20         //删除管理VLAN端口ip address192.168.1.2 255.255.255.0      //配置管理VLAN接口静态IP地址
undo ipaddress         //删除IP地址ip gateway 192.168.1.1         //指定缺省网关(默认无网关地址)undo ip gatewayshutdown      //关闭接口undo shutdown         //开启display ip         //显示管理VLAN接口IP的相关信息display interface vlan-interface20         //查看管理VLAN的接口信息<H3C>debugging ip         //开启IP调试功能<H3C>undo debugging ip

5、DHCP客户端配置
ip address dhcp-alloc      // 管理VLAN接口通过DHCP方式获取IP地址undo ip address dhcp-alloc      // 取消display dhcp      //显示DHCP客户信息<H3C>debugging dhcp-alloc         //开启DHCP调试功能<H3C>undo debugging dhcp-alloc

6、端口配置
interface Ethernet0/3             //进入端口shutdown         //关闭端口speed 100         //速率可为10,100,1000和auto(缺省)duplexfull         //双工,可为half,full和auto,光口和汇聚后不能配置flow-control      //开启流控,默认为关闭broadcast-suppression 20         //设置抑制广播百分比为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响loopback internal         //内环测试port link-type trunk         //设置链路的类型为trunkport trunk pvid vlan 20         //设置20为该trunk的缺省VLAN,默认为1(trunk线路两端的PVID必须一致)port access vlan 20         //将当前access端口加入指定的VLANport trunk permit vlanall         //允许所有的VLAN通过当前的trunk端口,可多次使用该命令mdiauto         //设置以太端口为自动监测,normal为直通线,across为交叉线                            link-aggregation Ethernet 0/1 toEthernet 0/4         //将1-4口加入汇聚组,1为主端口,两端需要同时配置,设置了端口镜像以及端口隔离的端口无法汇聚
undo link-aggregation Ethernet 0/1   //删除该汇聚组link-aggregation mode egress         //配置端口汇聚模式为根据目的MAC地址进行负荷分担,可选为ingress,egress和both,缺省为bothmonitor-port Ethernet 0/2         //将该端口设置为镜像端口,必须先设置镜像端口,删除时必须先删除被镜像端口,而且它们不能同在一个端口,该端口不能在汇聚组中,设置新镜像端口时,新取代旧,被镜像不变
mirroring-port Ethernet 0/3 toEthernet 0/4 both         //将端口3和4设置为被镜像端口,both为同时监控接收和发送的报文,inbound表示仅监控接收的报文,outbound表示仅监控发送的报文
display mirrordisplay interface Ethernet 0/3<H3C>resetcounters         //清除所有端口的统计信息display link-aggregation Ethernet0/3         //显示端口汇聚信息virtual-cable-test      //诊断该端口的电路状况
7、qos优先级配置
QoS配置步骤:设置端口的优先级,设置交换机信任报文的优先级方式,队列调度,端口限速priority 7         //设置端口优先级为7,默认为0priority-trustcos         //设置交换机信任报文的优先级方式为cos(802.1p优先级,缺省值),还可以设为dscp方式
queue-scheduler hq-wrr 2 4 6 8         //设置队列调度算法为HQ-WRR(默认为WRR),权重为2,4,6,8line-rate inbound 29      //将端口进口速率限制为2Mbps,取1-28时,速率为rate*8*1024/125,即64,128,192...1.792M;29-127时,速率为(rate-27)*1024,即2M,3M,4M...100M。
displayqueue-scheduler         //显示队列调度模式及参数displaypriority-trust         //显示优先级信任模式

chl1314 发表于 2021-5-19 19:39:40

感恩无私的分享与奉献 :)

llll_0321 发表于 2021-5-19 21:59:51

加油,加油,不要沉下去,我是最热贴

紫电 发表于 2025-11-14 01:17:00

笑不活了,评论区比正文还精彩!

789456321mn 发表于 2025-11-14 01:32:35

说得对!狠狠赞同,没毛病~

cumttf 发表于 2025-11-14 02:49:43

求个链接 / 教程,楼主好人一生平安~

涳白°cium 发表于 2025-11-14 02:54:58

蹲一波同款,有没有姐妹 / 兄弟推荐?

请多指教 发表于 2025-11-14 02:55:00

笑不活了,评论区比正文还精彩
已转发给朋友,一起快乐一下

易传伟 发表于 2025-11-14 02:57:20

原来还有这种操作,长见识了!

xuruifeng 发表于 2025-11-14 02:57:55

水贴也要有仪式感,我先来打卡~
页: [1] 2 3
查看完整版本: 华为/思科/华三基本命令对比