Ubuntu 11.04 pptp VPN using PPTPD how-to

Required kernel support:
ppp
MPPE

#mknod /dev/ppp c 108 0

#apt-get update
#apt-get install pptpd
#vim /etc/ppp/pptpd-options

add
———————————–
ms-dns 8.8.8.8
ms-dns 8.8.4.4

———————————–

#cp -R /etc/ppp/pptpd-options /etc/pptpd.conf
#vim /etc/pptpd.conf

add
———————————–
localip 10.0.0.1
remoteip 10.0.0.10-100

———————————–

#vim /etc/ppp/chap-secrets

add
———————————–
johndoe pptpd johndoepassword *
———————————–

#/etc/init.d/pptpd restart

Now, if you would like to add internet access over this vpn, you can do this:

#vim /etc/sysctl.conf

and find the line for ipv4 forwarding and make sure it = 1:
———————————–
net.ipv4.ip_forward = 1
———————————–

Then use iptables to get the net forwarded:
#/sbin/iptables -P FORWARD ACCEPT
#/sbin/iptables –table nat -A POSTROUTING -o venet0 -j MASQUERADE
If this gives an error like “iptables: No chain/target/match by that name”, check if iptable_nat is enabled:
#modprobe iptable_nat
If not, then either enable it and try again or use this instead:
#iptables -t nat -A POSTROUTING -o venet0 -s 10.0.0.1/24 -j SNAT –to x.x.x.x
Where x.x.x.x is your server’s outgoing IP.

And then restart again

Leave a Reply

Your email address will not be published. Required fields are marked *