LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2009, 05:14 AM   #1
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Rep: Reputation: 0
Configuring OPENVPN 2.1


Hi all this is my first post so try to be less rude if i am wrong.

Last couple of days i have been trying openvpn2.1 on centos 5.3. I am trying a simple thing

server ------------------------------client
192.168.7.120 --------------------------192.168.7.150

I want to establish a ROUTED OPENVPN with x509 (PKI) certification not with static key, between this two pc. what i did is

# I created iptables for tun
IPTABLES -A INPUT -i tun+ -j accept

1.Generate master Certificate
2.Generate server certificate
3.Generate client certificate
(I copied client certificate from server to client in a secure channel)

4.Generate DH parameter
5. Edit server.conf on server pc
local 192.168.7.120
port 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.cert
cert /etc/openvpn/easy-rsa/2.0/keys/server.cert
key /etc/openvpn/easy-rsa/2.0/keys/server.key

dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem

server 10.8.8.0 255.255.255.0


6. Edit client.conf on client pc (A windows pc)

client
dev tun
proto 1194
remote 192.168.7.120 1194

ca c:\\Program Files\OpenVPN\easy-rsa\keys\ca.cert
cert c:\\Program Files\OpenVPN\easy-rsa\keys\client1.cert
key c:\\Program Files\OpenVPN\easy-rsa\keys\client1.key

7. Now Starting OPENVPN in server

openvpn server.conf

###Here is my problem cause this command is not working
and showing me following error.

-bash: openvpn: command not found


Please help me where is my fault or whether there is any other requirement or not.

Last edited by towhid; 06-29-2009 at 05:17 AM.
 
Old 06-29-2009, 05:30 AM   #2
nowonmai
Member
 
Registered: Jun 2003
Posts: 481

Rep: Reputation: 48
Assuming you installed using Yum or an RPM, you should have a file in /etc/rc.d/init.d/ called openvpn... it is this that you should use to start openvpn... as follows

# /etc/rc.d/init.d/openvpn start

If you installed from source, you will need to find the openvpn binary, which you can do by entering...

# find / -iname openvpn

It should be in your path, but obviously is not...
 
Old 06-29-2009, 05:34 AM   #3
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
What user did you try to run openvpn as? You probably need to be root.
 
Old 06-29-2009, 05:58 AM   #4
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
[root@vmcent ~]# /etc/rc.d/init.d/openvpn start
/etc/rc.d/init.d/openvpn: line 9: /etc/openvpn/: is a directory


can you help me what will i do now..and i am doing it as root.
 
Old 06-29-2009, 03:19 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Ho did you install openvpn? I'm guessing you installed from source rather than using yum?
 
Old 06-29-2009, 10:20 PM   #6
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
I have downloaded openvpn-2.1_rc18.tar.gz and installed with rpm and can you tell me how to install with yum
 
Old 06-29-2009, 10:26 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
yum install openvpn

would have installed the CentOS specific version.

Are you saying you created the rpm from the tarball? If so, uninstall with rpm -e and install with yum.
 
Old 06-30-2009, 01:36 AM   #8
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
dear billymayday;
I have added 3rd party repository to my centeos-base-repos for installing openvpn. i have used "yum install openvpn" it has downloaded lzo2-2.02-3.el5.rf.i386.rpm openvpn-2.0.9-1.el5.rf.i386.rpm these two packages. Now what will do with these things coz ./configure is not working.

can you check my previous configuration pocess whether the process is right or not.
 
Old 06-30-2009, 01:40 AM   #9
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Yum should have installed them.

Did you remove the old version first?
 
Old 07-02-2009, 12:24 AM   #10
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
configuring openvpn

My server side is ok now and its up and running. But my client side is not working when ever i start client side with "openvpn client.ovpn"
it shows me following error.
"Options error: In [CMD-LINE]:1: Error opening configuration file: client.ovpn"

I created client.crt and client.key on server side and copy these files along with ca.crt to the client windows machine.

Can anyone tell whether i have to create the client.crt and client.key file in server side or in the client side.
 
Old 07-02-2009, 12:47 AM   #11
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
So are you trying to run the client on Windows? If so what client, where is client.ovpn, etc.?
 
Old 07-02-2009, 03:27 AM   #12
towhid
LQ Newbie
 
Registered: Jun 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Oh its working. I copied client.ovpn in C://programfiles/openvpn/config/ directory and client.cert, client.key, ca.crt in easy-rsa/keys directory thats why its was not working . Next i copied all the files in C://programfiles/openvpn/config/ directory and changed directories in client.ovpn files. Now its working. thanks everybody for giving me time.
 
Old 07-02-2009, 03:46 AM   #13
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
A small thought for you. I keep a small batch file on my desktop to map remote samba shares with a simple double click and password entry. Works a charm. Note that you will probably need to use the IP rather than server name if you are using a routed connection.

Last edited by billymayday; 07-02-2009 at 03:50 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
problems configuring Kvpnc using openvpn nielsl Linux - Networking 0 08-24-2008 08:14 AM
openvpn wanghao Linux - Server 1 06-17-2008 07:46 PM
OpenVPN Question : connecting 5-6 comps with OpenVPN duryodhan Linux - Networking 7 02-15-2007 10:28 PM
OpenVPN wwnexc Linux - Software 6 05-20-2006 02:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration