IPv4 Subnetting Mastery: VLSM, CIDR และ Subnet Design

IPv4 Subnetting Mastery: VLSM, CIDR และ Subnet Design

IPv4 Subnetting เป็นทักษะพื้นฐานที่สำคัญที่สุดสำหรับ network engineers การแบ่ง network ออกเป็น subnets ช่วยจัดการ IP addresses อย่างมีประสิทธิภาพ VLSM (Variable Length Subnet Mask) ช่วยให้ใช้ subnet masks ต่างขนาดกันใน network เดียว ส่วน CIDR (Classless Inter-Domain Routing) ช่วยลดขนาด routing table

การ subnet แบบ classful (Class A/B/C) เปลืองเปล่า IP addresses มหาศาล เช่น Class C /24 ให้ 254 hosts ถ้าต้องการแค่ 10 hosts ก็เสีย 244 addresses VLSM แก้ปัญหานี้โดยให้แต่ละ subnet มี mask ต่างกันได้ ใช้ IP addresses อย่างคุ้มค่าที่สุด

Subnet Mask Basics

CIDR Subnet Mask Hosts Usable Hosts
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2 (point-to-point)
/32 255.255.255.255 1 1 (host route)

Subnetting Formula

Formula คำอธิบาย ตัวอย่าง (/26)
2^n = subnets n = bits ที่ยืมจาก host portion 2^2 = 4 subnets (จาก /24)
2^h – 2 = usable hosts h = host bits ที่เหลือ 2^6 – 2 = 62 usable hosts
Block size = 256 – subnet mask last octet ระยะห่างระหว่าง subnets 256 – 192 = 64
Network = first address Address ที่ host bits เป็น 0 ทั้งหมด 192.168.1.0
Broadcast = last address Address ที่ host bits เป็น 1 ทั้งหมด 192.168.1.63

VLSM (Variable Length Subnet Mask)

Feature รายละเอียด
คืออะไร ใช้ subnet masks ต่างขนาดกันใน network เดียว
ข้อดี ประหยัด IP addresses — subnet ใหญ่สำหรับ segment ที่มี hosts เยอะ, เล็กสำหรับ point-to-point
วิธีทำ เริ่มจาก subnet ใหญ่สุดก่อน → ไล่ไปเล็กสุด
Routing Protocol ต้องใช้ classless routing (OSPF, EIGRP, BGP) — RIPv1 ไม่รองรับ

VLSM Design Example

Subnet Hosts Needed CIDR Network Usable Range Broadcast
LAN A 100 /25 (126 hosts) 10.0.0.0/25 10.0.0.1 – 10.0.0.126 10.0.0.127
LAN B 50 /26 (62 hosts) 10.0.0.128/26 10.0.0.129 – 10.0.0.190 10.0.0.191
LAN C 25 /27 (30 hosts) 10.0.0.192/27 10.0.0.193 – 10.0.0.222 10.0.0.223
WAN Link 2 /30 (2 hosts) 10.0.0.224/30 10.0.0.225 – 10.0.0.226 10.0.0.227

CIDR (Classless Inter-Domain Routing)

Feature รายละเอียด
คืออะไร Route aggregation — รวมหลาย subnets เป็น 1 route (supernetting)
ข้อดี ลดขนาด routing table, ลด routing updates
ตัวอย่าง 192.168.0.0/24 + 192.168.1.0/24 + 192.168.2.0/24 + 192.168.3.0/24 = 192.168.0.0/22
เงื่อนไข Subnets ต้อง contiguous + align กับ boundary ของ summary route

Supernetting (Route Summarization)

Networks Summary วิธีคิด
10.1.0.0/24 – 10.1.3.0/24 10.1.0.0/22 4 networks = 2^2 → ลด 2 bits
172.16.0.0/24 – 172.16.7.0/24 172.16.0.0/21 8 networks = 2^3 → ลด 3 bits
192.168.0.0/24 – 192.168.15.0/24 192.168.0.0/20 16 networks = 2^4 → ลด 4 bits

Private IP Ranges

Range CIDR Class Addresses
10.0.0.0 – 10.255.255.255 10.0.0.0/8 A 16,777,216
172.16.0.0 – 172.31.255.255 172.16.0.0/12 B 1,048,576
192.168.0.0 – 192.168.255.255 192.168.0.0/16 C 65,536

Subnet Design Best Practices

Practice รายละเอียด
Plan for growth เผื่อ 50-100% สำหรับ growth (ถ้าต้องการ 50 hosts ใช้ /25 ไม่ใช่ /26)
Use VLSM ใช้ /30 หรือ /31 สำหรับ point-to-point links
Summarize at boundaries Design subnets ให้ summarize ได้ที่ ABR/ASBR
Document everything IPAM (IP Address Management) tool สำหรับ track allocations
Reserve addresses Reserve .1 สำหรับ gateway, .2-.10 สำหรับ infrastructure
Consistent scheme ใช้ pattern เดียวกันทุก site (e.g., 10.site.vlan.host)

IP Addressing Scheme Example

Site Supernet VLANs
HQ Bangkok 10.1.0.0/16 10.1.10.0/24 (Users), 10.1.20.0/24 (Servers), 10.1.30.0/24 (Mgmt)
Branch Chiang Mai 10.2.0.0/16 10.2.10.0/24 (Users), 10.2.20.0/24 (Servers)
Branch Phuket 10.3.0.0/16 10.3.10.0/24 (Users), 10.3.20.0/24 (Servers)
WAN Links 10.255.0.0/16 10.255.1.0/30, 10.255.1.4/30, etc.

ทิ้งท้าย: Subnetting = Foundation of Networking

Subnetting 2^h – 2 = usable hosts, block size = 256 – last octet VLSM = different masks per subnet → ประหยัด IPs CIDR = aggregate routes → ลด routing table Plan for growth + document + consistent scheme = good design /30 สำหรับ point-to-point, /31 สำหรับ RFC 3021 links

อ่านเพิ่มเติมเกี่ยวกับ OSPF Advanced และ BGP Route Filtering ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart