written by cail • posted in How-To • 13,154 views 5 comments

Why still Intrepid (Ubuntu 8.10) server? I just don't have time to upgrade it. For a server, as long as it is secure and stable, no need for the cutting edge.

Why VPN? Check wiki. For me, I want to access some location sensitive files while I am on the iPhone via 3G network.

How? There is an excellent How-To in Chinese. I followed it and it works! This post is a summary of what I did.

For iPhone, three VPN protocols are supported: L2TP, PPTP and Cisco IPSec. I am going to install a pptpd on my Ubuntu server.

  1. Get the server installed.
    sudo apt-get install pptpd
  2. Edit /etc/pptpd.conf file to setup the IP address for connected clients. Enable localip and remoteip to something like
    localip 10.100.113.1
    remoteip 10.100.113.2-4
  3. Use /etc/resolv.conf to find the DNS of the system, and edit /etc/ppp/pptpd-options to enable ms-dns - something like
    ms-dns 128.218.254.10
    ms-dns 128.218.254.40
  4. Set the VPN account by editing /etc/ppp/chap-secrets. For an account test with password TSET that can connect from any where
    test pptpd TSET *
  5. Restart the server by executing
    sudo /etc/init.d/pptpd restart
  6. Enable forward for Internet connection. First, edit /etc/sysctl.conf file to enable
    net.ipv4.ip_forward=1

    and

    sudo sysctl -p

    Second, use iptables (install by apt-get) to setup a route

    sudo iptables -t nat -A POSTROUTING -s 10.100.113.0/24 -o eth0 -j MASQUERADE
  7. Setup VPN in the iPhone by General > Network > VPN > PPTP. Enable Auto encryption level. Keep RSA SecurID off.
    iphone-vpn-pptp
    It should work now.
  8. Automatically enable iptables after rebooting. First, save the working iptables by
    # iptables-save > /etc/iptables-rules

    Second, edit /etc/network/interfaces to something like

    # The primary network interface
    auto eth0
    iface eth0 inet dhcp
    pre-up iptables-restore < /etc/iptables-rules

That is all I did and I don't need to tweak other things as listed in the original post. I also tested on a windows xp machine, which works like a charm. Enjoy Ubuntu!

Previous:
Next:

Leave a Reply

You must be logged in to post a comment.