新聞中心
華為、H3C、銳捷三家交換機(jī)配置命令詳解
為了讓大家更加清楚,每行代碼都有解釋。
創(chuàng)新互聯(lián)建站主要從事成都網(wǎng)站建設(shè)、成都網(wǎng)站制作、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)商河,十余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108
一、華為交換機(jī)基礎(chǔ)配置命令
1、創(chuàng)建vlan:
//用戶視圖,也就是在Quidway模式下運(yùn)行命令。
system-view //進(jìn)入配置視圖
[Quidway] vlan 10 //創(chuàng)建vlan 10,并進(jìn)入vlan10配置視圖,如果vlan10存在就直接進(jìn)入vlan10配置視圖
[Quidway-vlan10] quit //回到配置視圖
[Quidway] vlan 100 //創(chuàng)建vlan 100,并進(jìn)入vlan100配置視圖,如果vlan10存在就直接進(jìn)入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 //進(jìn)入1號(hào)插槽上的第一個(gè)千兆網(wǎng)口配置視圖中。0代表1號(hào)口
[Quidway- GigabitEthernet1/0/0] port link-type access //定義端口傳輸模式
[Quidway- GigabitEthernet2/0/1] port default vlan 10 //將這個(gè)端口加入到vlan10中
[Quidway- GigabitEthernet2/0/1] quit
3、將多個(gè)端口加入到VLAN中
system-view
[Quidway]vlan 10
[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //將0到29號(hào)口加入到vlan10中
[Quidway-vlan10]quit
4、交換機(jī)配置IP地址
[Quidway] interface Vlanif100 // 進(jìn)入vlan100接口視圖與vlan 100命令進(jìn)入的地方不同
[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 // 定義vlan100管理IP三層 交換網(wǎng)關(guān)路由
[Quidway-Vlanif100] quit //返回視圖
[Quidway] interface Vlanif10 // 進(jìn)入vlan10接口視圖與vlan 10命令進(jìn)入的地方不同
[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定義vlan10管理IP三層交換網(wǎng)關(guān)路由
[Quidway-Vlanif10] quit
5、配置默認(rèn)網(wǎng)關(guān):
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默認(rèn)網(wǎng)關(guān)。
6、 交換機(jī)保存設(shè)置和重置命令
save //保存配置信息
reset saved-configuration //重置交換機(jī)的配置
reboot //重新啟動(dòng)交換機(jī)
7、交換機(jī)常用的顯示命令
用戶視圖模式下:
display current-configuration //顯示現(xiàn)在交換機(jī)正在運(yùn)行的配置明細(xì)
display device //顯示各設(shè)備狀態(tài)
display interface ? //顯示個(gè)端口狀態(tài),用?可以查看后邊跟的選項(xiàng)
display version //查看交換機(jī)固件版本信息
display vlan ? // 查看vlan的配置信息
8、恢復(fù)交換機(jī)出廠設(shè)置
reset saved-configuration //重置交換機(jī)的配置
二、H3C交換機(jī)的基本配置
我們先來了解下h3c的配置命令與功能,都是常用的,基本上大部分網(wǎng)絡(luò)配置都少不了這些命令。
1、基本配置
//用戶直行模式提示符,用戶視圖
system-view // 進(jìn)入配置視圖
[H3C] sysname xxx //設(shè)置主機(jī)名成為xxx這里使用修改特權(quán)用戶密碼
2、用戶配置
system-view
[H3C]super password H3C //設(shè)置用戶分級(jí)密碼
[H3C]undo superpassword //刪除用戶分級(jí)密碼
[H3C]localuser bigheap 1234561 //Web網(wǎng)管用戶設(shè)置,1為管理級(jí)用戶
[H3C]undo localuser bigheap //刪除Web網(wǎng)管用戶
[H3C]user-interface aux 0 //只支持0
[H3C-Aux]idle-timeout 250 //設(shè)置超時(shí)為2分50秒,若為0則表示不超時(shí),默認(rèn)為5分鐘
[H3C-Aux]undoidle-timeout //恢復(fù)默認(rèn)值
[H3C]user-interface vty 0 //只支持0和1
[H3C-vty]idle-timeout 250 //設(shè)置超時(shí)為2分50秒,若為0則表示不超時(shí),默認(rèn)為5分鐘
[H3C-vty]undoidle-timeout //恢復(fù)默認(rèn)值
[H3C-vty]set authentication password123456 //設(shè)置telnet密碼,必須設(shè)置
[H3C-vty]undo set authenticationpassword //取消密碼
[H3C]displayusers //顯示用戶
[H3C]displayuser-interface //用戶界面狀態(tài)
3、vlan配置
[H3C]vlan 2 //創(chuàng)建VLAN2
[H3C]undo vlanall //刪除除缺省VLAN外的所有VLAN,缺省VLAN不能被刪除
[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //將4到7號(hào)端口加入到VLAN2中,此命令只能用來加access端口,不能用來增加trunk或者h(yuǎn)ybrid端口
[H3C-vlan2]port-isolate enable //打開VLAN內(nèi)端口隔離特性,不能二層轉(zhuǎn)發(fā), 默認(rèn)不啟用該功能
[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //設(shè)置4為VLAN2的 隔離上行端口 ,用于轉(zhuǎn)發(fā)二層數(shù)據(jù),只能配置一個(gè)上行端口,若為trunk,則建議允許所有VLAN通過,隔離不能與匯聚同時(shí)配置
[H3C]display vlan all // 顯示所有VLAN的詳細(xì)信息
[H3C]user-group 20 //創(chuàng)建user-group 20,默認(rèn)只存在user-group 1
[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 // 將4到7號(hào)端口加入到VLAN20中, 初始時(shí)都屬于user-group 1中
[H3C]display user-group 20 //顯示user-group 20的相關(guān)信息
四、交換機(jī)ip配置
[H3C]vlan 20 // 創(chuàng)建vlan
[H3C]management-vlan 20 //管理vlan
[H3C]interface vlan-interface 20 // 進(jìn)入并管理vlan20
[H3C]undo interface vlan-interface 20 //刪除管理VLAN端口
[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 // 配置管理VLAN接口靜態(tài)IP地址
[H3C-Vlan-interface20]undo ipaddress //刪除IP地址
[H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省網(wǎng)關(guān)(默認(rèn)無網(wǎng)關(guān)地址)
[H3C-Vlan-interface20]undo ip gateway
[H3C-Vlan-interface20]shutdown // 關(guān)閉接口
[H3C-Vlan-interface20]undo shutdown //開啟
[H3C]display ip //顯示管理VLAN接口IP的相關(guān)信息
[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息
debugging ip //開啟IP調(diào)試功能
undo debugging ip
5、DHCP客戶端配置
[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口 通過DHCP方式獲取IP地址
[H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消
[H3C]display dhcp //顯示DHCP客戶信息
debugging dhcp-alloc //開啟DHCP調(diào)試功能
undo debugging dhcp-alloc
6、端口配置
[H3C]interface Ethernet0/3 //進(jìn)入端口
[H3C-Ethernet0/3]shutdown //關(guān)閉端口
[H3C-Ethernet0/3]speed 100 //速率可為10,100,1000和auto(缺省)
[H3C-Ethernet0/3]duplexfull // 雙工,可 為half,full和auto,光口和匯聚后不能配置
[H3C-Ethernet0/3]flow-control // 開啟流控,默認(rèn)為關(guān)閉
[H3C-Ethernet0/3]broadcast-suppression 20 //設(shè)置抑制廣播百分比為20%,可取5,10,20,100,缺省為100,同時(shí)組播和未知單播也受此影響
[H3C-Ethernet0/3]loopback internal //內(nèi)環(huán)測(cè)試
[H3C-Ethernet0/3]port link-type trunk //設(shè)置鏈路的 類型為trunk
[H3C-Ethernet0/3]port trunk pvid vlan 20 //設(shè)置20為該trunk的缺省VLAN,默認(rèn)為1(trunk線路兩端的PVID必須一致)
[H3C-Ethernet0/3]port access vlan 20 //將當(dāng)前 access端口加入指定的VLAN
[H3C-Ethernet0/3]port trunk permit vlanall //允許 所有的VLAN通過當(dāng)前的trunk端口, 可多次使用該命令
[H3C-Ethernet0/3]mdiauto //設(shè)置以太端口為自動(dòng)監(jiān)測(cè),normal為直通線,across為交叉線
[H3C]link-aggregation Ethernet 0/1 toEthernet 0/4 // 將1-4口加入?yún)R聚組, 1為主端口,兩端需要同時(shí)配置,設(shè)置了端口鏡像以及端口隔離的端口無法匯聚
[H3C]undo link-aggregation Ethernet 0/1 //刪除該匯聚組
[H3C]link-aggregation mode egress //配置端口匯聚模式為根據(jù)目的MAC地址進(jìn)行負(fù)荷分擔(dān),可選為 ingress,egress和both,缺省為both
[H3C]monitor-port Ethernet 0/2 // 將該端口設(shè)置為鏡像端口 ,必須先設(shè)置鏡像端口,刪除時(shí)必須先刪除被鏡像端口,而且它們不能同在一個(gè)端口,該端口不能在匯聚組中,設(shè)置新鏡像端口時(shí),新取代舊,被鏡像不變
[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //將 端口3和4設(shè)置為被鏡像端口 ,both為同時(shí)監(jiān)控接收和發(fā)送的報(bào)文,inbound表示僅監(jiān)控接收的報(bào)文,outbound表示僅監(jiān)控發(fā)送的報(bào)文
[H3C]display mirror
[H3C]display interface Ethernet 0/3
resetcounters // 清除所有端口的統(tǒng)計(jì)信息
[H3C]display link-aggregation Ethernet0/3 // 顯示端口 匯聚信息
[H3C-Ethernet0/3]virtual-cable-test //診斷該端口的電路狀況
7、qos優(yōu)先級(jí)配置
QoS配置步驟:設(shè)置端口的優(yōu)先級(jí),設(shè)置交換機(jī)信任報(bào)文的優(yōu)先級(jí)方式,隊(duì)列調(diào)度,端口限速
[H3C-Ethernet0/3]priority 7 //設(shè)置端口 優(yōu)先級(jí)為7 ,默認(rèn)為0
[H3C]priority-trustcos //設(shè)置交換機(jī)信任報(bào)文的優(yōu)先級(jí)方式為cos(802.1p優(yōu)先級(jí),缺省值),還可以設(shè)為dscp方式
[H3C]queue-scheduler hq-wrr 2 4 6 8 //設(shè)置隊(duì)列調(diào)度算法為HQ-WRR(默認(rèn)為WRR),權(quán)重為2,4,6,8
[H3C-Ethernet0/3]line-rate inbound 29 //將 端口進(jìn)口速率限制 為2Mbps,取1-28時(shí),速率為rate*8*1024/125,即64,128,192...1.792M;
29-127時(shí),速率為(rate-27)*1024,即2M,3M,4M...100M。
[H3C]displayqueue-scheduler //顯示隊(duì)列調(diào)度模式及參數(shù)
[H3C]displaypriority-trust // 顯示優(yōu)先級(jí)信任模式
三、銳捷交換機(jī)基礎(chǔ)命令配置
連接上交換機(jī)后,肯定是需要進(jìn)行命令配置,我們來看下基礎(chǔ)命令配置。
1、準(zhǔn)備命令
Enable //進(jìn)入特權(quán)模式
#Exit //返回上一級(jí)操作模式
#End //返回到特權(quán)模式
#copy running-config startup-config //保存配置文件
#del flash:config.text //刪除配置文件(交換機(jī)及1700系列路由器)
#erase startup-config //刪除配置文件(2500系列路由器)
#del flash:vlan.dat //刪除Vlan配置信息(交換機(jī))
#Configure terminal //進(jìn)入全局配置模式
(config)# hostname switchA //配置設(shè)備名稱為switchA
(config)#banner motd //配置每日提示信息 為終止符
(config)#enable secret level 1 0 star //配置遠(yuǎn)程登陸密碼為star
(config)#enable secret level 15 0 star //配置特權(quán)密碼為star
Level 1為普通用戶級(jí)別,可選為1~15,15為最高權(quán)限級(jí)別;0表示密碼不加密
(config)#enable services web-server //開啟交換機(jī)WEB管理功能
Services 可選以下:web-server(WEB管理)、telnet-server(遠(yuǎn)程登陸)等
2、查看信息
#show running-config //查看當(dāng)前生效的配置信息
#show interface fastethernet 0/3 //查看F0/3端口信息
#show interface serial 1/2 //查看S1/2端口信息
#show interface //查看所有端口信息
#show ip interface brief //以簡(jiǎn)潔方式匯總查看所有端口信息
#show ip interface //查看所有端口信息
#show version //查看版本信息
#show mac-address-table //查看交換機(jī)當(dāng)前MAC地址表信息
#show running-config //查看當(dāng)前生效的配置信息
#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 //查看該端口的生成樹狀態(tài)
#show port-security //查看交換機(jī)的端口安全配置信息
#show port-security address //查看地址安全綁定配置信息
#show ip access-lists listname //查看名為listname的列表的配置信息
3、端口的基本配置
(config)#Interface fastethernet 0/3 //進(jìn)入F0/3的端口配置模式
(config)#interface range fa 0/1-2,0/5,0/7-9 //進(jìn)入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(自適應(yīng))
(config-if)#no shutdown //開啟該端口
(config-if)#switchport access vlan 10 //將該端口劃入VLAN10中,用于VLAN
(config-if)#switchport mode trunk //將該端口設(shè)為trunk模式,可選模式為access , trunk
(config-if)#port-group 1 //將該端口劃入聚合端口AG1中,用于聚合端口
4、聚合端口的創(chuàng)建
(config)# interface aggregateport 1 //創(chuàng)建聚合接口AG1
(config-if)# switchport mode trunk //配置并保證AG1為 trunk 模式
(config)#int f0/23-24
(config-if-range)#port-group 1 //將端口(端口組)劃入聚合端口AG1中
5、生成樹
配置多生成樹協(xié)議:
switch(config)#spanning-tree //開啟生成樹協(xié)議
switch(config)#spanning-tree mst configuration //建立多生成樹協(xié)議
switch(config-mst)#name ruijie //命名為ruijie
switch(config-mst)#revision 1 //設(shè)定校訂本為1
switch(config-mst)#instance 0 vlan 10,20 //建立實(shí)例0
switch(config-mst)#instance 1 vlan 30,40 //建立實(shí)例1
switch(config)#spanning-tree mst 0 priority 4096 //設(shè)置優(yōu)先級(jí)為4096
switch(config)#spanning-tree mst 1 priority 8192 //設(shè)置優(yōu)先級(jí)為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地址(另一三層交換機(jī))
switch(config)#interface vlan 40
switch(config-if)#vrrp 2 ip 192.168.40.1 //此為vlan 40的IP地址(另一三層交換機(jī))
6、VLAN的基本配置
(config)#vlan 10 //創(chuàng)建VLAN10
(config-vlan)#name vlanname // 命名VLAN為vlanname
(config-if)#switchport access vlan 10 //將該端口劃入VLAN10中
某端口的接口配置模式下進(jìn)行
(config)#interface vlan 10 //進(jìn)入VLAN 10的虛擬端口配置模式
(config-if)# ip address 192.168.1.1 255.255.255.0 //為VLAN10的虛擬端口配置IP及掩碼,二層交換機(jī)只能配置一個(gè)IP,此IP是作為管理IP使用,例如,使用Telnet的方式登錄的IP地址
(config-if)# no shutdown //啟用該端口
7、端口安全
(config)# interface fastethernet 0/1 //進(jìn)入一個(gè)端口
(config-if)# switchport port-security //開啟該端口的安全功能
a、配置最大連接數(shù)限制
(config-if)# switchport port-secruity maxmum 1 //配置端口的最大連接數(shù)為1,最大連接數(shù)為128
(config-if)# switchport port-secruity violation shutdown
//配置安全違例的處理方式為shutdown,可選為protect (當(dāng)安全地址數(shù)滿后,將未知名地址丟棄)、restrict(當(dāng)違例時(shí),發(fā)送一個(gè)Trap通知)、shutdown(當(dāng)違例時(shí)將端口關(guān)閉,并發(fā)送Trap通知,可在全局模式下用errdisable recovery來恢復(fù))
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進(jìn)行綁定(MAC地址注意用小寫)
8、三層路由功能(針對(duì)三層交換機(jī))
(config)# ip routing //開啟三層交換機(jī)的路由功能
(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 shutdown
9、三層交換機(jī)路由協(xié)議
(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 //配置靜態(tài)路由
注:172.16.1.0 255.255.255.0 //為目標(biāo)網(wǎng)絡(luò)的網(wǎng)絡(luò)號(hào)及子網(wǎng)掩碼
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協(xié)議進(jìn)程
(config-router)# network 172.16.1.0 //申明本設(shè)備的直連網(wǎng)段信息
(config-router)# version 2 //開啟RIP V2,可選為version 1(RIPV1)、version 2(RIPV2)
(config-router)# no auto-summary //關(guān)閉路由信息的自動(dòng)匯總功能(只有在RIPV2支持)
(config)# router ospf //開啟OSPF路由協(xié)議進(jìn)程(針對(duì)1762,無需使用進(jìn)程ID)
(config)# router ospf 1 //開啟OSPF路由協(xié)議進(jìn)程(針對(duì)2501,需要加OSPF進(jìn)程ID)
(config-router)# network 192.168.1.0 0.0.0.255 area 0
//申明直連網(wǎng)段信息,并分配區(qū)域號(hào)(area0為骨干區(qū)域)
可以明顯看出,三家命令大同小異,其實(shí)華為與H3C更加類似。
華為、H3C、銳捷交換機(jī)配置命令大全
對(duì)于 華為、H3C、銳捷 交換機(jī)的命令配置,三家交換機(jī)的配置命令容易弄混,經(jīng)常在實(shí)際項(xiàng)目配置中出錯(cuò),因此,本期我把這三家交換機(jī)的基礎(chǔ)配置命令顯示在這里,大家可以分別來看下他們的命令有什么不同。
為了讓大家更加清楚,每行代碼都有解釋。
一、華為交換機(jī)基礎(chǔ)配置命令
1、創(chuàng)建vlan:
//用戶視圖,也就是在Quidway模式下運(yùn)行命令。
system-view //進(jìn)入配置視圖
[Quidway] vlan 10 //創(chuàng)建vlan 10,并進(jìn)入vlan10配置視圖,如果vlan10存在就直接進(jìn)入vlan10配置視圖
[Quidway-vlan10] quit //回到配置視圖
[Quidway] vlan 100 //創(chuàng)建vlan 100,并進(jìn)入vlan100配置視圖,如果vlan10存在就直接進(jìn)入vlan100配置視圖
[Quidway-vlan100] quit //回到配置視圖
2、將端口加入到vlan中:
[Quidway] interface GigabitEthernet2/0/ // (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 //進(jìn)入1號(hào)插槽上的第一個(gè)千兆網(wǎng)口配置視圖中。0代表1號(hào)口
[Quidway- GigabitEthernet1/0/0] port link-type access //定義端口傳輸模式
[Quidway- GigabitEthernet2/0/1] port default vlan 10 //將這個(gè)端口加入到vlan10中
[Quidway- GigabitEthernet2/0/1] quit //退出
3、將多個(gè)端口加入到VLAN中
system-view
[Quidway]vlan 10
[Quidway-vlan10]port GigabitEthernet 1/0/0 to 1/0/29 //將0到29號(hào)口加入到vlan10中
[Quidway-vlan10]quit
4、交換機(jī)配置IP地址
[Quidway] interface Vlanif100 // 進(jìn)入vlan100接口視圖與vlan 100命令進(jìn)入的地方不同
[Quidway-Vlanif100] ip address 119.167.200.90 255.255.255.252 // 定義vlan100管理IP三層 交換網(wǎng)關(guān)路由
[Quidway-Vlanif100] quit //返回視圖
[Quidway] interface Vlanif10 // 進(jìn)入vlan10接口視圖與vlan 10命令進(jìn)入的地方不同
[Quidway-Vlanif10] ip address 119.167.206.129 255.255.255.128 // 定義vlan10管理IP三層交換網(wǎng)關(guān)路由
[Quidway-Vlanif10] quit
5、配置默認(rèn)網(wǎng)關(guān):
[Quidway]ip route-static 0.0.0.0 0.0.0.0 119.167.200.89 //配置默認(rèn)網(wǎng)關(guān)。
6、 交換機(jī)保存設(shè)置和重置命令
save //保存配置信息
reset saved-configuration //重置交換機(jī)的配置
reboot //重新啟動(dòng)交換機(jī)
7、交換機(jī)常用的顯示命令
用戶視圖模式下:
display current-configuration //顯示現(xiàn)在交換機(jī)正在運(yùn)行的配置明細(xì)
display device //顯示各設(shè)備狀態(tài)
display interface ? //顯示個(gè)端口狀態(tài),用?可以查看后邊跟的選項(xiàng)
display version //查看交換機(jī)固件版本信息
display vlan ? // 查看vlan的配置信息
8、恢復(fù)交換機(jī)出廠設(shè)置
reset saved-configuration //重置交換機(jī)的配置
二、H3C交換機(jī)的基本配置
我們先來了解下h3c的配置命令與功能,都是常用的,基本上大部分網(wǎng)絡(luò)配置都少不了這些命令。
1、基本配置
//用戶直行模式提示符,用戶視圖
system-view //**進(jìn)入配置視圖**
[H3C] sysname xxx //設(shè)置主機(jī)名成為xxx這里使用修改特權(quán)用戶密碼
2、用戶配置
system-view
[H3C]super password H3C //設(shè)置用戶分級(jí)密碼
[H3C]undo superpassword //刪除用戶分級(jí)密碼
[H3C]localuser bigheap 1234561 //Web網(wǎng)管用戶設(shè)置,1為管理級(jí)用戶
[H3C]undo localuser bigheap //刪除Web網(wǎng)管用戶
[H3C]user-interface aux 0 //只支持0
[H3C-Aux]idle-timeout 250 //設(shè)置超時(shí)為2分50秒,若為0則表示不超時(shí),默認(rèn)為5分鐘
[H3C-Aux]undoidle-timeout //恢復(fù)默認(rèn)值
[H3C]user-interface vty 0 //只支持0和1
[H3C-vty]idle-timeout 250 //設(shè)置超時(shí)為2分50秒,若為0則表示不超時(shí),默認(rèn)為5分鐘
[H3C-vty]undoidle-timeout //恢復(fù)默認(rèn)值
[H3C-vty]set authentication password123456 //設(shè)置telnet密碼,必須設(shè)置
[H3C-vty]undo set authenticationpassword //取消密碼
[H3C]displayusers //顯示用戶
[H3C]displayuser-interface //用戶界面狀態(tài)
3、vlan配置
[H3C]vlan 2 //創(chuàng)建VLAN2
[H3C]undo vlanall //刪除除缺省VLAN外的所有VLAN,缺省VLAN不能被刪除
[H3C-vlan2]port Ethernet 0/4 to Ethernet0/7 //將4到7號(hào)端口加入到VLAN2中,此命令只能用來加access端口,不能用來增加trunk或者h(yuǎn)ybrid端口
[H3C-vlan2]port-isolate enable //打開VLAN內(nèi)端口隔離特性,不能二層轉(zhuǎn)發(fā),默認(rèn)不啟用該功能
[H3C-Ethernet0/4]port-isolate uplink-portvlan 2 //設(shè)置4為VLAN2的隔離上行端口,用于轉(zhuǎn)發(fā)二層數(shù)據(jù),只能配置一個(gè)上行端口,若為trunk,則建議允許所有VLAN通過,隔離不能與匯聚同時(shí)配置
[H3C]display vlan all //顯示所有VLAN的詳細(xì)信息
[H3C]user-group 20 //創(chuàng)建user-group 20,默認(rèn)只存在user-group 1
[H3C-UserGroup20]port Ethernet 0/4 toEthernet 0/7 //將4到7號(hào)端口加入到VLAN20中,初始時(shí)都屬于user-group 1中
[H3C]display user-group 20 //顯示user-group 20的相關(guān)信息
4、交換機(jī)ip配置
[H3C]vlan 20 //創(chuàng)建vlan
[H3C]management-vlan 20 //管理vlan
[H3C]interface vlan-interface 20 //進(jìn)入并管理vlan20
[H3C]undo interface vlan-interface 20 //刪除管理VLAN端口
[H3C-Vlan-interface20]ip address192.168.1.2 255.255.255.0 //配置管理VLAN接口靜態(tài)IP地址
[H3C-Vlan-interface20]undo ipaddress //刪除IP地址
[H3C-Vlan-interface20]ip gateway 192.168.1.1 //指定缺省網(wǎng)關(guān)(默認(rèn)無網(wǎng)關(guān)地址)
[H3C-Vlan-interface20]undo ip gateway
[H3C-Vlan-interface20]shutdown //關(guān)閉接口
[H3C-Vlan-interface20]undo shutdown //開啟
[H3C]display ip //顯示管理VLAN接口IP的相關(guān)信息
[H3C]display interface vlan-interface20 //查看管理VLAN的接口信息
debugging ip //開啟IP調(diào)試功能
undo debugging ip
5、DHCP客戶端配置
[H3C-Vlan-interface20]ip address dhcp-alloc // 管理VLAN接口通過DHCP方式獲取IP地址
[H3C-Vlan-interface20]undo ip address dhcp-alloc // 取消
[H3C]display dhcp //顯示DHCP客戶信息
debugging dhcp-alloc //開啟DHCP調(diào)試功能
undo debugging dhcp-alloc
6、端口配置
[H3C]interface Ethernet0/3 //進(jìn)入端口
[H3C-Ethernet0/3]shutdown //關(guān)閉端口
[H3C-Ethernet0/3]speed 100 //速率可為10,100,1000和auto(缺省)
[H3C-Ethernet0/3]duplexfull //雙工,可為half,full和auto,光口和匯聚后不能配置
[H3C-Ethernet0/3]flow-control //開啟流控,默認(rèn)為關(guān)閉
[H3C-Ethernet0/3]broadcast-suppression 20 //設(shè)置抑制廣播百分比為20%,可取5,10,20,100,缺省為100,同時(shí)組播和未知單播也受此影響
[H3C-Ethernet0/3]loopback internal //內(nèi)環(huán)測(cè)試
[H3C-Ethernet0/3]port link-type trunk //設(shè)置鏈路的類型為trunk
[H3C-Ethernet0/3]port trunk pvid vlan 20 //設(shè)置20為該trunk的缺省VLAN,默認(rèn)為1(trunk線路兩端的PVID必須一致)
[H3C-Ethernet0/3]port access vlan 20 //將當(dāng)前access端口加入指定的VLAN
[H3C-Ethernet0/3]port trunk permit vlanall //允許**所有的VLAN通過當(dāng)前的trunk端口,可多次使用該命令
[H3C-Ethernet0/3]mdiauto //設(shè)置以太端口為自動(dòng)監(jiān)測(cè),normal為直通線,across為交叉線
[H3C]link-aggregation Ethernet 0/1 toEthernet 0/4 //將1-4口加入?yún)R聚組,1為主端口,兩端需要同時(shí)配置,設(shè)置了端口鏡像以及端口隔離的端口無法匯聚
[H3C]undo link-aggregation Ethernet 0/1 //刪除該匯聚組
[H3C]link-aggregation mode egress //配置端口匯聚模式為根據(jù)目的MAC地址進(jìn)行負(fù)荷分擔(dān),可選為 ingress,egress和both,缺省為both
[H3C]monitor-port Ethernet 0/2 //將該端口設(shè)置為鏡像端口,必須先設(shè)置鏡像端口,刪除時(shí)必須先刪除被鏡像端口,而且它們不能同在一個(gè)端口,該端口不能在匯聚組中,設(shè)置新鏡像端口時(shí),新取代舊,被鏡像不變
[H3C]mirroring-port Ethernet 0/3 toEthernet 0/4 both //將端口3和4設(shè)置為被鏡像端口,both為同時(shí)監(jiān)控接收和發(fā)送的報(bào)文,inbound表示僅監(jiān)控接收的報(bào)文,outbound表示僅監(jiān)控發(fā)送的報(bào)文
[H3C]display mirror
[H3C]display interface Ethernet 0/3
resetcounters //清除所有端口的統(tǒng)計(jì)信息
[H3C]display link-aggregation Ethernet0/3 //顯示端口匯聚信息
[H3C-Ethernet0/3]virtual-cable-test //診斷該端口的電路狀況
7、qos優(yōu)先級(jí)配置
QoS配置步驟:設(shè)置端口的優(yōu)先級(jí),設(shè)置交換機(jī)信任報(bào)文的優(yōu)先級(jí)方式,隊(duì)列調(diào)度,端口限速
[H3C-Ethernet0/3]priority 7 //設(shè)置端口優(yōu)先級(jí)為7,默認(rèn)為0
[H3C]priority-trustcos //設(shè)置交換機(jī)信任報(bào)文的優(yōu)先級(jí)方式為cos(802.1p優(yōu)先級(jí),缺省值),還可以設(shè)為dscp方式
[H3C]queue-scheduler hq-wrr 2 4 6 8 //設(shè)置隊(duì)列調(diào)度算法為HQ-WRR(默認(rèn)為WRR),權(quán)重為2,4,6,8
[H3C-Ethernet0/3]line-rate inbound 29 //將端口進(jìn)口速率限制為2Mbps,取1-28時(shí),速率為rate*8*1024/125,即64,128,192...1.792M;
29-127時(shí),速率為(rate-27)*1024,即2M,3M,4M...100M。
[H3C]displayqueue-scheduler //顯示隊(duì)列調(diào)度模式及參數(shù)
[H3C]displaypriority-trust //顯示優(yōu)先級(jí)信任模式
三、銳捷交換機(jī)基礎(chǔ)命令配置
連接上交換機(jī)后,肯定是需要進(jìn)行命令配置,我們來看下基礎(chǔ)命令配置。
1、準(zhǔn)備命令
Enable //進(jìn)入特權(quán)模式
#Exit //返回上一級(jí)操作模式
#End //返回到特權(quán)模式
#copy running-config startup-config //保存配置文件
#del flash:config.text //刪除配置文件(交換機(jī)及1700系列路由器)
#erase startup-config //刪除配置文件(2500系列路由器)
#del flash:vlan.dat //刪除Vlan配置信息(交換機(jī))
#Configure terminal //進(jìn)入全局配置模式
(config)# hostname switchA //配置設(shè)備名稱為switchA
(config)#banner motd //配置每日提示信息 為終止符
(config)#enable secret level 1 0 star //配置遠(yuǎn)程登陸密碼為star
(config)#enable secret level 15 0 star //配置特權(quán)密碼為star
Level 1為普通用戶級(jí)別,可選為1~15,15為最高權(quán)限級(jí)別;0表示密碼不加密
(config)#enable services web-server //開啟交換機(jī)WEB管理功能
Services 可選以下:web-server(WEB管理)、telnet-server(遠(yuǎn)程登陸)等
2、查看信息
#show running-config //查看當(dāng)前生效的配置信息
#show interface fastethernet 0/3 //查看F0/3端口信息
#show interface serial 1/2 //查看S1/2端口信息
#show interface //查看所有端口信息
#show ip interface brief //以簡(jiǎn)潔方式匯總查看所有端口信息
#show ip interface //查看所有端口信息
#show version //查看版本信息
#show mac-address-table //查看交換機(jī)當(dāng)前MAC地址表信息
#show running-config //查看當(dāng)前生效的配置信息
#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 //查看該端口的生成樹狀態(tài)
#show port-security //查看交換機(jī)的端口安全配置信息
#show port-security address //查看地址安全綁定配置信息
#show ip access-lists listname //查看名為listname的列表的配置信息
3、端口的基本配置
(config)#Interface fastethernet 0/3 //進(jìn)入F0/3的端口配置模式
(config)#interface range fa 0/1-2,0/5,0/7-9 //進(jìn)入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(自適應(yīng))
(config-if)#no shutdown //開啟該端口
(config-if)#switchport access vlan 10 //將該端口劃入VLAN10中,用于VLAN
(config-if)#switchport mode trunk //將該端口設(shè)為trunk模式,可選模式為access , trunk
(config-if)#port-group 1 //將該端口劃入聚合端口AG1中,用于聚合端口
4、聚合端口的創(chuàng)建
(config)# interface aggregateport 1 //創(chuàng)建聚合接口AG1
(config-if)# switchport mode trunk //配置并保證AG1為 trunk 模式
(config)#int f0/23-24
(config-if-range)#port-group 1 //將端口(端口組)劃入聚合端口AG1中
5、生成樹
配置多生成樹協(xié)議:
switch(config)#spanning-tree //開啟生成樹協(xié)議
switch(config)#spanning-tree mst configuration //建立多生成樹協(xié)議
switch(config-mst)#name ruijie //命名為ruijie
switch(config-mst)#revision 1 //設(shè)定校訂本為1
switch(config-mst)#instance 0 vlan 10,20 //建立實(shí)例0
switch(config-mst)#instance 1 vlan 30,40 //建立實(shí)例1
switch(config)#spanning-tree mst 0 priority 4096 //設(shè)置優(yōu)先級(jí)為4096
switch(config)#spanning-tree mst 1 priority 8192 //設(shè)置優(yōu)先級(jí)為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地址(另一三層交換機(jī))
switch(config)#interface vlan 40
switch(config-if)#vrrp 2 ip 192.168.40.1 //此為vlan 40的IP地址(另一三層交換機(jī))
6、VLAN的基本配置
(config)#vlan 10 //創(chuàng)建VLAN10
(config-vlan)#name vlanname // 命名VLAN為vlanname
(config-if)#switchport access vlan 10 //將該端口劃入VLAN10中
某端口的接口配置模式下進(jìn)行
(config)#interface vlan 10 //進(jìn)入VLAN 10的虛擬端口配置模式
(config-if)# ip address 192.168.1.1 255.255.255.0 //為VLAN10的虛擬端口配置IP及掩碼,二層交換機(jī)只能配置一個(gè)IP,此IP是作為管理IP使用,例如,使用Telnet的方式登錄的IP地址
(config-if)# no shutdown //啟用該端口
7、端口安全
(config)# interface fastethernet 0/1 //進(jìn)入一個(gè)端口
(config-if)# switchport port-security //開啟該端口的安全功能
a、配置最大連接數(shù)限制
(config-if)# switchport port-secruity maxmum 1 //配置端口的最大連接數(shù)為1,最大連接數(shù)為128
(config-if)# switchport port-secruity violation shutdown
//配置安全違例的處理方式為shutdown,可選為protect (當(dāng)安全地址數(shù)滿后,將未知名地址丟棄)、restrict(當(dāng)違例時(shí),發(fā)送一個(gè)Trap通知)、shutdown(當(dāng)違例時(shí)將端口關(guān)閉,并發(fā)送Trap通知,可在全局模式下用errdisable recovery來恢復(fù))
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進(jìn)行綁定 (MAC地址注意用小寫)
8、三層路由功能(針對(duì)三層交換機(jī))
(config)# ip routing //開啟三層交換機(jī)的路由功能
(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 shutdown
9、三層交換機(jī)路由協(xié)議
(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1 //配置靜態(tài)路
注:172.16.1.0 255.255.255.0 //為目標(biāo)網(wǎng)絡(luò)的網(wǎng)絡(luò)號(hào)及子網(wǎng)掩碼
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協(xié)議進(jìn)程
(config-router)# network 172.16.1.0 //申明本設(shè)備的直連網(wǎng)段信息
(config-router)# version 2 //開啟RIP V2,可選為version 1(RIPV1)、version 2(RIPV2)
(config-router)# no auto-summary //關(guān)閉路由信息的自動(dòng)匯總功能(只有在RIPV2支持)
(config)# router ospf //開啟OSPF路由協(xié)議進(jìn)程(針對(duì)1762,無需使用進(jìn)程ID)
(config)# router ospf 1 //開啟OSPF路由協(xié)議進(jìn)程(針對(duì)2501,需要加OSPF進(jìn)程ID)
(config-router)# network 192.168.1.0 0.0.0.255 area 0
//申明直連網(wǎng)段信息,并分配區(qū)域號(hào)(area0為骨干區(qū)域)
可以明顯看出,三家命令大同小異,其實(shí)華為與H3C更加類似。
如何在Linux下安裝銳捷和VPN認(rèn)證 謝謝
假設(shè)你是使用Windows和Linux雙系統(tǒng)并在Win上已經(jīng)安裝了銳捷。
1、從 上下載最新的mentohust版本deb包,最新的版本少了許多麻煩,比如說抓包。我用的版本是0.3.4。
2、執(zhí)行以下命令,以下命令主要是為了應(yīng)付銳捷的客戶端版本驗(yàn)證。
cd '/media/WINXP/Program Files/銳捷網(wǎng)絡(luò)/Ruijie Supplicant' (單引號(hào)里面的是在win下面安裝銳捷的位置。)
sudo mkdir /etc/mentohust (這個(gè)目錄一定要?jiǎng)?chuàng)建成功。)
sudo cp W32N55.dll /etc/mentohust
sudo cp 8021x.exe /etc/mentohust
3、下面進(jìn)行第一次使用mentohust的配置過程:
sudo mentohust
歡迎使用MentoHUST 版本: 0.3.4
Copyright (C) 2009-2010 HustMoon Studio
人到華中大,有甜亦有辣。明德厚學(xué)地,求是創(chuàng)新家。
Bug report to
** 網(wǎng)卡[1]: eth0
** 網(wǎng)卡[2]: usbmon1
** 網(wǎng)卡[3]: usbmon2
** 網(wǎng)卡[4]: usbmon3
** 網(wǎng)卡[5]: usbmon4
** 網(wǎng)卡[6]: usbmon5
** 網(wǎng)卡[7]: usbmon6
** 網(wǎng)卡[8]: usbmon7
?? 請(qǐng)選擇網(wǎng)卡[1-10]: 1
** 您選擇了第[1]塊網(wǎng)卡。
?? 請(qǐng)輸入用戶名: ****
?? 請(qǐng)輸入密碼: *****
?? 請(qǐng)選擇組播地址(0標(biāo)準(zhǔn) 1銳捷私有 2賽爾): 1
?? 請(qǐng)選擇DHCP方式(0不使用 1二次認(rèn)證 2認(rèn)證后 3認(rèn)證前): 3
** 用戶名: ********
** 網(wǎng)卡: eth0
** 認(rèn)證超時(shí): 8秒
** 響應(yīng)間隔: 30秒
** 失敗等待: 15秒
** 允許失敗: 0次
** 組播地址: 銳捷
** DHCP方式: 認(rèn)證前
** 通知超時(shí): 5秒
** DHCP腳本: dhclient
(紅色為要求輸入部分,其實(shí)不多………………)
4、mentohust的主要參數(shù):
用法: mentohust [-選項(xiàng)][參數(shù)]
選項(xiàng): -h 顯示本幫助信息
-k 退出程序
-w 保存參數(shù)到配置文件
-u 用戶名
-p 密碼
例如:sudo mentohust -uhust -p123456 -w
本方法在Ubuntu 10.04 LTS Beta2,銳捷3.50下調(diào)試通過。
參考: ;t=258644
銳捷交換機(jī)如何配置
交換機(jī)基本操作
1.進(jìn)入特權(quán)模式
Switchenable
Switch#
2.返回用戶模式
Switch#exit
Press
RETURN
to
get
started!
Switch
配置模式:
全局配置模式[主機(jī)名(config)#]:配置交換機(jī)的整體參數(shù)
子模式:
1.線路配置模式[主機(jī)名(config-line)#]:配置交換機(jī)的線路參數(shù)
2.接口配置模式[主機(jī)名(config-if)#]:配置交換機(jī)的接口參數(shù)
1.進(jìn)入全局配置模式下
Switch#configure
terminal
Switch(config)#exit
Switch#
2.進(jìn)入線路配置模式
Switch(config)#line
console
Switch(config-line)#exit
Switch(config)#
3.進(jìn)入接口配置模式
Switch(config)#interface
fastEthernet
0/1
Switch(config-if)#exit
Switch(config)#
從子模式下直接返回特權(quán)模式
Switch(config-if)#end
Switch#
交換機(jī)操作幫助特點(diǎn):
1.支持命令簡(jiǎn)寫(按TAB鍵將命令補(bǔ)充完整)
2.在每種操作模式下直接輸入“?”顯示該模式下所有的命令
3.命令空格
“?”顯示命令參數(shù)并對(duì)其解釋說明
4.字符“?”顯示以該字符開頭的命令
5.命令歷史緩存:
(Ctrl+P)顯示上一條命令,(Ctrl+N)顯示下一條命令
6.錯(cuò)誤提示信息
交換機(jī)顯示命令:
顯示交換機(jī)硬件及軟件的信息
Switch#show
version
顯示當(dāng)前運(yùn)行的配置參數(shù)
Switch#show
running-config
顯示保存的配置參數(shù)
Switch#show
configure
常用交換機(jī)EXEC命令
將當(dāng)前運(yùn)行的配置參數(shù)復(fù)制到flash:Switch#write
memory
Building
configuration...
[OK]
Switch#
清空flash中的配置參數(shù):Switch#delete
flash:config.text
Switch#
交換機(jī)重新啟動(dòng):Switch#reload
System
configuration
has
been
modified.
Save?
[yes/no]:n
Proceed
with
reload?
[confirm]
配置交換機(jī)主機(jī)名:Switch(config)#hostname
S2126G
S2126G(config)#
配置交換機(jī)口令:
1、
配置交換機(jī)的登陸密碼
S2126G(config)#enable
secret
level
1
star
“0”表示輸入的是明文形式的口令
2、
配置交換機(jī)的特權(quán)密碼
S2126G(config)#enable
secret
level
15
Star
“0”表示輸入的是明文形式的口令
常用交換機(jī)配置命令:
1、為交換機(jī)分配管理IP地址
S2126G(config)#interface
vlan
1
S2126G(config-if)#ip
address
{IP
address}
{IP
subnetmask}[secondary]
2、將接口啟用
S2126G(config-if)#no
shutdown
3、將接口關(guān)閉
S2126G(config-if)#shutdown
4、配置接口速率
S2126G(config-if)#speed
[10|100|auto]
5、配置接口雙工模式
S2126G(config-if)#duplex
[auto|full|half
顯示接口狀態(tài):S2126G#show
interfaces
測(cè)定目的端的可達(dá)性:S2126Gping
{IP
address}
從TFTP服務(wù)器下載配置參數(shù):S2126G#copy
tftp
startup-config
管理交換機(jī)MAC地址表:
1、查看MAC地址表
S2126G#show
mac-address-table
2、配置MAC地址表記錄的生存時(shí)間(缺省為300秒)
S2126G(config)#mac-address-table
aging-time
10-1000000
3、查看MAC地址表記錄的生存時(shí)間
S2126G#show
mac-address-table
aging-time
VLAN的配置:
1.添加一個(gè)VLAN
S2126G(config)#vlan
1-4094
S2126G(config-vlan)#
2.為VLAN命名(可選)
S2126G(config-vlan)#name
將交換機(jī)端口分配到VLAN
1.配置Port
VLAN
Switch(config-if)#switchport
access
vlan
1-4094
2.配置Tag
VLAN
Switch(config-if)#switchport
mode
trunk
1).配置本地(native)VLAN
Switch(config-if)#switchport
trunk
native
vlan
1-4094
2).從主干鏈路中清除VLAN
Switch(config-if)#switchport
trunk
allowed
vlan
except
注:VLAN1不可被清除
VLAN的驗(yàn)證:
1.顯示全部的VLAN:Switch#show
vlan
2.顯示單獨(dú)的VLAN
:Switch#show
vlan
id
1-4094
將VLAN信息保存到flash中:Switch#write
memory
從flash中清除VLAN信息:Switch#delete
flash:vlan.dat
RSTP的配置:
1.啟用生成樹:S2126G(config)#spanning-tree
2.配置交換機(jī)優(yōu)先級(jí):S2126G(config)#spanning-tree
priority
0-61440
“0”或“4096”的倍數(shù)(RSTP
BPDU該值后12bit全0)
3.配置交換機(jī)端口優(yōu)先級(jí):S2126G(config-if)#spanning-tree
port-priority
0-240
“0”或“16”的倍數(shù)(RSTP
BPDU該值后4bit全0)
4、生成樹hello時(shí)間的配置(由Root決定):S2126G(config)#spanning-tree
hello-time
1-10
5、生成樹的驗(yàn)證:Switch#show
spanning-tree
Switch#show
spanning-tree
interface
接口名稱
接口編號(hào)
以上用于銳捷交換機(jī)的。交換機(jī)配置命令集Enable
進(jìn)入特權(quán)模式
#ExIT
返回上一級(jí)操作模式
#End
返回到特權(quán)模式
#write
memory
或copy
running-config
startup-config
保存配置文件
#del
flash:config.text
刪除配置文件(交換機(jī)及1700系列路由器)
#erase
startup-config
刪除配置文件(2500系列路由器)
#del
flash:vlan.dat
刪除Vlan配置信息(交換機(jī))
#Configure
terminal
進(jìn)入全局配置模式
(config)#
hostname
switchA
配置設(shè)備名稱為switchA
(config)#banner
motd
配置每日提示信息
為終止符
(config)#enable
secret
level
1
star
配置遠(yuǎn)程登陸密碼為star
(config)#enable
secret
level
15
star
配置特權(quán)密碼為star
Level
1為普通用戶級(jí)別,可選為1~15,15為最高權(quán)限級(jí)別;0表示密碼不加密
(config)#enable
services
web-server
開啟交換機(jī)WEB管理功能
Services
可選以下:web-server(WEB管理)、telnet-server(遠(yuǎn)程登陸)等查看信息
#show
running-config
查看當(dāng)前生效的配置信息
#show
interface
fastethernet
0/3
查看F0/3端口信息
#show
interface
serial
1/2
查看S1/2端口信息
#show
interface
查看所有端口信息
#show
ip
interface
brief
以簡(jiǎn)潔方式匯總查看所有端口信息
#show
ip
interface
查看所有端口信息
#show
version
查看版本信息
#show
mac-address-table
查看交換機(jī)當(dāng)前MAC地址表信息
#show
running-config
查看當(dāng)前生效的配置信息
#show
vlan
查看所有VLAN信息
#show
vlan
id
10
查看某一VLAN
(如VLAN10)的信息
#show
interface
fastethernet
0/1
switchport
查看某一端口模式(如F
0/1)
#show
aggregateport
1
summary
查看聚合端口AG1的信息
#show
spanning-tree
查看生成樹配置信息
#show
spanning-tree
interface
fastethernet
0/1
查看該端口的生成樹狀態(tài)
#show
port-security
查看交換機(jī)的端口安全配置信息
#show
port-security
address
查看地址安全綁定配置信息
#show
ip
access-lists
listname
查看名為listname的列表的配置信息
#show
access-lists端口的基本配置
(config)#Interface
fastethernet
0/3
進(jìn)入F0/3的端口配置模式
(config)#interface
range
fa
0/1-2,0/5,0/7-9
進(jìn)入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(自適應(yīng))
(config-if)#no
shutdown
開啟該端口
(config-if)#switchport
access
vlan
10
將該端口劃入VLAN10中,用于VLAN
(config-if)#switchport
mode
trunk
將該端口設(shè)為trunk模式,用于Tag
vlan
可選模式為access
,
trunk
(config-if)#port-group
1
將該端口劃入聚合端口AG1中,用于聚合端口聚合端口的創(chuàng)建
(config)#
interface
aggregateport
1
創(chuàng)建聚合接口AG1
(config-if)#
switchport
mode
trunk
配置并保證AG1為
trunk
模式
(config)#int
f0/23-24
(config-if-range)#port-group
1
將端口(端口組)劃入聚合端口AG1中生成樹
(config)#spanning-tree
開啟生成樹協(xié)議
(config)#spanning-tree
mode
stp
指定生成樹類型為stp
可選模式stp
,
rstp
,
mstp
(config)#spanning-tree
priority
4096
設(shè)置交換機(jī)的優(yōu)先級(jí)為4096
,
優(yōu)先級(jí)值小為高。優(yōu)先級(jí)可選值為0,4096,8192,……,為4096的倍數(shù)。交換機(jī)默認(rèn)值為32768VLAN的基本配置
(config)#vlan
10
創(chuàng)建VLAN10
(config-vlan)#name
vlanname
命名VLAN為vlanname
(config-if)#switchport
access
vlan
10
將該端口劃入VLAN10中
某端口的接口配置模式下進(jìn)行
(config)#interface
vlan
10
進(jìn)入VLAN
10的虛擬端口配置模式
(config-if)#
ip
address
192.168.1.1
255.255.255.0
為VLAN10的虛擬端口配置IP及掩碼,二層交換機(jī)只能配置一個(gè)IP,此IP是作為管理IP使用,例如,使用Telnet的方式登錄的IP地址
(config-if)#
no
shutdown
啟用該端口端口安全
(config)#
interface
fastethernet
0/1
進(jìn)入一個(gè)端口
(config-if)#
switchport
port-security
開啟該端口的安全功能
1.配置最大連接數(shù)限制
(config-if)#
switchport
port-secruity
maxmum
1
配置端口的最大連接數(shù)為1,最大連接數(shù)為128
(config-if)#
switchport
port-secruity
violation
shutdown
配置安全違例的處理方式為shutdown,可選為protect
(當(dāng)安全地址數(shù)滿后,將未知名地址丟棄)、restrict(當(dāng)違例時(shí),發(fā)送一個(gè)Trap通知)、shutdown(當(dāng)違例時(shí)將端口關(guān)閉,并發(fā)送Trap通知,可在全局模式下用errdisable
recovery來恢復(fù))
2.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進(jìn)行綁定(MAC地址注意用小寫)三層路由功能(針對(duì)三層交換機(jī))
(config)#
ip
routing
開啟三層交換機(jī)的路由功能
(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
shutdown
三層交換機(jī)路由協(xié)議
(config)#
ip
route
172.16.1.0
255.255.255.0
172.16.2.1
配置靜態(tài)路由
注:172.16.1.0
255.255.255.0
為目標(biāo)網(wǎng)絡(luò)的網(wǎng)絡(luò)號(hào)及子網(wǎng)掩碼
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協(xié)議進(jìn)程
(config-router)#
network
172.16.1.0
申明本設(shè)備的直連網(wǎng)段信息
(config-router)#
version
2
開啟RIP
V2,可選為version
1(RIPV1)、version
2(RIPV2)
(config-router)#
no
auto-summary
關(guān)閉路由信息的自動(dòng)匯總功能(只有在RIPV2支持)(config)#
router
ospf
開啟OSPF路由協(xié)議進(jìn)程(針對(duì)1762,無需使用進(jìn)程ID)
(config)#
router
ospf
1
開啟OSPF路由協(xié)議進(jìn)程(針對(duì)2501,需要加OSPF進(jìn)程ID)
(config-router)#
network
192.168.1.0
0.0.0.255
area
申明直連網(wǎng)段信息,并分配區(qū)域號(hào)(area0為骨干區(qū)域)IP
ACL:
交換機(jī)采用命名的訪問控制列表;分標(biāo)準(zhǔn)(stand)和擴(kuò)展(extended)兩種
1.標(biāo)準(zhǔn)ACL
(config)#ip
access-list
stand
listname
定義命名標(biāo)準(zhǔn)列表,命名為listname,stand為標(biāo)準(zhǔn)列表
(config-std-nacl)#deny
192.168.30.0
0.0.0.255
拒絕來自192.168.30.0網(wǎng)段的IP流量通過
注:deny:拒絕通過;可選:deny(拒絕通過)、permit(允許通過)
192.168.30.0
0.0.0.255:源地址及源地址通配符;可使用any表示任何IP
(config-std-nacl)#permit
any
(config-std-nacl)#end
返回
2.擴(kuò)展ACL
(config)#ip
access-list
extended
listname
定義命名擴(kuò)展列表,命名為listname,extended為擴(kuò)展
(config-ext-nacl)#deny
tcp
192.168.30.0
0.0.0.255
192.168.10.0
0.0.0.255
eq
www
拒絕源地址為192.168.30.0網(wǎng)段的IP訪問目的地址為192.168.10.0網(wǎng)段的WWW服務(wù)
注:deny:拒絕通過,可選:deny(拒絕通過)、permit(允許通過)
tcp:
協(xié)議名稱,協(xié)議可以是udp,
ip,eigrp,
gre,
icmp,
igmp,
igrp等等。
192.168.10.0
0.0.0.255:源地址及源地址通配符
192.168.30.0
0.0.0.255:目的地址及目的地址通配符
eq:操作符(lt-小于,eq-等于,gt-大于,neg-不等于,range-包含)
www:端口號(hào),可使用名稱或具體編號(hào)
可以使用的協(xié)議名稱(或編號(hào))和端口名稱(或編號(hào))請(qǐng)打?查詢。
(config-ext-nacl)#permit
ip
any
any
允許其它通過
(config-ext-nacl)#end
返回
(config)#interface
vlan
10
進(jìn)入端口配置模式
(config-if)#
ip
access-group
listname
in
訪問控制列表在端口下in方向應(yīng)用;可選:in(入棧)、out(出棧)
(config-if)#end
返回
注:配置ACL時(shí),若只想對(duì)其中部分IP進(jìn)行限制訪問時(shí),必須配置允許其流量通過,否則設(shè)備只會(huì)對(duì)限制IP進(jìn)行處理,不會(huì)對(duì)非限制IP進(jìn)行允許通過處理。
分享文章:linux銳捷配置命令,銳捷基本命令
文章分享:http://www.dlmjj.cn/article/heeses.html