軟考網工—華為命令總結

2020-10-02 17:00:09

文章目錄


1、設定交換機的名稱和密碼:
2、設定交換機的遠端管理IP地址:
3、設定交換機埠速率、雙工、ARP:
4、設定路由器介面IP和靜態路由:
5、設定交換機VLAN相關命令:
6、設定路由RIP協定:RIPV1 RIPV2
7、設定路由器OSPF協定:
8、設定基於全域性的DHCP協定:
9、設定基於介面的DHCP協定:
10、設定路由器基本ACL:2000~2999
11、設定路由器高階ACL:3000~3999
12、設定路由器動態NAT(多對少):
13、設定路由器靜態NAT(一對一):
14、設定路由器動態NAPT(多對一):
15、設定三層交換機VLAN間路由:
16、設定單臂路由VLAN間通訊:

1、設定交換機的名稱和密碼:

<Huawei> 				//使用者檢視 
<Huawei>system-view		//進入系統檢視設定 
[Huawei]				//系統檢視 
[Huawei]quit/return		//退出系統檢視 
[Huawei]sysname AIY		//設定主機名 
[Huawei]user-intface console 0	//進入控制檯 
[Huawei-ui-console0]authentication-mode password	//驗證 
[Huawei-ui-console0]set authentication password cipher huwei 	//設定密文密碼 

2、設定交換機的遠端管理IP地址:

[Huawei]interface vlanif 1	//進入vlan 1 
[Huawei-vlanif]ip add 192.168.1.254 24	//設定IP 
[Huawei-vlanif]undo shotdown		//開啟介面 
[Huawei]dns domain AIY.com			//設定域名 
[Huawei]dns server 192.168.254.254	//設定域名IP 
<Huawei>undo terminal monitor	//取消提示資訊 
dis vlan 	顯示vlan		save	儲存設定
dis curr	顯示當前設定	reboot 	重新啟動裝置

3、設定交換機埠速率、雙工、ARP:

[Huawei]int g 0/0/1		//進入介面 
[Huawei-G0/0/1]description AIY		//埠描述 
[Huawei-g 0/0/1]undo negotiation auto	//取消協商 
[Huawei-GigabitEthernet 0/0/1]duplex full	//全雙工 
[Huawei-GigobitEthernet 0/0/1]auto duplex full	//自動 
[Huawei-GigabitEthernet 0/0/1]speed 10		//速率 10M 
[Huawei-GigabitEthernet 0/0/1]auto speed 100	//自動 
[Huawei]arp static 192.168.1.8 5489-98cf-2603	//繫結 IP、MAC 
[Huawei]dis arp	/[Huawei]dis arp all		//檢視ARP 

4、設定路由器介面IP和靜態路由:

[Huawei]int g 0/0/1				//進入介面 
[Huawei]ip add 192.168.1.6 24		//配IP地址 
[Huawei-GigabitEthernet 0/0/1]undo shoutdown	//開啟 
<Huawei>dis cur			//檢視ARP 
[Huawei]ip route-static 192.168.20.0 24 10.0.12.2	//設定靜態路由 
[Huawei]ip route-static 0.0.0.0 0 192.168.1.5	//預設 
[Huawei]display ip routing-able	//檢視路由表 

5、設定交換機VLAN相關命令:

[Huawei]vlan 10 或 [Huawei]vlan 20	//建立vlan 
[Huawei-vlan 10]description	AIY //vlan描述 
[Huawei]vlan bath 30 40			//建立多個vlan 
[Huawei]int g 0/0/1				//進入介面 
[Huawei-g 0/0/1]port link-type access	//存取口 
[Huawei-g 0/0/1]port default vlan 10	//加入vlan 
[Huawei-g 0/0/2]port link-type trunk	//幹道口 
[Huawei-g 0/0/2]port trunk allow-pass vlan 10 20	//允許10 20 
[Huawei-g 0/0/2]port trunk allow-pass vlan all			//所有 
[Huawei]int e 0/0/2			//進入介面 
[Huawei-E 0/0/2]port link-type hybrid		//混合口模式 
[Huawei-E 0/0/2]undo port default vlan	//刪除預設vlan 
[Huawei-E 0/0/2]port hybrid untagged vlan 20	//去標籤 
[Huawei-E 0/0/2]port hybrid pvid vlan 2			//設定預設vlan 
[Huawei-E 0/0/2]port trunk allow pass vlan 10 to 100 //允許10~100 
[Huawei]dis port vlan / display vlan	//檢視vlan 

6、設定路由RIP協定:RIPV1 RIPV2

[Huawei]rip				//啟用RIP,預設RIPV1 
[Huawei-riop-1]network 192.168.1.0		//釋出直連網段 
[Huawei-rip-1]version 2				//設定RIPV2banb 
[Huawei]dis rip					//檢視RIP 
[Huawei]dis rip database			//檢視RIP資料庫 
[Huawei]dis ip routing-table	//檢視路由表 

