三層交換機(jī)負(fù)載均衡的接口配置過(guò)程
三層交換機(jī)配置——配置一組二層端口
- configure terminal 進(jìn)入配置狀態(tài)
 - nterface range {port-range} 進(jìn)入組配置狀態(tài)
 
三層交換機(jī)配置——配置三層端口
- configure terminal 進(jìn)入配置狀態(tài)
 - interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} | {port-channel port-channel-number} 進(jìn)入端口配置狀態(tài)
 - no switchport 把物理端口變成三層口
 - ip address ip_address subnet_mask 配置IP地址和掩碼
 - no shutdown 激活端口
 
- Switch(config)# interface gigabitethernet0/2
 - Switch(config-if)# no switchport
 - Switch(config-if)# ip address 192.20.135.21 255.255.255.0
 - Switch(config-if)# no shutdown
 
三層交換機(jī)配置——配置VLAN
- configure terminal 進(jìn)入配置狀態(tài)
 - vlan vlan-id 輸入一個(gè)VLAN號(hào), 然后進(jìn)入vlan配態(tài),可以輸入一個(gè)新的VLAN號(hào)或舊的來(lái)進(jìn)行修改
 - name vlan-name 可選)輸入一個(gè)VLAN名,如果沒(méi)有配置VLAN名,缺省的名字是VLAN號(hào)前面用0填滿的4位數(shù),如VLAN0004是VLAN4的缺省名字
 - mtu mtu-size (可選) 改變MTU大小
 
例:
- Switch# configure terminal
 - Switch(config)# vlan 20
 - Switch(config-vlan)# name test20
 - Switch(config-vlan)# end
 - 或
 - Switch# vlan database
 - Switch(vlan)# vlan 20 name test20
 - Switch(vlan)# exit
 
三層交換機(jī)配置——端口分配給一個(gè)VLAN
- configure terminal 進(jìn)入配置狀態(tài)
 - interface interface-id 進(jìn)入要分配的端口
 - switchport mode access 定義二層口
 - switchport access vlan vlan-id 把端口分配給某一VLAN
 
例:
- Switch# configure terminal
 - Enter configuration commands, one per line. End with CNTL/Z.
 - Switch(config)# interface fastethernet0/1
 - Switch(config-if)# switchport mode access
 - Switch(config-if)# switchport access vlan 2
 - Switch(config-if)# end
 - Switch#
 - 配置VLAN trunk
 - configure terminal 進(jìn)入配置狀態(tài)
 - interface interface-Id 進(jìn)入端口配置狀態(tài)
 - switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封裝ISL 或 802.1Q 或
 
三層交換機(jī)配置——自動(dòng)協(xié)商
- switchport mode {dynamic {auto | desirable} | trunk} 配置二層trunk模式。
 - dynamic auto—自動(dòng)協(xié)商是否成為trunk
 - dynamic desirable—把端口設(shè)置為trunk如果對(duì)方端口是trunk, desirable, 配置Native VLAN
 - (802.1q)或自動(dòng)模式,trunk—設(shè)置端口為強(qiáng)制的trunk方式,而不理會(huì)對(duì)方端口是否為trunkswitchport access vlan vlan-id 可選)
 - 指定一個(gè)缺省VLAN, 如果此端口不再是trunkswitchport trunk native vlan vlan-id 指定802.1Q native VLAN號(hào)
 
- Switch# configure terminal
 - Enter configuration commands, one per line. End with CNTL/Z.
 - Switch(config)# interface fastethernet0/4
 - Switch(config-if)# switchport mode trunk
 - Switch(config-if)# switchport trunk encapsulation dot1q
 - Switch(config-if)# end
 
三層交換機(jī)配置——定義TRUNK允許的VLAN
- configure terminal子 進(jìn)入配置狀態(tài)
 - interface interface-id 進(jìn)入端口配置
 - switchport mode trunk 配置二層口為trunk
 - switchport trunk allowed vlan {add | all | except | remove} vlan-list可選) 配置trunk允許的VLAN.使用add, all, except, remove關(guān)健字
 - no switchport trunk allowed vlan 允許所有VLAN通過(guò)
 
