- 華為交換機命令最新 推薦度:
- 相關推薦
華為交換機常用命令匯總
同學們學習華為交換機技術,覺得難嗎?為幫助大家更好深入學習華為交換機基礎知識,yjbys小編為大家帶來最新華為交換機常用命令,希望對大家學習有幫助!
vlan 顯示vlan
name text 指定當前vlan的名稱
undo name 取消
[h3c] vlan 2
[h3c-vlan2]name test vlan
dis users 顯示用戶
dis startup 顯示啟動配置文件的信息
dis user-interface 顯示用戶界面的相關信息
dis web users 顯示web用戶的相關信息。
header login 配置登陸驗證是顯示信息
header shell
undo header
lock 鎖住當前用戶界面
acl 訪問控制列表 acl number inbound/outbound
[h3c]user-interface vty 0 4
[h3c-vty0-4] acl 2000 inbound
shutdown:關閉vlan接口
undo shutdown 打開vlan接口
關閉vlan1 接口
[h3c] interface vlan-interface 1
[h3c-vlan-interface] shutdown
vlan vlan-id 定義vlan
undo valn vlan-id
display ip routing-table
display ip routing-table protocol static
display ip routing-table statistics
display ip routing-table verbose 查看路由表的全部詳細信息
interface vlan-interface vlan-id 進入valn
management-vlan vlan-id 定義管理vlan號
reset ip routing-table statistics protocol all 清除所有路由協議的路由信息.
display garp statistics interface GigabitEthernet 1/0/1 顯示以太網端口上的garp統計信息
display voice vlan status 查看語音vlan狀態
[h3c-GigabitEthernet1/0/1] broadcast-suppression 20 允許接受的最大廣播流量為該端口傳輸能力的20%.超出部分丟棄.
[h3c-GigabitEthernet1/0/1] broadcast-suppression pps 1000 每秒允許接受的最大廣播數據包為1000傳輸能力的20%.超出部分丟棄.
display interface GigabitEthernet1/0/1 查看端口信息
display brief interface GigabitEthernet1/0/1 查看端口簡要配置信息
display loopback-detection 用來測試環路測試是否開啟
display transceiver-information interface GigabitEthernet1/0/50 顯示光口相關信息
duplex auto/full/half
[h3c]interface GigabitEthernet1/0/1
[h3c-GigabitEthernet1/0/1]duplux auto 設置端口雙工屬性為自協商
port link-type access/hybrid/trunk 默認為access
port trunk permit vlan all 將trunk扣加入所有vlan中
reset counters interface GigabitEthernet1/0/1 清楚端口的統計信息
speed auto 10/100/1000
display port-security 查看端口安全配置信息
am user-bind mac-addr 00e0-fc00-5101 ip-addr 10.153.1.2 interface GigabitEthernet1/0/1 端口ip綁定
display arp 顯示arp
display am user-bind 顯示端口綁定的配置信息
display mac-address 顯示交換機學習到的mac地址
display stp 顯示生成樹狀態與統計信息
[h3c-GigabitEthernet1/0/1]stp instance 0 cost 200 設置生成樹實例0上路徑開銷為200
stp cost 設置當前端口在指定生成樹實例上路徑開銷。instance-id 為0-16 0表cist 取值范圍1-200000
system-guard enable 啟用系統防攻擊功能
display icmp statistics icmp流量統計
display ip socket
display ip statistics
display acl all
acl number acl-number match-order auto/config
acl-number (2000-2999 是基本acl 3000-3999是高級acl為管理員預留的編號)
rule deny/permit protocal
訪問控制
[h3c] acl number 3000
[h3c-acl-adv-3000]rule permit tcp source 129.9.0.0 0.0.255.255 destination 202.38.160.0 0.0.255.255 destination-port eq 80 (
定義高級acl 3000,允許129.0.0/16網段的主機向202.38.160/24網段主機訪問端口80)
rule permit source 211.100.255.0 0.255.255.255
rule deny cos 3 souce 00de-bbef-adse ffff-ffff-fff dest 0011-4301-9912 ffff-ffff-ffff
(禁止mac地址00de-bbef-adse發送到mac地址0011-4301-9912且802.1p優先級為3的報文通過)
display qos-interface GigabitEthernet1/0/1 traffic-limit 查看端口上流量
端口速率限制
line-rate inbound/outbound target-rate
inbound:對端口接收報文進行速率限制
outbound: 對端口發送報文進行速率限制
target-rate 對報文限制速率,單位kbps 千兆口 inbound范圍1-1000000 outbound范圍20-1000000
undo line-rate取消限速.
[h3c]interface GigabitEthernet1/0/1
[h3c-GigabitEthernet1/0/1]line-rate outbound 128 限制出去速率為128kbps
display arp | include 77
display arp count 計算arp表的記錄數
display ndp 顯示交換機端口的詳細配置信息。
display ntdp device-list verbose 收集設備詳細信息
display lock
display users
display cpu
display memory
display fan
display device
display power
----------------------------------------
交換機命令
~~~~~~~~~~
[Quidway]dis cur ;顯示當前配置
[Quidway]display current-configuration ;顯示當前配置
[Quidway]display interfaces ;顯示接口信息
[Quidway]display vlan all ;顯示路由信息
[Quidway]display version ;顯示版本信息
[Quidway]super password simple
[Quidway]sysname
[Quidway]interface ethernet0/1 ;進入接口視圖
[Quidway]int e0/1 ;簡寫方式
[Quidway]interface vlan-interface
[Quidway]int vlan
[Quidway-Vlan-interfacen]ip address 10.65.1.1 255.255.0.0 ;配置VLAN的IP地址
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.65.1.2 ;靜態路由=網關
[Quidway]rip ;三層交換支持
[Quidway]local-user ftp ;建立ftp用戶
[Quidway]user-interface vty 0 4 ;進入虛擬終端
[S3026-ui-vty0-4]authentication-mode password ;設置口令模式
[S3026-ui-vty0-4]set authentication-mode password simple 222 ;設置口令
[S3026-ui-vty0-4]user privilege level 3 ;用戶級別
[Quidway]interface ethernet0/1 ;進入端口模式
[Quidway]int e0/1 ;進入端口模式
[Quidway-Ethernet0/1]duplex {half|full|auto} ;配置端口工作狀態
[Quidway-Ethernet0/1]speed {10|100|auto} ;配置端口工作速率
[Quidway-Ethernet0/1]flow-control ;配置端口流控
[Quidway-Ethernet0/1]mdi {across|auto|normal} ;配置端口平接扭接
[Quidway-Ethernet0/1]port link-type {trunk|access|hybrid} ;設置端口工作模式
[Quidway-Ethernet0/1]port access vlan 3 ;當前端口加入到VLAN
[Quidway-Ethernet0/1]port trunk permit vlan {ID|All} ;設trunk允許的VLAN
[Quidway-Ethernet0/1]port trunk pvid vlan 3 ;設置trunk端口的PVID
[Quidway-Ethernet0/1]undo shutdown ;激活端口
[Quidway-Ethernet0/1]shutdown ;關閉端口
[Quidway-Ethernet0/1]quit ;返回
[Quidway]vlan 3 ;創建VLAN
[Quidway-vlan3]port ethernet 0/1 ;在VLAN中增加端口
[Quidway-vlan3]port e0/1 ;簡寫方式
[Quidway-vlan3]port ethernet 0/1 to ethernet 0/4 ;在VLAN中增加端口
[Quidway-vlan3]port e0/1 to e0/4 ;簡寫方式
[Quidway]monitor-port
[Quidway]port mirror
[Quidway]port mirror
例如:
[Quidway]port mirror e0/1 to e0/4 observing-port e0/7 ;指定鏡像和被鏡像
[Quidway]description string ;指定VLAN描述字符
[Quidway]description ;刪除VLAN描述字符
[Quidway]display vlan [vlan_id] ;查看VLAN設置
[Quidway]stp {enable|disable} ;設置生成樹,默認關閉
[Quidway]stp priority 4096 ;設置交換機的優先級
[Quidway]stp root {primary|secondary} ;設置為根或根的備份
[Quidway-Ethernet0/1]stp cost 200 ;設置交換機端口的花費
[Quidway]link-aggregation e0/1 to e0/4 ingress|both ; 端口的聚合
[Quidway]undo link-aggregation e0/1|all ; 始端口為通道號
[SwitchA-vlanx]isolate-user-vlan enable ;設置主vlan
[SwitchA]isolate-user-vlan ;設主vlan包括的子vlan
[Quidway-Ethernet0/2]port hybrid pvid vlan
[Quidway-Ethernet0/2]undo port hybrid pvid ;刪除vlan的pvid
[Quidway-Ethernet0/2]port hybrid vlan vlan_id_list untagged ;設置無標識的vlan
如果數據包的vlan id與PVId一致,則去掉vlan信息. 默認PVID=1。
所以設置PVID為所屬vlan id, 設置可以互通的vlan為untagged。
----------------------------------------
路由器命令
~~~~~~~~~~
[Quidway]display version ;顯示版本信息
[Quidway]display current-configuration ;顯示當前配置
[Quidway]display interfaces ;顯示接口信息
[Quidway]display ip route ;顯示路由信息
[Quidway]sysname
[Quidway]super passwrod
[Quidway]int s0/0 ;進入接口
[Quidway-serial0/0]clock rate 64000 ;設置同步時鐘
[Quidway-serial0/0]ip address
例:
[Quidway-serial0/0]ip address 10.65.1.1 255.255.0.0 ;或
[Quidway-serial0/0]ip address 10.65.1.1 16 ;
[Quidway-serial0/0]undo shutdown ;激活端口
[Quidway]link-protocol hdlc ;綁定hdlc協議
[Quidway]user-interface vty 0 4
[Quidway-ui-vty0-4]authentication-mode password
[Quidway-ui-vty0-4]set authentication-mode password simple 222
[Quidway-ui-vty0-4]user privilege level 3
[Quidway-ui-vty0-4]quit
[Quidway]debugging hdlc all serial0 ;顯示所有信息
[Quidway]debugging hdlc event serial0 ;調試事件信息
[Quidway]debugging hdlc packet serial0 ;顯示包的信息
靜態路由:
[Quidway]ip route-static
例如:
[Quidway]ip route-static 129.1.0.0 16 10.0.0.2
[Quidway]ip route-static 129.1.0.0 255.255.0.0 10.0.0.2
[Quidway]ip route-static 129.1.0.0 16 Serial 2
[Quidway]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2
動態路由:
[Quidway]rip ;設置動態路由
[Quidway]rip work ;設置工作允許
[Quidway]rip input ;設置入口允許
[Quidway]rip output ;設置出口允許
[Quidway-rip]network 10.0.0.0 ;設置交換路由網絡
[Quidway-rip]network all ;設置與所有網絡交換
[Quidway-rip]peer ip-address ;指定交換點
[Quidway-rip]summary ;路由聚合
[Quidway]rip version 1 ;設置工作在版本1
[Quidway]rip version 2 multicast ;設版本2,多播方式
[Quidway-Ethernet0/0]rip split-horizon ;水平分隔
[Quidway]router id A.B.C.D ;配置路由器的ID
[Quidway]ospf enable ;啟動OSPF協議
[Quidway-ospf]import-route direct ;引入直聯路由
[Quidway-Serial0/0]ospf enable area
標準訪問列表命令格式如下:
acl number
rule [normal|special]{permit|deny} source
例:
[Quidway]acl number 2001
[Quidway-acl-basic-2001]rule normal permit source 10.0.0.0 0.0.0.255
[Quidway-acl-basic-2001]rule normal deny source any
擴展訪問控制列表配置命令
配置TCP/UDP協議的擴展訪問列表:
rule {normal|special}{permit|deny}{tcp|udp}source {
[operate]
配置ICMP協議的擴展訪問列表:
rule {normal|special}{permit|deny}icmp source {
[icmp-code] [logging]
擴展訪問控制列表操作符的含義
equal portnumber ;等于
greater-than portnumber ;大于
less-than portnumber ;小于
not-equal portnumber ;不等
range portnumber1 portnumber2 ;區間
擴展訪問控制列表舉例
[Quidway]acl number 3001
[Quidway-acl-3001]rule deny souce any destination any
[Quidway-acl-3001]rule permit icmp source any destination any icmp-type echo
[Quidway-acl-3001]rule permit icmp source any destination any icmp-type echo-reply
[Quidway]acl number 3002
[Quidway-acl-3002]rule permit ip source 10.0.0.1 0.0.0.0 destination 202.0.0.1 0.0.0.0
[Quidway-acl-3002]rule deny ip source any destination any
[Quidway]acl number 103
[Quidway-acl-103]rule permit tcp source any destination 10.0.0.1 0.0.0.0 destination-port equal ftp
[Quidway-acl-103]rule permit tcp source any destination 10.0.0.2 0.0.0.0 destination-port equal www
[Quidway]firewall enable
[Quidway]firewall default permit|deny
[Quidway]int e0/0
[Quidway-Ethernet0/0]firewall packet-filter 2001 inbound|outbound
地址轉換配置舉例
[Quidway]firewall enable
[Quidway]firewall default permit
[Quidway]acl 2001 ;內部指定主機可以進入e0
[Quidway-acl-basic-2001]rule deny ip source any destination any
[Quidway-acl-basic-2001]rule permit ip source 129.38.1.1 0 destination any
[Quidway-acl-basic-2001]rule permit ip source 129.38.1.2 0 destination any
[Quidway-acl-basic-2001]rule permit ip source 129.38.1.3 0 destination any
[Quidway-acl-basic-2001]rule permit ip source 129.38.1.4 0 destination any
[Quidway-acl-basic-2001]quit
[Quidway]int e0/0
[Quidway-Ethernet0]firewall packet-filter 2001 inbound
[Quidway]acl 3002 ;外部特定主機和大于1024端口的數據包允許進入S0
[Quidway-acl-adv-3002]rule deny ip source any destination any
[Quidway-acl-adv-3002]rule permit tcp source 202.39.2.3 0 destination 202.38.160.1 0
[Quidway-acl-adv-3002]rule permit tcp source any destination 202.38.160.1 0 destination-port
great-than
1024
[Quidway-acl-adv-3002]quit
[Quidway]int s0/0
[Quidway-Serial0/0]firewall packet-filter 102 inbound
[Quidway-Serial0/0]nat outbound 3002 interface ;是Easy ip,將acl允許的IP從本接口出時變換源地址。
內部服務器地址轉換配置命令(靜態nat):
nat server global
[Quidway-Serial0/0]nat server global 202.38.160.1 inside 129.38.1.1 ftp tcp
[Quidway-Serial0/0]nat server global 202.38.160.1 inside 129.38.1.2 telnet tcp
[Quidway-Serial0/0]nat server global 202.38.160.1 inside 129.38.1.3 www tcp
設有公網IP:202.38.160.101~202.38.160.103 ;對外訪問
[Quidway]nat address-group 202.38.160.101 202.38.160.103 pool1 ;建立地址池
[Quidway]acl 2001
[Quidway-acl-basic-2001]rule permit source 10.110.10.0 0.0.0.255 ;指定允許的內部網絡
[Quidway-acl-basic-2001]rule deny source any
[Quidway-acl-basic-2001]int s0/0
[Quidway-Serial0/0]nat outbound 2001 address-group pool1 ;在s0口從地址池取出IP對外訪問
[Quidway-Serial0/0]nat server global 202.38.160.101 inside 10.110.10.1 ftp tcp
[Quidway-Serial0/0]nat server global 202.38.160.102 inside 10.110.10.2 www tcp
[Quidway-Serial0/0]nat server global 202.38.160.102 8080 inside 10.110.10.3 www tcp
[Quidway-Serial0/0]nat server global 202.38.160.103 inside 10.110.10.4 smtp udp
PPP設置:
[Quidway-Serial0/0]link-protocol ppp ;默認的協議
PPP驗證:
主驗方:pap|chap
[Quidway]local-user q2 password {simple|cipher} hello ;路由器1
[Quidway]interface s0/0
[Quidway-serial0/0]ppp authentication-mode {pap|chap}
[Quidway-serial0/0]ppp chap user q1 ;pap時,沒有此句
pap被驗方:
[Quidway]interface s0/0 ;路由器2
[Quidway-serial0/0]ppp pap local-user q2 password {simple|cipher} hello
chap被驗方:
[Quidway]interface s0/0 ;路由器2
[Quidway-serial0/0]ppp chap user q2 ;自己路由器名
[Quidway-serial0/0]local-user q1 password {simple|cipher} hello ;對方路由器名
幀中繼frame-relay (二分冊6-61)
[q1]fr switching
[q1]int s0/1
[q1-Serial0/1]ip address 192.168.34.51 255.255.255.0
[q1-Serial0/1]link-protocol fr ;封裝幀中繼協議
[q1-Serial0/1]fr interface-type dce
[q1-Serial0/1]fr dlci 100
[q1-Serial0/1]fr inarp
[q1-Serial0/1]fr map ip 192.168.34.52 dlci 100
[q2]int s0/1
[q2-Serial0/1]ip address 192.168.34.52 255.255.255.0
[q2-Serial0/1]link-protocol fr
[q2-Serial0/1]fr interface-type dte
[q2-Serial0/1]fr dlci 100
[q2-Serial0/1]fr inarp
[q2-Serial0/1]fr map ip 192.168.34.51 dlci 100
幀中繼監測
[q1]display fr lmi-info[]interface type number]
[q1]display fr map
[q1]display fr pvc-info[serial interface-number][dlci dlci-number]
[q1]display fr dlci-switch
[q1]display fr interface
[q1]reset fr inarp-info
[q1]debugging fr all[interface type number]
[q1]debugging fr arp[interface type number]
[q1]debugging fr event[interface type number]
[q1]debugging fr lmi[interface type number]
啟動ftp服務:
[Quidway]local-user ftp password {simple|cipher} aaa service-type ftp
[Quidway]ftp server enable
【華為交換機常用命令】相關文章:
華為交換機常用命令大全01-22
華為交換機常用命令2016最新08-12
華為交換機配置命令10-23
華為交換機配置命令08-07
華為交換機基本配置命令01-21
華為交換機端口的批量配置命令05-20
華為交換機基本配置命令大全01-21
華為交換機基本配置命令匯總02-25
H3C交換機常用命令注釋12-06