ติดตั้ง VPN PPTP on CentOS, RedHat and Ubuntu ได้ผลจริง!

By | 19/09/2013

Step 1. Install PPTPD

If your OS is CentOS/RedHat 5:

1
yum install ppp
1
cd /usr/local/src
1
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm
1
rpm -Uhv pptpd-1.3.4-2.rhel5.x86_64.rpm

If your OS is CentOS/RedHat 6:

1
yum install ppp
1
cd /usr/local/src
1
wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.el6.x86_64.rpm
1
rpm -Uhv pptpd-1.3.4-2.el6.x86_64.rpm

If you are using Ubuntu:

1
apt-get install pptpd

Step 2. Edit IP setttings in /etc/pptpd.conf

1
vi /etc/pptpd.conf

localip 192.168.0.1
remoteip 192.168.0.101-200

Step 3. Add user account in/etc/ppp/chap-secrets (assign username and password)

1
vi /etc/ppp/chap-secrets

usernameForuser1 *  setpassword1here  *

usernameForuser2 *  setpassword2here  *

Step 4. Optional settings in /etc/ppp/options.pptpd

1
vi /etc/ppp/options.pptpd

ms-dns 8.8.8.8
ms-dns 4.4.4.4

Step 5. Enable network forwarding in /etc/sysctl.conf

1
vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

use the following command to apply the change:

1
sysctl -p

Step 6. Configure firewall

1
iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
1
iptables -A INPUT -i eth0 -p gre -j ACCEPT
1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
1
iptables -A FORWARD -i ppp+ -o eth0 -j ACCEPT
1
iptables -A FORWARD -i eth0 -o ppp+ -j ACCEPT
1
service iptables save
1
service iptables restart

If you are using CSF firewall, you may refer to this post on firewall settings.

Step 7. Start PPTP VPN server

If your OS is CentOS or Redhat, using the following command:

1
service pptpd restart

To start PPTP Daemon automatically when rebooting next time, use command:

1
chkconfig pptpd on

Credit http://www.photonvps.com/billing/knowledgebase.php?action=displayarticle&id=58

 

One thought on “ติดตั้ง VPN PPTP on CentOS, RedHat and Ubuntu ได้ผลจริง!

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องที่ต้องการถูกทำเครื่องหมาย *