Lab GNS3 Trunking – Etherchanel – Vlan

bởi | CCNP, GNS3

Home » CCNP » Lab GNS3 Trunking – Etherchanel – Vlan

Sơ đồ bài lab

Cấu hình cơ bản cho Switch

Xóa cấu hình của Switch

IOU1#erase startupconfig
IOU1#delete flash:vlan.dat
IOU1#reload

Cấu hình gắn IP quản lý vào interface vlan của Switch

IOU1(config)#interface vlan 1
IOU1(config-if)# ip address 10.0.0.1 255.255.255.0
IOU1(config-if)# no shutdown
IOU1(config-if)# exit
IOU2(config)#interface vlan 1
IOU2(config-if)# ip address 10.0.0.2 255.255.255.0
IOU2(config-if)# no shutdown
IOU2(config-if)# exit

IOU1#ping 10.0.0.2
!!!!

Cấu hình telnet tại IOU1 và IOU2

IOU1(config)#enable secret 123456
IOU1(config)#username thanhdd secret 123456
IOU1(config)#line vty 0 4
IOU1(config-line)#login local
IOU1(config-line)#exit
IOU2(config)#enable secret 123456
IOU2(config)#username thanhdd secret 123456
IOU2(config)#line vty 0 4
IOU2(config-line)#login local
IOU2(config-line)#exit

Kiểm tra và cấu hình bằng mac-address-table

IOU1#show mac address-table dynamic
Mac Address Table
-------------------------------------------

Vlan Mac Address Type Ports
---- ----------- -------- -----
1 aabb.cc00.0200 DYNAMIC Et0/0
1 aabb.cc00.0210 DYNAMIC Et0/1
1 aabb.cc80.0200 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 3
IOU2#show mac addr dynamic
Mac Address Table
-------------------------------------------

Vlan Mac Address Type Ports
---- ----------- -------- -----
1 aabb.cc00.0100 DYNAMIC Et0/0
1 aabb.cc00.0210 DYNAMIC Et0/0
1 aabb.cc80.0100 DYNAMIC Et0/0
Total Mac Addresses for this criterion: 3
IOU1-SW(config)#mac address-table static CAFE.CAFE.8000 vlan 1 interface ethernet 2/3
IOU1#clear mac address-table dynamic
IOU1#show mac address-table static
Mac Address Table
-------------------------------------------

Vlan Mac Address Type Ports
---- ----------- -------- -----
1 cafe.cafe.8000 STATIC Et2/3

Cấu hình port-security

+ chuyển port của switch thành dạng port access. Port access dùng kết nối xuống PC đầu cuối:
IOU1(config)# interface ethernet 0/2
IOU1(config-if)# shutdown
IOU1(config-if)# switchport mode access
+ chỉ được phép chứa đựng 1 mac address
IOU1(config-if)# switchport port-security maximum 1
+ chỉ cho phép mac address là CAFE.CAFE.9000
IOU1(config-if)# switchport port-security mac-address CAFE.CAFE.9000
+ Nếu như có mac address khác kết nối thì bị shutdown
IOU1(config-if)# switchport port-security violation shutdown
+ kích hoạt tính năng port security
IOU1(config-if)# switchport port-security
IOU1(config-if)# exit

– cấu hình port-sercurity với tính năng “Sticky” ( Sử dụng các mac đầu tiên làm mac
security ) Sử dụng tính năng “Errdisable” để phục hồi interface
//IOU1

conf t
interface range ethernet 0/2
switchport mode access
switchport port-security maximum 2
switchport port-security mac-address sticky
switchport port-security violation shutdown
switchport port-security
spanning-tree portfast => cho port chạy nhanh
exit
errdisable detect cause all => Phát hiện ra lỗi bởi tất cả nguyên nhân
errdisable recovery cause psecure-violation => phục hồi lỗi bởi nguyên nhân port security
errdisable recovery interval 30 => Phục hồi sau 30s

Cấu hình Etherchanel

