分享

EtherChannel负载均衡

 luobo2012 2012-07-26
配置二、三层交换机EtherChannel及负载均衡
配置二、三层交换机EtherChannel及负载均衡
2011-02-22 14:45

目的:若欲在三层设备(如三层交换机)之间实现高速连接,可以采用三层EtherChannel方式,从而避免由路由连接而产生的瓶颈。

1.创建Port-Channel逻辑接口
当将IP地址从物理接口移动至EtherChannel时,必须先从物理接口中删除该IP地址。

第一步:进入全局配置模式。
Switch# configure terminal

第二步:创建Port-Channel接口。port_channel_number取值范围为1~48。
Switch(config)# interface port-channel port_channel_number

第三步:将接口置于三层模式。
Switch(config-if)# no switchport

第四步:为该EtherChannel指定IP地址和子网掩码。
Switch(config-if)# ip address ip_address mask

第五步:退出配置模式。
Switch(config-if)# end

第六步:校验配置。
Switch# show running-config interface port-channel port_channel_number

2.配置为三层EtherChannel

第一步:进入全局配置模式。
Switch# configure terminal

第二步:选择欲配置的物理接口。
Switch(config)# interface {fastethernet | gigabitethernet} slot/port

第三步:创建三层路由端口。
Switch(config-if)# no switchport

第四步:确保该物理接口没有指定IP地址。
Switch(config-if)# no ip address

第五步:将接口配置至port-channel,并指定PAgP或LACP模式。
Switch(config-if)# channel-group channel-group-number mode {auto [non-silent] | desirable [non-silent] | on} | {active | passive}

第六步:退出配置模式。
Switch(config-if)# end

第七步:校验配置。
Switch# show running-config

3.实现负载均衡

第一步:进入全局配置模式。
Switch# configure terminal

第二步:配置Etherchannel负载均衡。
Switch(config)# port-channel load-balance {src-mac | dst-mac | src-dst-mac | src-ip | dst-ip | src-dst-ip | src-port | dst-port | src-dst-port}

其中,src-mac指源MAC地址;dst-mac指目的MAC地址;src-dst-mac指源和目的IP地址;src-ip指源IP地址;dst-ip指目的IP地址;src-dst-ip指源和目的IP地址;src-port指源第四层端口;dst-port指目的第四层端口;src-dst-port指源和目的第四层端口。

第三步:退出配置模式。
Switch(config-if)# end

第四步:校验配置。
Switch# show etherchannel load-balance

 
 
二层交换机ETHER CHANNEL配置


步骤:
1、创建以太通道

SW1(config)#int port-channel 1

2、在接口下把接口指定到已创建的通道中


SW1(config)#int f0/13
SW1(config-if)#channel-group 1 mode on
SW1(config-if)#int f0/14
SW1(config-if)#channel-group 1 mode on
SW1(config-if)#exit


S3、在以太通道接口下指定双工模式、速率和 TRUNK


SW1(config)#int port-channel 1

SW1(config-if)#switchport mode trunk
SW1(config-if)#duplex full
SW1(config-if)#exit

4、配置负载平衡


SW1(config)#port-channel load-balance dst-mac


Warning: Delete and re-create existing port channels to apply new load balance method to them   //要重起接口

5、接口重启

SW1(config)#int port-channel 1
SW1(config-if)#sh
SW1(config-if)#no sh
SW1(config-if)#^Z (ctrl+z实现)
SW1#
*Mar 1 03:23:27.543: %EC-5-BUNDLE: Interface Fa0/13 joined port-channel Po1
*Mar 1 03:23:28.483: %EC-5-BUNDLE: Interface Fa0/14 joined port-channel Po1
*Mar 1 03:23:28.627: %DTP-5-TRUNKPORTON: Port Fa0/13-14 has become dot1q trunk
*Mar 1 03:23:28.631: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 03:23:29.383: %LINK-3-UPDOWN: Interface FastEthernet0/13, changed state to up
*Mar 1 03:23:29.391: %LINK-3-UPDOWN: Interface FastEthernet0/14, changed state to up
SW1#
*Mar 1 03:23:29.623: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
*Mar 1 03:23:30.383: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/13, changed state to up
*Mar 1 03:23:30.391: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/14, changed state to up

6、查看etherchannel


SW1#sh etherchannel summary
Flags: D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa0/13(P) Fa0/14(P)               //SU表示正常,SD表示要重起通道接口,但是要配置负载均衡才会这样表示

SW1#

-----------------------------------------------------------------------

同样配置交换机2
SW2(config)#int port-channel 1
SW2(config-if)#int f0/13
SW2(config-if)#channel-group 1 mode on
SW2(config-if)#int f0/14
SW2(config-if)#channel-group 1 mode on
SW2(config-if)#exit  
SW2(config)#int port-channel 1
SW2(config-if)#switchport mode trunk
SW2(config-if)#duplex full
SW2(config-if)#exit
SW2(config)#port-channel load-balance dst-mac
SW2#sh etherchannel summary
Flags: D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1     Po1(SD)     Fa0/13(D) Fa0/14(D)                             //表示要重起

SW2(config)#int port-channel 1
SW2(config-if)#sh
SW2(config-if)#no sh
SW2(config-if)#^Z
SW2#^Z
SW2#sh etherchannel summary
Flags: D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa0/13(P) Fa0/14(P)

SW2#

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多