Giới thiệu về EtherChannel và cách cấu hình trên các thiết bị chuyển mạch (Switch)

Thảo luận trong 'Mua bán thiết bị, dịch vụ mạng' bắt đầu bởi huyvu1321, 13/4/21.

  1. huyvu1321

    huyvu1321 Member

    Giới thiệu về EtherChannel và cách cấu hình trên các thiết bị chuyển mạch (Switch)

    Tại sao phải EtherChannel?

    Do các đường trunk giữa các Switch thường có băng thông không đủ lớn đo đó không đáp ứng được nhu cầu ở bên trong mạng dể gây ra nghẽn do đó mà người ta sử dụng etherchannel để ghép nhiều đường trunk lại thành một đường để tăng dung lượng, thứ hai là đối với các server có nhu cầu truy nhập cao do đó cũng cần một lượng băng thông lớn để tránh nghẻn, để ta sử ta cũng sử dụng etherchannel

    Nguyên tắc phân phối tải qua Etherchannel

    Việc phân phối tải qua các đường của một bundle (etherchannel) được thực hiện theo thuật toán hashing: Thuật toán này có thể sử dụng: Địa chỉ IP nguồn, đích; Hoặc địa chỉ MAC nguồn, dích, hoặc có thể sử dụng TCP/UDP port.
    - Nếu chỉ sử dụng một địa chỉ hay một port thì việc truyền tải qua port này hay port khác được thực hiện dựa vào các bit cuối cùng, và phụ thuộc vào số port của etherchannel
    - Nếu sử dụng cả địch, và nguồn thì thuật toán này được thực hiện nhờ phép toán XOR các bit cuối của địa chỉ.

    Các lệnh cơ bản để cấu hình Ethechannel

    1. Cấu hình PAGP Etherchannel (dùng cho Switch Cisco):

    Switch(config-if)# channel-protocol pagp
    Switch(config-if)# channel-group number mode {on | auto | desirable }


    Các mode:

    + ON mode: ở mode này thì Switch tự động enable etherchannel tuy nhiên nó lại không gởi hay nhận bất kỳ gói PAGP nào, do đó mà phải cấu hình on mode ở hai dầu
    + Auto mode: Nó sẻ tự động enable ethechannel nếu nó nhận được PAGP packet.
    + Desirable: Nó sẻ tự động cố gắng yêu cầu đầu kia enable ethechannel.

    2. Cấu hình LACP Etherchannel (dùng cho tất cả Switch các hãng có hỗ trợ Etherchannel):
    Switch(config)# lacp system-priority priority
    Switch(config-if)# channel-protocol lacp
    Switch(config-if)# channel-group number mode {on | passive | active}
    Switch(config-if)# lacp port-priority priority


    Giải thích:
    + Lệnh đầu tiên để xác định system priority để xác định Switch nào làm Switch điều khiển Ethechannel, hoặc nếu Priority bằng nhau thì Switch nào có điạc chỉ mac nhỏ hơn sẽ được chọn
    + Ta còn xác định priority của port để xác định xem port nào là active và port nào ở trạng thái standby. Port có priority nhỏ sẽ active và, lớn sẽ ở trạng thái standby
    + Các mode trong lệnh channel-group On, Passive, active tuần tự tương tự như On, Auto , Desirable trong PAGP

    Cấu hình cho sơ đồ thực tế
    [​IMG]
    1. Giải thích sơ bộ về sơ đồ trên

    Ở sơ đồ này ta thực hiện Etherchannel giữa Core Switch C3650 va Access Switch C2960X. Ở đây thì ta sử dụng 4 port fastethernet 0/1 – 0/4 làm etherchannel. Ta sẽ cấu hình etherchannel dùng cả PAGP, và LACP.

    2. Cấu hình PAGP

    Show run để kiểm tra cấu hình

    Access# show run

    Building configuration...
    Current configuration : 2238 bytes
    version 12.1
    no service pad
    service timestamps debug uptime
    service timestamps log uptime
    no service password-encryption
    hostname Access
    enable password cisco
    ip subnet-zero
    no ip domain-lookup
    spanning-tree mode pvst
    spanning-tree extend system-id
    !
    interface FastEthernet0/1
    switchport trunk encapsulation isl
    switchport mode trunk
    no ip address
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/2
    switchport trunk encapsulation isl
    switchport mode trunk
    no ip address
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/3
    switchport trunk encapsulation isl
    switchport mode trunk
    no ip address
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/4
    switchport trunk encapsulation isl
    switchport mode trunk
    no ip address
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/5
    switchport access vlan 2
    switchport mode access
    no ip address
    !
    interface FastEthernet0/6
    no ip address
    !
    ............................................
    !
    interface FastEthernet0/24
    no ip address
    !
    interface GigabitEthernet0/1
    no ip address
    !
    interface GigabitEthernet0/2
    no ip address
    !
    interface Vlan1
    ip address 192.168.5.2 255.255.255.0
    define interface-range thegioimang.vn FastEthernet0/1 - 4
    !
    ip classless
    ip http server
    !
    line con 0
    logging synchronous
    line vty 0 4
    no login
    line vty 5 15
    login
    !
    end


    Core# show run

    Building configuration...

    Current configuration : 3016 bytes
    !
    version 12.1
    no service pad
    service timestamps debug uptime
    service timestamps log uptime
    no service password-encryption
    !
    hostname Core
    enable password cisco
    !
    ip subnet-zero
    ip routing
    !
    no ip domain-lookup
    !
    spanning-tree mode pvst
    spanning-tree extend system-id
    !
    interface Port-channel1
    switchport trunk encapsulation isl
    switchport mode dynamic desirable
    !
    interface FastEthernet0/1
    switchport trunk encapsulation isl
    switchport mode dynamic desirable
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/2
    switchport trunk encapsulation isl
    switchport mode dynamic desirable
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/3
    switchport trunk encapsulation isl
    switchport mode dynamic desirable
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/4
    switchport trunk encapsulation isl
    switchport mode dynamic desirable
    duplex full
    speed 100
    channel-group 1 mode desirable
    !
    interface FastEthernet0/5
    no switchport
    ip address 192.168.3.2 255.255.255.0
    duplex half
    speed 100
    !
    interface FastEthernet0/6
    switchport mode dynamic desirable
    !
    interface FastEthernet0/7
    switchport mode dynamic desirable
    !
    interface FastEthernet0/8
    switchport mode dynamic desirable
    interface FastEthernet0/9
    switchport mode access
    !
    .................................
    !
    interface FastEthernet0/24
    switchport mode dynamic desirable
    !
    interface GigabitEthernet0/1
    switchport mode dynamic desirable
    !
    interface GigabitEthernet0/2
    switchport mode dynamic desirable
    !
    interface Vlan1
    ip address 192.168.5.1 255.255.255.0
    !
    interface Vlan2
    ip address 192.168.2.1 255.255.255.0
    define interface-range thegioimang.vn FastEthernet0/1 - 4
    !
    router ospf 1
    log-adjacency-changes
    passive-interface Port-channel1
    network 192.168.2.0 0.0.0.255 area 0
    network 192.168.3.0 0.0.0.255 area 0
    !
    ip classless
    ip http server
    line con 0
    logging synchronous
    line vty 0 4
    password cisco
    no login
    line vty 5 15
    login
    !
    monitor session 1 source interface Po1
    monitor session 1 destination interface Fa0/10
    end


    3. Kiểm tra:

    - Show etherchannel port để xem trạng thái của tất cả các port trong group

    Core# show etherchannel port

    Channel-group listing:
    -----------------------
    Group: 1
    ----------
    Ports in the group:
    -------------------
    Port: Fa0/1
    ------------
    Port state = Up Mstr In-Bndl
    Channel group = 1 Mode = Desirable-Sl Gcchange = 0
    Port-channel = Po1 GC = 0x00010001 Pseudo port-channel = Po1
    Port index = 0 Load = 0x00 Protocol = PAgP
    Flags: S - Device is sending Slow hello. C - Device is in Consistent state.
    A - Device is in Auto mode. P - Device learns on physical port.
    d - PAgP is down.
    Timers: H - Hello timer is running. Q - Quit timer is running.
    S - Switching timer is running. I - Interface timer is running.
    Local information:
    Hello Partner PAgP Learning Group
    Port Flags State Timers Interval Count Priority Method Ifindex
    Fa0/1 SC U6/S7 H 30s 1 128 Any 29
    Partner's information:
    Partner Partner Partner Partner Group
    Port Name Device ID Port Age Flags Cap.
    Fa0/1 Access 000d.bc33.2b00 Fa0/1 0s SC 10001
    Age of the port in the current state: 00d:00h:06m:04s


    Port: Fa0/2
    ------------
    Port state = Up Mstr In-Bndl
    Channel group = 1 Mode = Desirable-Sl Gcchange = 0
    Port-channel = Po1 GC = 0x00010001 Pseudo port-channel = Po1
    Port index = 0 Load = 0x00 Protocol = PAgP
    Flags: S - Device is sending Slow hello. C - Device is in Consistent state.
    A - Device is in Auto mode. P - Device learns on physical port.
    d - PAgP is down.
    Timers: H - Hello timer is running. Q - Quit timer is running.
    S - Switching timer is running. I - Interface timer is running.
    Local information:
    Hello Partner PAgP Learning Group
    Port Flags State Timers Interval Count Priority Method Ifindex
    Fa0/2 SC U6/S7 H 30s 1 128 Any 29
    Partner's information:
    Partner Partner Partner Partner Group
    Port Name Device ID Port Age Flags Cap.
    Fa0/2 Access 000d.bc33.2b00 Fa0/2 2s SC 10001
    Age of the port in the current state: 00d:00h:32m:20s


    Port: Fa0/3
    ------------
    Port state = Up Mstr In-Bndl
    Channel group = 1 Mode = Desirable-Sl Gcchange = 0
    Port-channel = Po1 GC = 0x00010001 Pseudo port-channel = Po1
    Port index = 0 Load = 0x00 Protocol = PAgP
    Flags: S - Device is sending Slow hello. C - Device is in Consistent state.
    A - Device is in Auto mode. P - Device learns on physical port.
    d - PAgP is down.
    Timers: H - Hello timer is running. Q - Quit timer is running.
    S - Switching timer is running. I - Interface timer is running.
    Local information:
    Hello Partner PAgP Learning Group
    Port Flags State Timers Interval Count Priority Method Ifindex
    Fa0/3 SC U6/S7 H 30s 1 128 Any 29
    Partner's information:
    Partner Partner Partner Partner Group
    Port Name Device ID Port Age Flags Cap.
    Fa0/3 Access 000d.bc33.2b00 Fa0/3 14s SC 10001
    Age of the port in the current state: 00d:00h:04m:19s


    Channel group = 1 Mode = Desirable-Sl Gcchange = 0
    Port-channel = Po1 GC = 0x00010001 Pseudo port-channel = Po1
    Port index = 0 Load = 0x00 Protocol = PAgP
    Flags: S - Device is sending Slow hello. C - Device is in Consistent state.
    A - Device is in Auto mode. P - Device learns on physical port.
    d - PAgP is down.
    Timers: H - Hello timer is running. Q - Quit timer is running.
    S - Switching timer is running. I - Interface timer is running.
    Local information:
    Hello Partner PAgP Learning Group
    Port Flags State Timers Interval Count Priority Method Ifindex
    Fa0/4 SC U6/S7 H 30s 1 128 Any 29
    Partner's information:
    Partner Partner Partner Partner Group
    Port Name Device ID Port Age Flags Cap.
    Fa0/4 Access 000d.bc33.2b00 Fa0/4 14s SC 10001
    Age of the port in the current state: 00d:00h:48m:29s


    - Ta có thể sử dụng lênh show etherchannel summary để dể xem xét hơn.

    Core# 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 - unsuitable for bundling
    U - in use f - failed to allocate aggregator
    d - default port
    Number of channel-groups in use: 1
    Number of aggregators: 1
    Group Port-channel Protocol Ports
    ------+-------------+-----------+-----------------------------------------------
    1 Po1(SU) PAgP Fa0/1(P) Fa0/2(P) Fa0/3(P) Fa0/4(P)

    4. Cấu hình LACP

    Đối với cấu hình này thì ta cũng sử dụng 4 interface fa0/1- fa0/4 làm etherchannel.

    - Show run để kiểm tra cấu hình
    Core# show run

    Building configuration...
    Current configuration : 2142 bytes
    !
    version 12.1
    no service pad
    service timestamps debug uptime
    service timestamps log uptime
    no service password-encryption
    !
    hostname Core
    !
    enable password cisco
    !
    ip subnet-zero
    !
    lacp system-priority 100
    !
    interface Port-channel1
    no ip address
    !
    interface FastEthernet0/1
    switchport trunk encapsulation dot1q
    switchport mode trunk
    no ip address
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/2
    switchport trunk encapsulation dot1q
    switchport mode trunk
    no ip address
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/3
    switchport trunk encapsulation dot1q
    switchport mode trunk
    no ip address
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/4
    switchport trunk encapsulation dot1q
    switchport mode trunk
    no ip address
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/5
    switchport mode access
    no ip address
    spanning-tree portfast
    !
    interface FastEthernet0/6
    no ip address
    !
    ......................................
    !
    interface FastEthernet0/24
    no ip address
    !
    interface GigabitEthernet0/1
    no ip address
    !
    interface GigabitEthernet0/2
    no ip address
    !
    interface Vlan1
    ip address 192.168.5.1 255.255.255.0
    define interface-range cuong FastEthernet0/1 - 4
    !
    ip classless
    ip http server
    !
    line con 0
    line vty 0 4
    no login
    line vty 5 15
    login
    monitor session 1 source interface Po1
    monitor session 1 destination interface Fa0/5
    end


    Access# show run

    Building configuration...

    Current configuration : 2693 bytes
    !
    version 12.1
    no service pad
    service timestamps debug uptime
    service timestamps log uptime
    no service password-encryption
    !
    hostname Access
    !
    enable password cisco
    !
    ip subnet-zero
    !
    no ip domain-lookup
    !
    spanning-tree mode pvst
    spanning-tree extend system-id
    lacp system-priority 10
    !
    interface Port-channel1
    switchport trunk encapsulation dot1q
    switchport mode trunk
    !
    interface FastEthernet0/1
    switchport trunk encapsulation dot1q
    switchport mode trunk
    duplex full
    speed 100
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/2
    switchport trunk encapsulation dot1q
    switchport mode trunk
    duplex full
    speed 100
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/3
    switchport trunk encapsulation dot1q
    switchport mode trunk
    duplex full
    speed 100
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/4
    switchport trunk encapsulation dot1q
    switchport mode trunk
    duplex full
    speed 100
    channel-group 1 mode active
    channel-protocol lacp
    !
    interface FastEthernet0/5
    switchport mode access
    spanning-tree portfast
    !
    interface FastEthernet0/6
    switchport mode dynamic desirable
    !
    .......................................................
    !
    interface FastEthernet0/24
    switchport mode dynamic desirable
    !
    interface GigabitEthernet0/1
    switchport mode dynamic desirable
    !
    interface GigabitEthernet0/2
    switchport mode dynamic desirable
    !
    interface Vlan1
    ip address 192.168.5.2 255.255.255.0
    define interface-range cuong FastEthernet0/1 - 4
    !
    ip classless
    ip http server
    line con 0
    logging synchronous
    line vty 0 4
    no login
    line vty 5 15
    login
    !
    end


    5. Kiểm tra

    - Lệnh show lacp neighbor:

    Core# show lacp neighbor

    Flags: S - Device is sending Slow LACPDUs F - Device is sending Fast LACPDUs
    A - Device is in Active mode P - Device is in Passive mode
    Channel group 1 neighbors
    Partner's information:
    Partner Partner Partner
    Port System ID Port Number Age Flags
    Fa0/1 00010,000d.299a.7e00 0x0 29s SA
    LACP Partner Partner Partner
    Port Priority Oper Key Port State
    32768 0x1 0x3D
    Partner's information:
    Partner Partner Partner
    Port System ID Port Number Age Flags
    Fa0/2 00010,000d.299a.7e00 0x1 11s SA
    LACP Partner Partner Partner
    Port Priority Oper Key Port State
    32768 0x1 0x3D
    Partner's information:
    Partner Partner Partner
    Port System ID Port Number Age Flags
    Fa0/3 00010,000d.299a.7e00 0x2 27s SA
    LACP Partner Partner Partner
    Port Priority Oper Key Port State
    32768 0x1 0x3D
    Partner's information:
    Partner Partner Partner
    Port System ID Port Number Age Flags
    Fa0/4 00010,000d.299a.7e00 0x3 12s SA
    LACP Partner Partner Partner
    Port Priority Oper Key Port State
    32768 0x1 0x3D


    - Kiểm tra trạng thái các port bằng show lacp internal hoặc show etherchannel detail
    Access# show lacp internal
    Flags: S - Device is sending Slow LACPDUs F - Device is sending Fast LACPDUs
    A - Device is in Active mode P - Device is in Passive mode
    Channel group 1
    LACP port Admin Oper Port Port
    Port Flags State Priority Key Key Number State
    Fa0/1 SA bndl 32768 0x1 0x1 0x0 0x3D
    Fa0/2 SA bndl 32768 0x1 0x1 0x1 0x3D
    Fa0/3 SA bndl 32768 0x1 0x1 0x2 0x3D
    Fa0/4 SA bndl 32768 0x1 0x1 0x3 0x3D

    Chúc các bạn thành công!

    Chi tiết xem tại:
    Hướng dẫn cấu hình etherchannel giữa các Switch Cisco và các Switch None Cisco
     

trang này