Install OpenVPN and WindowsOpenVPNGUI in Linux

Source: Internet
Author: User
The great GFW is becoming more and more popular. Normal website maintenance, such as FTP and popsmtp email sending and receiving, and google's technical information, are often forcibly disconnected by GFW. To solve this problem, I installed an OpenVPN on my foreign host and recorded the installation process. Today, another friend asked about OpenVPN security.

The great GFW is becoming more and more popular. Normal website maintenance, such as FTP, pop & smtp Email sending and receiving, and google-based technical information, are often forcibly disconnected by GFW. To solve this problem, I installed an OpenVPN on my foreign host and recorded the installation process.

Today, another friend asked meOpenVPN InstallationSo I will refresh this articleLinux OpenVPN installation and Windows OpenVPN GUI Installation notes

Hope to help you.

At that timeInstall OpenVPNAnd get the help from WenZK. Thank you.

1. OpenVPN installation environment

 

    Server Environment
  1. REdHat, Kernel version: 2.4.20-31.9, IP Address: 70.8.7.6
  2. Kernel requiredTun devices supportedTo load the iptables module.
    Check whether tun is installed:
    Code:
    root@a [/]# modinfo tun filename:    /lib/modules/2.4.20-31.9/kernel/drivers/net/tun.o description: 
         author:      
         license:     "GPL" 
    If no modinfoCommandTo check whether the tun. o file exists in the kernel:
    Code:
    find -name tun.o ./lib/modules/2.4.20/kernel/drivers/net/tun.o 
    Check the iptables module to check whether the following files exist:
    /Etc/init. d/iptables
  3. OpenSSL. To enable the SSL connection, install OpenSSL first. The method for installing OpenSSL is not described here. You can search for it by Google. In CentOS, you can use yum install:
    yum install opensslyum install openssl-devel
  4. OpenVPN version: 2.0.5. Now there seems to be an updated version. You can download it on the http://openvpn.net.

 

 

    Client environment:
  1. Windows xp pro SP2
  2. OpenVPN GUI For windows 1.0.3, Which can be downloaded from openvpn. se.
    Note:OpenVPN GUI for windowsAndOpenVPN Server.
    For example, the server is installedOpenVPN 2.0.5, Then the downloaded OpenVPN GUI fow windows should be: openvpn-2.0.5-gui-1.0.3-install.ExE
    All history versions of OpenVPN GUI: http://openvpn.se/files/install_packages/

 

 

Ii. OpenVPN Server Installation Process

