
VPN Site-to-Site IPsec: เชื่อมต่อสาขาอย่างปลอดภัยผ่าน Internet
VPN Site-to-Site IPsec คือการสร้าง encrypted tunnel ระหว่าง 2 sites (เช่น HQ กับ Branch) ผ่าน internet ทำให้ทั้ง 2 sites สื่อสารกันได้เหมือนอยู่ใน private network เดียวกัน โดยข้อมูลทั้งหมดถูก encrypt ด้วย IPsec ป้องกัน eavesdropping
สำหรับองค์กรที่มี สาขาหลายแห่ง แต่ไม่ต้องการจ่ายค่า MPLS ที่แพง VPN Site-to-Site IPsec เป็นทางเลือกที่ประหยัดมาก ใช้ internet link ที่มีอยู่แล้ว เพิ่ม router/firewall ที่รองรับ IPsec ก็เชื่อมต่อ sites ได้ บทความนี้จะอธิบายพื้นฐาน IPsec VPN และวิธี configure
IPsec Phases
| Phase | Protocol | ทำอะไร | สร้างอะไร |
|---|---|---|---|
| Phase 1 (IKE SA) | IKEv1 Main/Aggressive หรือ IKEv2 | Authenticate peers + negotiate encryption | IKE Security Association (SA) |
| Phase 2 (IPsec SA) | Quick Mode (IKEv1) หรือ CREATE_CHILD_SA (IKEv2) | Negotiate IPsec parameters สำหรับ data encryption | IPsec Security Association (SA) |
IKEv1 vs IKEv2
| คุณสมบัติ | IKEv1 | IKEv2 |
|---|---|---|
| Messages ใน Phase 1 | 6 (Main Mode) หรือ 3 (Aggressive) | 4 messages |
| NAT Traversal | ต้อง enable แยก | Built-in |
| Dead Peer Detection | ต้อง enable แยก | Built-in |
| Multi-homing | ไม่รองรับ | รองรับ (MOBIKE) |
| Reliability | ไม่มี built-in retry | Built-in reliable transport |
| แนะนำ | Legacy only | แนะนำใช้ IKEv2 |
IPsec Encryption
Algorithms ที่แนะนำ (2025)
| Component | แนะนำ | ยอมรับได้ | ไม่แนะนำ |
|---|---|---|---|
| Encryption | AES-256-GCM | AES-128-CBC | DES, 3DES |
| Integrity | SHA-256, SHA-384 | SHA-1 (phase out) | MD5 |
| DH Group | Group 20 (ECP-384), Group 21 (ECP-521) | Group 14 (2048-bit) | Group 1, 2, 5 |
| Authentication | RSA/ECDSA certificates | Pre-Shared Key (PSK) | – |
Topology Types
| Topology | โครงสร้าง | เหมาะกับ |
|---|---|---|
| Hub-and-Spoke | ทุก branch เชื่อมต่อผ่าน HQ (hub) | Centralized applications, ง่ายต่อ management |
| Full Mesh | ทุก site เชื่อมต่อกันทุกคู่ | ต้องการ direct communication ระหว่าง branches |
| Partial Mesh | บาง sites เชื่อมตรง บางผ่าน hub | Balance ระหว่าง performance + complexity |
| DMVPN | Dynamic tunnels สร้างอัตโนมัติเมื่อต้องการ | Large scale, many branches (Cisco) |
Configuration ตัวอย่าง
Cisco IOS — IKEv2 Site-to-Site
Phase 1 (IKEv2 Proposal + Policy): crypto ikev2 proposal IKEV2-PROPOSAL encryption aes-cbc-256 integrity sha256 group 14 crypto ikev2 policy IKEV2-POLICY proposal IKEV2-PROPOSAL crypto ikev2 keyring IKEV2-KEYRING peer BRANCH-1 address 203.0.113.2 pre-shared-key MySecretKey123!
IKEv2 Profile: crypto ikev2 profile IKEV2-PROFILE match identity remote address 203.0.113.2 authentication remote pre-share authentication local pre-share keyring local IKEV2-KEYRING
Phase 2 (IPsec Transform Set): crypto ipsec transform-set IPSEC-TS esp-aes 256 esp-sha256-hmac mode tunnel
Crypto Map: crypto map VPN-MAP 10 ipsec-isakmp set peer 203.0.113.2 set transform-set IPSEC-TS set ikev2-profile IKEV2-PROFILE match address VPN-TRAFFIC interface GigabitEthernet0/0 crypto map VPN-MAP
Interesting Traffic ACL: ip access-list extended VPN-TRAFFIC permit ip 10.0.1.0 0.0.0.255 10.0.2.0 0.0.0.255
Route-based VPN (VTI)
ดีกว่า Policy-based
VTI (Virtual Tunnel Interface) เป็นทางเลือกที่ดีกว่า crypto map: interface Tunnel0 ip address 172.16.0.1 255.255.255.252 tunnel source GigabitEthernet0/0 tunnel destination 203.0.113.2 tunnel mode ipsec ipv4 tunnel protection ipsec profile IPSEC-PROFILE ip route 10.0.2.0 255.255.255.0 172.16.0.2 ข้อดี: ใช้ routing protocols (OSPF, BGP) ผ่าน tunnel ได้ ไม่ต้อง ACL สำหรับ interesting traffic ง่ายกว่า crypto map มาก
Troubleshooting
| ปัญหา | อาการ | วิธีตรวจ |
|---|---|---|
| Phase 1 ไม่ขึ้น | Tunnel down, ไม่มี IKE SA | show crypto ikev2 sa (ตรวจ proposal mismatch, PSK ผิด) |
| Phase 2 ไม่ขึ้น | IKE SA up แต่ไม่มี IPsec SA | show crypto ipsec sa (ตรวจ transform set mismatch, ACL ไม่ match) |
| NAT ขัดจังหวะ | Tunnel ขึ้นแล้วหลุด | ตรวจ NAT traversal (UDP 4500), ใช้ IKEv2 |
| Traffic ไม่ผ่าน tunnel | Tunnel up แต่ ping ไม่ได้ | ตรวจ routing, ACL, NAT exemption |
Best Practices
| Practice | ทำไม |
|---|---|
| ใช้ IKEv2 แทน IKEv1 | เร็วกว่า ปลอดภัยกว่า NAT-T built-in |
| ใช้ VTI แทน Crypto Map | ง่ายกว่า รองรับ routing protocols |
| ใช้ AES-256 + SHA-256 ขึ้นไป | DES/3DES/MD5 ไม่ปลอดภัยแล้ว |
| ใช้ certificates แทน PSK (ถ้าทำได้) | PSK management ยากเมื่อ sites มากขึ้น |
| Enable DPD (Dead Peer Detection) | ตรวจจับ peer failure เร็ว |
| SA lifetime 8 ชั่วโมง | Re-key บ่อยขึ้น ลดความเสี่ยง |
ทิ้งท้าย: IPsec VPN ยังเป็นพื้นฐานของ Secure Connectivity
IPsec VPN เป็นวิธีที่ประหยัดที่สุดในการเชื่อมต่อ sites ผ่าน internet ใช้ IKEv2 + VTI + AES-256 สำหรับ deployment ใหม่ สำหรับ large scale ใช้ DMVPN หรือ SD-WAN ที่ใช้ IPsec เป็น underlying transport
อ่านเพิ่มเติมเกี่ยวกับ SD-WAN และ MPLS VPN ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com