
Network Redundancy: HSRP, VRRP และ GLBP สำหรับ Gateway HA
First Hop Redundancy Protocols (FHRP) เป็น protocols ที่ให้ default gateway มี high availability ถ้า router/L3 switch ตัวหลักล่ม router สำรองจะเข้ามาทำหน้าที่แทนทันที โดยที่ clients ไม่ต้องเปลี่ยน default gateway IP ลด downtime จากหลายนาทีเหลือไม่กี่วินาที
ถ้าองค์กรมี router เพียงตัวเดียว เป็น default gateway เมื่อ router ล่ม ทุกคนใน subnet นั้นจะเข้า internet หรือข้าม VLAN ไม่ได้ FHRP แก้ปัญหานี้โดยให้ routers หลายตัวทำงานเป็น group แชร์ virtual IP address เดียวกัน HSRP, VRRP และ GLBP เป็น 3 protocols หลักที่ใช้ บทความนี้จะเปรียบเทียบทั้ง 3
HSRP vs VRRP vs GLBP
| คุณสมบัติ | HSRP | VRRP | GLBP |
|---|---|---|---|
| Standard | Cisco proprietary | Open (RFC 5798) | Cisco proprietary |
| Virtual IP | ต้องต่างจาก real IP | สามารถใช้ real IP ของ master ได้ | ต้องต่างจาก real IP |
| Active/Standby | 1 Active + 1 Standby + listeners | 1 Master + backups | 1 AVG + up to 4 AVFs (load balancing) |
| Load Balancing | ไม่มี (ต้องใช้ 2 groups) | ไม่มี (ต้องใช้ 2 groups) | มี built-in (round-robin, weighted, host-dependent) |
| Multicast Address | 224.0.0.2 (v1), 224.0.0.102 (v2) | 224.0.0.18 | 224.0.0.102 |
| Timers (default) | Hello 3s, Hold 10s | Advertisement 1s, Master down 3.6s | Hello 3s, Hold 10s |
| Preempt | Disabled by default | Enabled by default | Disabled by default |
| Authentication | Plain text, MD5 | Plain text (v2: none) | Plain text, MD5 |
HSRP (Hot Standby Router Protocol)
Configuration
Router A (Active): interface Vlan10 ip address 10.0.10.2 255.255.255.0 standby 10 ip 10.0.10.1 standby 10 priority 110 standby 10 preempt standby 10 timers 1 3 standby 10 track 1 decrement 20
Router B (Standby): interface Vlan10 ip address 10.0.10.3 255.255.255.0 standby 10 ip 10.0.10.1 standby 10 priority 100 standby 10 preempt standby 10 timers 1 3
Clients ใช้ default gateway = 10.0.10.1 (virtual IP) ถ้า Router A ล่ม → Router B เข้ามาเป็น Active ภายใน 3 วินาที (hold timer)
HSRP Load Balancing (2 Groups)
วิธี: สร้าง 2 HSRP groups บน interface เดียว: Group 10: Router A = Active, Router B = Standby (VIP 10.0.10.1) Group 20: Router B = Active, Router A = Standby (VIP 10.0.10.4) ครึ่งหนึ่งของ clients ใช้ gateway 10.0.10.1 อีกครึ่งใช้ 10.0.10.4 ข้อเสีย: ต้อง config DHCP 2 pools หรือ manual IP
VRRP (Virtual Router Redundancy Protocol)
Open Standard Alternative
VRRP ทำงานคล้าย HSRP แต่เป็น open standard: ใช้คำว่า Master (แทน Active) และ Backup (แทน Standby) Virtual IP สามารถเป็น real IP ของ Master ได้ (HSRP ทำไม่ได้) Preempt enabled by default (Master กลับมาทำงาน เข้ามาเป็น Master ทันที) Faster default timers (advertisement 1s vs HSRP hello 3s)
Configuration
Router A (Master): interface Vlan10 ip address 10.0.10.2 255.255.255.0 vrrp 10 ip 10.0.10.1 vrrp 10 priority 110
Router B (Backup): interface Vlan10 ip address 10.0.10.3 255.255.255.0 vrrp 10 ip 10.0.10.1 vrrp 10 priority 100
GLBP (Gateway Load Balancing Protocol)
Built-in Load Balancing
GLBP เป็น FHRP เดียวที่มี load balancing ในตัว: AVG (Active Virtual Gateway): เลือก 1 router เป็น AVG ตอบ ARP requests AVF (Active Virtual Forwarder): ทุก router เป็น AVF forward traffic จริง เมื่อ client ARP หา gateway → AVG ตอบด้วย virtual MAC ที่ต่างกัน แต่ละ client ได้ virtual MAC ของ AVF ที่ต่างกัน → traffic กระจาย
Load Balancing Methods
| Method | วิธีกระจาย | เหมาะกับ |
|---|---|---|
| Round-Robin | สลับ AVF ทุก ARP request | Equal distribution |
| Weighted | กระจายตาม weight ที่กำหนด | Routers ไม่เท่ากัน |
| Host-Dependent | Client เดิมได้ AVF เดิมเสมอ | Consistent hashing |
Interface Tracking
ลด Priority เมื่อ Uplink Down
ปัญหา: Router A เป็น Active แต่ uplink ไป internet ล่ม Traffic ยังไหลเข้า Router A แล้ว black hole วิธีแก้: Track uplink interface ลด priority เมื่อ down track 1 interface GigabitEthernet0/0 line-protocol standby 10 track 1 decrement 20 ถ้า Gi0/0 down → priority ลดจาก 110 เป็น 90 → Router B (priority 100) เข้ามาเป็น Active
เลือกใช้อะไร
| สถานการณ์ | แนะนำ | เหตุผล |
|---|---|---|
| Cisco only, ต้องการ load balancing | GLBP | Built-in load balancing ใช้ทุก router |
| Cisco only, ไม่ต้อง load balancing | HSRP | Simple, widely supported, well-documented |
| Multi-vendor environment | VRRP | Open standard ทุก vendor support |
| Data Center (modern) | VXLAN + Anycast Gateway | FHRP ไม่จำเป็นใน modern DC fabrics |
ทิ้งท้าย: Gateway Redundancy เป็นสิ่งจำเป็น
FHRP ป้องกัน single point of failure ที่ default gateway HSRP สำหรับ Cisco, VRRP สำหรับ multi-vendor, GLBP สำหรับ load balancing อย่าลืม interface tracking เพื่อ track uplink ทดสอบ failover สม่ำเสมอ
อ่านเพิ่มเติมเกี่ยวกับ Spanning Tree Protocol และ VPN IPsec Site-to-Site ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com