Warning: Parameter 3 to mb_videobot() expected to be a reference, value given in /home/www/virtual/susethailand.com/htdocs/libraries/joomla/event/dispatcher.php on line 136
VPN IPSec - Dynamic DNS
การติดตั้ง VPN IPSec + Dynamic DNS ด้วยโปรแกรม OpenSWAN กับ ZyXELL VPN
Protocal ที่ควรรู้
IPsec : UDP (Port 500 Dest)
ESP : (Port 50 IP Protocal)
PPTP : ( Port 1723 TCP Dest)
GRE : (Port 51 IP Protocal)
1. เริ่มติดตั้ง โปรแกรมกันดีกว่าครับ
Yast -> Software -> Software Managerment
- ipsec-tools
- openswan
2. ทำสำเนาไฟล์ cript
# cp /etc/ipsec.conf /etc/ipsec.conf-origianl
# vi /etc/ipsec.conf
แก้ไขไฟล์ตามนี้ครับ
# /etc/ipsec.conf - Openswan IPsec configuration file
# RCSID $Id: ipsec.conf.in,v 1.15.2.2 2005/11/14 20:10:27 paul Exp $
# This file: /usr/share/doc/packages/openswan/ipsec.conf-sample
#
# Manual: ipsec.conf.5
version 2.0 # conforms to second version of ipsec.conf specification
# basic configuration
config setup
# plutodebug / klipsdebug = "all", "none" or a combation from below:
# "raw crypt parsing emitting control klips pfkey natt x509 private"
# eg:
# plutodebug="control parsing"
#
# Only enable klipsdebug=all if you are a developer
#
# NAT-TRAVERSAL support, see README.NAT-Traversal
# nat_traversal=yes
# virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%4:172.16.0.0/12
#
# Certificate Revocation List handling:
#crlcheckinterval=600
#strictcrlpolicy=yes
#
# Change rp_filter setting? (default is 0, disabled)
# See also setting in the /etc/sysctl.conf file!
#rp_filter=%unchanged
#
# Workaround to setup all tunnels immediately, since the new default
# of "plutowait=no" causes "Resource temporarily unavailable" errors
# for the first connect attempt over each tunnel, that is delayed to
# be established later / on demand.
#
plutowait=yes
forwardcontrol=no
nat_traversal=yes
# default settings for connections
conn %default
# keyingtries default to %forever
#keyingtries=3
# Sig keys (default: %dnsondemand)
### leftrsasigkey=%cert
### rightrsasigkey=%cert
# Lifetimes, defaults are 1h/8hrs
#ikelifetime=20m
#keylife=1h
#rekeymargin=8m
### deyexchange=ike
#Disable Opportunistic Encryption
# include /etc/ipsec.d/examples/no_oe.conf
# Add connections here
# sample VPN connection
#conn sample
# # Left security gateway, subnet behind it, nexthop toward right.
# left=10.0.0.1
# leftsubnet=172.16.0.0/24
# leftnexthop=10.22.33.44
# # Right security gateway, subnet behind it, nexthop toward left.
# right=10.12.12.1
# rightsubnet=192.168.0.0/24
# rightnexthop=10.101.102.103
# # To authorize this connection, but not actually start it,
# # at startup, uncomment this.
# #auto=start
###############################################
conn service-headoffice
type=tunnel
left=125.24.xxx.xxx # IP Router Servece
leftnexthop=%defaultroute
leftsubnet=192.168.1.0/24
right=125.24.xxx.xxx # IP Router Head Office
rightnexthop=%defaultroute
rightsubnet=192.168.11.0/24
keyexchange=ike
auth=esp
auto=start
authby=secret
pfs=no
conn packetdefault
auto=ignore
conn clear
auto=ignore
conn private
auto=ignore
conn private-or-clear
auto=ignore
conn clear-or-private
auto=ignore
3. Restart Openswan
#rcipsec restart
4. สร้าง Pre-Shared Keys (PSK)
# ipsec ranbits --continuous 64
0x1234*************** (ตัวอย่างเท่านั้น)
- copy รหัสที่เห็น แล้วนำไปวางที่ไฟล์ ipsec.secrets
# vi /etc/ipsec.secrets
เพิ่มคำสั่งนั้ในบรรทัดสุดท้าย
### Additional line by SuSEThailand.com ###
125.24.xxx.xxx 125.24.xxx.xxx : PSK "0x1234***************"
5. คอนฟิก Zywall VPN
- Login to web-base config หรือใช้ Telnet ก็ได้ตามสะดวกครับ
- เลือก VPN menu
- คลิก ปุ่ม Edit
- คลิกที่ช่อง Acctive
Name : Service-Ho
Key Management = IKE
Negofiation Mode = Main
- คลิกที่ช่อง Server Mode
Local
- คลิกเลือก site to site
Address Type : Subnet Address
Starting IP Address : 192.168.11.0
Ending IP Address/Subnet Mask : 255.255.255.0
DNS Server(for IPSec VPN) = 203.113.24.199
*** IP Address นี้เป็น DNS ของ TOT ครับ ถ้าคุณใช้ Public IP ก็ให้ใส่ตัวนั้น ในกรณีนี้เป็นการคอนฟิกให้ใช้ Dynamic IP Address ครับ
Authentication Method
- คลิกเลือก Pre-Shard Key : 0x1234***********
Local ID Type = IP
content = 0.0.0.0
Peer ID Type = IP
content = 0.0.0.0
My IP Address = 0.0.0.0 (ถ้าคุณมี Public IP ก็ให้ใส่ครับ)
Secure Gateway Address = myhost.dyndns.org
Encapsulation Mode = Tunnel
- เลือก ESP
Encryption Algorithm = 3DES
Authentication Algorithm = SHA1
กด Apply ครับ
- เลือก Firewall menu
ทำการเพิ่ม protocal IKE เข้าไปในส่วนของ WAN/WAN ครับ.
6. ที่เครื่อง Linux Server
# rcipsec restart
# ipsec auto --up service-headoffice
# ipsec auto --status
7. ทดสอบ VPN
# ping 192.168.11.x
8. ตรวจสอบ Router
# netstat -nr
# tcpdump -n -i eth1 icmp
9. ตรวจสอบ Syslog Error Messages
# tail -f /var/log/messages
เสร็จขั้นตอนการทำ IPSec VPN + Dynamic DNS