– Etherchanel là công nghệ giúp nâng cao của băng thông đường link kết nối

– Etherchanel có 2 chuẩn
+ PAGP : chuẩn của Cisco
+ LACP : chuẩn standard heo 802.3ad

– Yêu cầu cấu hình etherchanel
+ Các port : cùng tốc độ kết nối
+ Các port cấu hình ở dạng full-duplex

– Cấu hình etherchannel bằng LACP
+ Sử dụng với dòng switch 2950 , 2960 , 3550, 3560 , 3750 …
IOU1(config)# interface range eth 0/0 – 1
=> Chọn cùng 1 lúc 2 interface eth0/0 và eth0/1 để thực hiện chung cấu hình
IOU1(config-range-if)#channel-protocol lacp
=> Sử dụng chung etherchannel có chuẩn là LACP
IOU1(config-range-if)#channel-group 1 mode active
=> Tạo ra interface luận lý là port-channel 1
=> Interface luận lý này chủ động tạo kết nối Etherchannel, Bật LACP vô điều kiện
IOU1(config-range-if)#exit
IOU2(config)#interface range fa 0/1 – 2
IOU2(config-range-if)#channel-protocol lacp
IOU2(config-range-if)#channel-group 1 mode active
=> tạo ra 1 interface luận lý là port-channel 1, Bật LACP vô điều kiện
IOU2(config-range-if)#exit

+ Đối với dòng switch 2900XL, 3500XL, va switch ảo GNS3
IOU1(config)#interface range eth 3/0 – 1
IOU1(config-range-if)#channel-group 1 mode on
=> Sử dụng chuẩn Etherchannel là PAGP của cisco
IOU1(config-range-if)#exit
IOU2(config)#interface range eth 3/0 – 1
IOU2(config-range-if)#channel-group 1 mode on
=> Sử dụng chuẩn Etherchannel là PAGP của Cisco
IOU2(config-range-if)#exit

– Kiểm tra trạng thái của Etherchannel

IOU1#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 f - failed to allocate aggregator

M - not in use, minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port

Number of channel-groups in use: 1
Number of aggregators: 1

Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) LACP Et0/0(P) Et0/1(P)
IOU1#show int port-channel 1
=> BW 20000 Kbit/sec
IOU2#show interface port-channel 1
=> BW 20000 Kbit/sec

Cấu hình Static Trunking

– Xóa cấu hình port etherchannel phía trên và set cấu hình các port về default

IOU1(config)#no int po1
IOU1(config)#default interface range ethernet 0/0-1
IOU2(config)#no int po1
IOU2(config)#default interface range ethernet 0/0-1

– Cú pháp cấu hình trunking
IOU1(config)#interface range eth 0/0 – 1
IOU1(config-if-range)#shutdown
=> Mặc định các switch mới sử dụng công nghệ dynamic trunking
=> Shutdown interface để không bị ảnh hưởng trong quá trình cấu hình
IOU1(config-if-range)#switchport trunk encapsulation dot1q | isl
=> Xác định dạng trunking là dot1q hoặc isld
=> Đối với các dòng Switch layer 2 : mặc định chỉ biết dot1q. Cho nên câu lệnh ở
trên nhập vào Fail. Đối với switch ảo GNS3 “Phải” xác định dạng trunking
IOU1(config-if-range)#switchport mode trunk
=> Chuyển port-channel 1 thành dạng port trunking
IOU1(config-if-range)#switchport nonegotiate
=> Tắt đi tính năng DTP, Disable Dynamic Trunking. Tính năng DTP mặc định được bật trên cisco, nên để tránh sw tự động thiết lập trunking ngoài ý muốn cần tắt chức năng này đi
IOU1(config-if-range)#switchport trunk allowed vlan 2
=> Mặc định đường trunking cho phép tất cả các vlan. Ta có thể sử dụng câu lệnh trên để filter lại Vlan có thể đi qua port
IOU1(config-if-range)#switchport trunk navive vlan VLAN_ID
=> Hiệu chỉnh chọn navive vlan trên 1 cổng. navive vlan khi đi vào đường trunk sẽ không bị tag thêm thông tin trunking. navive vlan được sử dụng để cho phép tương thích với các thiết bị cũ không có khả năng trunking
IOU1(config-if-range)#no shutdown
IOU1(config-if-range)#end

