FreeBSD as OpenVPN Client

Hello the team,

I'm French boy from France, excuse me for my bad English. I have installed FreeNAS, this is a FreeBSD OS specialized in NAS (Network Area Storage). FreeNAS is installed with the full version, not embedded.

I'm a customer from a VPN Provider Arethusa. I have a little problem for to automate the VPN connection on my VPN provider.

First: I only have from VPN Provider a Login and Password, ca.key and openvpn.conf.
My openvpn.conf file:
Code:
client
dev tun
proto udp
remote xxx.xxxxxxx.xxx 443
resolv-retry infinite
nobind
persist-key
persist-tun
ca /usr/local/etc/openvpn/ca.crt
ns-cert-type server
cipher AES-256-CBC
comp-lzo
verb 3
auth-user-pass
redirect-gateway def1 bypass-dhcp

Look, auth-user-pass, if I try to put the Login and Password in a file -> it doesn't work

Second: in Putty SSH mode:
[cmd=]pkg_add -r openvpn[/cmd]

Third: At the End of rc.conf I have to add:
Code:
openvpn_enable="YES"
openvpn_if="tap"

Fourth: in Putty SSH mode:
[cmd=]ifconfig tun0 create[/cmd]

Fifth: in Putty SSH mode:
[cmd=]/usr/local/etc/rc.d/openvpn start[/cmd]

After the following command openvpn start, the Prompt of Putty ask:
Code:
Enter Auth Username:[i] I need to type the login[/i]
Enter Auth Password:[i] I need to type the password[/i]

Ok, FreeNAS VPN client works.

Now, if I reboot FreeNas after the file rc.conf has loaded, the prompt asks:
Code:
[b]Enter Auth Username[/b] and [b]Enter Auth Password[/b]
Ok, I type the login and password.
But the tun0 doesn't exist, so the vpn doesn't work

I have two questions:
the problem for me is: to type the login and password at the boot
I tried this command:
Code:
auth-user-pass /usr/local/etc/openvpn/key.conf -> it doesn't work
auth-user-pass /usr/local/etc/openvpn/key.conf via file -> it doesn't work

Do you have a solution ?

I also need to create an automated command for [cmd=]ifconfig tun0 create[/cmd] Do you have any idea? And where and in which file can I put this command ?

Regards,
The French boy who tried to write an English :e
 
In FreeBSD (which FreeNAS, is not!), this would be in /etc/rc.conf:
Code:
openvpn_enable="YES"
openvpn_if="tun"
 
The answer is staring you right in the face....

cortex said:
Third: At the End of rc.conf I have to add:
Code:
openvpn_enable="YES"
openvpn_if="tap"
But the tun0 doesn't exist, so the vpn doesn't work

Notice the difference? tap(4) and tun(4) are not the same thing.
 
Ok thx.
I will try to replace
Code:
openvpn_if="tap"
with
Code:
openvpn_if="tun"

DutchDaemon can you move this topic in Topics about PC-BSD / FreeNAS / DesktopBSD / m0N0WALL / pfSense.
 
Back
Top