7、設定路由器OSPF協定:

[Huawei]ospf			//啟用OSPF,預設程序為1 
[Huawei-ospf-1]area 0		//進入區域0 
[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255	//釋出直連網段 
[Huawei-ospf-1]silent-intface g 0/0/2		//被動介面 
[Huawei]dis ospf interface			//檢視OSPF通告 
[Huawei]dis ospf peer			//檢視OSPF鄰居 
[Huawei]dis ospf ip routing-table	//檢視路由表 
[Huawei]dis ospf routing		//檢視OSPF路由表 

8、設定基於全域性的DHCP協定:

[Huawei]dhcp enabel				//開啟DHCP 
[Huawei]ip pool AIY				// 地址池名 
[Huawei-ip-pool-AIY]network 192.168.1.0 //地址池 
[Huawei-ip-pool-AIY]lease day 2				//租約預設1 
[Huawei-ip-pool-AIY]gateway-list 192.168.1.254		//閘道器 
[Huawei-ip-pool-AAI]excluded -ip-address 192.168.1.250 192.168.1.253		//排除IP範圍 
[Huaweiip-pool-AIY]dns-list 8.8.8.8 //DNS伺服器 
[Huawei-G 0/0/0]dhcp select global	//基於全域性 

9、設定基於介面的DHCP協定:

[Huawei]dhcp enable				//開啟DHCP 
[Huawei]int g 0/0/1				//進入介面 
[Huawei-G 0/0/1]dhcp select interface		//基於介面 
[Huawei-G 0/0/1]dhcp server lease day 2	//租約預設1 
[Huawei-G 0/0/1]dhcp server exclude-ip-adress 192.168.1.1 192.168.1.10  //排除IP範圍 
[Huawei-G 0/0/1]dhcp server dns-list 8.8.8.8	//DNS 
[Huawei]dis ip pool		//檢視DHCP 

10、設定路由器基本ACL:2000~2999

[Huawei]acl 2000		//設定基本ACL 
[Huawei-acl-basic-2000]rule 5 permit source 1.1.1.1 0	//允許源IP 
[Huawei-acl-basic-2000]rule 10 deny any			//拒絕任意 
[Huawei]user-interface vty 0 4				//進入介面 
[Huawei-ui-vty0-4]alc 2000 inbound		//應用ACL 
[Huawei]dis acl all				//檢視所有ACL 
[Huawei]dis acl 2000			//檢視ACL2000 

11、設定路由器高階ACL:3000~3999

[Huawei]acl 3000	//設定高階ACL 
[Huawei-acl-adv-3000]rule permit ip source 1.1.1.1 0 destination 4.4.4.4 0	//允許存取 
[Huawei]user-interface vty 0 4			//進入虛擬介面 
[Huawei-ui-vty0-4]acl 3000 outbount			//應用ACL 
[Huawei]int g 0.0.1					//進入介面 
[Huawei-g 0/0/1]traffic-filter inbound acl 3000		//應用 

12、設定路由器動態NAT(多對少):

[Huawei]nataddress-group 1 202.169.10.50 202.169.10.60		//外部IP 
[Huawei]acl 2001						//設定ACL 
[Huawei-acl-basic-2001]rule 5 permit source 172.17.1.0 0.0.0.255		//內部IP 
[Huawei]int g 0/0/1		//進入介面 
[Huawei-GigabitEthernet 0/0/0]nat outbound 2001 address-group 1 no-pat	//應用NAT 
[Huawei]dis nat outbound		//檢視NAT 

13、設定路由器靜態NAT(一對一):

[Huawei]int g 0/0/1			//進入介面 
[Huawei-GigabitEthernet 0/0/1]nat static global 202.169.10.5 inside 172.16.1.1 //一對一轉換 

14、設定路由器動態NAPT(多對一):

[Huawei]int g 0/0/0		//進入介面 
[Huawei-G 0/0/0]nat outbound 2001 //多對一轉換 
[Huawei]dis nat static		//檢視靜態NAT 

15、設定三層交換機VLAN間路由:

[Huawei]int vlanif 10		//進入介面 
[Huawei-vlanif 10]ip add 192.168.1.254 24	//設定IP 
[Huawei]int vlanif 20				//進入介面 
[Huawei-vlanif 20]ip add 192.168.2.254 24		//配IP 
[Huawei]dis ip interface brief		//介面簡略資訊 
[Huawei]dis port vlan   //介面vlan資訊 
[Huawei]dis vlan	//檢視vlan資訊 

16、設定單臂路由VLAN間通訊:

[Huawei-G0/0/1]ip add 192.168.1.254 24		//設定IP 
[Huawei-G 0/0/1]dot1q termination vid 10	//封裝 
[Huawei-G 0/0/1]arp broad case enable		//檢視介面 
[Huawei]dis ip interface brief			//檢視路由表 
[Huawei]display current-configuration		//檢視設定