Jump to content

Linux: Howto setup a VPN Server in Debian


Leon

Recommended Posts

  • Administrators

Hi,

 

This short guide will show you howto setup a VPN server in Debian with ONE network card.

 

 

1. Install the required packages

 

apt-get install pptpd dnsmasq

 

 

2. Configure the IP range assigned to clients by running: pico /etc/pptpd.conf

 

localip 10.0.0.1-99

remoteip 10.0.0.100-199,10.0.0.245

 

Using this config the clients are assigned any IP address between and including 10.0.0.100 and 10.0.0.199

 

 

3. Create a user allowed to connect by running: pico /etc/ppp/chap-secrets

 

* *

 

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

 

4. Enable IP forward at startup to allow the VPN clients to connect to the server's local network by running: 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

 

5. 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

 

6. Add DNS configuration to your setup by running: pico /etc/ppp/options

 

Change:

 

 

 

ms-dns 10.0.0.1

ms-dns 8.8.8.8

 

 

 

7. Create a virtual network interface for 10.0.0.1

pico /etc/network/interfaces

 

Add this:

 

auto eth0:0

iface eth0:0 inet static

address 10.0.0.1

netmask 255.255.255.0

 

Now.. reboot and enjoy VPN! :)

 

 

Note(s):

1) On Ubuntu server, i had to create a "startup" script with the line below in order to enable data routing.

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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...