一、拓撲結構圖
二、實驗步驟
另外一個交換機與該交換機配置相同,但是在鏈路聚合時成員端口所屬聚合組號和成員端口的模式不同。(改為如下)
Switch(config-if-range)#channel-group 2 mode passive
1、給主機設IP
在該二層交換機實驗中,主機的IP需要和交換機在同一個網段,且不能與其沖突。
2、給交換機設IP
Switch>enable Switch#config Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#interface vlan 1 Switch(config-if)#ip address 192.168.1.100 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit
3、設置鏈路聚合
Switch(config)#interface range fastEthernet 0/1-2 Switch(config-if-range)#switchport mode trunk Switch(config-if-range)#channel-protocol ? lacp Prepare interface for LACP protocol pagp Prepare interface for PAgP protocol Switch(config-if-range)#channel-protocol lacp
Switch(config-if-range)#channel-group 1 mode ? active Enable LACP unconditionally auto Enable PAgP only if a PAgP device is detected desirable Enable PAgP unconditionally on Enable Etherchannel only passive Enable LACP only if a LACP device is detected
Switch(config-if-range)#channel-group 1 mode active
以上的 fastEthernet 0/1-2中的1-2是兩個交換機相連的接口。
4、做負載均衡
Switch(config-if)#exit Switch(config)#port-channel load-balance src-ip
補充:
思科交換機的鏈路聚合根據使用的協議可以分為三種工作模式LACP模式、PAgP模式和On模式。
具體這三種工作模式下共有5種不同的端口模式active、passive、auto、desirable、on。
其中active和passive使用LACP協議進行工作,auto和desirable使用PAgP協議進行工作,on則是強制啟用鏈路聚合,相當於華三的手工聚合模式。