華爲設備常用命令

[Huawei-Ethernet0/0/1]
0/0/1:第一個“0”代表槽位號,第二個“0”代表子卡號,“1”代表接口號
<Huawei>system-view 進入系統試圖
[Huawei]interface GigabitEthernet 0/0/0 接口視圖
[Huawei]quit 退出 ctrl+z
[Huawei]sysname 12 改名
[Huawei]display version 查看設備版本
[Huawei]display current-configuration 查看配置
(uawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
[Huawei-ui-console0]set authentication password simple 123
交換機設置明文和密文密碼 *
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
[Huawei-ui-console0]set authentication password cipher 123)
([Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode password
Please configure the login password (maximum length 16):123
路由器設置密碼)
([Huawei]aaa
[Huawei-aaa]local-user admin01 password cipher 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa
交換機設置用戶
[Huawei]aaa
[Huawei-aaa]local-user admin01 password simple 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa)
([Huawei]aaa
[Huawei-aaa]local-user admin01 password cipher 123456
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa
交換機設置用戶)
<Huawei>save 保存
<Huawei>reboot 重啓
<Huawei>reset saved-configuration 恢復出廠配置
([Huawei]user-interface console 0
[Huawei-ui-console0]idle-timeout 10 10
設置關閉時間)
([Huawei]user-interface 0
[Huawei-ui0]screen-length 24
設置顯示命令行數)
<Huawei>undo terminal monitor 不起動提示
[Huawei]clear configuration interface Ethernet 0/0/3 清空端口配置
<Huawei>display mac-address 查看MAC地址表
[Huawei]display bridge mac-address 查看交換機MAC地址
[Huawei]lldp enable 開啓lldp鄰居信息
[Huawei]display lldp neighbor brief 查看鄰居設備信息
[Huawei]display lldp neighbor 查看鄰居設備信息摘要
[Huawei]display lldp neighbor interface Ethernet 0/0/5 按接口查看
[Huawei-Ethernet0/0/3]display this 查看當前配置
[Huawei-Ethernet0/0/3]undo negotiation auto 關閉自動協商雙工配置
[Huawei-Ethernet0/0/3]duplex half 開啓半雙工
[Huawei-Ethernet0/0/3]duplex full 開啓全雙工
[Huawei-Ethernet0/0/3]speed 100 配置速率在非自動協商模式下
<Huawei>display ip routing-table 查看路由表
[Huawei]ip route-static 目標網絡ID 子網掩碼 下一跳地址 配置靜態路由
[Huawei]user-interface vty 0 4 開啓遠程
[Huawei-ui-vty0-4]authentication-mode password 設置密碼
Please configure the login password (maximum length 16):123
[Huawei-ui-vty0-4]protocol inbound telnet 設置
[Huawei-ui-vty0-4]user privilege level 15 設置權限
PC端telnet ip地址 遠程

VLAN配置相關命令
[Huawei]vlan 12 創建單個vlan
[Huawei-vlan12]description vlan-qq VLAN改名
[Huawei]vlan batch 10 20 30 批量創建VLAN
[Huawei]vlan batch 10 to 20 連續創建VLAN
[Huawei]undo vlan 10 刪除VLAN
[Huawei]interface Ethernet 0/0/1 進入端口
[Huawei-Ethernet0/0/1]port link-type access 修改模式
[Huawei-Ethernet0/0/1]port default vlan 10 端口加入VLAN
[Huawei]port-group 1 創建組批量加入VLAN
[Huawei-port-group-1]group-member Ethernet 0/0/1 to Ethernet 0/0/2 加入VLAN
[Huawei]port-group group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/6 創建臨時組
<Huawei>display vlan 查看VLAN配置
[Huawei-Ethernet0/0/5]port link-type trunk 開啓創客
[Huawei-Ethernet0/0/5]port trunk allow-pass vlan all 允許所有通過
[Huawei-Ethernet0/0/5]port trunk allow-pass vlan 10 允許單個通過
[Huawei-Ethernet0/0/1]port link-type hybrid 設置HYBRID 模式
[Huawei-Ethernet0/0/1]port hybrid pvid vlan 10 爲HYBRID端口配置pvid
[Huawei-Ethernet0/0/1]port hybrid tagged vlan 10 有標籤允許幀通過
[Huawei-Ethernet0/0/1]port hybrid untagged vlan 10 沒有標籤允許幀通過
配置GRP功能 交換機互相學習
[Huawei]gvrp 開啓
[Huawei]interface Ethernet 0/0/20 進入端口
[Huawei-Ethernet0/0/20]port link-type trunk 開TRUNK
[Huawei-Ethernet0/0/20]port trunk allow-pass all 允許所有VLAN [Huawei-Ethernet0/0/20]gvrp 端口開啓
[Huawei-Ethernet0/0/20]gvrp registration normal 配置GVRP

靜態路由配置
[Huawei]ip route-static 192.168.2.0 255.255.255.0 192.168.23.3 靜態路由
[Huawei]display ip interface brief 查看路由
[Huawei]display ip routing-table 查看路由
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.100.2 preference 80 浮動路由配置 數字大小代表優先級高低

[Huawei]interface vlanif 13 VLAN配置IP
ip address 192.168.13.254 255.255.255.0 VLAN配置IP

STP配置相關命令
[huawei]stp disable 關閉 該交換機的 STP 功能
[huawei]stp enable 開啓 該交換機的 STP 功能,默認就是開啓的
[huawei]stp mode {stp | rstp | mstp } 配置 交換機運行的 STP 的模式,華爲默認是 MSTP
[huawei]stp priority 32768 STP的優先級,默認是 32768 ,設置時數值必須是 4096的倍數
[huawei]interface gi0/0/23 進入接口
[huawei-gi0/0/23] stp {enable | disable } 默認是開啓的,也可以基於實際應用場景選擇關閉STP
[huawei-gi0/0/23] stp cost 20000 修改一個端口上的 STP 的 cost 。
[huawei]display stp 可以查看到交換機運行的 STP 的模式,以及自己和根交換機的 BID 信息。
[huawei]display stp brief 可以查看到交換機上的每個啓用了 STP 的端口的角色與狀態;
[huawei]display stp interface gi0/0/23 可以查看該接口的 cost ,以及發送和接收BPDU的情況

MSTP配置:創建VLAN
vlan batch 10 20 30 40 在每個交換機上批量創建 vlan ; [SWA]port-group group-member gi0/0/1 gi0/0/2 臨時組
[SWA-port-group] port link-type trunk 開啓創客
[SWA-port-group] port trunk allow-pass vlan all 允許所有 vlan通過
[SWA] stp mode mstp 開啓MSTP模式
[SWA]stp region-configuration 進入
[SWA-mst-region]region-name HCIE 創建區域
[SWA-mst-region] instance 1 vlan 10 20 創建實例 1
[SWA-mst-region] instance 2 vlan 30 40 創建實例2
[SWA-mst-region] active region-configuration 激活
[SWA] stp instance 1 priority 0 設置優先級
[SWA] stp instance 2 priority 4096 設置優先級
[SWA]display stp 查看 STP 的運行模式;
[SWA]display stp instance 1/2 在交換機上查看修改之後的優先級是否生效;
[SWA]display stp instance 1/2 brief 查看屬於某個特定 instance 的

DHCP 配置相關命令
[Huawei]dhcp enable 開啓DHCP服務
[Huawei]ip pool 1 創建DHCP 地址池
[Huawei-ip-pool-1]network 192.168.1.1 mask 255.255.255.0 設置IP
[Huawei-ip-pool-1]gateway-list 192.168.1.254 設置網關
[Huawei-ip-pool-1]dns-list 8.8.8.8 設置DNS
[Huawei]interface GigabitEthernet 0/0/1 進入接口
[Huawei-GigabitEthernet0/0/1]dhcp select global 開啓接口
開啓DHCP中繼
[Huawei-GigabitEthernet0/0/1]dhcp select relay DHCP中繼
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 192.168.2.1 DHCP中繼
[Huawei-GigabitEthernet0/0/1]dhcp select interface DHCP 端口
[Huawei-GigabitEthernet0/0/1]dhcp server excluded-ip-address 192.168.1.1 192.168.1.100 設置保留地址

動態路配置相關命令
[Huawei]rip 進入模式
[Huawei-rip-1]version 2 選擇版本
[Huawei-rip-1]network 192.168.1.0 宣告路由

VRRP配置相關命令
interface gi0/0/2
ip address 192.168.1.254 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.250 配置虛擬IP vrrp vrid 1 priority 200 配置優先級爲 200,確保爲主設備
display vrrp 查看命令
interface gi0/0/0
vrrp vrid 1 timer {數值} <---更改 master 設備發送報文的週期時間。
(VRRP認證:明文, simple密文, md5
interface gi0/0/0
vrrp vrid 1 authentication-mode simple HCIE
注意:如果 VRRP 認證不成功的話,有可能會導致網絡中同時存在多個master;)
[R1]interaface gi0/0/1 進入端口
[R1-gi0/0/1] vrrp vrid 1 track interface gi0/0/0 reduced 150 端口跟蹤

ACL配置相關命令
[R1] acl 2000 配置基本ACL
[R1-acl-basic-2000] rule 5 deny source 192.168.1.0 0.0.0.255調用ACL
[R1]interface gi0/0/2 進入端口
[R1-gi0/0/2] traffic-filter inbound acl 2000 調用ACL
[R1] display acl 2000 查看ACL
display traffic-filter applied-record : 查看的是本地設備上的 ACL 的調用情況
display traffic-filter statistic interface gi0/0/2 inbound/outbound 查看的特定端口的特定方向上的 ACL 的批量的流量以及處理動作。
display acl all : 查看設備上創建的所有的 ACL ;
display acl 3333 : 查看設備上特定的 ACL 3333 ;
acl 3333 創建高級ACL
rule 5 deny icmp source 192.168.1.254 0.0.0.0 destination 192.168.23.3 0.0.0.0
interface gi0/0/0 進入接口
traffic-filter outbound acl 3333 調用

{NAT配置相關命令} 轉換成該接口的 公網IP 地址
[R1] nat static global 100.1.12.3 inside 192.168.1.1 靜態NAT轉換條目
[R1]interface gi0/0/1 在出端口開啓NAT裝換[R1-gi0/0/1] nat static enable 在出端口開啓NAT裝換
PAT/PNAT/NAT-Port/端口複用/端口NAT/ port NAT
[R1] acl 2000 創建ACL
[R1-acl-basic-2000] rule 5 permit source 192.168.1.1 0.0.0.0
[R1]interface gi0/0/1 端口調用
[R1-gi0/0/1] nat outbound 2000 端口調用

{OSPF設置相關命令}
<R1>reset ospf 1 process OSPF協議1 進行重啓;
<R1> reset ospf process OSPF協議進程重啓
<AR21>display ospf interface OSPF查看接口配置
<AR21>display ospf interface GigabitEthernet 0/0/2 查看單個接口明細
[AR22]ospf 創建OSPF
[AR22-ospf-1]area 0 創建區域
[AR22-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.255 廣播

[AR22-GigabitEthernet0/0/0]ospf dr-priority 10 更改該端口用於競選DR/BDR 時使用的優先級
[AR22-GigabitEthernet0/0/0]ospf network-type p2p 更改該端口的 OSPF 網絡類型;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章