FreeBSD 10.3: Configure OpenVPN client


In this article VPNBook provider has been chosen. Check here what they provide:

http://www.vpnbook.com/freevpn

http://www.vpnbook.com/features

Go to www.vpnbook.com and download a certificate bundle. I’ve chosen Euro1 Server. After download it you’ll finish with a zip named something like:

VPNBook.com-OpenVPN-Euro1.zip

After unzip it four files are available. All are the same certificate/keys, but with different configuration. We will use the UDP53 one, named as:


vpnbook-euro1-udp53.ovpn

Install OpenVPN:


pkg install openvpn

Copy the vpnbook certificate to the right place and make a link to it:


cp vpnbook-euro1-udp53.ovpn /usr/local/etc/openvpn
cd /usr/local/etc/openvpn
ln -s vpnbook-euro1-udp53.ovpn openvpn.conf

Make sure your machine is able to IP Forwarding. In FreeBSD edit /etc/rc.conf and put this line:


gateway_enable="YES"

To activate it manually (to avoid reboot):


sysctl net.inet.ip.forwarding=1

This is needed in order your machine can route traffic between interfaces (through new tun0 interface).

Then start OpenVPN:


service openvpn onestart

Check progress with:


tail -f /var/log/messages

It can take some time and several retryings to get ipsec tunnel up. When it finishes and the tunnel is stablished you’ll have:


ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
inet6 fe80::f2de:f1ff:fe6a:ccb5%tun0 prefixlen 64 scopeid 0x5
inet 10.8.0.78 --> 10.8.0.77 netmask 0xffffffff
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
Opened by PID 5608

Maybe a different resolv.conf with different nameservers could be needed. With some networks I must replace the resolv.conf obtained via dhcp with a custom with OpenDNS nameservers:


nameserver 208.67.222.222
nameserver 208.67.220.220

About jjjesss

I'm a guy interested in technology, bsd fan and concerned about the world around.
This entry was posted in BSD, FreeBSD. Bookmark the permalink.

Leave a comment