How to install PPTP Service on ubuntu

Setup PPTP server

  • Install PPTP Service

    # sudo apt-get install pptpd

  • Configure PPTPD

    # sudo nano /etc/pptpd.conf

    Add server IP and client IP at the end of the file. You can add like below:

    1
    2
    localip 192.168.0.1
    remoteip 192.168.0.100-200
  • DNS configuration

    # sudo nano /etc/ppp/pptpd-options

    Uncomment the ms-dns and add google like below or OpenDNS:

    1
    2
    ms-dns 8.8.8.8
    ms-dns 8.8.4.4
  • User secret configuration

    # sudo nano /etc/ppp/chap-secrets

    The column is username. Second column is server name, you can put “pptpd” in there. Third column is password. The last column is the IP addresses, you can put * to allow all IP.

    1
    2
    # client        server  secret                  IP addresses
    username * myPassword *

Setup IP Forwarding

  • To enable IPv4 forward. Change /etc/sysctl.conf file, add forward rule below.

    # sudo nano /etc/sysctl.conf

  • Uncomment the line

    net.ipv4.ip_forward=1

  • Then reload the configuration

    sudo sysctl -p

  • Add forward rule in iptables

    # sudo nano /etc/rc.local

  • adding to the bottom just before the exit 0

    1
    2
    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
    iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356

Create NAT rules in firewall

To make PPTP clients talk to each other, we add the following rules to the firewall.

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

Your should replace “eth0” with your ethernet node name.

Restart server

sudo service pptpd restart

Reference