華爲交換機路由器的基本操作

華爲路由器交換機的一些入門級操作


1、如何配置console線路密碼

A、用password認證方式設置密碼:

  <Huawei>system-view  //進入配置模式

  [Huawei] sysname R1  //更改主機名

  [R1] user-interface  console 0  //進入console口

  [R1-ui-console0]authentication-mode password  //認證模式爲password

 輸入密碼,驗證

B、用aaa認證方式

  [R1] user-interface  console 0 

  [R1-ui-console0]authentication-mode aaa

  [R1]aaa

  [R1-aaa]local-user zhangsan password  cipher  123456  //創建用戶名和密碼

  [R1-aaa]local-user zhangsan privilege level  15  //訪問級別


2、配置遠程telnet遠程管理

[R1]user-interface vty 0 4

[R1-ui-vty0-4]authentication-mode aaa

[R1-ui-vty0-4]quit

[R1]aaa

[R1-aaa]local-user zhangsan password cipher  123456

[R1-aaa]local-user zhangsan privilege level  15

[R1-aaa]local-user zhangsan service-type telnet  //該用戶允許的服務類型


3、ssh遠程管理配置

[R1]stelnet  server  enable  //開啓ssh功能

[R1]rsa  local-key-pair  create //創建加密報文的密鑰對

[R1]aaa

[R1-aaa]local-user zhangsan password cipher  123456

[R1-aaa]local-user zhangsan privilege level  15

[R1-aaa]local-user zhangsan service-type ssh

[R1]user-interface vty 0 4

[R1-ui-vty0-4]authentication-mode aaa

[R1-ui-vty0-4]protocol inbound ssh     //開啓vty線路的ssh訪問功能

[R1]ssh user zhangsan  authentication-type all //定義ssh用戶的認證模式


4、配置IP地址和查看

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24

[R1-GigabitEthernet0/0/0]quit 

查看接口IP配置:

[R1]display ip interface brief


5、配置靜態路由:

[R1]ip route-static  23.1.1.0     24    g0/0/0    12.1.1.2

                            // 目標網段  子網掩碼 本地出口  下一跳地址


6、配置等價靜態路由:

[R1]ip route-static  23.1.1.0  24  g0/0/1  12.1.1.2

[R1]ip route-static  23.1.1.0  24  g0/0/0  21.1.1.2


7、路由的選舉規則是什麼?

第一步比較掩碼長度,越長越優

第二步比較路由優先級,越小越優

第三步比較路由開銷值,越小越優

配置浮動靜態路由:

[R1]ip route-static 23.1.1.0 24  g0/0/0  21.1.1.2

[R1]ip route-static 23.1.1.0 24  s1/0/0  12.1.1.2  preference 61


8、配置缺省靜態路由:

[R1]ip route-static  0.0.0.0  0  g0/0/0  12.1.1.2


9、ospf的簡單配置

[R2]ospf 100  //啓動ospf進程

[R2-ospf-100]area 0   //進入0區域

[R2-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255 //宣告網段

[R2-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255

[R2-ospf-100-area-0.0.0.0]quit 

查看OSPF鄰居:

[R1]display ospf peer

查看OSPF路由:

[R1]display ip routing-table protocol ospf


10、修改OSPF的RID:

[R1] ospf 100  router-id  1.1.1.1

(RID修改後不會立即生效,需要重啓OSPF

進程新的RID纔會生效)

重啓OSPF進程:

<R1>reset    ospf   process 


11、修改OSPF基準帶寬:當帶寬高於100時需修改

[R1]ospf 100

[R1-ospf-100]bandwidth-reference 10000


12、修改OSPF計時器:鄰居之間必須同時修改

[R1]int g0/0/0                //基於端口的修改

[R1-GigabitEthernet0/0/0]ospf timer hello 20 

[R1-GigabitEthernet0/0/0]ospf timer dead 60


13、修改OSPF的DR接口優先級:只能把優先級調低

[R2]int g0/0/0

[R2-GigabitEthernet0/0/0] ospf  dr-priority  0


14、配置OSPF接口認證:

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher huawei123

配置OSPF區域認證:

[R2]ospf 100

[R2-ospf-100]area 0

[R2-ospf-100-area-0.0.0.0]authentication-mode md5 1 cipher huawei123


15、配置基本ACL:

[R1]acl 2000

[R1-acl-basic-2000]rule deny source 10.1.1.1 0

[R1-acl-basic-2000]quit 

調用基本ACL:

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]traffic-filter outbound acl 2000


16、配置擴展ACL:

[R1]acl 3000

[R1-acl-adv-3000]rule deny ip source 10.1.1.1 0 destination 20.1.1.1 0

[R1-acl-adv-3000]quit

調用擴展ACL:

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]traffic-filter inbound acl 3000

