思科实验 动态链路聚合

动态链路聚合
动态链路聚合实验预览

Tips: 动态链路聚合和静态链路聚合 的区别就是两侧的交换机需要配置动态链路聚合协议

动态链路协议为lacp

active 模式

passive模式

相比静态路由就多上面两种模式的配置,实验开始

第一步 配置主机 IP

配置主机IP 左上 192.168.1.1 左下 192.168.1.2 右上192.168.1.3 右下192.168.1.4

【注意】本实验不需要配置网关

第二步 用交叉线 分别连接两台交换机的 22 23 24端口

开始配置 进入左侧交换机 1
Switch>en
Switch#conf                       // 进入特权模式
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2             //创建vlan2
Switch(config-vlan)#e         //退出操作
Switch(config)#vlan 3             //创建vlan3
Switch(config-vlan)#e         //退出操作
Switch(config)#interface f0/1     //进入端口1 配置vlan2
Switch(config-if)#sw mo ac        //模式为active
Switch(config-if)#sw ac vlan 2    //配置vlan2
Switch(config-if)#e           //退出操作
Switch(config)#interface f0/2     //进入端口2 配置vlan3
Switch(config-if)#sw mo ac        //模式为active
Switch(config-if)#sw ac vlan 3    //配置vlan3
Switch(config-if)#e           //退出操作
Switch(config)#interface range f0/22-24                //进入群端口 22-24
Switch(config-if-range)#channel-protocol lacp          //设置动态路由协议为lacp
Switch(config-if-range)#channel-group 1 mode active    //链路1模式设置成active
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up

Switch(config-if-range)#exit           //退出操作
Switch(config)#interface port-channel 1            //进入链路 1
Switch(config-if)#sw mo trunk                      //设置模式为trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#sw trunk all vlan 2,3           //以trunk模式绑定所有vlan
Switch(config-if)#end           //退出操作
Switch#
%SYS-5-CONFIG_I: Configured from console by console

配置完毕 查询参数是否正确
Switch#show running-config 
Building configuration...
interface FastEthernet0/1
 switchport access vlan 2      //参数1
 switchport mode access        //参数2
!
interface FastEthernet0/2
 switchport access vlan 3      //参数1
 switchport mode access        //参数2
!
interface FastEthernet0/22
 channel-protocol lacp         //参数3
 channel-group 1 mode active   //参数4
 switchport mode trunk         //参数5
!
interface FastEthernet0/23
 channel-protocol lacp         //参数3
 channel-group 1 mode active   //参数4
 switchport mode trunk         //参数5
!
interface FastEthernet0/24
 channel-protocol lacp         //参数3
 channel-group 1 mode active   //参数4
 switchport mode trunk         //参数5
!
interface Port-channel 1
 switchport trunk allowed vlan 2-3       //参数6
 switchport mode trunk                   //参数7
!
interface Vlan1
 no ip address
 shutdown
 --More-- 

左侧交换机配置完成 , 接下来配置右侧交换机

开始配置 进入右侧交换机 2
Switch>en
Switch#conf                       // 进入特权模式
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2             //创建vlan2
Switch(config-vlan)#e         //退出操作
Switch(config)#vlan 3             //创建vlan3
Switch(config-vlan)#e         //退出操作
Switch(config)#interface f0/1     //进入端口1 配置vlan2
Switch(config-if)#sw mo ac        //模式为active
Switch(config-if)#sw ac vlan 2    //配置vlan2
Switch(config-if)#e           //退出操作
Switch(config)#interface f0/2     //进入端口2 配置vlan3
Switch(config-if)#sw mo ac        //模式为active
Switch(config-if)#sw ac vlan 3    //配置vlan3
Switch(config-if)#e           //退出操作
Switch(config)#interface range f0/22-24                //进入群端口 22-24
Switch(config-if-range)#channel-protocol lacp          //设置动态路由协议为lacp
Switch(config-if-range)#channel-group 1 mode passive    //链路1模式设置成passive
Switch(config-if-range)#
Creating a port-channel interface Port-channel 1

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up

Switch(config-if-range)#exit           //退出操作
Switch(config)#interface port-channel 1            //进入链路 1
Switch(config-if)#sw mo trunk                      //设置模式为trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Switch(config-if)#sw trunk all vlan 2,3           //以trunk模式绑定所有vlan
Switch(config-if)#end           //退出操作
Switch#
%SYS-5-CONFIG_I: Configured from console by console

配置完毕 查询参数是否正确
Switch#show running-config 
Building configuration...
interface FastEthernet0/1
 switchport access vlan 2      //参数1
 switchport mode access        //参数2
!
interface FastEthernet0/2
 switchport access vlan 3      //参数1
 switchport mode access        //参数2
!
interface FastEthernet0/22
 channel-protocol lacp         //参数3
 channel-group 1 mode passive   //参数4
 switchport mode trunk         //参数5
!
interface FastEthernet0/23
 channel-protocol lacp         //参数3
 channel-group 1 mode passive   //参数4
 switchport mode trunk         //参数5
!
interface FastEthernet0/24
 channel-protocol lacp         //参数3
 channel-group 1 mode passive   //参数4
 switchport mode trunk         //参数5
!
interface Port-channel 1
 switchport trunk allowed vlan 2-3       //参数6
 switchport mode trunk                   //参数7
!
interface Vlan1
 no ip address
 shutdown
 --More-- 

ok , 到现在所有配置已经完成,接下来我们验证一下。

pc0 ping同一vlan 2 的1.3pc成功

pc1 ping同一vlan 3的1.4pc成功

ok,验证成功,实验结束感谢你的阅读!

点击数:390

默认图片
JiHua article
文章: 17

留下评论