Activity Stream
48,167 MEMBERS
6742 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Respected Member
    Bharat's Avatar
    Website's:
    ShineServers.Com Pickadedi.com

    Default Install OpenVPN on CentOS

    Here i'm using OpenVZ VPS with CentOS 5.5 32bit, and about the memory requirement? Don't worry, OPENVPN doesn't eat your memory too much, i have 50 user running in my 128MB vps and it only eats 25MB memory

    First thing you have to do is check whether tun/tap is active or not by typing
    #cat /dev/net/tun

    Code: 
    cat: /dev/net/tun: File descriptor in bad state
    take a look at the status above, "File descriptor in bad state" means tun/tap is active, otherwise please ask your provider to activate it

    Install required modules
    #yum install gcc make rpm-build autoconf.noarch zlib-devel pam-devel openssl-devel

    Download OPENVPN repo
    #wget http://openvpn.net/release/lzo-1.08-4.rf.src.rpm

    for 32bit
    #wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

    for 64bit
    #wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

    Build the rpm packages
    #rpmbuild --rebuild lzo-1.08-4.rf.src.rpm
    #rpm -Uvh /usr/src/redhat/RPMS/i386/lzo-*.rpm
    #rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm


    *remember to change i386 to x86_64 if you're using 64bit

    Install OPENVPN
    #yum install openvpn

    Copy OPENVPN easy-rsa folder to /etc/openvpn/
    #cp -R /usr/share/doc/openvpn-2.1.4/easy-rsa/ /etc/openvpn/

    Now let's create the certificate
    #cd /etc/openvpn/easy-rsa/2.0
    #chmod 755 *
    #source ./vars
    #./vars
    #./clean-all


    Build CA
    #./build-ca


    Country Name:
    may be filled or press enter
    State or Province Name:
    may be filled or press enter
    City:
    may be filled or press enter
    Org Name:
    may be filled or press enter
    Org Unit Name:
    may be filled or press enter
    Common Name:
    your server hostname
    Email Address:
    may be filled or press enter
    Build key server
    #./build-key-server server

    Almost the same with ./build.ca but check the changes and additional Common Name: server
    A challenge password:
    leave
    Optional company name: fill or enter
    sign the certificate:
    y
    1 out of 1 certificate requests:
    y
    Build Diffie Hellman (wait a moment until the process finish)
    #./build-dh

    Now i'm gonna create UDP port 1194 configuration for OPENVPN, use any text editor you like
    #nano /etc/openvpn/1194.conf

    Code: 
    local 123.123.123.123 #- your_server_ip port 1194 #- port proto udp #- protocol dev tun tun-mtu 1500 tun-mtu-extra 32 mssfix 1450 ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt cert /etc/openvpn/easy-rsa/2.0/keys/server.crt key /etc/openvpn/easy-rsa/2.0/keys/server.key dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login client-cert-not-required username-as-common-name server 1.2.3.0 255.255.255.0 push "redirect-gateway def1" push "dhcp-option DNS 208.67.222.222" push "dhcp-option DNS 4.2.2.1" keepalive 5 30 comp-lzo persist-key persist-tun status 1194.log verb 3
    before you save the configuration, make sure that the "plugin /usr/share/.. /pam.d/login" is one line

    Start the OPENVPN with 1194.conf
    #openvpn /etc/openvpn/1194.conf &

    here's the status if OPENVPN successfully started

    Code: 
    Mon Sun 31 02:23:20 2011 UDPv4 link remote: [undef] Mon Sun 31 02:23:20 2011 MULTI: multi_init called, r=256 v=256 Mon Sun 31 02:23:20 2011 IFCONFIG POOL: base=1.2.3.4 size=62 Mon Sun 31 02:23:20 2011 Initialization Sequence Completed
    Make OPENVPN 1194.conf running in background
    #bg

    Enable ipv4 forward
    #echo 1 > /proc/sys/net/ipv4/ip_forward

    Route iptables
    #iptables -t nat -A POSTROUTING -s 1.2.3.0/24 -j SNAT --to 123.123.123.123

    *1.2.3.0 is allocated ip for OPENVPN client
    *123.123.123.123 is your server ip


    Now we create username and password for authorization
    #useradd username -s /bin/false
    #passwd username


    Download ca.crt file in /etc/openvpn/easy-rsa/2.0/keys/ directory, you can use sftp client

    Download and install OPENVPN client for windows, download the latest stable release OPENVPN version 2.1.4 from here

    After you finished installing OPENVPN, move ca.crt (file that you previously downloaded from /etc/openvpn/easy-rsa/2.0/keys/) to OPENVPN config folder in your program files (\Program Files\OpenVPN\config\)

    Also create client configuration file in OPENVPN config directory, here's the example:

    Code: 
    client dev tun proto udp #- protocol remote 123.123.123.123 1194 #- SERVER IP and OPENVPN Port resolv-retry infinite nobind tun-mtu 1500 tun-mtu-extra 32 mssfix 1450 persist-key persist-tun ca ca.crt auth-user-pass comp-lzo verb 3
    save with anyname.ovpn or 1194.ovpn

    http://i56.tinypic.com/aktvet.jpg

    Run OPENVPN Client on your Windows, connect with your username and password.

    http://i55.tinypic.com/2vwz9di.jpg
    http://i53.tinypic.com/2883y0y.jpg

    Check your IP Address in browser and Voila!!! You're IP is now changed to your server IP

    note:
    - Never fails make OPENVPN on CentOS with this tutorial
    - Those configurations above are basic configuration, you can check OPENVPN website for another configuration
    - If you're using Win 7, before installing OPENVPN client, right click on the installer, properties, run as administrator and change compatibility to Windows XP SP3
    - If you wanna add another port, maybe TCP so you can run OPENVPN over proxy, just create new configuration for server, adjust the following lines:

    Code: 
    port: your preferred port protocol: tcp or udp client's ip: 1.2.4.0 or 1.2.5.0 ; 1.2.6.0 ; and so on
    also new configuration for client

    Code: 
    proto xxxx #- change xxxx to tcp or udp remote 123.123.123.123 yyyy #- change yyyy to OPENVPN port
    and then run the command
    #iptables -t nat -A POSTROUTING -s 1.2.4.0/24 -j SNAT --to 123.123.123.123

    Took Me 1hr To Write And Doing Everything , Just Took 1 sec To Add Repu Thanks
    Bharat Reviewed by Bharat on . Install OpenVPN on CentOS Here i'm using OpenVZ VPS with CentOS 5.5 32bit, and about the memory requirement? Don't worry, OPENVPN doesn't eat your memory too much, i have 50 user running in my 128MB vps and it only eats 25MB memory http://www.besthostingforums.com/images/cdn/besthostingforums.com/2011/07/biggrin-1.gif First thing you have to do is check whether tun/tap is active or not by typing #cat /dev/net/tun cat: /dev/net/tun: File descriptor in bad statetake a look at the status above, "File descriptor in Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    unicef.org
    Thanks man

  4.     
    #3
    Respected Member
    Bharat's Avatar
    Website's:
    ShineServers.Com Pickadedi.com
    Quote Originally Posted by Atlaschild View Post
    Thanks man
    welcome dude

  5.     
    #4
    Member
    thanks for this. will try it.

  6.     
    #5
    Respected Member
    Bharat's Avatar
    Website's:
    ShineServers.Com Pickadedi.com
    Quote Originally Posted by zeroseven View Post
    thanks for this. will try it.
    ur welcome surely will work if any problem occurs i will do it for free

  7.     
    #6
    Member
    Website's:
    urgentVPS.com
    A well written tutorial, no doubt it will help a lot of people since OpenVPN can be quite tricky for some!
    urgentVPS - Premium DDoS Protected Xen OnApp CLOUD based in Germany, Europe - backed by a solid SLA and completely free Windows Server OS options!
    E-mail: [email protected] | Phone: 020-3137-1802
    Follow us on twitter: http://twitter.com/urgentvps

  8.     
    #7
    Member
    When I try to connect I get error:
    Options error: Unrecognized option or missing parameter(s) in server.ovpn:4: 172.16.74.24 (2.0.9)
    How to fix this?

  9.     
    #8
    Banned
    Website's:
    CuraShare.Net CuraShare.Me CuraShare.Info
    There must be a misconfiguration in your config/ovpn file. If you want you can PM it to me, I'll take a look...

  10.     
    #9
    Respected Member
    Bharat's Avatar
    Website's:
    ShineServers.Com Pickadedi.com
    You can add me at yahoo or msn , i'll take a look at it

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Hiring] Setup ICMP on OPENVPN running Centos (minimum 3USD offer)
    By fidai90 in forum Services
    Replies: 0
    Last Post: 4th Oct 2012, 09:12 PM
  2. OpenVPN Centos Installer
    By Onessa in forum Tutorials and Guides
    Replies: 1
    Last Post: 24th Aug 2012, 12:08 PM
  3. OpenVPN For VZ VPS Bash Script. "CentOS"
    By dotvps in forum Tutorials and Guides
    Replies: 4
    Last Post: 28th Feb 2012, 01:07 PM
  4. How to Install OpenVPN on Ubuntu VPS
    By leonking in forum Tutorials and Guides
    Replies: 2
    Last Post: 30th Dec 2011, 03:54 PM
  5. How to install OpenVPN on Ubuntu VPS
    By mana333 in forum Tutorials and Guides
    Replies: 4
    Last Post: 24th Dec 2011, 04:54 PM

Tags for this Thread

BE SOCIAL