{"id":1892,"date":"2012-05-15T11:39:04","date_gmt":"2012-05-15T15:39:04","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1892"},"modified":"2013-03-20T08:38:22","modified_gmt":"2013-03-20T12:38:22","slug":"how-to-install-and-configure-pptp-vpn-in-linux","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-install-and-configure-pptp-vpn-in-linux","title":{"rendered":"How to Install and Configure PPTP VPN in Linux?"},"content":{"rendered":"<p>PPTP (Point to Point Tunneling Protocol) is a method for implementing VPN (Virtual Private Networks). The <strong>basic requirement to configure PPTP VPN<\/strong> is to <strong>allow port 1723 (TCP)<\/strong> in the server firewall and to <strong>load ip_gre module in the kernel<\/strong>. The module is by default compiled with the kernel but sometimes it is not loaded which can be done using the modprobe command.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># modprobe ip_gre<\/span><\/pre>\n<\/blockquote>\n<p>If you have a VPS, you have to ask your hosting provider <strong><a title=\"to enable the PPP module on your VPS\" href=\"https:\/\/linuxhostingsupport.net\/blog\/ppp-module-in-a-vpscontainer\" target=\"_blank\">to enable the PPP module on your VPS<\/a><\/strong> and to load the ip_gre module on the host server. Refer:<\/p>\n<p><strong>Now lets get started with the installation:<\/strong><\/p>\n<p><strong>1)<\/strong> Install the PPP and PPTPD package on your server. You can either use YUM to install them OR install them manually by downloading their RPMs.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># yum install ppp<\/span><\/pre>\n<pre><span style=\"color: #0000ff;\"># yum install pptpd<\/span><\/pre>\n<\/blockquote>\n<p>OR<\/p>\n<p>download the PPP and PPTPD RPMs from http:\/\/poptop.sourceforge.net\/yum\/stable\/rhel5 according to your server architecture. Once downloaded, install them using the &#8216;rpm&#8217; command:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># rpm -ivh ppp-2.4.4-14.1.rhel5.x86_64.rpm<\/span>\r\n<span style=\"color: #0000ff;\"># rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm<\/span><\/pre>\n<\/blockquote>\n<p><strong>2)<\/strong> Now, <strong>open the \/etc\/pptpd.conf file<\/strong>. The only change you have to make in this file is to specify the localip and remoteip. The parameters are defined at the end of the file.<\/p>\n<blockquote>\n<pre>localip 10.0.0.2\r\nremoteip 10.0.0.10-50<\/pre>\n<\/blockquote>\n<p>The IP 10.0.0.2 (localip) will be assigned to the PPP interface created on your server. IPs from the IP range 10.0.0.10-50 (remoteip) will be assigned to the clients who will connect to the PPP interface. You can use any Private IP range instead of the above IPs.<\/p>\n<p><strong>3)<\/strong> You now have to <strong>define the DNS that PPTP is going to use<\/strong>. The DNS can either be the one provided by your ISP\/hosting provider OR you can use Google DNS too.<\/p>\n<p>Edit the file <strong>\/etc\/ppp\/options.pptpd<\/strong> and scroll down to the line which states &#8220;ms-dns&#8221; and uncomment the lines. They should look like follows:<\/p>\n<blockquote>\n<pre>ms-dns 8.8.8.8\r\nms-dns 8.8.4.4<\/pre>\n<\/blockquote>\n<p>Save the file.<\/p>\n<p><strong>4)<\/strong> The next step is to <strong>add username\/passwords of your clients in the \/etc\/ppp\/chap-secrets file<\/strong> (one user per line). The server by default is pptpd and you can restrict a user to a specific IP as well. The file should look like the following:<\/p>\n<blockquote>\n<pre># client server secret IP addresses\r\n client1 pptpd pass1 10.0.0.10\r\n client2 pptpd pass2 10.0.0.11<\/pre>\n<\/blockquote>\n<p>So the above lines state that their are 2 users, client1 and client2 to whom IPs 10.0.0.10 and 10.0.0.11 will be assigned when their connection to the PPTP server will be established.<\/p>\n<p>You can also state * instead of the IP in the above file and any IP from the &#8216;remoteip&#8217; range will be assigned randomly to the user.<\/p>\n<p><strong>5)<\/strong> Now <strong>activate IP forwarding in the sysctl.conf<\/strong> file by enabling &#8220;net.ipv4.ip_forward&#8221;. <strong>Open \/etc\/sysctl.conf file<\/strong> and add the following:<\/p>\n<blockquote>\n<pre>net.ipv4.ip_forward = 1<\/pre>\n<\/blockquote>\n<p>to make the changes active immediately, execute:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># sysctl -p<\/span><\/pre>\n<\/blockquote>\n<p><strong>6)<\/strong> Now <strong>add the firewall rules<\/strong> to do NAT, accept connections on GRE protocol and on port 1723. You should also add FORWARD rules if you want to route all your internet traffic through the VPN server.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<\/span>\r\n<span style=\"color: #0000ff;\">iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT<\/span>\r\n<span style=\"color: #0000ff;\">iptables -A INPUT -i eth0 -p gre -j ACCEPT<\/span>\r\n<span style=\"color: #0000ff;\">iptables -A FORWARD -i ppp+ -o eth0 -j ACCEPT<\/span>\r\n<span style=\"color: #0000ff;\">iptables -A FORWARD -i eth0 -o ppp+ -j ACCEPT<\/span><\/pre>\n<\/blockquote>\n<p><strong>7)<\/strong> Now start the pptpd service<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># service pptpd start<\/span><\/pre>\n<\/blockquote>\n<p>Your are done with the server side configuration.<\/p>\n<p><strong>Now the second part is to configure the Client side VPN network:<\/strong><\/p>\n<p><strong>1)<\/strong> Goto Start -&gt; Settings -&gt; Control Panel -&gt; &#8216;Network Connections&#8217;<br \/>\n<strong>2)<\/strong> Click on &#8220;Create a New Connection&#8221; and click Next<br \/>\n<strong>3)<\/strong> Select &#8216;connect to the network at my workplace&#8217;<br \/>\n<strong>4)<\/strong> Select &#8216;Virtual Private Network connection&#8217;<br \/>\n<strong>5)<\/strong> Type a name for your connection and click Next<br \/>\n<strong>6)<\/strong> Select &#8216;Do not dial the initial connection&#8217;<br \/>\n<strong>7)<\/strong> Type IP or Hostname of the server on which server side PPTP is configured<br \/>\n<strong>8 )<\/strong> Click Finish and it will prompt for username\/password<br \/>\n<strong>9)<\/strong> Enter one of the username\/password that you have specified in the \/etc\/ppp\/chap-secrets file<br \/>\n<strong>10)<\/strong> Click Connect.<\/p>\n<p>That&#8217;s it. You will now be connected to the PPTP VPN server.<\/p>\n<p>To verify whether your requests are going through the VPN server, browse the website http:\/\/whatismyip.com which will display the VPN server IP address instead of your local internet IP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PPTP (Point to Point Tunneling Protocol) is a method for implementing VPN (Virtual Private Networks). The basic requirement to configure PPTP VPN is to allow port 1723 (TCP) in the server firewall and to load ip_gre module in the kernel. The module is by default compiled with the kernel but sometimes it is not loaded which can be done using the modprobe command.<\/p>\n<p># modprobe ip_gre<\/p>\n<p>If you have a VPS, you have to ask your hosting provider to enable the PPP module on your VPS and to load the [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1394,1393,1391,1392,1390,1396,1395],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1892"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=1892"}],"version-history":[{"count":9,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions"}],"predecessor-version":[{"id":1909,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions\/1909"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}