1、主动发送PAGP协商消息,主动要求对方工作在EtherChannel下,属于主动模式。如果两边交换机都是Desirable模式,则可以协商成功,如果两边都是Auto模式,则不能工作在EtherChannel。当将接口使用LACP作为协商协议时,有以下两种模式可供选择:Passive 只接收LACP协商消息,并做出回应同意工作在EtherChannel下,并不主动发出LACP协商,属于被动状态。Active 主动发送LACP协商消息,主动要求对方工作在EtherChannel下,属于主动模式。如果两边交换机都是Active模式,则可以协商成功,如果两边都是Passive模式,则不能工作在Ethe
2、rChannel。在配置EtherChannel时,除了在接口上配置以上两种协议来自动协商外,还可以强制让接口工作在EtherChannel而不需要协商,配置为ON模式即可,如果配置ON,则两边都必须配置为ON,否则不能转发数据。下表为配置EtherChannel的模式总结:模式协议描述 ON 无 手工静态强制接口工作在EtherChanne下。PAGP 只接收PAgP协商消息,并做出回应同意工作在EtherChanne下,并不主动发出PAgP协商。主动发送PAGP协商消息,主动要求对方工作在EtherChanne下。LACP 只接收LACP协商消息,并做出回应同意工作在EtherChanne
3、下,并不主动发出LACP协商。主动发送LACP协商消息,主动要求对方工作在EtherChanne下。当配置PAGP时,可以使用关键字non-silent,如果不指定non-silent,默认为silent。Silent表示即使不能从对端设备收到PAGP协商数据,也使物理接口工作在EtherChannel组中,思科建议接口连接服务器或分析仪时使用。 non-silent表示只有在和对方协商成功之后,才使物理接口工作在EtherChannel组中。也就是说只有双方都支持PAGP的情况下,才使物理接口工作在EtherChannel组中。因为三层交换机的接口即可以工作在二层模式,也可以工作在三层模式,
4、所以EtherChannel捆绑后的逻辑接口也有二层和三层之分。当将接口EtherChannel捆绑后,会自动生成逻辑接口,称为port-channel接口,port-channel接口与EtherChannel组的号码相同,但范围是1-48。当使用二层接口时,在物理接口下配置参数后,port-channel接口将读取物理接口下的参数,但必须组成的所有接口都做相同的配置;在port-channel接口下做的配置也会自动在物理接口下生效。当使用三层接口时,必须先将物理接口变成三层接口后,再做捆绑,因为port-channel接口是不能在二层与三层之间转换的,配置三层接口,应该到port-chan
5、nel接口下做的配置,而不应该直接配置物理接口。如果是使用2层EtherChannel,那么组中第一个正常工作的口接口的MAC地址就是port-channel接口接口的MAC地址。注:在配置EtherChannel组时,需要定义组号码,但不要配置超过48个组。两边交换机的EtherChannel组号码可以采用不同号码。PAGP组中不能配超过8个接口。LACP中不能超过16个接口,但只有8个活动接口。两个协议可以配置在同台交换机上,但不能配置在同一个组中。组中的接口不能是安全接口以及802.1x端口。将接口配置为2层时,全部必须在相同VLAN,如果是trunk,native vlan必须相同。配
6、好EtherChannel组后后,在port-channel下配的参数会对所有物理接口生效,但对单个物理接口配置的只对单物理接口生效。多个接口捆绑成单条EtherChannel后,在STP中,被当作单条链路来计算,同时Path Cost值会和原物理链路有所不同。EtherChannel Load Balancing 当将多个接口捆绑成EtherChannel组之后,流量将同时从多个接口上被发出去,称为Load Balancing,即负载均衡,对于流量以什么样的负载均衡方式从EtherChannel组中的多个接口上发出去,可以有以下几种方式:Souce-MAC 基于源MAC,默认为此模式,不同源
7、主机,流量可能从不同的接口被发出去,但相同源主机肯定走相同接口。Source-and-Destination MAC 同时基于源和目标MAC,流量从主机A到主机B,从主机A到主机C以及从主机C到主机B都可能走不同的接口。Source-IP 基于源IP,不同源IP的流量可能走不同接口,相同IP则走相同接口。Destination-IP 基于目的IP,到不同目标IP的流量,会走不同接口,不同主机发往相同IP的流量会走相同接口。Source-and-Destination IP 同时基于源和目标IP,流量从主机A到主机B,从主机A到主机C以及从主机C到主机B都可能走不同的接口。并不是所有型号的交换机
8、所有IOS都支持所有负载方式,需要视IOS版本而定。在交换机之间通过EtherChannel捆绑了多条链路后,默认执行基于源MAC的负载均衡,而每条链路的流量比例却是固定的,也就是说,你只能改变EtherChannel负载均衡方式,但却改不了每条物理链路上的流量比例,接口上的流量比例,执行以下标准:配置 1.配置2层EtherChannel (1)配置SW1 sw1(config)#int range f0/23 - 24 sw1(config-if-range)#channel-group 12 mode desirable 说明:在接口F0/23-24下选用PAGP配置EtherChann
9、el (2)配置SW2 sw2(config)#int range f0/23-24 sw2(config-if-range)#channel-group 12 mode desirable (3)查看EtherChannel sw1#show etherchannel summary Flags: D - down P - in port-channel I - stand-alone s - suspended H - Hot-standby (LACP only) R - Layer3 S - Layer2 U - in use f - failed to allocate aggreg
10、ator u - unsuitable for bundling w - waiting to be aggregated d - default port Number of channel-groups in use: 1 Number of aggregators:Group Port-channel Protocol Ports -+-+-+-12 Po12(SU) PAgP Fa0/23(P) Fa0/24(P) 可以看到,已捆绑的接口为2层接口,并且所有物理接口都工作在EtherChannel下。(4)在port-channel接口下配置接口 sw1(config)#int por
11、t-channel 12 sw1(config-if)#switchport mode access sw1(config-if)#switchport access vlan 10 port-channel接口下将接口划入VLAN。(5)查看port-channel接口MAC地址 sw1#sh int f0/23 FastEthernet0/23 is up, line protocol is up (connected) Hardware is Fast Ethernet, address is 007d.618d.0317 (bia 007d.618d.0317) sw1#sh int
12、f0/24 FastEthernet0/24 is up, line protocol is up (connected) Hardware is Fast Ethernet, address is 007d.618d.0318 (bia 007d.618d.0318) sw1#sh int port-channel 12 Port-channel12 is up, line protocol is up (connected) Hardware is EtherChannel, address is 007d.618d.0318 (bia 007d.618d.0318) port-chann
13、el使用了接口F0/24下的MAC地址,说明接口F0/24先工作正常。2.配置3层EtherChannel sw1(config-if-range)#no switchport sw1(config-if-range)#channel-group 12 mode active sw1(config-if)#ip address 10.1.1.1 255.255.255.0 配置3层EtherChannel,需要先将物理接口变成3层接口后,才能正常配置,IP地址必须在port-channel下配置。sw2(config)#int range f0/23 - 24 sw2(config-if-ra
14、nge)#no switchport sw2(config-if-range)#channel-group 12 mo active sw2(config)#int port-channel 12 sw2(config-if)#ip address 10.1.1.2 255.255.255.0 sw1#sh eth summary 12 Po12(RU) LACP Fa0/23(P) Fa0/24(P) 可以看到,已捆绑的接口为3层接口,并且所有物理接口都工作在EtherChannel下。(4)测试port-channel连通性 sw1#ping 10.1.1.2 Type escape se
15、quence to abort. Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms port-channel正常工作在3层。3.配置Load Balancing (1)配置基于目标MAC的负载均衡 sw1(config)#port-channel load-balance dst-mac 开启了基于目标MAC的负载均衡,默认为基于源MAC,其它负载方式,可自行配置。(2)查看E
16、therChannel Load Balancing sw1#sh etherchannel load-balance EtherChannel Load-Balancing Configuration:dst-mac EtherChannel Load-Balancing Addresses Used Per-Protocol:Non-IP: Destination MAC address IPv4:可以看到,EtherChannel已经基于MAC的负载均衡。附:当配置PAGP时,可以选择配置non-silent,默认为silent,配置如下:sw1(config-if-range)#cha
17、nnel-group 12 mode desirable non-silent 2、Protected Port 在某些特殊需求下,需要禁止同台交换机上相同VLAN的主机之间通信,但又不能将这些不能通信的主机划到不同VLAN,因为还需要和VLAN中的其它主机通信,只是不能和部分主机通信。要限制交换机上相同VLAN的主机通信,通过将交换机上的接口配置成Protected Port来实现,如果交换机上某个VLAN有三个接口,其中有两个是Protected Port,有一个是正常端口,那么两个 Protected Port之间是不能通信的,但是Protected Port与正常端口之间的流量还是保持
18、正常,而不受任何限制。Protected Port可以拒绝unicast,broadcast以及multicast在这些端口之间通信,也就是说Protected Port与Protected Port之间没有任何流量发送。Protected Port只在单台交换机上有效,也就是说只有单台交换机上的Protected Port与Protected Port之间是不能通信的,但是不同交换机的Protected Port与Protected Port之间通信还是保持正常。配置Protected Port时,可以在物理接口和EtherChannel上配置,如果是配在EtherChannel上,那么配置
19、将对EtherChannel中的所有物理接口生效。以上图为例,配置protected port,SW1的F0/1,F0/2,F0/3以及SW2的F0/4都在VLAN 10中。1.配置交换机 sw1(config)#vlan 10 sw1(config-vlan)#exit sw1(config)#int range f0/1 - 3 sw1(config-if-range)#switchport mode access sw1(config-if-range)#switchport access vlan 10 sw1(config)#int f0/23 sw1(config-if)#swit
20、chport trunk encapsulation dot1q sw1(config-if)#switchport mode trunk sw2(config)#vlan 10 sw2(config-vlan)#exit sw2(config)#int f0/4 sw2(config-if)#switchport mode access sw2(config-if)#switchport access vlan 10 sw2(config)#int f0/23 sw2(config-if)#switchport trunk encapsulation dot1q sw2(config-if)
21、#switchport mode trunk 2.配置路由器 (1)配置R1 r1(config)#int f0/0 r1(config-if)#ip add 10.1.1.1 255.255.255.0 (2)配置R2 r2(config)#int f0/0 r2(config-if)#ip add 10.1.1.2 255.255.255.0 (3)配置R3 r3(config)#int f0/0 r3(config-if)#ip add 10.1.1.3 255.255.255.0 (4)配置R4 r4(config)#int f0/1 r4(config-if)#ip add 10.1
22、.1.4 255.255.255.0 3.测试正常情况下的通信 (1)测试R1到R2的连通性 r1#ping 10.1.1.2 因为没有配置protected port,所以R1到R2通信正常。(2)测试R1到R3的连通性 r1#ping 10.1.1.3 Sending 5, 100-byte ICMP Echos to 10.1.1.3, timeout is 2 seconds:因为没有配置protected port,所以R1到R3通信正常。(3)测试R1到R4的连通性 r1#ping 10.1.1.4 Sending 5, 100-byte ICMP Echos to 10.1.1.
23、4, timeout is 2 seconds:因为没有配置protected port,所以R1到R4通信正常。3.配置protected port (1)在SW1上将F0/1和F0/2配置为protected port sw1(config)#int f0/1 sw1(config-if)#switchport protected sw1(config)#int f0/2 (2) 在SW2上将F0/4 配置为protected port sw2(config-if)#switchport protected 4.测试配置了protected port的网络通信 (1)测试R1到同台交换机的正常端口F0/3的连通性 Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms 因为protected port与正常端口之间的通信不受影响,所以R1到R3通信正常。(2)测试R1到同台交换机的protected port F0/2的连通性 Type escape sequence to a
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1