华为思科华三基本命令对比
本期和大家来看下他们的区别在哪里,这里对命令做了个汇总,平时对命令不熟的朋友这次可以看下。
CISCO
H3C
HUAWEI
描述
no
undo
undo
取消、关闭当前设置
show
display
display
显示查看
exit
quit
quit
退回上级
hostname
sysname
sysname
设置主机名
en, config terminal
system-view
system-view
进入全局模式
delete
delete
delete
删除文件
reload
reboot
reboot
重启
write
save
save
保存当前配置
username
local-user
local-user
创建用户
shutdown
shutdown
shutdown
禁止、关闭 端口
show version
display version
display version
显示当前系统版本
show startup-config
display saved-configuration
display saved-configuration
查看已保存过的配置
show running-config
display current-configuration
display current-configuration
显示当前配置
no debug all
ctrl+d
ctrl+d
取消所有debug命令
erase startup-config
reset saved-configuration
reset saved-configuration
删除配置
end
return
return
退到用户视图
exit
logout
logout
登出
logging
info-center
info-center
指定信息中心配置信息
line
user-interface
user-interface
进入线路配置(用户接口)模式
start-config
saved-configuration
saved-configuration
启动配置
running-config
current-configuration
current-configuration
当前配置
host
ip host
ip host
host名字和ip地址对应
交换部分
enable password
set authentication password simple
set authentication password simple
配置明文密码
interface type/number
interface type/number
interface type/number
进入接口
interface vlan 1
interface vlan 1
interface vlan 1
进入vlan配置vlan管理地址
interface rang
interface ethID to ID
interface ethID to ID
定议多个端口的组
enabl esecret
super password
super 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 trunk
port link-type trunk
port link-type trunk
配置trunk
vlan ID /no vlan ID
vlan batch ID /undo vlan batch ID
vlan batch ID /undo vlan batch ID
添加、删除vlan
switchport access vlan
port default vlan ID
port acces vlan ID
将端口接入vlan
show interface
display interface
display interface
查看接口
show vlan ID
display vlan ID
display vlan ID
查看vlan
encapsulation
link-protocol
link-protocol
封装协议
channel-group 1 mode on
port link-aggregation group 1
port link-aggregation group 1
链路聚合
ip routing
默认开启
默认开启
开启三层交换的路由功能
no switchport
不支持
不支持
开启接口三层功能
vtp domain
GVRP
GVRP
对跨以太网交换机的VLAN进行动态注册和删除
spanning-tree vlan ID root primary
stp instance id root primary
stp instance id root primary
stp配置根网桥
spanning-tree vlan ID priority
stp primary vlaue
stp primary vlaue
配置网桥优先级
show spanning-tree
dis stp brief
dis stp brief
查看STP配置
路由部分
ip route 0.0.0.0 0.0.0.0
ip route-static 0.0.0.0 0.0.0.0
ip route-static 0.0.0.0 0.0.0.0
配置默认路由
ip route 目标网段+掩码 下一跳
ip route-static 目标网段+掩码 下一跳
ip route-static 目标网段+掩码 下一跳
配置静态路由
show ip route
display ip routing-table
display ip routing-table
查看路由表
router rip /network 网段
rip /network 网段
rip /network 网段
启用rip、并宣告网段
router ospf
ospf
ospf
启用ospf
network ip 反码 area
area
area
配置OSPF区域
no auto-summary
rip split-horizon
rip split-horizon
配置RIP V2水平分割
show ip protocol
display ip protocol
display ip protocol
查看路由协议
access-list 1-99 permit/deny IP
rule id permit source IP
rule id permit source IP
标准访问控制列表
access-list 100-199 permit/deny protocol source IP+反码 destination IP+反码 operator operan
rule {normal|special}{permit|deny}{tcp|udp}source {|any}destination |any}[operate]
rule {normal|special}{permit|deny}{tcp|udp}source {|any}destination |any}[operate]
扩展访问控制列表
standby group-number ip virtual-ip
vrrp vrid number virtual-ip
vrrp vrid number virtual-ip
配置HSRP组
standby group-number priority
vrrp vrid number priority
vrrp vrid number priority
配置HSRP优先级
standby group-number preempt
vrrp vrid number preempt-mode
vrrp vrid number preempt-mode
配置HSRP占先权
standby group-number track
配置端口跟踪
ip nat inside source static
nat server global [port] inside port [protocol]
nat server global [port] inside port [protocol]
配置静态地址转换
另外我们来看下华为与H3C的命令情况,方便大家进行对比。
一、华为交换机基础配置命令
1、创建vlan:
//用户视图,也就是在Quidway模式下运行命令。
system-view //进入配置视图
[Quidway] vlan 10 //创建vlan 10,并进入vlan10配置视图,如果vlan10存在就直接进入vlan10配置视图
[Quidway-vlan10] quit //回到配置视图
[Quidway] vlan 100 //创建vlan 100,并进入vlan100配置视图,如果vlan10存在就直接进入vlan100配置视图
[Quidway-vlan100] quit //回到配置视图
2、将端口加入到vlan中:
[Quidway] interface GigabitEthernet2/0/1 (10G光口)
[Quidway- GigabitEthernet2/0/1] port link-type access //定义端口传输模式
[Quidway- GigabitEthernet2/0/1] port default vlan 100 //将端口加入vlan100
[Quidway- GigabitEthernet2/0/1] quit //回到配置视图
[Quidway] interface GigabitEthernet1/0/0 //进入1号插槽上的第一个千兆网口配置视图中。0代表1号口
[Quidway- GigabitEthernet1/0/0] port link-type access //定义端口传输模式
[Quidway- GigabitEthernet2/0/1] port default vlan 10 //将这个端口加入到vlan10中
[Quidway- GigabitEthernet2/0/1] quit
3、将多个端口加入到VLAN中
system-view
[Quidway]vlan 10
[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //将0到29号口加入到vlan10中
[Quidway-vlan10]quit
4、交换机配置IP地址
[Quidway] interface Vlanif100 // 进入vlan100接口视图与vlan 100命令进入的地方不同
[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 // 定义vlan100管理IP三层 交换网关路由
[Quidway-Vlanif100] quit //返回视图
[Quidway] interface Vlanif10 // 进入vlan10接口视图与vlan 10命令进入的地方不同
[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定义vlan10管理IP三层交换网关路由
[Quidway-Vlanif10] quit
5、配置默认网关:
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默认网关。
6、 交换机保存设置和重置命令
save //保存配置信息
reset saved-configuration //重置交换机的配置
reboot //重新启动交换机
7、交换机常用的显示命令
用户视图模式下:
display current-configuration //显示现在交换机正在运行的配置明细
display device //显示各设备状态
display interface ? //显示个端口状态,用?可以查看后边跟的选项
display version //查看交换机固件版本信息
display vlan ? // 查看vlan的配置信息
8、恢复交换机出厂设置
reset saved-configuration //重置交换机的配置
二、H3C交换机的基本配置
我们先来了解下h3c的配置命令与功能,都是常用的,基本上大部分网络配置都少不了这些命令。
1、基本配置
//用户直行模式提示符,用户视图
system-view // 进入配置视图
[H3C] sysname xxx //设置主机名成为xxx这里使用修改特权用户密码
2、用户配置
system-view
[H3C]super password H3C //设置用户分级密码
[H3C]undo superpassword //删除用户分级密码
[H3C]localuser bigheap 1234561 //Web网管用户设置,1为管理级用户
[H3C]undo localuser bigheap //删除Web网管用户
[H3C]user-interface aux 0 //只支持0
[H3C-Aux]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-Aux]undoidle-timeout //恢复默认值
[H3C]user-interface vty 0 //只支持0和1
[H3C-vty]idle-timeout 250 //设置超时为2分50秒,若为0则表示不超时,默认为5分钟
[H3C-vty]undoidle-timeout //恢复默认值
[H3C-vty]set authentication password123456 //设置telnet密码,必须设置
[H3C-vty]undo set authenticationpassword //取消密码
[H3C]displayusers //显示用户
[H3C]displayuser-interface //用户界面状态
3、vlan配置
[H3C]vlan 2 //创建VLAN2
[H3C]undo vlanall //删除除缺省VLAN外的所有VLAN,缺省VLAN不能被删除
[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //将4到7号端口加入到VLAN2中,此命令只能用来加access端口,不能用来增加trunk或者hybrid端口
[H3C-vlan2]port-isolate enable //打开VLAN内端口隔离特性,不能二层转发, 默认不启用该功能
[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //设置4为VLAN2的 隔离上行端口 ,用于转发二层数据,只能配置一个上行端口,若为trunk,则建议允许所有VLAN通过,隔离不能与汇聚同时配置
[H3C]display vlan all // 显示所有VLAN的详细信息
[H3C]user-group 20 //创建user-group 20,默认只存在user-group 1
[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 // 将4到7号端口加入到VLAN20中, 初始时都属于user-group 1中
[H3C]display user-group 20 //显示user-group 20的相关信息
四、交换机ip配置
[H3C]vlan 20 // 创建vlan
[H3C]management-vlan 20 //管理vlan
[H3C]interface vlan-interface 20 // 进入并管理vlan20
[H3C]undo interface vlan-interface 20 //删除管理VLAN端口
[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 // 配置管理VLAN接口静态IP地址
[H3C-Vlan-interface20]undo ipaddress //删除IP地址
[H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省网关(默认无网关地址)
[H3C-Vlan-interface20]undo ip gateway
[H3C-Vlan-interface20]shutdown // 关闭接口
[H3C-Vlan-interface20]undo shutdown //开启
[H3C]display ip //显示管理VLAN接口IP的相关信息
[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息
debugging ip //开启IP调试功能
undo debugging ip
5、DHCP客户端配置
[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口 通过DHCP方式获取IP地址
[H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消
[H3C]display dhcp //显示DHCP客户信息
debugging dhcp-alloc //开启DHCP调试功能
undo debugging dhcp-alloc
6、端口配置
[H3C]interface Ethernet0/3 //进入端口
[H3C-Ethernet0/3]shutdown //关闭端口
[H3C-Ethernet0/3]speed 100 //速率可为10,100,1000和auto(缺省)
[H3C-Ethernet0/3]duplexfull // 双工,可 为half,full和auto,光口和汇聚后不能配置
[H3C-Ethernet0/3]flow-control // 开启流控,默认为关闭
[H3C-Ethernet0/3]broadcast-suppression 20 //设置抑制广播百分比为20%,可取5,10,20,100,缺省为100,同时组播和未知单播也受此影响
[H3C-Ethernet0/3]loopback internal //内环测试
[H3C-Ethernet0/3]port link-type trunk //设置链路的 类型为trunk
[H3C-Ethernet0/3]port trunk pvid vlan 20 //设置20为该trunk的缺省VLAN,默认为1(trunk线路两端的PVID必须一致)
[H3C-Ethernet0/3]port access vlan 20 //将当前 access端口加入指定的VLAN
[H3C-Ethernet0/3]port trunk permit vlanall //允许 所有的VLAN通过当前的trunk端口, 可多次使用该命令
[H3C-Ethernet0/3]mdiauto //设置以太端口为自动监测,normal为直通线,across为交叉线
[H3C]link-aggregation Ethernet 0/1 toEthernet 0/4 // 将1-4口加入汇聚组, 1为主端口,两端需要同时配置,设置了端口镜像以及端口隔离的端口无法汇聚
[H3C]undo link-aggregation Ethernet 0/1 //删除该汇聚组
[H3C]link-aggregation mode egress //配置端口汇聚模式为根据目的MAC地址进行负荷分担,可选为 ingress,egress和both,缺省为both
[H3C]monitor-port Ethernet 0/2 // 将该端口设置为镜像端口 ,必须先设置镜像端口,删除时必须先删除被镜像端口,而且它们不能同在一个端口,该端口不能在汇聚组中,设置新镜像端口时,新取代旧,被镜像不变
[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //将 端口3和4设置为被镜像端口 ,both为同时监控接收和发送的报文,inbound表示仅监控接收的报文,outbound表示仅监控发送的报文
[H3C]display mirror
[H3C]display interface Ethernet 0/3
resetcounters // 清除所有端口的统计信息
[H3C]display link-aggregation Ethernet0/3 // 显示端口 汇聚信息
[H3C-Ethernet0/3]virtual-cable-test //诊断该端口的电路状况
7、qos优先级配置
QoS配置步骤:设置端口的优先级,设置交换机信任报文的优先级方式,队列调度,端口限速
[H3C-Ethernet0/3]priority 7 //设置端口 优先级为7 ,默认为0
[H3C]priority-trustcos //设置交换机信任报文的优先级方式为cos(802.1p优先级,缺省值),还可以设为dscp方式
[H3C]queue-scheduler hq-wrr 2 4 6 8 //设置队列调度算法为HQ-WRR(默认为WRR),权重为2,4,6,8
[H3C-Ethernet0/3]line-rate inbound 29 //将 端口进口速率限制 为2Mbps,取1-28时,速率为rate*8*1024/125,即64,128,192...1.792M;
29-127时,速率为(rate-27)*1024,即2M,3M,4M...100M。
[H3C]displayqueue-scheduler //显示队列调度模式及参数
[H3C]displaypriority-trust // 显示优先级信任模式