Http://www.xiaohui.com/dev/server/20070514-install-openvpn.htm

  1. Use SecureCRT to log on to the host and enter the root directory.Code:
    cd / 
  2. Download LZO,ExtractTo lzo-2.02.

     

    Address: http://www.oberhumer.com/opensource/lzo/download/ code:

    wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.02.tar.gz
  3. Download OpenVPN, unzip to openvpn-2.0.5

     

    Address: http://openvpn.net/download.html code:

    wget http://openvpn.net/release/openvpn-2.0.5.tar.gz
  4. Install LZOCode:
    cd /lzo-2.02 ./configure make make check make install 
  5. Install OpenVPN

     

    Code:

    Openvpn-2.0.5/cd. /configure # or use the specified dir: (Note: The following command should be written in one line. in order to facilitate display, this is divided into four rows )#. /configure -- with-lzo-headers =/usr/local/INcLude # -- with-lzo-lib =/usr/local/lib # -- with-ssl-headers =/usr/local/include/openssl # -- with-ssl-lib =/ usr/local/lib make install
  6. Generate certificate Key

     

    Initialize PKI

    (If NOExportCommand can also be usedSetEnv [name] [value] command)

    Code:

    cd /openvpn-2.0.5/easy-rsa export D=`pwd` export KEY_CONFIG=$D/openssl.cnf export KEY_DIR=$D/keys export KEY_SIZE=1024 export KEY_COUNTRY=CN export KEY_PROVINCE=GD export KEY_CITY=SZ export KEY_ORG="xiaohui.com" export KEY_EMAIL="your-email [at] xiaohui.com" 
    Build:

     

    Code:

    ./clean-all ./build-ca 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) [xiaohui.com]: Organizational Unit Name (eg, section) []:xiaohui.com Common Name (eg, your name or your server\'s hostname) []:server Email Address [your-email [at] xiaohui.com]: 
    # Create server key code:
    ./build-key-server server Generating a 1024 bit RSA private key ......++++++ ....................++++++ writing new private key to \'server.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) [xiaohui.com]: Organizational Unit Name (eg, section) []:xiaohui.com Common Name (eg, your name or your server\'s hostname) []:server Email Address [your-email [at] xiaohui.com]: Please enter the following \'extra\' attributes to be sent with your certificate request A challenge password []:abcd1234 An optional company name []:xiaohui.com Using configuration from /openvpn-2.0.5/easy-rsa/openssl.cnf Check that the request matches the signature Signature ok The Subject\'s Distinguished Name is as follows countryName           :PRINTABLE:\'CN\' stateOrProvinceName   :PRINTABLE:\'GD\' localityName          :PRINTABLE:\'SZ\' organizationName      :PRINTABLE:\'xiaohui.com\' organizationalUnitName:PRINTABLE:\'xiaohui.com\' commonName            :PRINTABLE:\'server\' emailAddress          :IA5STRING:\'your-email [at] xiaohui.com\' Certificate is to be certified until Mar 19 08:15:31 2016 GMT (3650 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated 

     

    # Generate client key

    Code:

    . /Build-key client1 Generating a 1024 bit RSA private key ..... ++ ...... ++ writing new private key to \ 'client1. key \ '----- You are about to be asked to enter information that will be ininitialized 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 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) [xiaohui.com]: Organizational Unit Name (eg, section) []: xiaohui.com Common Name (eg, your name or your server \'s hostname) []: client1 # important: certificates generated by different clients must have different names. email Address [your-e Mail [at] xiaohui.com]: Please enter the following \ 'extra \ 'attributes to be sent with your certificate request A challenge password []: abcd1234 An optional company name []: xiaohui.com Using configuration from/openvpn-2.0.5/easy-rsa/openssl. cnf Check that the request matches the signature Signature OK The Subject \'s Distinguished Name is as follows countryName: PRINTABLE: \ 'cn \ 'stateOrProvinceNa Me: PRINTABLE: \ 'gd \ 'localityname: PRINTABLE: \ 'sz \ 'organizationName: PRINTABLE: \ 'xiaohui. com \ 'organizationalunitname: PRINTABLE: \ 'xiaohui. com \ 'commonname: PRINTABLE: \ 'client1 \ 'emailAddress: IA5STRING: \ 'your-email [at] xiaohui.com \ 'Certificate is to be certified until Mar 19 08:22:00 2016 GMT (3650 days) Sign the Certificate? [Y/n]: y 1 out of 1 certificate requests certified, commit? [Y/n] y Write out database with 1 new entries Data Base Updated

     

    Generate other client certificates/keys by analogy

    Code:

    ./build-key client2 ./build-key client3 
    Note that when entering the input Common Name (eg, your name or your server \'s hostname) []:, each certificate must have a different Name.
  7. Generate the Diffie Hellman Parameter. Code:
    ./build-dh 
  8. Package and download all files in keys to your local device.

     

    Code:

    tar -cf mykeys.tar /openvpn-2.0.5/easy-rsa/keys cp mykeys.tar /home/xiaohui.comsys/public_html/mykeys.tar 
    Move mykeys.tar to web public (absolute paths vary from person to person), download it to local in http://www.a.com/mykeys.tar mode, save it, and delete it from server: code:
    rm /home/xiaohui.comsys/public_html/mykeys.tar 
    You can also use other methods to obtain the key file locally, for exampleFtp.
  9. Create a server configuration file

     

    Create from the sample file:

    Code:

    Cd $ dir/sample-config-files/# enter the cp server in the sample-config-files subdirectory under the extract source code directory. conf/usr/local/etc # cp server configuration file to/usr/local/etc vi/usr/local/etc/server. conf
    The contents of server. conf created by me will be attached later.
  10. Create a client configuration file

     

    Code:

    Cd $ dir/sample-config-files/# enter the cp client in the sample-config-files subdirectory under the extract source code directory. conf/usr/local/etc # cp client configuration file to/usr/local/etc vi/usr/local/etc/client. conf
    The content of client. conf created by me will be attached later.
  11. Start Openvpn: openvpn [server config file]Code:
    /usr/local/sbin/openvpn --config /usr/local/etc/server.conf 

 

 

Iii. OpenVPN GUI For Windows Client installation process
  1. Install OpenVPN GUI For WindowsTo download to the http://openvpn.se. The current version is 1.0.3. Note: OpenVPN GUI version and OpenVPN Server version matching. For details, see section 1. installation environment description.

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.