华为、H3C、锐捷三家交换机配置命令详解
生活随笔
收集整理的這篇文章主要介紹了
华为、H3C、锐捷三家交换机配置命令详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一、華為交換機基礎配置命令
1、創建vlan:
<Quidway> //用戶視圖,也就是在Quidway模式下運行命令。 <Quidway>system-view //進入配置視圖 [Quidway] vlan 10 //創建vlan 10,并進入vlan10配置視圖,如果vlan10存在就直接進入vlan10配置視圖 [Quidway-vlan10] quit //回到配置視圖 [Quidway] vlan 100 //創建vlan 100,并進入vlan100配置視圖,如果vlan10存在就直接進入vlan100配置視圖 [Quidway-vlan100] quit //回到配置視圖2、將端口加入到vlan中:
[Quidway] interface GigabitEthernet2/0/1 (10G光口) [Quidway- GigabitEthernet2/0/1] port link-type access //定義端口傳輸模式 [Quidway- GigabitEthernet2/0/1] port default vlan 100 //將端口加入vlan100 [Quidway- GigabitEthernet2/0/1] quit //回到配置視圖 [Quidway] interface GigabitEthernet1/0/0 //進入1號插槽上的第一個千兆網口配置視圖中。0代表1號口 [Quidway- GigabitEthernet1/0/0] port link-type access //定義端口傳輸模式 [Quidway- GigabitEthernet2/0/1] port default vlan 10 //將這個端口加入到vlan10中 [Quidway- GigabitEthernet2/0/1] quit3、將多個端口加入到VLAN中
<Quidway>system-view [Quidway]vlan 10 [Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //將0到29號口加入到vlan10中 [Quidway-vlan10]quit4、交換機配置IP地址
[Quidway] interface Vlanif100 // 進入vlan100接口視圖與vlan 100命令進入的地方不同 [Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 // 定義vlan100管理IP三層 交換網關路由 [Quidway-Vlanif100] quit //返回視圖 [Quidway] interface Vlanif10 // 進入vlan10接口視圖與vlan 10命令進入的地方不同 [Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定義vlan10管理IP三層交換網關路由 [Quidway-Vlanif10] quit5、配置默認網關:
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默認網關。6、 交換機保存設置和重置命令
<Quidway>save //保存配置信息 <Quidway>reset saved-configuration //重置交換機的配置 <Quidway>reboot //重新啟動交換機7、交換機常用的顯示命令
用戶視圖模式下:
8、恢復交換機出廠設置
<Quidway>reset saved-configuration //重置交換機的配置二、H3C交換機的基本配置
我們先來了解下h3c的配置命令與功能,都是常用的,基本上大部分網絡配置都少不了這些命令。
1、基本配置
<H3C> //用戶直行模式提示符,用戶視圖 <H3C>system-view //進入配置視圖 [H3C] sysname xxx //設置主機名成為xxx這里使用修改特權用戶密碼2、用戶配置
<H3C>system-view [H3C]super password H3C //設置用戶分級密碼 [H3C]undo superpassword //刪除用戶分級密碼 [H3C]localuser bigheap 1234561 //Web網管用戶設置,1為管理級用戶 [H3C]undo localuser bigheap //刪除Web網管用戶 [H3C]user-interface aux 0 //只支持0 [H3C-Aux]idle-timeout 250 //設置超時為2分50秒,若為0則表示不超時,默認為5分鐘[H3C-Aux]undoidle-timeout //恢復默認值 [H3C]user-interface vty 0 //只支持0和1 [H3C-vty]idle-timeout 250 //設置超時為2分50秒,若為0則表示不超時,默認為5分鐘 [H3C-vty]undoidle-timeout //恢復默認值 [H3C-vty]set authentication password123456 //設置telnet密碼,必須設置 [H3C-vty]undo set authenticationpassword //取消密碼 [H3C]displayusers //顯示用戶 [H3C]displayuser-interface //用戶界面狀態3、vlan配置
[H3C]vlan 2 //創建VLAN2 [H3C]undo vlanall //刪除除缺省VLAN外的所有VLAN,缺省VLAN不能被刪除 [H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //將4到7號端口加入到VLAN2中,此命令只能用來加access端口,不能用來增加trunk或者hybrid端口[H3C-vlan2]port-isolate enable //打開VLAN內端口隔離特性,不能二層轉發,默認不啟用該功能[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //設置4為VLAN2的隔離上行端口,用于轉發二層數據,只能配置一個上行端口,若為trunk,則建議允許所有VLAN通過,隔離不能與匯聚同時配置[H3C]display vlan all //顯示所有VLAN的詳細信息[H3C]user-group 20 //創建user-group 20,默認只存在user-group 1[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 //將4到7號端口加入到VLAN20中,初始時都屬于user-group 1中 [H3C]display user-group 20 //顯示user-group 20的相關信息擴展
華為&華三
因為華為、華三的命令基本類似,有些細微差別需要自己去查相應手冊,工程師江湖 這次只是介紹下基本的命令,以供參考。
dispaly cu 查看當前配置 dispaly irf 查看堆疊狀態 display clock 查看系統時間 display version 查看設備版本 display license 查看license信息 display ip interface brief 查看ip display interface brief 查看接口狀態 display device manuinfo 序列號 display ip routing-table 查看路由表 display ip routing-table vpn-instance 查看路由表 display transceiver interface Ten-GigabitEthernet 查看光模塊接口 display vlan 查看vlan dispaly vrrp brief 查看vrrp主備信息 display ospf peer 查看ospf鄰居 display interface ETh-Trunk 接口號 查看聚合口信息 display ETh-Trunk 接口號 查看聚合口信息 display stp brief 查看生成樹信息 display device manufacture-info 查看具體型號和SN號 display esn 查看主框序列號 dispaly ntp status 查看ntp服務器 display interface 接口 discard為0說明沒有丟包 display cpu-usage 查看cpu利用率 display power 查看電源信息 display fan 查看風扇信息 display mac-address 查看mac表信息 display lldp neighbor brief 查看鄰居設備信息 display environment 查看溫度四、交換機ip配置
[H3C]vlan 20 //創建vlan [H3C]management-vlan 20 //管理vlan [H3C]interface vlan-interface 20 //進入并管理vlan20 [H3C]undo interface vlan-interface 20 //刪除管理VLAN端口 [H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 //配置管理VLAN接口靜態IP地址[H3C-Vlan-interface20]undo ipaddress //刪除IP地址 [H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省網關(默認無網關地址) [H3C-Vlan-interface20]undo ip gateway [H3C-Vlan-interface20]shutdown //關閉接口 [H3C-Vlan-interface20]undo shutdown //開啟 [H3C]display ip //顯示管理VLAN接口IP的相關信息 [H3C]display interface vlan-interface20 //查看管理VLAN的接口信息 <H3C>debugging ip //開啟IP調試功能 <H3C>undo debugging ip5、DHCP客戶端配置
[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口通過DHCP方式獲取IP地址 [H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消 [H3C]display dhcp //顯示DHCP客戶信息 <H3C>debugging dhcp-alloc //開啟DHCP調試功能 <H3C>undo debugging dhcp-alloc6、端口配置
[H3C]interface Ethernet0/3 //進入端口 [H3C-Ethernet0/3]shutdown //關閉端口 [H3C-Ethernet0/3]speed 100 //速率可為10,100,1000和auto(缺省) [H3C-Ethernet0/3]duplexfull //雙工,可為half,full和auto,光口和匯聚后不能配置 [H3C-Ethernet0/3]flow-control //開啟流控,默認為關閉 [H3C-Ethernet0/3]broadcast-suppression 20 //設置抑制廣播百分比為20%,可取5,10,20,100,缺省為100,同時組播和未知單播也受此影響 [H3C-Ethernet0/3]loopback internal //內環測試 [H3C-Ethernet0/3]port link-type trunk //設置鏈路的類型為trunk [H3C-Ethernet0/3]port trunk pvid vlan 20 //設置20為該trunk的缺省VLAN,默認為1(trunk線路兩端的PVID必須一致) [H3C-Ethernet0/3]port access vlan 20 //將當前access端口加入指定的VLAN [H3C-Ethernet0/3]port trunk permit vlanall //允許所有的VLAN通過當前的trunk端口,可多次使用該命令 [H3C-Ethernet0/3]mdiauto //設置以太端口為自動監測,normal為直通線,across為交叉線 [H3C]link-aggregation Ethernet 0/1 toEthernet 0/4 //將1-4口加入匯聚組,1為主端口,兩端需要同時配置,設置了端口鏡像以及端口隔離的端口無法匯聚[H3C]undo link-aggregation Ethernet 0/1 //刪除該匯聚組 [H3C]link-aggregation mode egress //配置端口匯聚模式為根據目的MAC地址進行負荷分擔,可選為 ingress,egress和both,缺省為both [H3C]monitor-port Ethernet 0/2 //將該端口設置為鏡像端口,必須先設置鏡像端口,刪除時必須先刪除被鏡像端口,而且它們不能同在一個端口,該端口不能在匯聚組中,設置新鏡像端口時,新取代舊,被鏡像不變[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //將端口3和4設置為被鏡像端口,both為同時監控接收和發送的報文,inbound表示僅監控接收的報文,outbound表示僅監控發送的報文[H3C]display mirror [H3C]display interface Ethernet 0/3 <H3C>resetcounters //清除所有端口的統計信息 [H3C]display link-aggregation Ethernet0/3 //顯示端口匯聚信息 [H3C-Ethernet0/3]virtual-cable-test //診斷該端口的電路狀況7、qos優先級配置
QoS配置步驟:設置端口的優先級,設置交換機信任報文的優先級方式,隊列調度,端口限速 [H3C-Ethernet0/3]priority 7 //設置端口優先級為7,默認為0 [H3C]priority-trustcos //設置交換機信任報文的優先級方式為cos(802.1p優先級,缺省值),還可以設為dscp方式[H3C]queue-scheduler hq-wrr 2 4 6 8 //設置隊列調度算法為HQ-WRR(默認為WRR),權重為2,4,6,8 [H3C-Ethernet0/3]line-rate inbound 29 //將端口進口速率限制為2Mbps,取1-28時,速率為rate*8*1024/125,即64,128,192...1.792M; 29-127時,速率為(rate-27)*1024,即2M,3M,4M...100M。[H3C]displayqueue-scheduler //顯示隊列調度模式及參數 [H3C]displaypriority-trust //顯示優先級信任模式三、銳捷交換機基礎命令配置
連接上交換機后,肯定是需要進行命令配置,我們來看下基礎命令配置。
1、準備命令
>Enable //進入特權模式 #Exit //返回上一級操作模式 #End //返回到特權模式 #copy running-config startup-config //保存配置文件 #del flash:config.text //刪除配置文件(交換機及1700系列路由器) #erase startup-config //刪除配置文件(2500系列路由器) #del flash:vlan.dat //刪除Vlan配置信息(交換機) #Configure terminal //進入全局配置模式 (config)# hostname switchA //配置設備名稱為switchA (config)#banner motd & //配置每日提示信息 &為終止符 (config)#enable secret level 1 0 star //配置遠程登陸密碼為star (config)#enable secret level 15 0 star //配置特權密碼為star Level 1為普通用戶級別,可選為1~15,15為最高權限級別;0表示密碼不加密 (config)#enable services web-server //開啟交換機WEB管理功能 Services 可選以下:web-server(WEB管理)、telnet-server(遠程登陸)等2、查看信息
#show running-config //查看當前生效的配置信息 #show interface fastethernet 0/3 //查看F0/3端口信息 #show interface serial 1/2 //查看S1/2端口信息 #show interface //查看所有端口信息 #show ip interface brief //以簡潔方式匯總查看所有端口信息 #show ip interface //查看所有端口信息 #show version //查看版本信息 #show mac-address-table //查看交換機當前MAC地址表信息 #show running-config //查看當前生效的配置信息 #show vlan //查看所有VLAN信息 #show vlan id 10 //查看某一VLAN (如VLAN10)的信息 #show interface fastethernet 0/1 //查看某一端口模式(如F 0/1) #show aggregateport 1 summary //查看聚合端口AG1的信息 #show spanning-tree //查看生成樹配置信息 #show spanning-tree interface fastethernet 0/1 //查看該端口的生成樹狀態 #show port-security //查看交換機的端口安全配置信息 #show port-security address //查看地址安全綁定配置信息 #show ip access-lists listname //查看名為listname的列表的配置信息3、端口的基本配置
(config)#Interface fastethernet 0/3 //進入F0/3的端口配置模式 (config)#interface range fa 0/1-2,0/5,0/7-9 //進入F0/1、F0/2、F0/5、F0/7、F0/8、F0/9的端口配置模式 (config-if)#speed 10 //配置端口速率為10M,可選10,100,auto (config-if)#duplex full //配置端口為全雙工模式,可選full(全雙工),half(半雙式),auto(自適應) (config-if)#no shutdown //開啟該端口 (config-if)#switchport access vlan 10 //將該端口劃入VLAN10中,用于VLAN (config-if)#switchport mode trunk //將該端口設為trunk模式,可選模式為access , trunk (config-if)#port-group 1 //將該端口劃入聚合端口AG1中,用于聚合端口4、聚合端口的創建
(config)# interface aggregateport 1 //創建聚合接口AG1 (config-if)# switchport mode trunk //配置并保證AG1為 trunk 模式 (config)#int f0/23-24 (config-if-range)#port-group 1 //將端口(端口組)劃入聚合端口AG1中5、生成樹
配置多生成樹協議: switch(config)#spanning-tree //開啟生成樹協議 switch(config)#spanning-tree mst configuration //建立多生成樹協議 switch(config-mst)#name ruijie //命名為ruijie switch(config-mst)#revision 1 //設定校訂本為1 switch(config-mst)#instance 0 vlan 10,20 //建立實例0 switch(config-mst)#instance 1 vlan 30,40 //建立實例1 switch(config)#spanning-tree mst 0 priority 4096 //設置優先級為4096 switch(config)#spanning-tree mst 1 priority 8192 //設置優先級為8192 switch(config)#interface vlan 10 switch(config-if)#vrrp 1 ip 192.168.10.1 //此為vlan 10的IP地址 switch(config)#interface vlan 20 switch(config-if)#vrrp 1 ip 192.168.20.1 //此為vlan 20的IP地址 switch(config)#interface vlan 30 switch(config-if)#vrrp 2 ip 192.168.30.1 //此為vlan 30的IP地址(另一三層交換機) switch(config)#interface vlan 40 switch(config-if)#vrrp 2 ip 192.168.40.1 //此為vlan 40的IP地址(另一三層交換機)6、VLAN的基本配置
(config)#vlan 10 //創建VLAN10 (config-vlan)#name vlanname // 命名VLAN為vlanname (config-if)#switchport access vlan 10 //將該端口劃入VLAN10中 某端口的接口配置模式下進行 (config)#interface vlan 10 //進入VLAN 10的虛擬端口配置模式 (config-if)# ip address 192.168.1.1 255.255.255.0 //為VLAN10的虛擬端口配置IP及掩碼,二層交換機只能配置一個IP,此IP是作為管理IP使用,例如,使用Telnet的方式登錄的IP地址 (config-if)# no shutdown //啟用該端口7、端口安全
(config)# interface fastethernet 0/1 //進入一個端口 (config-if)# switchport port-security //開啟該端口的安全功能a、配置最大連接數限制
(config-if)# switchport port-secruity maxmum 1 //配置端口的最大連接數為1,最大連接數為128 (config-if)# switchport port-secruity violation shutdown //配置安全違例的處理方式為shutdown,可選為protect (當安全地址數滿后,將未知名地址丟棄)、restrict(當違例時,發送一個Trap通知)、shutdown(當違例時將端口關閉,并發送Trap通知,可在全局模式下用errdisable recovery來恢復)b、IP和MAC地址綁定
(config-if)#switchport port-security mac-address xxxx.xxxx.xxxx ip-address 172.16.1.1 //接口配置模式下配置MAC地址xxxx.xxxx.xxxx和IP172.16.1.1進行綁定(MAC地址注意用小寫)8、三層路由功能(針對三層交換機)
(config)# ip routing //開啟三層交換機的路由功能 (config)# interface fastethernet 0/1 (config-if)# no switchport //開啟端口的三層路由功能(這樣就可以為某一端口配置IP) (config-if)# ip address 192.168.1.1 255.255.255.0 (config-if)# no shutdown9、三層交換機路由協議
(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 //配置靜態路由 注:172.16.1.0 255.255.255.0 //為目標網絡的網絡號及子網掩碼 172.16.2.1 為下一跳的地址,也可用接口表示,如ip route 172.16.1.0 255.255.255.0 serial 1/2(172.16.2.0所接的端口)(config)# router rip //開啟RIP協議進程 (config-router)# network 172.16.1.0 //申明本設備的直連網段信息 (config-router)# version 2 //開啟RIP V2,可選為version 1(RIPV1)、version 2(RIPV2) (config-router)# no auto-summary //關閉路由信息的自動匯總功能(只有在RIPV2支持)(config)# router ospf //開啟OSPF路由協議進程(針對1762,無需使用進程ID) (config)# router ospf 1 //開啟OSPF路由協議進程(針對2501,需要加OSPF進程ID) (config-router)# network 192.168.1.0 0.0.0.255 area 0 //申明直連網段信息,并分配區域號(area0為骨干區域)可以明顯看出,三家命令大同小異,其實華為與H3C更加類似。
參考鏈接 :
華為、H3C、銳捷三家交換機配置命令詳解 : https://mp.weixin.qq.com/s/rf3UCj9iAQSEw5mInHPCdg
總結
以上是生活随笔為你收集整理的华为、H3C、锐捷三家交换机配置命令详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: web学习入门资源总结
- 下一篇: 电力通信专业技术总结,智能电网通信技术总