美文网首页CCNA
CCNA-23、EthernetChannel

CCNA-23、EthernetChannel

作者: Tess鱼丸 | 来源:发表于2022-11-10 16:48 被阅读0次

    EC

    EthernetChannel - 以太网信道

    EC模型

    -将类似属性的链路逻辑聚合
    -负载均衡
    -视为一个逻辑端口冗余

    能做负载均衡也能做链路备份

    Dynamic Trunk Negotiation Protocols
    动态中继协商协议
    ·PAgP协议
    -Cisco proprietary #思科私有
    ·LACP
    -IEEE 802.3ad standard #信网大部分都是LACP

    模式

    -Etherchannel PAgP Mode:
    Mode                                                                      Description
    ·auto
      Places a port into a passive negotiating state, in which the port responds to PAgP packetsit receives but does not start PAgP packet negotiation.This setting minimizes the transmission of PAgP packets.
    ·desirable
      Places a port into an active negotiating state, in which the port starts negotiations with otherports by sending PAgP packets.
    ·on
      Forces a port to channel without PAgP(or the Link Aggregation Control Protocol [LACP]).In the on mode, a usable EtherChannel exists only when a port group in the on mode isconnected to another port group in the on mode.
    
    -Etherchannel LACP Mode:
    Mode                                                                       Description
    ·active     #自动
      Places a port into an active negotiating state in which the port starts negotiations with otherports by sending LACP packets.
    ·passive    #被动
      Places a port into a passive negotiating state in which the port responds to LACP packetsthat it receives,but does not start LACP packet negotiation.This setting minimizes thetransmission of LACP packets.
    ·on      #no模式两边都有配置no模式
      Forces a port to channel without PAgP or LACP.With the on mode, a usable EtherChannelexists only when a port group in the on mode is connected to another port group in the on mode.
    
    . Configure PAgP
    - interface port-channel {channel-group-number}
    - channel-protocol pagp
    - channel-group 1 mode {mode}
    
    . Verify
    - show interfaces fastethernet 0/1 etherchannel
    - show etherchannel 1 port-channel
    - show etherchannel 1 summary
    
    Configuring Layer 2 EtherChannel
    #配置二层EC 
    Switch (config)#interface range interface slot / port - port
    #Specifies the interfaces to configure in the bundle
    Switch (config-if-range) #channel-protocol {pagp | lacp}
    #Specifies the channel protocol-either PAgP or LACP
    Switch(config-if-range) #channel-group number mode {activel on | auto | desirable | passive}
    #Creates the port-channel interface and places the interfaces as members
    

    两台交换机的配置

    SW1与SW2配置一样
    SW2(config)#interface range gigabitEthernet 0/1-2
    SW2(config-if-range)#switchport trunk encapsulation dot1q 
    Switch(config-if-range)#switchport mode trunk 
    SW2(config)#interface range gigabitEthernet 0/1-2
    SW2(config-if-range)#channel-group 1 mode on 
    

    查看捆绑组是否生效

    SW2(config-if-range)#do sh etherc sum 
    Flags:  D - down        P - bundled in port-channel
            I - stand-alone s - suspended
            H - Hot-standby (LACP only)
            R - Layer3      S - Layer2
            U - in use      N - not in use, no aggregation
            f - failed to allocate aggregator
    
            M - not in use, minimum links not met
            m - not in use, port not aggregated due to minimum links not met
            u - unsuitable for bundling
            w - waiting to be aggregated
            d - default port
    
            A - formed by Auto LAG
    
    
    Number of channel-groups in use: 1
    Number of aggregators:           1
    
    Group  Port-channel  Protocol    Ports
    ------+-------------+-----------+-----------------------------------------------
    1      Po1(SU)          -        Gi0/1(P)    Gi0/2(P)  
    ###Group里有了Gi0/1;Gi0/2这个就代表捆绑成功了
    

    查看链路带宽是否翻倍

    SW2(config-if-range)#
    ======================================================================
    SW2#show interfaces port-channel 1
    Port-channel1 is up, line protocol is up (connected) 
      Hardware is EtherChannel, address is 50c7.e200.bf01 (bia 50c7.e200.bf01)
      MTU 1500 bytes, (((BW 2000000 Kbit/sec))), DLY 10 usec,    
                              #带宽变成了200兆      
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input 00:00:00, output never, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/2000/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue: 0/40 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 1000 bits/sec, 2 packets/sec
         126 packets input, 7332 bytes, 0 no buffer
         Received 0 broadcasts (0 multicasts)
         0 runts, 0 giants, 0 throttles 
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 input packets with dribble condition detected
         314 packets output, 22660 bytes, 0 underruns
         0 output errors, 0 collisions, 0 interface resets
         0 unknown protocol drops
         0 babbles, 0 late collision, 0 deferred
         0 lost carrier, 0 no carrier
         0 output buffer failures, 0 output buffers swapped out
    SW2#
    

    普通链路带宽是100M

    SW2#show interfaces gigabitEthernet 0/3
    GigabitEthernet0/3 is down, line protocol is down (notconnect) 
      Hardware is iGbE, address is 50c7.e200.bf03 (bia 50c7.e200.bf03)
      MTU 1500 bytes, (((BW 1000000 Kbit/sec))), DLY 10 usec, 
                         #未捆绑的普通链路带宽是100兆     
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      Auto Duplex, Auto Speed, link type is auto, media type is RJ45
      output flow-control is unsupported, input flow-control is unsupported
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input never, output never, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue: 0/0 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 0 bits/sec, 0 packets/sec
         0 packets input, 0 bytes, 0 no buffer
         Received 0 broadcasts (0 multicasts)
         0 runts, 0 giants, 0 throttles 
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 watchdog, 0 multicast, 0 pause input
         0 packets output, 0 bytes, 0 underruns
         0 output errors, 0 collisions, 2 interface resets
         0 unknown protocol drops
         0 babbles, 0 late collision, 0 deferred
         1 lost carrier, 0 no carrier, 0 pause output
         0 output buffer failures, 0 output buffers swapped out
    SW2#
    

    删除接口下的配置命令:

    SW2(config)#default interface gigabitEthernet 0/1

    default 接口

    配置EC时要先把接口shutdown,再配置,配置完后再no shutdown ,可以减少出bug的情况
    S = 二层以太网信道
    R = 三层以太网信道
    U = 在使用当中

    #先配置Trunk 
     switchport trunk encapsulation dot1q
     switchport mode trunk
    
    SW1(config)#interface range gigabitEthernet 0/1-2
    SW1(config-if-range)#channel-protocol lacp
    SW1(config-if-range)#channel-group 12 mode active 
    
    SW2(config)#interface range gigabitEthernet 0/1-2
    SW2(config-if-range)#channel-protocol lacp
    SW2(config-if-range)#channel-group 12 mode passive 
    
    SW2#show etherchannel summary 
    Flags:  D - down        P - bundled in port-channel
            I - stand-alone s - suspended
            H - Hot-standby (LACP only)
            R - Layer3      S - Layer2
            U - in use      N - not in use, no aggregation
            f - failed to allocate aggregator
    
            M - not in use, minimum links not met
            m - not in use, port not aggregated due to minimum links not met
            u - unsuitable for bundling
            w - waiting to be aggregated
            d - default port
    
            A - formed by Auto LAG
    
    
    Number of channel-groups in use: 2
    Number of aggregators:           2
    
    Group  Port-channel  Protocol    Ports
    ------+-------------+-----------+-----------------------------------------------
    1      Po1(SD)          -        
    12     Po12(SD)        LACP      Gi0/1(s)    Gi0/2(s) 
    #新建的捆绑组12已经生效了工作在(s)二层以太网信道模式
    

    ==================================================================================

    Configuring Layer 3 EtherChannel

    配置三层的以太网信道

    Switch (config)#interface port-channel port-channel-number
      ·Creates a port-channel interface
    Switch (config-if)#no switchport
    Switch (config-if)#ip address address mask
      ·Specifies L3 and assigns an lP address and subnet mask to the EtherChannel
    Switch (config)#interface interface slot/port
      ·Specifies an interface to configure
    Switch (config-if)#no switchport
    Switch (config-if)#channel-group number mode { auto | desirable | on }
      ·Configures the interface as L3 and specifies the port channeland the PAgP mode
    

    配置三层EC

    ###SW1
    SW1(config-if-range)#channel-protocol pagp 
    SW1(config-if-range)#channel-group 34 mode  desirable 
    Creating a port-channel interface Port-channel 34
    ###SW2
    SW2(config-if-range)#channel-protocol pagp 
    SW2(config-if-range)#channel-group 34 mode auto 
    Creating a port-channel interface Port-channel 34
    ===============================================
    ###配置ip是在port-channel里配置的
    ###SW1
    SW1(config)#interface port-channel 34
    SW1(config-if)#ip address 12.1.1.1 255.255.255.0
    SW1(config-if)#
    ###SW2
    SW2(config)#interface port-channel 34
    SW2(config-if)#ip address 12.1.1.2 255.255.255.0
    SW2(config-if)#
     
    ###配置双工速率
    ###一般是自动协商
    sw2(config-if)#duplex auto
    sw2(config-if)#speed auto
    ###也可以手动设置
    sw2(config-if)#duplex full
    sw2(config-if)#speed 100
    ###ip地址必须配置在三层以太网逻辑port-channel里。
    ###如果配置二层里面,他们里面的vlan必须要相同。
    
    SW1#show interfaces port-channel 34
    Port-channel34 is up, line protocol is up (connected) 
      Hardware is EtherChannel, address is 50c7.e200.8000 (bia 50c7.e200.8000)
      MTU 1500 bytes, (((BW 2000000 Kbit/sec))), DLY 10 usec, 
                              #带宽变成了200兆     
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input 00:00:02, output never, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue: 0/40 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 0 bits/sec, 0 packets/sec
         34 packets input, 7816 bytes, 0 no buffer
         Received 0 broadcasts (0 IP multicasts)
         0 runts, 0 giants, 0 throttles 
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 input packets with dribble condition detected
         29 packets output, 6794 bytes, 0 underruns
         0 output errors, 0 collisions, 0 interface resets
         0 unknown protocol drops
         0 babbles, 0 late collision, 0 deferred
         0 lost carrier, 0 no carrier
         0 output buffer failures, 0 output buffers swapped out
    SW1#
    

    以太网负载均衡

    9种负载均衡方式
    Command       Purpose
    Step 1        configure terminal                      Enter global configuration mode.
    Step 2        port-channel load-balance { dst-ip | dst-mac | src-dst-ip | src-dst-mac | src-ip | src-mac }        Configure an EtherChannel load-balancing method.
                              The default is src-mac.
                              Select one of these load-distribution methods:
    #目标ip
    dst-ip—Load distribution is based on the destination-host IP address.
    #目标mac
    dst-mac—Load distribution is based on the destination-hostMAC address of the incoming packet.
    #源和目标ip
    src-dst-ip—Load distribution is based on thesource-and-destination host-IP address.
    #源和目标mac
    src-dst-mac—Load distribution is based on thesource-and-destination host-MAC address.
    #源ip
    src-ip—Load distribution is based on the source-host IPaddress.
    #源mac
    src-mac—Load distribution is based on the source-MAC address of the incoming packet.
    Step 3    end      Retun to privileged EXEC mode.
    Step 4    show etherchannel load-balance        Verify your entries.
    Step 5    copy running-config startup-config    (Optional) Save your entries in the configuration file.
    #还有一些高级的交换机还可以基于:源端口;目标端口;源和目标端口
    

    去取数据包中的最后一个ip地址,就有两种排序,
    -最后一个ip地址如果是0,他就走第一条链路,如果是1他就走第二条链路。
    如果是4条链路,它取最后两位ip,就有四种排序
    如果是8条链路,他就取最后三位ip

    如果是基于源跟目的ip,他要取两位嘛,他就取源ip取1位,把目标ip取1位,进行异或运行 0 0=0 ;0 1 =1

    负载均衡的配置命令

    SW1(config)#port-channel load-balance ?
      dst-ip       Dst IP Addr
      dst-mac      Dst Mac Addr
      src-dst-ip   Src XOR Dst IP Addr
      src-dst-mac  Src XOR Dst Mac Addr
      src-ip       Src IP Addr
      src-mac      Src Mac Addr
    
    SW1(config)#port-channel load-balance 
    ####一般来说捆绑8条没啥问题,具体还待看ios
    

    相关文章

      网友评论

        本文标题:CCNA-23、EthernetChannel

        本文链接:https://www.haomeiwen.com/subject/nhbztdtx.html