Autostart

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Autostart

Post by ragno » Fri Oct 31, 2014 3:11 pm

Hello!

I have already set my openvpn into my raspberry pi, and all is working fine, but when I reboot the system, the openvpn service don´t turn ON automatically.. and every time I have to start it manually by appling the command : /etc/init.d/openvpn start

I edited /etc/default/openvpn and uncommented the line AUTOSTART="all" and saving the file...but even with this nothing happens.

Someone knows the trick here? :idea:

Thanks!

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Fri Oct 31, 2014 5:44 pm

if you use chkconfig --list do you see it on?

Michael.

ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Re: Autostart

Post by ragno » Fri Oct 31, 2014 5:57 pm

maikcat wrote:if you use chkconfig --list do you see it on?

Michael.
Yes, just like bellow:

openvpn 0:off 1:off 2:on 3:on 4:on 5:on 6:off

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Sat Nov 01, 2014 2:32 pm

AFAIK rasberry syncs its time from ntp,
if you use log directive inside vpn config do you see openvpn creating any log file?

it seems to me like a dependecy issue...
can you configure openvpn to come up last?

Michael.

ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Re: Autostart

Post by ragno » Mon Nov 03, 2014 12:57 pm

maikcat wrote:AFAIK rasberry syncs its time from ntp,
if you use log directive inside vpn config do you see openvpn creating any log file?

it seems to me like a dependecy issue...
can you configure openvpn to come up last?

Michael.
Michale, this is all that I got from the file /var/log/openvpn.log

Mon Nov 3 12:28:55 2014 OpenVPN 2.2.1 arm-linux-gnueabihf [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Oct 12 2013
Mon Nov 3 12:28:55 2014 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Mon Nov 3 12:28:55 2014 Control Channel Authentication: using '/etc/openvpn/easy-rsa/keys/ta.key' as a OpenVPN static key file
Mon Nov 3 12:28:55 2014 TCP/UDP: Socket bind failed on local address [AF_INET]192.168.2.34:1194: Cannot assign requested address
Mon Nov 3 12:28:55 2014 Exiting

One thing that I noted is the hour is wrong, is two hours ahead from my current local in Brazil.

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Mon Nov 03, 2014 1:53 pm

Mon Nov 3 12:28:55 2014 TCP/UDP: Socket bind failed on local address [AF_INET]192.168.2.34:1194: Cannot assign requested address
this means that openvpn is already running...

how many .conf files are inside /etc/openvpn directory?

Michael.

ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Re: Autostart

Post by ragno » Mon Nov 03, 2014 1:58 pm

maikcat wrote: this means that openvpn is already running...

how many .conf files are inside /etc/openvpn directory?

Michael.
But look the service:

root@raspberrypi:/home/pi# service openvpn status
root@raspberrypi:/home/pi# service openvpn status [FAIL] VPN 'server' is not running ... failed!

Inside /etc/openvpn there is only one: server.conf
This is the content inside it:

local 192.168.2.34
dev tun
proto udp
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/OpenVPN-Server.crt
key /etc/openvpn/easy-rsa/keys/OpenVPN-Server.key
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
# server and remote endpoints
ifconfig 10.8.0.1 10.8.0.2
# Add route to Client routing table for the OpenVPN Server
push "route 10.8.0.1 255.255.255.255"
# Add route to Client routing table for the OpenVPN Subnet
push "route 10.8.0.0 255.255.255.0"
# your local subnet
push "route 192.168.2.0 255.255.255.0"
# Set primary domain name server address to the SOHO Router
# If your router does not do DNS, you can use Google DNS 8.8.8.8
push "dhcp-option DNS 192.168.2.2"
# Override the Client default gateway by using 0.0.0.0/1 and
# 128.0.0.0/1 rather than 0.0.0.0/0. This has the benefit of
# overriding but not wiping out the original default gateway.
push "redirect-gateway def1"
client-to-client
duplicate-cn
keepalive 10 120
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0
cipher AES-128-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-status.log 20
log /var/log/openvpn.log
verb 1

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Tue Nov 04, 2014 6:39 am

can you verify that openvpn is scheduled to start AFTER the network is up?

Michael.

ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Re: Autostart

Post by ragno » Tue Nov 04, 2014 11:30 am

maikcat wrote:can you verify that openvpn is scheduled to start AFTER the network is up?

Michael.
How can I check this?
(noob here..)

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Tue Nov 04, 2014 12:55 pm

post the contents of /etc/init.d/openvpn

Michael.

ragno
OpenVpn Newbie
Posts: 6
Joined: Fri Oct 31, 2014 3:04 pm

Re: Autostart

Post by ragno » Tue Nov 04, 2014 1:49 pm

maikcat wrote:post the contents of /etc/init.d/openvpn

Michael.
File located in:/etc/init.d/openvpn : http://www.evokeredes.com.br/downloads_ ... penvpn.txt
File located in: /etc/default/openvpn : http://www.evokeredes.com.br/downloads_ ... ostart.txt

User avatar
maikcat
Forum Team
Posts: 4200
Joined: Wed Jan 12, 2011 9:23 am
Location: Athens,Greece
Contact:

Re: Autostart

Post by maikcat » Wed Nov 05, 2014 5:24 pm

also check that inside directories /etc/rcX.d exists S* based symlink to openvpn...

because debian are a little different that redhat/suse check which is the default runlevel
by issuing who -r, then check the correct directory f.e /etc/rc3.d if your runlevel is 3 to
find SXXopenvpn link file...

also check by numbers that the openvpn link has greater number that network one..

Michael.

Post Reply