[R1-GigabitEthernet0/0/0]quit


17、配置靜態NAT

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]nat static global 12.1.1.1 inside 10.1.1.1


18、配置動態NAT:

[R1]nat address-group 0 12.1.1.1 12.1.1.3  //動態地址池

[R1]acl 2000

[R1-acl-basic-2000]rule permit source 10.1.1.1 0.0.0.0

[R1-acl-basic-2000]rule permit source 10.1.1.2 0.0.0.0

[R1-acl-basic-2000]rule permit source 10.1.1.3 0.0.0.0

[R1-acl-basic-2000]quit 

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 0 no-pat


19、配置NAPT:

[R1]nat address-group 0 12.1.1.1 12.1.1.1

[R1]acl 2000

[R1-acl-basic-2000]rule permit source 10.1.1.1 0.0.0.0

[R1-acl-basic-2000]rule permit source 10.1.1.2 0.0.0.0

[R1-acl-basic-2000]rule permit source 10.1.1.3 0.0.0.0

[R1-acl-basic-2000]quit 

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]nat outbound 2000 address-group 0

[R1-GigabitEthernet0/0/1]quit 

[R1]display nat session all  //查看轉換信息


20、easy-ip配置


[R1]acl 2000

[R1-acl-basic-2000]rule permit source 10.1.1.0 0.0.0.255

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]nat outbound 2000


21、配置DHCP server:

[R1]dhcp enable   //啓用dhcp服務

[R1]ip pool dhcp1    //定義地址池

[R1-ip-pool-dhcp1] network 10.1.1.0 mask 255.255.255.0

[R1-ip-pool-dhcp1] gateway-list 10.1.1.1

[R1-ip-pool-dhcp1] dns-list 10.1.1.1

[R1-ip-pool-dhcp1]lease day 2

[R1]int g0/0/0    //在接口調用

[R1-GigabitEthernet0/0/0]dhcp  select global


22、DHCP中繼

服務器端:

[R2]dhcp enable     // 啓用

[R2]ip pool dhcp1    //地址池1

[R2-ip-pool-dhcp1]network 10.1.1.0 mask 255.255.255.0

[R2-ip-pool-dhcp1]gateway-list 10.1.1.1

[R2-ip-pool-dhcp1]dns-list 10.1.1.1

[R2-ip-pool-dhcp1]lease day 2

[R2-ip-pool-dhcp1]quit 

[R2]ip pool dhcp2    //地址池2

[R2-ip-pool-dhcp2]network 20.1.1.0 mask 255.255.255.0

[R2-ip-pool-dhcp2]gateway-list 20.1.1.1

[R2-ip-pool-dhcp2]dns-list 20.1.1.1

[R2-ip-pool-dhcp2]lease day 2

[R2-ip-pool-dhcp2]quit 

[R2]int g0/0/2

[R2-GigabitEthernet0/0/2]dhcp  select global   //端口啓用dhcp

[R2-GigabitEthernet0/0/2]quit

[R2]ip route-static 10.1.1.0 24 g0/0/2 12.1.1.1  //配置靜態路由

[R2]ip route-static 20.1.1.0 24 g0/0/2 12.1.1.1

配置DHCP relay:

[R1]dhcp enable 

[R1]int g0/0/0

[R1-GigabitEthernet0/0/0]dhcp select relay  //啓用中繼

[R1-GigabitEthernet0/0/0]dhcp relay server-ip 12.1.1.2 //指定服務的地址

