GRE Tunnel และ IPsec VPN: Site-to-Site Connectivity

GRE Tunnel และ IPsec VPN: Site-to-Site Connectivity

GRE (Generic Routing Encapsulation) และ IPsec VPN เป็น 2 เทคโนโลยีหลักสำหรับเชื่อมต่อ sites ผ่าน internet หรือ WAN GRE สร้าง tunnel สำหรับส่ง traffic ข้าม network ในขณะที่ IPsec เข้ารหัสข้อมูลเพื่อความปลอดภัย ใช้ร่วมกัน (GRE over IPsec) เป็น best practice สำหรับ site-to-site VPN

องค์กรที่มี หลายสาขา ต้องการเชื่อมต่อ network ระหว่างสาขาอย่างปลอดภัย MPLS WAN มีราคาแพง VPN ผ่าน internet เป็นทางเลือกที่ถูกกว่ามาก GRE + IPsec ให้ทั้ง flexibility (GRE รองรับ multicast/routing protocols) และ security (IPsec encryption) ในตัวเดียว

GRE vs IPsec

คุณสมบัติ GRE IPsec
จุดประสงค์ Encapsulation (tunnel) Encryption (security)
Encryption ไม่มี (plaintext) มี (AES, 3DES)
Multicast Support รองรับ (OSPF, EIGRP) ไม่รองรับ (unicast only)
Broadcast Support รองรับ ไม่รองรับ
Routing Protocols รัน OSPF/EIGRP/BGP ผ่าน tunnel ได้ ไม่ได้ (ต้องใช้ GRE หรือ VTI)
Protocol Support ทุก protocol (IP, IPv6, multicast) IP only (tunnel mode) หรือ transport mode
Overhead 24 bytes (GRE header) 50-70 bytes (ESP + IV + padding)
Protocol Number 47 50 (ESP), 51 (AH)

GRE Tunnel

Feature รายละเอียด
Encapsulation Wrap original packet ใน new IP header + GRE header
Tunnel Source Physical/loopback IP ของ local router
Tunnel Destination Physical/loopback IP ของ remote router
Tunnel IP IP address ของ tunnel interface (point-to-point)
MTU 1476 bytes (1500 – 24 GRE overhead)
Keepalive GRE keepalive ตรวจ tunnel status

IPsec Components

Component บทบาท
IKE Phase 1 (ISAKMP) Negotiate security parameters + authenticate peers → สร้าง IKE SA
IKE Phase 2 (IPsec) Negotiate IPsec parameters → สร้าง IPsec SA (for data encryption)
ESP (Encapsulating Security Payload) Encrypt + authenticate data (protocol 50)
AH (Authentication Header) Authenticate only ไม่ encrypt (protocol 51) — ไม่ค่อยใช้
DH (Diffie-Hellman) Key exchange (สร้าง shared secret)
SA (Security Association) Agreement ระหว่าง 2 peers (encryption, auth, lifetime)

IKE Phase 1 Parameters

Parameter Options แนะนำ
Authentication Pre-shared Key (PSK), Certificate (RSA) Certificate (production), PSK (lab/small)
Encryption AES-128, AES-256, 3DES AES-256
Hash SHA-256, SHA-384, SHA-512, MD5 SHA-256 ขึ้นไป
DH Group 2, 5, 14, 15, 16, 19, 20, 21 Group 14 (2048-bit) ขึ้นไป
Lifetime 86400 seconds (default) 28800 (8 hours)
IKE Version IKEv1, IKEv2 IKEv2 (faster, more secure)

IKE Phase 2 Parameters

Parameter Options แนะนำ
Protocol ESP, AH ESP (encrypt + auth)
Encryption AES-128, AES-256, AES-GCM AES-256 หรือ AES-GCM-256
Hash/Auth SHA-256, SHA-512 SHA-256
PFS (Perfect Forward Secrecy) DH Group 14, 19, 20 Enable (Group 14+)
Lifetime 3600 seconds (default) 3600 (1 hour)
Mode Tunnel, Transport Tunnel (site-to-site)

GRE over IPsec

Feature รายละเอียด
วิธีทำงาน GRE encapsulate → IPsec encrypt → send over internet
ข้อดี Routing protocols + multicast + encryption
MTU ~1400 bytes (1500 – GRE 24 – IPsec ~56-70)
MSS Clamp TCP MSS = MTU – 40 = ~1360
Use Case Site-to-site VPN ที่ต้องรัน OSPF/EIGRP ข้าม sites

VPN Types

VPN Type ใช้สำหรับ เทคโนโลยี
Site-to-Site (LAN-to-LAN) เชื่อม 2+ sites ถาวร GRE/IPsec, DMVPN, VTI
Remote Access User เข้า corporate network จากบ้าน SSL VPN, IPsec client, WireGuard
DMVPN Hub-and-spoke + spoke-to-spoke dynamic mGRE + NHRP + IPsec
SD-WAN Intelligent WAN with multiple transports IPsec + overlay routing + policy

VTI vs Crypto Map vs GRE

Method Config Complexity Routing Protocol Dynamic Routing
Crypto Map (legacy) Complex (ACL-based) ไม่รองรับ Static routes only
GRE over IPsec Medium รองรับ (multicast) OSPF/EIGRP/BGP
VTI (Virtual Tunnel Interface) Simple รองรับ (unicast) OSPF/EIGRP/BGP (unicast)

Troubleshooting IPsec

Problem Symptom Check
IKE Phase 1 fail Tunnel ไม่ขึ้นเลย Mismatched: encryption, hash, DH group, auth, peer IP
IKE Phase 2 fail Phase 1 OK แต่ no traffic Mismatched: transform set, PFS, interesting traffic ACL
NAT-T issues Tunnel ผ่าน NAT ไม่ได้ Enable NAT-T (UDP 4500), check firewall allow ESP/UDP 4500
MTU/fragmentation Ping ได้ แต่ app ช้า/fail Set tunnel MTU, clamp TCP MSS, enable PMTUD
Interesting traffic mismatch Some traffic ไม่ผ่าน tunnel Check crypto ACL ทั้ง 2 ฝั่ง (must mirror)

Best Practices

Practice รายละเอียด
ใช้ IKEv2 เร็วกว่า IKEv1, fewer messages, better NAT-T
AES-256 + SHA-256 Strong encryption + hash สำหรับ production
Enable PFS Perfect Forward Secrecy ป้องกัน key compromise
ใช้ VTI แทน crypto map Simple config + support dynamic routing
Set tunnel MTU + MSS ป้องกัน fragmentation issues
Dead Peer Detection (DPD) Detect เมื่อ peer down → failover เร็ว
ใช้ loopback เป็น tunnel source Stability (loopback ไม่ down ตราบใดที่ router ทำงาน)

ทิ้งท้าย: GRE + IPsec = Secure Site-to-Site

GRE = tunnel (multicast + routing protocols) IPsec = encryption (AES-256 + SHA-256) GRE over IPsec = best of both worlds ใช้ IKEv2 + AES-256 + PFS สำหรับ production VTI = simpler alternative ถ้าไม่ต้องการ multicast DMVPN = scalable สำหรับ many sites

อ่านเพิ่มเติมเกี่ยวกับ SD-WAN และ MPLS Enterprise WAN ที่ 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