Installing and configuring PPTP VPN server on lenny

Posted: June 11, 2011 by Hacking & Relax in Linux

If you would like to setup a Virtual Private Network (VPN) for Windows clients, PPTP is a great choice. It’s easy to set up on the server and you don’t need any additional software for the Windows clients to connect.

1. Install the required packages

apt-get install pptpd

2. Configure the IP range assigned to clients (pico /etc/pptpd.conf)

localip 192.168.1.2
remoteip 192.168.1.10-20

Using this config the clients are assigned any IP address between and including 192.168.1.10 and 192.168.1.20.

3. Restart the PPTP daemon

/etc/init.d/pptpd restart

4. Create a user allowed to connect (pico /etc/ppp/chap-secrets)

user1 pptpd secretpassword *

Passwords are not encrypted. This allows the a user with the username: user1 and the password: secretpassword to login from any ip address.

5. Enable IP forward at startup to allow the VPN clients to connect to the server’s local network. (pico /etc/sysctl.conf)

net.ipv4.ip_forward=1

Also run this command to activate the IP forward instantly:

echo 1 > /proc/sys/net/ipv4/ip_forward

6. Create a routing rule to allow the VPN clients to route network traffic through the server.

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

Read this tutorial to learn how to create iptables rules on startup:

Loading iptables rules on startup

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s