Hallo Anantha

Install OpenVPN on FreeBSD

Posted by: Nanta on: December 15, 2007

OpenVPN is a SSL VPN. As we know, VPN is a technique to connect two site likes leased line. It’s liked a kind of tunneling principle. This time, i would like to share my experience installing OpenVPN on FreeBSD. Thank you to Mas Rendo, Mas Adhy, Mas Artiko and other person that support me. This installation using key for a user whose want to connect using OpenVPN.

1. We install the OpenVPN software from ports

cd /usr/ports/security/openvpn
make install clean

2. We copy example configurations folder

cp /usr/local/share/doc/openvpn/ /usr/local/etc/openvpn/

cd /usr/local/etc/openvpn cp -R sample-config-files config-files/

3. Edit main configuration of OpenVPN ( server.conf )

cd config-files

vi server.conf

This is my server.conf

port 443
# TCP or UDP server?
proto tcp
dev tun
ca /usr/local/etc/openvpn/easy-rsa/keys/ca.crt
cert /usr/local/etc/openvpn/easy-rsa/keys/server.crt
key /usr/local/etc/openvpn/easy-rsa/keys/server.key # This file should be kept secret
dh /usr/local/etc/openvpn/easy-rsa/keys/dh1024.pem
server xxx.xxx.xxx.xxx 255.255.255.224 ( your server ip address )
ifconfig-pool-persist /var/log/ipp.txt
push "route remote_host 255.255.255.255 net_gateway"
push "route xxx.xxx.xxx.xxx 255.255.255.192"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /var/log/openvpn-status.log
log-append /var/log/openvpn.log
verb 3

4. create server and client key

cd /usr/local/etc/openvpn/easy-rsa
vi vars ( change export with setenv )
./vars
./clean-all
./build-ca
./build-key-server server (can change with another name)
./build-key-pass myname --- key for us ( common name myname )
./build-dh

5. We have to run forwarding function on our server

sysctl net.inet.forwarding=1

6. Then run openvpn

openvpn /usr/local/etc/config-files/server.conf &

And then we put ca.crt, myname.crt and myname.key on client site to connect through openvpn.

Thank You

3 Responses to "Install OpenVPN on FreeBSD"

Hi,
Thanks for putting up this posting… but there are some errors. For example in the following line:

cp /usr/local/share/doc/openvpn/ /usr/local/etc/openvpn/

the cp command is missing the -R switch.

Also, I think you meant that the following line is really two lines:

cd /usr/local/etc/openvpn cp -R sample-config-files config-files/

Couldn’t execute the ./vars script, but I’ll figure it out eventually.

-Jaime

Well, this is answering my own question from my previous posting. I could execute the vars script because the permission was wrong on the script(http://openvpn.net/archive/openvpn-users/2007-01/msg00091.html). I had to change the permission via:

chmod 750 vars

Once I did that, I was able to run the script, however, I used export instead of setenv in my copy of the vars script. To run the script properly, I had to type:

. ./vars

There is a space between the first period and the second period.

Again, thanks for posting the article!

Back in October I wrote a full how-to, with other routing and networking information on my wiki, http://www.secure-computing.net/wiki/index.php/OpenVPN_Server

Leave a Reply

Pages

 

December 2007
M T W T F S S
« Nov   Jan »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

My !Yahoo

Community

Amateur Radio Club ITB

Balikpapan blogger



KampungBlog.com - Kumpulan Blog-Blog
Indonesia
Personal blogs

Foto2

DSC00009

DSCF0724

CIMG3190

More Photos

Peta-Pengunjung