華爲路由器交換機的一些入門級操做
服務器
一、如何配置console線路密碼
session
A、用password認證方式設置密碼:ssh
<Huawei>system-view //進入配置模式ide
[Huawei] sysname R1 //更改主機名ui
[R1] user-interface console 0 //進入console口加密
[R1-ui-console0]authentication-mode password //認證模式爲passwordspa
輸入密碼,驗證orm
B、用aaa認證方式router
[R1] user-interface console 0 server
[R1-ui-console0]authentication-mode aaa
[R1]aaa
[R1-aaa]local-user zhangsan password cipher 123456 //建立用戶名和密碼
[R1-aaa]local-user zhangsan privilege level 15 //訪問級別
二、配置遠程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 //該用戶容許的服務類型
三、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用戶的認證模式
四、配置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
五、配置靜態路由:
[R1]ip route-static 23.1.1.0 24 g0/0/0 12.1.1.2
// 目標網段 子網掩碼 本地出口 下一跳地址
六、配置等價靜態路由:
[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
七、路由的選舉規則是什麼?
第一步比較掩碼長度,越長越優
第二步比較路由優先級,越小越優
第三步比較路由開銷值,越小越優
配置浮動靜態路由:
[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
八、配置缺省靜態路由:
[R1]ip route-static 0.0.0.0 0 g0/0/0 12.1.1.2
九、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
十、修改OSPF的RID:
[R1] ospf 100 router-id 1.1.1.1
(RID修改後不會當即生效,須要重啓OSPF
進程新的RID纔會生效)
重啓OSPF進程:
<R1>reset ospf process
十一、修改OSPF基準帶寬:當帶寬高於100時需修改
[R1]ospf 100
[R1-ospf-100]bandwidth-reference 10000
十二、修改OSPF計時器:鄰居之間必須同時修改
[R1]int g0/0/0 //基於端口的修改
[R1-GigabitEthernet0/0/0]ospf timer hello 20
[R1-GigabitEthernet0/0/0]ospf timer dead 60
1三、修改OSPF的DR接口優先級:只能把優先級調低
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0] ospf dr-priority 0
1四、配置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
1五、配置基本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
1六、配置擴展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
1七、配置靜態NAT
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat static global 12.1.1.1 inside 10.1.1.1
1八、配置動態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
1九、配置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
2一、配置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
2二、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
2三、配置手工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 //查看生成樹的狀態
2四、配置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 //查看鏈路狀態
2五、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信息
2六、配置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
2七、配置hybrid接口類型
建立vlan十、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
2八、配置單臂路由:實現不一樣網段之間的通訊,交換機連路由器的接口設置爲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
2九、配置三層交換:先建立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