ก่อนเริ่ม config VLAN ควรศึกษาเรื่องของ LAN และ VLAN เบื้องต้นที่บทความ https://www.jodoi.org/lan.html ก่อนนะครับ
ตามรูปภาพด้านบน Switch ตัวบนคือ Switch A มี Interface G0/0 และ G0/1 เป็น Trunk Port ,
Interface G0/2 ถูกกำหนดให้อยู่ใน VLAN 20 , Interface G0/3 ถูกกำหนดให้อยู่ใน VLAN 30 มาดูขั้นตอนการ Config กันครับ
การ Config VLAN บน Switch CISCO นั้นมีขั้นตอนดังนี้
1. การ Config Trunk Port
SW-A(config)#interface range g0/0-1
SW-A(config-if-range)#switchport trunk encapsulation dot1q
SW-A(config-if-range)#switchport mode trunk
ตรวจสอบผลด้วย command #show interface trunk จะได้ดังภาพด้านล่าง
2. สร้าง VLAN
SW-A(config)#vlan 20
SW-A(config-vlan)#name admin
SW-A(config-vlan)#vlan 30
SW-A(config-vlan)#name user
SW-A(config-vlan)#exit
3. การ Config Access Port
SW-A(config)#interface g0/2
SW-A(config-if)#switchport mode access
SW-A(config-if)#switchport access vlan 20
SW-A(config-if)#interface g0/3
SW-A(config-if)#switchport mode access
SW-A(config-if)#switchport access vlan 30
ตรวจสอบผลด้วย command #show vlan brief จะได้ผลตามภาพด้านล่าง
เราสามารถควบคุมหรือเพิ่มความปลอดภัย โดยกำหนด VLAN ที่สามารถผ่าน Trunk Port ได้ด้วยการ allowed vlan แต่ควรศึกษาการใช้ให้ดีนะครับ เช่นถ้าต้องการให้ VLAN 40 และ VLAN 50 ผ่าน Trunk Port ได้เท่านั้นจะ config ตามด้านล่าง
SW-A(config)#interface g0/0
SW-A(config-if)#switchport trunk allowed vlan 40,50
และกรณีที่ต้องการเพิ่ม VLAN 30 ให้ผ่าน Trunk Port ได้ ให้ใช้ allowed vlan add 30 ดังด้านล่าง
SW-A(config)#interface g0/0
SW-A(config-if)#switchport trunk allowed vlan add 30
กรณีที้ต้องการห้าม VLAN 50 ผ่าน Trunk Port ให้ใช้ allowed vlan remove 50 ดังด้านล่าง
SW-A(config)#interface g0/0
SW-A(config-if)#switchport trunk allowed vlan remove 50
แต่ถ้าไม่มีความชำนาญ ห้ามใช้ command allowed vlan นะครับเพราะทุก VLAN สามารถผ่าน Trunk Port ได้อยู่แล้ว
--------------------------------------------------------------------------------------------
ข้อแนะนำเพิ่มเติม command ที่ใช้ในการตรวจสอบ config ของ Port หรือ Interface ของ Switch CISCO ครับ
command ที่แนะนำคือ show interfaces switchport ดังตัวอย่างด้านล่าง
โดยให้สังเกตุตรง Administrative Mode และ Operational Mode
เช่น interfaces f0/1 ของ SW-A จะเป็น Trunk Port ,
interfaces f0/3 ของ SW-A จะเป็น Access Port
และ interfaces f0/4 ของ SW-A จะเป็น dynamic auto เนื่องจากยัง Config ไม่ถูกต้องนั่นเอง ที่ถูกคือควรทำการ Config เป็น Access Port ด้วยครับ
SW-A#show interfaces f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
SW-A#show interfaces f0/3 switchport
Name: Fa0/3
Switchport: Enabled
Administrative Mode: static access
Operational Mode: static access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Negotiation of Trunking: Off
Access Mode VLAN: 20 (VLAN0020)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
SW-A#show interfaces f0/4 switchport
Name: Fa0/4
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 30 (VLAN0030)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
วีดีโอตัวอย่างวิธีการทำ VLAN บน Switch CISCO
VIDEO
ดูวีดีโอเพิ่มเติมเกี่ยวกับ Switch CISCO ได้ ที่ Playlist ด้านล่าง
https://www.youtube.com/watch?v=EZNUtzdj0A8&list=PLxTcKTJPFY7MNy_Vi5DqmDIZ7wgCft6SY
หวังว่าบทความนี้คงจะก่อให้เกิดประโยชน์ไม่มากก็น้อยสำหรับผู้ที่ทำงานอยู่ในแวดวงไอทีนะครับ
ขอบคุณครับ
-------------------------------------------------------------------------------------------------------
บทความ Network
บทความ Linux
บทความ Certificate