Thứ Hai, 4 tháng 6, 2012

EtherChannel

Giới Thiệu Về EtherChannel :


Mục đích:
Đo các đường trunk giữa các Switch thường có băng thông không dủ lớn đo đó khôn đá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 :

- Cấu hình PAGP Ethechannel:
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 enale 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 đầ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.

- Cấu hình LACP:
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ế:
1. Giải thích sơ bộ về sơ đồ trên:

Ở sơ đồ này ta lấy lại sơ đồ bài QoS trước để thực hiện Etherchannel giữa Core va Access Switch. Ở đây thì ta sử dụng 4 port fastethernet 0/1 – 0/4 làm etherchannel, Ta sẽ cấu hình ehterchannel dùng cả PAGP, và LACP. Trước hết ta cấu hình PAGP.
2. Show run

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/7
no ip address
interface FastEthernet0/8
no ip address
!
interface FastEthernet0/9
no ip address
!
interface FastEthernet0/10
no ip address
!
interface FastEthernet0/11
no ip address
!
interface FastEthernet0/12
no ip address
!
interface FastEthernet0/13
no ip address
!
interface FastEthernet0/14
no ip address
!
interface FastEthernet0/15
no ip address
!
interface FastEthernet0/16
no ip address
!
interface FastEthernet0/17
no ip address
!
interface FastEthernet0/18
no ip address
!
interface FastEthernet0/19
no ip address
!
interface FastEthernet0/20
no ip address
!
interface FastEthernet0/21
no ip address
!
interface FastEthernet0/22
no ip address
!
interface FastEthernet0/23
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 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
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/10
switchport mode dynamic desirable
!
interface FastEthernet0/11
switchport mode dynamic desirable
!
interface FastEthernet0/12
switchport mode dynamic desirable
!
interface FastEthernet0/13
switchport mode dynamic desirable
!
interface FastEthernet0/14
switchport mode dynamic desirable
!
interface FastEthernet0/15
switchport mode dynamic desirable
!
interface FastEthernet0/16
switchport mode dynamic desirable
!
interface FastEthernet0/17
switchport mode dynamic desirable
!
interface FastEthernet0/18
switchport mode dynamic desirable
!
interface FastEthernet0/19
switchport mode dynamic desirable
!
interface FastEthernet0/20
switchport mode dynamic desirable
!
interface FastEthernet0/21
switchport mode dynamic desirable
!
interface FastEthernet0/22
switchport mode dynamic desirable
!
interface FastEthernet0/23
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.1 255.255.255.0
!
interface Vlan2
ip address 192.168.2.1 255.255.255.0
define interface-range cuong 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

R1# show run
Building configuration...
Current configuration:
!
version 12.1
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
enable password cisco
!
memory-size iomem 10
ip subnet-zero
no ip domain-lookup
!
interface Loopback1
ip address 11.1.1.1 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.1.1 255.255.255.0
half-duplex
!
interface Serial0/0
no ip address
encapsulation frame-relay
no fair-queue
clockrate 64000
!
interface Serial0/0.122 point-to-point
ip address 172.16.1.1 255.255.255.0
frame-relay interface-dlci 122
!
interface Serial0/1
no ip address
shutdown
!
router ospf 1
log-adjacency-changes
network 11.0.0.0 0.0.0.255 area 0
network 172.16.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
!
ip classless
ip http server
!
access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.3.0 0.0.0.255
!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
no login
!
end
R2#show run
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
enable password cisco
memory-size iomem 10
ip subnet-zero
no ip domain-lookup
!
-max-time 200
!
interface FastEthernet0/0
ip address 192.168.3.1 255.255.255.0
no ip directed-broadcast
speed 100
!
interface Serial0/0
no ip address
no ip directed-broadcast
encapsulation frame-relay
no ip mroute-cache
no fair-queue
clockrate 64000
cdp enable
frame-relay lmi-type cisco
!
interface Serial0/0.221 point-to-point
ip address 172.16.1.2 255.255.255.0
no ip directed-broadcast
frame-relay interface-dlci 221
!
interface Serial0/1
no ip address
no ip directed-broadcast
shutdown
!
router ospf 1
network 172.16.1.0 0.0.0.255 area 0
network 172.16.3.0 0.0.0.255 area 0
network 0.0.0.0 255.255.255.255 area 0
!
router rip
network 192.168.3.0
!
ip classless
ip http server
!
access-list 101 permit ip 172.16.2.0 0.0.0.255 192.168.1.0 0.0.0.255
!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
no login
!
no scheduler allocate
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. Kiểm tra bằng Ethereal:


- Khi 4 port đều up


- Khi ta shut dow một cổng của group đó là fa0/2 và fa0/3 ta có kết quả sau :
5. 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, Ở đây chỉ xét đến 2 Switch Core và Switch Access thôi
- Show run để kiểm tra cấu hình
Core#sho 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/7
no ip address
!
interface FastEthernet0/8
no ip address
!
interface FastEthernet0/9
no ip address
interface FastEthernet0/10
no ip address
!
interface FastEthernet0/11
no ip address
!
interface FastEthernet0/12
no ip address
!
interface FastEthernet0/13
no ip address
!
interface FastEthernet0/14
no ip address
!
interface FastEthernet0/15
no ip address
!
interface FastEthernet0/16
no ip address
!
interface FastEthernet0/17
no ip address
!
interface FastEthernet0/18
no ip address
!
interface FastEthernet0/19
no ip address
!
interface FastEthernet0/20
no ip address
!
interface FastEthernet0/21
no ip address
!
interface FastEthernet0/22
no ip address
!
interface FastEthernet0/23
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/7
switchport mode dynamic desirable
!
interface FastEthernet0/8
switchport mode dynamic desirable
!
interface FastEthernet0/9
switchport mode dynamic desirable
!
interface FastEthernet0/10
switchport mode dynamic desirable
!
interface FastEthernet0/11
switchport mode dynamic desirable
!
interface FastEthernet0/12
switchport mode dynamic desirable
!
interface FastEthernet0/13
switchport mode dynamic desirable
!
interface FastEthernet0/14
switchport mode dynamic desirable
!
interface FastEthernet0/15
switchport mode dynamic desirable
interface FastEthernet0/16
switchport mode dynamic desirable
!
interface FastEthernet0/17
switchport mode dynamic desirable
!
interface FastEthernet0/18
switchport mode dynamic desirable
!
interface FastEthernet0/19
switchport mode dynamic desirable
!
interface FastEthernet0/20
switchport mode dynamic desirable
!
interface FastEthernet0/21
switchport mode dynamic desirable
!
interface FastEthernet0/22
switchport mode dynamic desirable
!
interface FastEthernet0/23
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
6. Kiểm tra :

- Lệnh show lacp neighbor:
SW1#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
SW1#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
- Kiểm tra sys priority bằng lệnh
Sw2#show lacp sys-id
150 ,000d.299a.7e00

- Bằng Ethereal thì tương tự như trong trường hợp PAGP

Không có nhận xét nào:

Đăng nhận xét