1. OpenVPN relies on a virtual TUNTAP device to implement SSLVPN. Therefore, the kernel must support the TUNTAP device module. This configuration option is located in the 2.6.x kernel and is in the DeviceDrivers-Networkdevicesupport menu. It is called UniversalTUNTAPdevicedriversupport, in the standard kernel
1. OpenVPN implements ssl vpn Based on Virtual TUN/TAP devices. Therefore, the kernel must support the TUN/TAP device module. This configuration option is in the 2.6.x kernel, in Device Drivers-> Network deviceSuIn the pport menu, the full name is Universal TUN/TAP device driver support. It is usually provided in the standard kernel as a module. When Open VPN is started, it will automatically load this module, therefore, you do not need to manually load this module.
Root@www.linuxIdC.com 2.6.18-238.12.1.el5-i686] #Pwd
/Usr/src/kerneLs/2.6.18-238.12.1.el5-i686
[Root@www.linuxidc.com 2.6.18-238.12.1.el5-i686] #Make menuconfig# Open the kernel menu
Device Drivers --->
Network device support --->
Universal TUN/TAP device driver support # That is to say, it is loaded to the kernel in modular mode.
2. Before installing OpenVPN, you also need to install some support packages, including the OpenSSL Development Library and LZOCompressionDevelopment Library
1. You can use yum to install the OpenSSL development library, but you need to manually download and install the LZO development kit.
Root@www.linuxidc.com/] # Yum install openssl
Root@www.linuxidc.com/] # Yum install openssl-devel
2. You canHttp://www.oberhumer.com/opensource/lzo/Download LZO
[Src root@www.linuxidc.com] # Tar zxvf lzo-2.03.tar.gz
[Src root@www.linuxidc.com] # CdLzo-2.03
[Root@www.linuxidc.com lzo-2.03] # ./Configure
[Root@www.linuxidc.com lzo-2.03] # Make
[Root@www.linuxidc.com lzo-2.03] # Make install
3. Configure the ssl vpn Service
1.Http://openvpn.net/release/Download openvpn-2.0.9.tar.gz and install
[Src root@www.linuxidc.com] #Tar zxvf openvpn-2.0.9.tar.gz
[Src root@www.linuxidc.com] #Cd openvpn-2.0.9/
[Root@www.linuxidc.com openvpn-2.0.9] #./Configure
[Root@www.linuxidc.com openvpn-2.0.9] #Make
[Root@www.linuxidc.com openvpn-2.0.9] #Make install
[Root@www.linuxidc.com openvpn-2.0.9] #Cp-P sample-scripts/openvpn. init/etc/init. d/openvpn
[Root@www.linuxidc.com openvpn-2.0.9] #Chkconfig--DdOpenvpn
[Root@www.linuxidc.com openvpn-2.0.9] #Service openvpnStatUs# View service status
Openvpn: service not startEd
[Root@www.linuxidc.com openvpn-2.0.9] #Chkconfig -- level 235 openvpn on
[Root@www.linuxidc.com openvpn-2.0.9] #Chkconfig -- list openvpn
Openvpn 0: off 1: off 2: on 3: on 4: on 5: on 6: off
2. Enable IP Forwarding
[Root@www.linuxidc.com openvpn-2.0.9] #Vi/etc/sysctl. conf
Net. ipv4.ip _ forward = 1
[Root@www.linuxidc.com openvpn-2.0.9] #Sysctl-p
3. Define the configuration directory of OpenVPN as/etc/openvpn and define the server configuration file as/etc/openvpn/server. conf.
OpenVPN is an ssl vpn implementation. Therefore, the most important authentication is the SSL Certificate Management of servers and clients. If the Administrator has no SSL certificate publishing mechanism before, you can use a set of tools attached to OpenVPN to complete all the work.
In/usr/src/openvpn-2.0.9/, there is an easy-rsa Directory, which is a tool for creating and managing SSL certificates, and the following is a certificate generation operation.
[Root@www.linuxidc.com openvpn-2.0.9] # Mkdir-P/etc/openvpn
[Root@www.linuxidc.com openvpn-2.0.9] #Cp-p sample-config-FileS/server. conf/etc/openvpn/# Copy the sample configuration fileGo to/etc/openvpn/, and make modifications later.
4. Modify the vars file variables and set the country code, province, city, institution list, and organization name email.
[Root@www.linuxidc.com openvpn-2.0.9] #Cd easy-rsa/
[Root@www.linuxidc.com easy-rsa] # Grep-V "#" vars
ExPort D = 'pwd'
ExportKEY_CONFIG = $ D/openssl. cnf
Export KEY_DIR = $ D/keys
Echo NOTE: when you run./clean-all, I will be doingRm-Rf on $ KEY_DIR
Export KEY_SIZE = 1024
Export KEY_COUNTRY = CN
Export KEY_PROVINCE = GD
Export KEY_CITY = SZ
Export KEY_ORG = "DIC"
Export KEY_EMAIL ="Tghfly222@126.com"
[Root@www.linuxidc.com easy-rsa] #Source vars
NOTE: when you run./clean-all, I will be doing a rm-rf on/usr/src/openvpn-2.0.9/easy-rsa/keys# Prompt to use./clean-all to clear all certificates including CA
5. Use the clean-all script to clear all certificates, including CA, and then create a CA certificate.
[Root@www.linuxidc.com easy-rsa] #./Clean-all# Clear the certificate before creating the certificate
[Root@www.linuxidc.com easy-rsa] #./Build-ca# Create a CA certificate
Generating a 1024 bit RSA private key
...
...
Writing new private key to 'Ca. key'
-----
You are about to be asked to enter information that will be INcOrporated
Into your certifiCatE request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
CounTrY Name (2 letter code) [CN]:
State or Province Name (full name) [GD]:
Locality Name (eg, city) [SZ]:
Organization Name (eg, company) [DIC]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:Dic172# Server host name
Email Address [tghfly222@126.com]: