HostOnNet Blog

Install pptpd server (vpn) in Amazon EC2

To install in Ubuntu 16.04, run

apt-get install pptpd

Now edit /etc/pptpd.conf

vi /etc/pptpd.conf

Add to end of the file.

localip 10.0.0.1
remoteip 10.0.0.100-200

Next you need to create users, this can be done by editing file

vi /etc/ppp/chap-secrets

I created a user with username = “hostonnet” and password = “tpmH7xADcb@zKH”

root@ip-172-31-0-74:~# cat  /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client    server  secret          IP addresses
hostonnet   pptpd   tpmH7xADcb@zKH      *

root@ip-172-31-0-74:~# 

Last column, IP addresses, i put * to allow connection from ANY IP address.

To configure DNS Servers, edit /etc/ppp/pptpd-options

vi /etc/ppp/pptpd-options

Add

ms-dns 8.8.8.8
ms-dns 8.8.4.4

Restart pptpd server

service pptpd restart

Verify it is working with

root@ip-172-31-0-74:~# netstat -an | grep LISTEN | grep 1723
tcp        0      0 0.0.0.0:1723            0.0.0.0:*               LISTEN     
root@ip-172-31-0-74:~# 

Enable IP Forwarding

vi /etc/sysctl.conf

add

net.ipv4.ip_forward = 1

Reload sysconfig

sysctl -p
root@ip-172-31-0-74:~# sysctl -p
net.ipv4.ip_forward = 1
root@ip-172-31-0-74:~# sysctl -a | grep net.ipv4.ip_forward
net.ipv4.ip_forward = 1
net.ipv4.ip_forward_use_pmtu = 0
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
root@ip-172-31-0-74:~# 

Enable MASQUERADE

Run

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save

Useful Links

https://wiki.archlinux.org/index.php/PPTP_server

Connecting to VPN from Ubuntu Desktop PC

To use PPTPD vpn, on ubuntu, Go to Network > VPN Connections > Configure VPN

Here is my configuration

pptpd-vpn-1

pptpd-vpn-2

In the configuration, Use Point-to-Point encryption (MPPE) is important. Everything else is default options. With out this you get login fail error. pptpd server log to /var/log/syslog.


Posted in Ubuntu