華爲交換機常用配置命令
1.基本配置命令
<huawei>system-view 進入系統視圖模式(即特權模式)
[Switch A]sysname Switch A 交換機命名爲Switch A
[Switch A]vlan 2 創建vlan 2
[Switch A-Vlan2]description Market 描述vlan 2
[Switch A-Vlan2]port ehternet 0/1 to ethernet 0/4 將端口1至4加入vlan2
[Switch A-Vlan2]ip address 192.168.67.41 255.255.0.0 配置vlan2的ip地址爲192.168.67.41 掩碼255.255.0.0
[Switch A-Vlan2]quit 退出vlan2
[Switch A]interface ethernet 0/5 進入交換機端口5
[Switch A-Ethernet0/5]port link-type access 當前端口設置access
[Switch A-Ethernet0/5]port default vlan 10 當前端口配置成vlan 10
[Switch A-Ethernet0/5]quit 退出端口5
2.access、trunk、PVID配置
<Switch A>system-view 進入系統視圖模式(即特權模式)
[Switch A]lvlan 3 創建vlan 3
[Switch A-vlan3]port ethernet 0/2 將端口2加入vlan 3
[Switch A-Vlan3]quit 退出vlan2
[Switch A]interface ethernet0/2 進入交換機端口2
[Switch A-Ethernet0/2]port access vlan 3 設置vlan 3類型爲access
[Switch A-Ethernet0/2]port trunk permit vlan 3 設置vlan 3類型爲trunk
[Switch A-Ethernet0/2]port hybird pvid vlan 3 設置端口vlan的pvid爲vlan 3
[Switch A-Ethernet0/2]port trunk pvid vlan 3 設置trunk的pvid爲vlan 3
[Switch A-Ethernet0/2]port trunk pvid vlan 3 list untagged 設置無標識的VLAN ID如果和pvid一致,則去掉vlan信息
[Switch A-Ethernet0/2]undo shutdown 激活端口
[Switch A-Ethernet0/2]shut down 關閉端口
3.Telnet功能設置
<Switch A>system-view 進入系統視圖模式(即特權模式)
[Switch A]user-interface vty 0 4 進入用戶終端
[Switch A-ui-vty0-4]authentication-mode password 進入登錄密碼設置
[Switch A-ui-vty0-4]set authentication-mode password admin123 設置telnet登錄密碼爲admin123
[Switch A-ui-vty0-4]user privilege level 3 設置用戶級別爲3(0爲參觀級,1爲監控級,2爲配置級,3爲管理級)
4.端口模式及流控設置
<Switch A>system-view 進入系統視圖模式(即特權模式)
[Switch A]interface ethernet 0/1 進入交換機端口1
[Switch A-Ethernet0/1]duplex {half|full|auto} 交換機端口設置爲半雙工、雙工、自動
[Switch A-Ethernet0/1]speed {100|10|auto} 設置交換機端口1的傳輸速率爲100M、10M、自動
[Switch A-Ethernet0/1]flow-control 配置交換機端口流控
[Switch A-Ethernet0/1]port link-type {access|trunk|hybrid} 設置交換機端口工作模式
[Switch A-Ethernet0/1]undo shut down 激活端口
[Switch A-Ethernet0/1]quit 退出系統視圖
5.配置靜態路由
[Switch A]ip route -static 10.69.1.137 255.255.0.0 10.65.1.2 255.255.0.0 配置交換機路由10.69.1.137至10.65.1.2
[Switch A]rip 開啓三層交換功能
[Switch A]local-user ftp 開啓ftp上傳功能
6.配置生成樹、端口聚合
<Switch A>system-view 進入系統視圖模式(即特權模式)
[Switch A]stp {enable/disable} 開啓交換機生成樹功能
[Switch A]stp priority 4096 設置交換機的優先級
[Switch A]stp root {primary/secondary} 設置交換機爲根或者備份根
[Switch A]interface ethernet0/1 進入交換機端口1
[Switch A-Ethernet0/1]stp cost 200 設置交換機端口的花費爲200
[Switch A-Ethernet0/1]quit 退出端口1
[Switch A]link -aggregation e0/1 to e0/4 ingress|both 將端口1-端口4聚合
[Switch A]undo link-aggregatuin e/0/1|all 始端口爲通道號
7.配置保存、刪除,查看,及交換機重啓命令
<Switch A>system-view 進入系統視圖模式(即特權模式)
[Switch A]display curent-configuration 查看當前配置
[Switch A]display interfaces 查看交換機端口信息
[Switch A]display vlan all 查看交換機所有vlan
[Switch A]display version 查看交換機版本信息
[Switch A]quit 退出系統視圖模式
<Switch A>save 保存當前配置
[Switch A]reboot 重啓交換機
[Switch A]reset saved-configuration 清除交換機配置