[R1-GigabitEthernet0/0/0]quit 

[R1]int g0/0/1

[R1-GigabitEthernet0/0/1]dhcp  select relay

[R1-GigabitEthernet0/0/1]dhcp  relay server-ip 12.1.1.2


23、配置手工eth-trunk:

[SW1] int Eth-Trunk 12  //創建

[SW1-Eth-Trunk12]trunkport Ethernet 0/0/1 to 0/0/3  //加入端口

[SW1]display interface brief  //查看端口狀態

[SW1]display stp brief   //查看生成樹的狀態



24、配置LACP方式eth-trunk:另外一端的交換機只需指定模式,加入端口

[SW1]int Eth-Trunk 12

[SW1-Eth-Trunk12]mode lacp-static  //指定模式

[SW1-Eth-Trunk12]trunkport Ethernet 0/0/1 to 0/0/3  //加入端口

[SW1]lacp priority 100    //設置LACP的主設備,調整優先級

[SW1]int Ethernet 0/0/1

[SW1-Ethernet0/0/1]lacp priority 100  //設置LACP接口的優先級

[SW1]int Ethernet 0/0/2

[SW1-Ethernet0/0/2]lacp priority 100

[SW1]int Eth-Trunk 12

[SW1-Eth-Trunk12]max active-linknumber 2   //設置最大活動鏈路數量

[SW1-Eth-Trunk12]lacp preempt enable      //開啓LACP搶佔功能

[SW1]display eth-trunk 12   //查看鏈路狀態


25、vlan基本的創建

[SW1]vlan batch 10 20   //創建vlan

[SW1]display vlan summary  //查看設備的vlan信息

[SW1]int Ethernet0/0/1

[SW1-Ethernet0/0/1]port link-type access //指定端口類型

[SW1-Ethernet0/0/1]port default vlan 10  //默認的vlan編號

[SW1]display port vlan active  //查看接口對應的vlan信息


26、配置trunk接口:兩邊交換機要同時配置

[SW1]int Ethernet0/0/3

[SW1-Ethernet0/0/3]port link-type trunk

[SW1-Ethernet0/0/3]port trunk allow-pass vlan all 

[SW1-Ethernet0/0/3]quit

查看trunk接口:

[SW1]display port vlan active


27、配置hybrid接口類型

創建vlan10、vlan20、vlan30、vlan40、vlan50、vlan60

配置hybrid接口,vlan10\30\50帶標記,vlan20\40\60不帶標記:

[SW1]int Ethernet0/0/3

[SW1-Ethernet0/0/3]port link-type hybrid 

[SW1-Ethernet0/0/3]port hybrid tagged vlan 10 30 50

[SW1-Ethernet0/0/3]port hybrid untagged vlan 20 40 60


28、配置單臂路由:實現不同網段之間的通信,交換機連路由器的接口設置爲trunk

[R1]int GigabitEthernet 0/0/0.10

[R1-GigabitEthernet0/0/0.10]dot1q termination vid 10 //和vlan關聯

[R1-GigabitEthernet0/0/0.10]ip address 10.1.1.100 24

[R1-GigabitEthernet0/0/0.10]arp broadcast enable //開啓arp廣播

[R1]int GigabitEthernet 0/0/0.20

[R1-GigabitEthernet0/0/0.20]dot1q termination vid 20

[R1-GigabitEthernet0/0/0.20]ip address 20.1.1.100 24

[R1-GigabitEthernet0/0/0.20]arp broadcast enable 


29、配置三層交換:先創建vlan,然後把端口加入。

[SW1]interface Vlanif 10

[SW1-Vlanif10]ip address 10.1.1.100 24

[SW1]interface Vlanif 20

[SW1-Vlanif20]ip address 20.1.1.100 24


30、修改stp的角色

將SW2設置爲新的根交換機:

[SW2]stp priority 4096

將SW3的e0/0/3接口修改爲新的根端口:

[SW3]int e0/0/4

[SW3-Ethernet0/0/4]stp cost 10  //改大原來根端口的開銷值

[SW3-Ethernet0/0/4]quit 
















































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