HowTo Setup VPN Server On Debian 5.0 Lenny

February 18, 2009 11 Comments

Setting Up VPN Server On Debian 5.0 Lenny

1. Install pptpd
apt-get  install  pptpd

2. Enable IP Forwarding

edit /etc/sysctl.conf, uncomment following
#net.ipv4.ip_forward=1

3. Configure pptpd
Edit /etc/pptpd.conf
Add local ip (server’s ip) and remote ips (range of ips which can be offered to clients)
e.g.

localip 10.0.0.1
remoteip 10.0.0.21-40,10.0.0.51

4. Configure DNS Servers
Edit /etc/ppp/pptpd-options
Add dns servers to ms-dns.  You could add 8.8.8.8 and 8.8.4.4 as shown below which are public dns provided by google.
e.g.
ms-dns  8.8.8.8
ms-dns  8.8.4.4

5. Add Users Authentication to /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client    server    secret            IP addresses
test        pptpd    test            *

6. Restart pptp daemon
/etc/init.d/pptpd restart

7. Open  tcp  port  1723 on your router/firewall to be able to  connect to the vpn server from the world.

8.  Test Connection

Automatic Approach:

We, at Initcron Labs  have created a script which automates all the steps above and  sets up pptp vpn server within a minute.  You can download it from the following link or use wget to do so.

INITCRON  Script :  http://bin.initcron.org/setup/pptp_vpn_on_debian_lenny.sh

Example Usage:

1. Copy the script using wget

wget -c http://bin.initcron.org/setup/pptp_vpn_on_debian_lenny.sh

2. Run the script as root user

bash  pptp_vpn_on_debian_lenny.sh


buy Laptop Battery at www.Deal-Cool.com

Tags: , , , , , , , , , , , , , , , How To's, SysAdmin
11 Comments to “HowTo Setup VPN Server On Debian 5.0 Lenny”
  1. Bastien says:

    Hi !

    Thanks for this very helpful tutorial ! I’ve done everything as you said, and it almost works. But when i’m trying to connect my mac to my server, i have this problem ( http://www.debianhelp.org/node/11630 ).

    I really can’t authentificate, do you have an idea ?

    Thanks for your help :)

    Bastien

  2. petros says:

    you forgot “/etc/ppp/chap-secrets
    ” in step Add Users Authentication ;-)

  3. Lars K says:

    You forgot info about which file to edit in #5:

    5. Add Users Authentication

    Edit the file /etc/ppp/chap-secrets
    # Secrets for authentication using CHAP
    # client server secret IP addresses
    test pptpd test *

  4. Gourav Shah says:

    Thanks Petros and Lars, I have updated #5

  5. tested says:

    I’d got some strange error:

    Plugin /usr/lib/pptpd/pptpd-logwtmp.so loaded.
    pptpd-logwtmp: $Version$
    using channel 45
    Using interface ppp0
    Connect: ppp0 /dev/pts/2
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x0 ]
    sent [LCP ConfAck id=0x0 ]
    rcvd [LCP ConfReq id=0x1 ]
    sent [LCP ConfAck id=0x1 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x2 ]
    sent [LCP ConfAck id=0x2 ]
    sent [LCP ConfReq id=0x1 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x3 ]
    sent [LCP ConfAck id=0x3 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x4 ]
    sent [LCP ConfAck id=0x4 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x5 ]
    sent [LCP ConfAck id=0x5 ]
    sent [LCP ConfReq id=0x1 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x6 ]
    sent [LCP ConfAck id=0x6 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x7 ]
    sent [LCP ConfAck id=0x7 ]
    sent [LCP ConfReq id=0x1 ]
    rcvd [LCP ConfReq id=0x8 ]
    sent [LCP ConfAck id=0x8 ]
    LCP: timeout sending Config-Requests
    Connection terminated.
    Modem hangup

  6. Ankit says:

    thanks to u for guide the above lines. but cn u help me how to connect two or more racoon clients through this pptp server. also i would like to ping host to host of different racoon clients and also host of pptp server.

  7. Tim says:

    Using the script, or after manually changing net.ipv4.ip_forward=1 in /etc/sysctl.conf – you’ll need to run: sysctl -p in order to activate ip forward, otherwise your VPN connection will only have access to the VPN server, not the rest of the network.

    /Tim

  8. Gourav Shah says:

    Thanks Tim. Much appreciated. I’ll add sysctl -p to the script.

  9. mads says:

    i ran the script and i can connect no problem but some how i can´t get internet

  10. Tim says:

    Bum bum, when I ran Lenny, the setup using your script worked perfectly. Now I’ve upgraded to squeeze, and it doesn’t really work anymore :(

    My client can connect and authenticate, but get’s thrown off after 1.3 minutes – while connected, client cannot ping or access anything on the network.

    I’ve tried messing around with the localip/remoteip settings, but that didn’t make any difference, and I don’t really think that would be the issue.

    Also during my tests, i’m connected to my box, from work using ssh, tailing the log and stuff, connect to the VPN using wifi at work – while my phone is connected, it somehow freezes my SSH connection, even though it’s from a different client.

    Any ideas?

    Thanks.

Leave a Reply

(required)

(required)


IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

What is 15 + 4 ?
Please leave these two fields as-is:

Varnish Cache Effect on a high traffic site

Varnish cache is a very effective tool to accelerate web sites and reduce loads on the frontend web...

Configuring Thunderbird with Exchange LDAP directory Addressbook with AutoComplete

How to make mozilla thunderbird look up exchange server ldap directory and how to make autocomplete work with displayname...

Recovering Windows Registry from Linux Host

How to edit and recover windows registry offline from a ubuntu linux machines using freely available tools such as...

Memcached equivalent ElasticCache launched by Amazon

Here is a good news for the ones who would like to speed up their webapp my providing in...

Achieving Regional Redundancy for Amazon EC2 Infrastructure

cost effective solution to regional redundancy with s3 amd warm ami images and puppetin case one complete...

Autoscaling with Scalr – An Introduction

An Introductory video explaining how you could achieve auto scaling of your cloud based infrastructure, such as Amazon...

Scaling Out MySQL without Changing your App

Implement ScaleBase Load Balancer to spilt r/w queries and redirect them to master and slave mysql read replicas. This...

32bit vs 64 bit Operating System?

With the rapid pace at  which  chip design is progressing, you see laptops and desktops being shipped with more...

Run Tomcat on port 80 with port redirection

Tomcat, by default runs on port 8080. You may want to make it run on port 80. Changing the...

Perfect HTPC keyboard – Rii Mini

Rii Mini Wireless Keyboard Touchpad is a perfect solution for Home Theater PC HTPC needs

PostgreSQL query plan visualizer tool

If you are a postgres dbs, here is a very handy online tool for you to visualize query plans....

How to Enable sar on Opensuse

SAR  is a system activity collector and reporting tool on a linux system. Very handy for sysadmins to  debug...

site tracking with Asynchronous Google Analytics plugin for Multisite by WordPress Expert at Web Design Jakarta.