Set up a PPTPVPN server in Linux

Source: Internet
Author: User
Article title: set up a PPTPVPN server in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Required software and

CentOS 1, 5.2----------------------------------------------------- The most stable linux server
Linux-2.6.19.tar.gz------------------------------------------ 2.6.19 kernel
Linux-2.6.19-mppe-mppc-1.3.patch.bz2-------------- Kernel mppe-mppc patch
Ppp-2.4.3.tar.gz--------------------------------------------- PPP main program
Ppp-2.4.3-mppe-mppc-1.1.patch.gz------------------ Ppp mppe-mppc patch
Pptpd-1.3.4.tar.gz------------------------------------------ Main program PPTP-VPN
OfficialHOWTOWebpage----------------------------------------- Problem solving

Implementation process and features
First, compile the kernel to add support for mppe and mppc, and then set up the pptp vpn server to end the user's VPN dialing function.

Linux server IP address: 192.168.1.20.

Windows client IP address: 192.168.1.55

2. Compile the kernel
2.1.1

MPPE: Microsoft Point-to-Point Encryption, Microsoft's Point-to-Point Encryption protocol, which can encrypt data packets transmitted on Point-to-Point links. for details, see RFC3078 and RFC3079.

MPPC: Microsoft Point-to-Point Compression, Microsoft's Point-to-Point Compression protocol. you can compress data packets transmitted on Point-to-Point links. for details, see RFC21189.

We need to compile the kernel and PPP so that they both support MPPE and MPPC.

2.1.2

DO Remember that: use IE brower "Save as .." to download kernel patch!

Use custom software when installing CentOS5.2, select "based" and cancel all other selections for basic installation. After installation is complete, go to the system and first install GCC.

[Root @ mm CentOS] # rpm-ivhU kernel-headers-2.6.18-92.el5.i386.rpm

[Root @ mm CentOS] # rpm-ivhU glibc-headers-2.5-24.i386.rpm

[Root @ mm CentOS] # rpm-ivhU glibc-devel-2.5-24.i386.rpm

[Root @ mm CentOS] # rpm-ivhU libgomp-4.1.2-42.el5.i386.rpm

[Root @ mm CentOS] # rpm-ivhU cpp-4.1.2-42.el5.i386.rpm

[Root @ mm CentOS] # rpm-ivhU gcc-4.1.2-42.el5.i386.rpm

Check it out:

[Root @ mm CentOS] # gcc-v

Using built-in specs.

Target: i386-redhat-linux

Thread model: posix

Gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)

Check the current kernel version:

[Root @ mm CentOS] # uname-r

2.6.18-92. el5

You also need to install the following RPM Package, which is required when # make menuconfig; otherwise, an error is returned:

[Root @ mm CentOS] # rpm-ivhU ncurses-devel-5.5-24.20060715.i386.rpm

2.1.3

Compile the kernel as follows:

[Root @ mm kernel] # tar zxvf linux-2.6.19.tar.gz

[Root @ mm kernel] # ln-s/home/kernel/linux-2.6.19/usr/src/linux

[Root @ mm kernel] # cd/usr/src/linux/

The following command patches the kernel

[Root @ mm linux] # bzcat/home/kernel/linux-2.6.19-mppe-mppc-1.3.patch.bz2 | patch-p1

You also need to modify the following files; otherwise, an error occurs during compilation:

[Root @ mm linux] # vi scripts/kconfig/mconf. c

Comment out the static struct menu * current_menu; line,

And add the struct menu * current_menu; as follows:

// Static struct menu * current_menu;

Struct menu * current_menu;

Copy the previous configuration file to the current kernel directory to inherit the original configuration:

[Root @ mm linux] # cp/boot/config-2.6.18-92.el5./. config

[Root @ mm linux] # make mrproper @ delete unnecessary files and directories, which are not required for the first Kernel Compilation

[Root @ mm linux] # make clean @ delete unnecessary modules and files

[Root @ mm linux] # make menuconfig @ text menu-based configuration interface, which is recommended for character terminals

When you select the corresponding configuration, there are three options, which represent the following meanings:
Y -- compile this function into the kernel
N -- do not compile this function into the kernel
M -- compile this function into a module that can be dynamically inserted into the kernel as needed

1. Go to "Load an Alternate Configuration File" and choose ". config"
2. Go to "General setup" select "Local version ..." And input "-default"

3. Go to "Device Drivers --->" "Network device support --->"

Then, select the following two items as a module:

Ppp bsd-Compress compression

Microsoft PPP compression/encryption (MPPC/MPPE)

Then save and exit the kernel configuration mode.

 

[Root @ mm linux] # make dep @ link program code and function library

[Root @ mm linux] # make bzImage @ start to compile the system kernel. this step takes about 25 minutes.

[Root @ mm linux] # make modules @ start to compile the plug-in module. this step takes about 1 hour.

[Root @ mm linux] # make modules_install @ install the compiled module

[Root @ mm linux] # make install @ install the compiled kernel into the system

 

After the kernel is compiled, start it with the new kernel and enter the system. view the following information:

[Root @ mm pppoe] # modprobe-l | grep mppe

/Lib/modules/2.6.19-default/kernel/drivers/net/ppp_mppe_mppc.ko

We can see that the ppp_mppe_mppc.ko module has been compiled.

# Lsmod does not see ppp_mppe_mppc. it indicates that this module has not been mounted by the kernel. We manually mount it:

# Modprobe ppp_mppe_mppc

Run # lsmod again to check whether the kernel has been mounted successfully.

Only when the ppp_mppe_mppc module is mounted to the kernel can the PPPOE server support mppc and mppe (compression and encryption functions ).

 

Add the module as self-starting:

Because we install patches in the module mode, we need to load the module every time the system is started. Therefore, we need to write a line in/etc/rc. d/rc. local:

/Sbin/modprobe ppp_mppe_mppc

[1] [2] [3] [4] Next page

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.