– Cấu hình port etherchannel trên các link kết nối giữa các SW
IOU1(config)#interface range eth 0/0 – 1
IOU1(config-if-range)#shutdown
IOU1(config-range-if)#channel-protocol lacp
IOU1(config-range-if)#channel-group 1 mode active
IOU1(config-if)#end
IOU2(config)#interface range eth 0/0 – 1
IOU2(config-if-range)#shutdown
IOU2(config-range-if)#channel-protocol lacp
IOU2(config-range-if)#channel-group 1 mode active
IOU2(config-if)#end

– Kiểm tra cấu hình port trunking

IOU1#show int trunk

Port Mode Encapsulation Status Native vlan
Po1 on 802.1q trunking 1
=> Liệt kê các interface trunking của Switch
IOU1#show interface port-channel 1 switchport
=> Kiểm tra các thông số của port-channel 1
IOU1-SW#show interfaces port-channel 1 switchport
Name: Po1 <--- Tên của interface
Switchport: Enabled <-- Thông báo đây là Layer 2 interface
Administrative Mode: trunk <-- Được cấu hình theo dạng trunking
Operational Mode: trunk <-- Đang hoạt hoạt động là trunking
Administrative Trunking Encapsulation: dot1q <-- Cấu hình trunking theo dạng là dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001 <-- Mặc định đường trunking cho phép tất cả ALL
IOU1#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/2, Et0/3, Et1/0, Et1/1
Et1/2, Et1/3, Et2/0, Et2/1
Et2/2, Et2/3, Et3/0, Et3/1
Et3/2, Et3/3
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
=> Interface trunking không thuộc VLAN

IOU1#show int eth0/0 trunk
IOU1#show int po1 trunk
IOU1#show interfaces switchport

Cấu hình tạo Vlan

– Cấu hình tạo vlan ta có thể thực hiện ở Config mode hoặc Vlan Mode (doi voi switch 2900,3500)
+ tạo ra vlan 2
IOU1(config)#vlan 2
+ Đặt tên cho vlan 2. Phục vu mục đích quản lý
IOU1(config)#vlan 2
IOU1(config-vlan)#name Ke_toan

– Kiểm tra thông tin vlan

IOU1#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/2, Et0/3, Et1/0, Et1/1
Et1/2, Et1/3, Et2/0, Et2/1
Et2/2, Et2/3, Et3/0, Et3/1
Et3/2, Et3/3
2 Ke_toan active
IOU2#show vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/2, Et0/3, Et1/0, Et1/1
Et1/2, Et1/3, Et2/0, Et2/1
Et2/2, Et2/3, Et3/0, Et3/1
Et3/2, Et3/3
2 Ke_toan active

Cấu hình Port Access thuộc Vlan

– Port Access được sử dụng để kết nối đến PC. Nếu không cấu hình thì Port access mặc định thuộc Vlan 1

– Tại Switch 1, cấu hình gắn port eth 1/3 thuộc vlan 2
IOU1(config)#interface eth 1/3
IOU1(config-if)#switchport mode access
=> Port Access là port được sử dụng để kết nối PC đầu cuối
IOU1(config-if)#switchport access vlan 2
=> Port eth 1/3 thuộc vlan 2
IOU1(config-if)#end

– Tại Switch 2 cấu hình Port eth 1/3 thuoc Vlan 2 và eth 1/2 thuộc vlan 3
IOU2(config)#int eth 1/3
IOU2(config-if)#switchport mode access
IOU2(config-if)#switchport access vlan 2
IOU2(config-if)#exit
IOU2(config)#int eth 1/2
IOU2(config-if)#switchport mode access
IOU2(config-if)#switchport access vlan 3
IOU2(config-if)#exit