例:
- Switch(config)# interface fastethernet0/1
 - Switch(config-if)# switchport trunk allowed vlan remove 2
 - Switch(config-if)# end
 
三層交換機(jī)配置——配置Native VLAN(802.1q)
- configure terminal 進(jìn)入配置狀態(tài)
 - interface interface-id 進(jìn)入配置成802.1qtrunk的端口
 - switchport trunk native vlan vlan-Id 配置native VLAN號(hào)
 - no switchport trunk native vlan 端口配置命令回到缺省的狀態(tài)
 
三層交換機(jī)配置——配置基于端口權(quán)值的負(fù)載均衡
- configure terminal 進(jìn)入Switch 1配置狀態(tài)
 - vtp domain domain-name 配置VTP域
 - vtp mode server 將Switch 1配置成VTP server.
 - show vtp status 驗(yàn)證VTP的配置
 - show vlan 驗(yàn)證VLAN
 - configure terminal 進(jìn)入配置狀態(tài)
 - interface fastethernet 0/1 進(jìn)入F0/1端口
 - switchport trunk encapsulation {isl | dot1q | negotiate}配置trunk封裝
 - switchport mode trunk 配置成trunk
 - show interfaces fastethernet0/1 switchport 驗(yàn)證VLAN配置
 
#p#
按以上步驟對(duì)想要負(fù)載均衡的接口進(jìn)行配置
在另一個(gè)交換機(jī)上進(jìn)行此配置
- show vlan 當(dāng)trunk已經(jīng)起來(lái),在switch2上驗(yàn)證已經(jīng)學(xué)到相的vlan配置
 - configure terminal 在Switch 1上進(jìn)入配置狀態(tài)
 - interface fastethernet0/1 進(jìn)入要配置的端口
 - spanning-tree vlan 8 port-priority 10 將端口權(quán)值10賦與VLAN 8.
 - spanning-tree vlan 9 port-priority 10 將端口權(quán)值10賦與VLAN 9.
 - spanning-tree vlan 10 port-priority 10 將端口權(quán)值10賦與VLAN 10.
 - interface fastethernet0/2 進(jìn)入F0/2
 - spanning-tree vlan 3 port-priority 10 將端口權(quán)值10賦與VLAN 3.
 - spanning-tree vlan 4 port-priority 10 將端口權(quán)值10賦與VLAN 4
 - spanning-tree vlan 5 port-priority 10 將端口權(quán)值10賦與VLAN 5
 - spanning-tree vlan 6 port-priority 10 將端口權(quán)值10賦與VLAN 10
 - end 退出
 - show running-config 驗(yàn)證配置
 - copy running-config startup-config 保存配置
 
配置STP路徑值的負(fù)載均衡
Trunk1走VLAN8-10,Trunk2走VLAN2-4
- configure terminal 進(jìn)入 Switch 1配置狀態(tài)
 - interface fastethernet 0/1 進(jìn)入F0/1
 - switchport trunk encapsulation {isl | dot1q | negotiate}配置封裝
 - switchport mode trunk 配置Trunk,缺省是ISL封裝
 - exit 退回
 
在F0/2口上重復(fù)2-4步驟
- exit 退回
 - show running-config 驗(yàn)證配置
 - show vlan驗(yàn)證switch1 已經(jīng)學(xué)到Vlan
 - configure terminal 進(jìn)入配置狀態(tài)
 - interface fastethernet 0/1 進(jìn)入F0/1
 - spanning-tree vlan 2 cost 30 設(shè)置Vlan2生成樹(shù)路徑值為30
 - spanning-tree vlan 3 cost 30 設(shè)置Vlan3生成樹(shù)路徑值為30
 - spanning-tree vlan 4 cost 30 設(shè)置Vlan4生成樹(shù)路徑值為30
 - end 退出
 
在switch1的F0/2上重復(fù)9-11步驟設(shè)置VLAN8,9,10生成樹(shù)路徑值為30
- end 退出
 - show running-config 驗(yàn)證配置
 - copy running-config startup-config 保存配置
 
負(fù)載均衡在三層交換機(jī)上的配置的全過(guò)程就為你介紹完了,按照以上的步驟,相信你一定可以成功完成整個(gè)配置步驟。
【編輯推薦】















 
 
 

 
 
 
 