Build xl2tp VPN using centos

Source: Internet
Author: User

I. VPN data transmission protocols: PPTP and L2TP
PPTP L2TP
IP-based Internet accesses frame relay, IP address, and X.25 based on a variety of wide area network connection media.
No Header Compression
No tunneling Authentication
Use IPsec Encryption for PPP Encryption

2. Official Website:
Http://l2tpd.sourceforge.net/

3. How to Build xl2tp VPN in Linux
Download xl2tpd-1.2.4.tar.gz from http://www.xelerance.com/software/xl2tpd/
After decompression, go to the extracted directory and compile and install:
Tar-zxvf xl2tpd-1.2.4.tar.gz
CD xl2tpd-1.2.4
Make
Make install

After the installation is complete, modify the relevant configuration file:
1. Modify/etc/xl2tpd/xl2tpd. conf as follows:
Mkdir/etc/xl2tpd

CP examples/xl2tpd. CONF/etc/xl2tpd/

VI/etc/xl2tpd/xl2tpd. conf
[Global]
Listen-ADDR = 192.168.1.67
Port = 1701
Auth file =/etc/PPP/chap-secrets
[LNS default]
IP range = 192.168.9.128-192.168.9.254
Local IP = 192.168.9.99
Require chap = Yes
Refuse PAP = Yes
Require Authentication = Yes
Name = linuxvpnserver
Ppp debug = Yes
Pppoptfile =/etc/PPP/options. xl2tpd
Length bit = Yes

2. Modify/etc/PPP/options. xl2tpd with the following content:

CP examples/ppp-options.xl2tpd/etc/PPP/options. xl2tpd

VI/etc/PPP/options. xl2tpd
Ipcp-Accept-Local
Ipcp-Accept-remote
MS-DNS 192.168.1.1
MS-DNS 192.168.1.3
MS-wins 192.168.1.2
MS-wins 192.168.1.4
Noccp
Auth
Crtscts
Idle 1800
MTU 1410
MRU 1410
Nodefaultroute
Debug
Lock
Proxyarp
Connect-delay 5000

3. Modify/etc/PPP/chap-secrets as follows:

"Test" * "test "*

4. Edit the/etc/init. d/xl2tpd file with the following content:
#! /Bin/sh
#
# Xl2tpd this shell script takes care of starting and stopping l2tpd.
#
# Chkconfig:-80 30
# Description: Layer 2 tunnelling protocol daemon (RFC 2661)
#
# Processname: xl2tpd
# Config:/etc/xl2tpd/xl2tpd. conf
# Pidfile:/var/run/xl2tpd. PID
# Servicename
Service = xl2tpd
# Source function library.
./Etc/rc. d/init. d/functions
# Source networking configuration.
./Etc/sysconfig/Network
If [$ {networking} = "no"]
Then
Exit 0
Fi
[-X/usr/local/sbin/$ Service] | exit 0
Retval = 0
Start (){
Echo-n "Starting $ service :"
If [! -D/var/run/xl2tpd]
Then
Mkdir/var/run/xl2tpd
Fi
Daemon/usr/local/sbin/$ Service
Retval =$?
[$ Retval-EQ 0] & Touch/var/lock/subsys/$ Service
Echo ""
Return $ retval
}
Stop (){
Echo-n "Stopping $ service :"
Killproc $ Service
Retval =$?
Echo
[$ Retval-EQ 0] & Rm-F/var/lock/subsys/$ Service
Return $ retval
}
Restart (){
Stop
Start
}
# See how we were called.
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Status)
Status $ Service
Retval =$?
;;
Restart | RELOAD)
Restart
;;
Condrestart)
[-F/var/lock/subsys/$ Service] & restart |:
;;
*)
Echo "Usage: $ Service {START | stop | status | restart | reload | condrestart }"
Exit 1
Esac

Run the CHMOD command to grant executable permissions to the xl2tpd file.
Chmod + x/etc/init. d/xl2tpd

Add xl2tpd to the System Service:
Chkconfig -- add xl2tpd
Chkconfig xl2tpd -- level 35 on

You can also start the xl2tpd service on the terminal: # xl2tpd-C/etc/xl2tpd/xl2tpd. conf-D.

4. Firewall gateway port opening:
# L2TP IPSec VPN
Iptables-I RH-Firewall-1-INPUT 10-P UDP-M UDP -- dport 1701-J accept
Iptables-I RH-Firewall-1-INPUT 10-P UDP-M UDP -- dport 4500-J accept
Iptables-I RH-Firewall-1-INPUT 10-P UDP-M UDP -- dport 500-J accept

5. Configure Windows XP as the L2TP Client
Follow these steps to configure a Windows XP computer to become an L2TP client.

1. configure the L2TP dial-up connection:
1) Go to "start", "set", and "Control Panel" of Windows XP, and select "switch to category View ".
2) Select "network and Internet connection ".
3) Select "create a network connection for your work location ".
4) Select "Virtual Private Network Connection" and click "Next ".
5) Enter "L2TP" for the connection and click "Next ".
6) Select "Do not dial this initial connection" and click "Next ".
7) enter the IP address "202.101.35.218" of the L2TP server to be connected, and click "Next ".
8) Click Finish ".
9) double-click "L2TP" and click "properties" in the L2TP connection window ".
10) Select the "Security" attribute page, select "Advanced (custom settings)", and click "Settings ".
11) in "Data Encryption", select "optional encryption (no encryption or connection )".
12) Select "Unencrypted Password (PAP)" and "Challenge Handshake Authentication Protocol (CHAP)" in "allow these protocols), Microsoft chap (MS-CHAP), and click OK ".
13) Select the "network" attribute page, and select "L2TP IPSec VPN" in "VPN type ".
14) confirm that "Internet Protocol (TCP/IP)" is selected.
15) confirm "nwlink IPX/SPX/NetBIOS compatible transport prococol" and "Microsoft Network File. and print shared "," Microsoft Network Customer "protocol is not selected.
Click OK to save the changes.

2. Modify the Registry
The default Windows XP L2TP Transmission Policy does not allow L2TP transmission without using IPsec Encryption. You can disable the default behavior by modifying the XP registry:
Manual modification:
1) Enter "start" and "run" in Windows XP, enter "regedt32", and open "Registry Editor ",
Locate the "HKEY_LOCAL_MACHINE \ SYSTEM \ currentcontrol set \ Services \ RasMan \ Parameters" primary key.
2) Add the following key values to the primary key:
Key Value: prohibitipsec
Data Type: REG_DWORD
Value: 1
3) Save the changes and restart the computer for the changes to take effect.
Tip: you must add the "prohibitipsec" registry key to every computer running Windows XP operating system that uses L2TP.

3. Use the L2TP tunnel to connect to the HiPer L2TP Server
1) Confirm that the computer is connected to the Internet (it may be a dial-up connection or a fixed IP Access ).
2) Start the "L2TP" dial-up connection created in the previous step.
3) enter the user name for the L2TP connection: vpn_mobile and password: vpntest.
4) Click Connect ".
5) after the connection is successful, enter "ipconfig" in the MS-DOS mode, you can see
The address in the server address pool is the IP address allocated to the local machine by the HiPer L2TP server.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.