
OSPF vs EIGRP vs BGP: เปรียบเทียบ Routing Protocols สำหรับองค์กร
Routing Protocols เป็นหัวใจของ network ที่ทำให้ routers รู้เส้นทางไปยังปลายทาง การเลือก routing protocol ที่เหมาะสมมีผลต่อ convergence time, scalability, bandwidth usage และ complexity ขององค์กร OSPF, EIGRP และ BGP เป็น 3 protocols หลักที่ใช้ใน enterprise networks
แต่ละ protocol มี จุดแข็งและข้อจำกัดต่างกัน OSPF เป็น open standard ใช้ได้กับทุก vendor EIGRP เป็น Cisco proprietary (แต่มี RFC แล้ว) ใช้ง่ายและ converge เร็ว BGP ใช้สำหรับ inter-AS routing และ large-scale networks บทความนี้จะเปรียบเทียบทั้ง 3 อย่างละเอียด
เปรียบเทียบ Overview
| คุณสมบัติ | OSPF | EIGRP | BGP |
|---|---|---|---|
| Type | Link-State (IGP) | Advanced Distance Vector (IGP) | Path Vector (EGP) |
| Standard | Open (RFC 2328) | Cisco (RFC 7868) | Open (RFC 4271) |
| Algorithm | Dijkstra (SPF) | DUAL | Best Path Selection |
| Metric | Cost (bandwidth-based) | Composite (bandwidth, delay, load, reliability) | Attributes (AS-path, local-pref, MED, etc.) |
| Convergence | เร็ว (1-10 วินาที) | เร็วมาก (< 5 วินาที) | ช้า (30-90 วินาที) |
| Scalability | ปานกลาง (ต้อง design areas) | ดี (auto-summary, stub) | สูงมาก (internet-scale) |
| Multi-vendor | ทุก vendor | Cisco เป็นหลัก | ทุก vendor |
| Admin Distance | 110 | 90 (internal), 170 (external) | 20 (eBGP), 200 (iBGP) |
OSPF (Open Shortest Path First)
Link-State Protocol
วิธีทำงาน: ทุก router สร้าง Link-State Database (LSDB) ที่เหมือนกัน ใช้ Dijkstra algorithm คำนวณ shortest path tree แบ่ง network เป็น Areas เพื่อ scalability Area 0 (backbone) เชื่อมทุก areas
OSPF Areas
| Area Type | ลักษณะ | เหมาะกับ |
|---|---|---|
| Backbone (Area 0) | ทุก area ต้องเชื่อมต่อ Area 0 | Core network |
| Normal Area | รับทุก LSA type | ส่วนใหญ่ของ network |
| Stub Area | ไม่รับ external routes (Type 5 LSA) | Branch offices ที่มี default route พอ |
| Totally Stub | ไม่รับ external + inter-area routes | Simple branches |
| NSSA | Stub + redistribute external routes ได้ | Branch ที่มี local redistribution |
EIGRP (Enhanced Interior Gateway Routing Protocol)
Advanced Distance Vector
วิธีทำงาน: ใช้ DUAL algorithm หา loop-free paths เก็บ Successor (best route) และ Feasible Successor (backup route) Feasible Successor ทำให้ failover เร็วมาก (ไม่ต้อง recalculate) Partial updates: ส่ง update เฉพาะที่เปลี่ยน (ไม่ส่งทั้ง table)
EIGRP Metrics
| Metric Component | Default K-value | ใช้ในการคำนวณ |
|---|---|---|
| Bandwidth | K1 = 1 | ใช้ (slowest bandwidth ใน path) |
| Delay | K3 = 1 | ใช้ (cumulative delay) |
| Load | K2 = 0 | ไม่ใช้ (default) |
| Reliability | K4 = 0, K5 = 0 | ไม่ใช้ (default) |
BGP (Border Gateway Protocol)
Path Vector Protocol
วิธีทำงาน: ใช้ TCP port 179 สร้าง neighbor relationship ตัดสินใจ best path จาก BGP attributes (ไม่ใช่ metric เดียว) eBGP: ระหว่าง AS (Autonomous Systems) ที่ต่างกัน iBGP: ภายใน AS เดียวกัน ใช้สำหรับ internet routing (900,000+ prefixes) และ enterprise WAN
BGP Best Path Selection (เรียงตามลำดับ)
| ลำดับ | Attribute | เลือก |
|---|---|---|
| 1 | Weight (Cisco local) | สูงสุด |
| 2 | Local Preference | สูงสุด |
| 3 | Locally Originated | prefer local routes |
| 4 | AS-Path Length | สั้นสุด |
| 5 | Origin | IGP > EGP > Incomplete |
| 6 | MED | ต่ำสุด |
| 7 | eBGP > iBGP | prefer eBGP |
| 8 | IGP metric to next-hop | ต่ำสุด |
เมื่อไหร่ใช้อะไร
| สถานการณ์ | แนะนำ | เหตุผล |
|---|---|---|
| Campus network (multi-vendor) | OSPF | Open standard, ทุก vendor support |
| Campus network (Cisco only) | EIGRP | ง่ายกว่า, converge เร็วกว่า |
| Large enterprise (multi-site) | OSPF + BGP | OSPF ภายใน site, BGP ระหว่าง sites |
| ISP / Service Provider | BGP + OSPF/IS-IS | BGP สำหรับ inter-AS, IGP สำหรับ backbone |
| Data Center | BGP (eBGP) | Scalable, simple (CLOS/Spine-Leaf) |
| Small office (1-2 routers) | Static routes | Simple, no overhead |
ทิ้งท้าย: เลือก Routing Protocol ตาม Network Design
ไม่มี routing protocol ที่ดีที่สุดสำหรับทุกสถานการณ์ OSPF = multi-vendor, scalable, industry standard EIGRP = simple, fast convergence, Cisco environments BGP = inter-AS, internet-scale, policy-based routing องค์กรขนาดใหญ่มักใช้หลาย protocols ร่วมกัน
อ่านเพิ่มเติมเกี่ยวกับ BGP Route Filtering และ SD-WAN ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com