Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have been trying to get an OpenVPN server setup on FreeNAS (not the most straight forward choice, I know) and have run into a puzzling error. It seems that the server is hanging after the "Initialization Sequence Completed" message whenever I try to start it. It will reach that point and just sit there until I have to break the execution with ctrl+c.

My openvpn.conf file is a follows:

#
# Sample OpenVPN configuration file for
# office using SSL/TLS mode and RSA certificates/keys.
#
# '#' or ';' may be used to delimit comments.

# Use a dynamic tun device.
# For Linux 2.2 or non-Linux OSes,
# you may want to use an explicit
# unit number such as "tun1".
# OpenVPN also supports virtual
# ethernet "tap" devices.
dev tap
;dev tun

# 192.168.1.102 id this server's actual IP address.
local 192.168.1.102

# 10.8.0.1 is this server's virtual IP address.
; ifconfig 192.168.1.102 255.255.255.0
server 10.8.0.0 255.255.255.0

# In SSL/TLS key exchange, this machine will
# assume server role and others
# will assume client role.
tls-server

# Diffie-Hellman Parameters (tls-server only)
dh /mnt/ZFS1/bin/openvpn/keys/dh1024.pem

# Certificate Authority file
ca /mnt/ZFS1/bin/openvpn/keys/ca.crt

# Server certificate/public key
cert /mnt/ZFS1/bin/openvpn/keys/server.crt

# Server private key
key /mnt/ZFS1/bin/openvpn/keys/server.key

# TCP or UDP server?
;proto tcp
proto udp

# OpenVPN 2.0 uses UDP port 1194 by default
# (official port assignment by iana.org 11/04).
# OpenVPN 1.x uses UDP port 5000 by default.
# Each OpenVPN tunnel must use
# a different port number.
# lport or rport can be used
# to denote different ports
# for local and remote.
port 1194

# Downgrade UID and GID to
# "nobody" after initialization
# for extra security.
 user nobody
 group nobody

# Maintain a record of client <-> virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# Verbosity level.
# 0 -- quiet except for fatal errors.
# 1 -- mostly quiet, but display non-fatal network errors.
# 3 -- medium output, good for normal operation.
# 9 -- verbose, good for troubleshooting
verb 3

Everything else seems to run without issue. Any ideas?

-Thanks in advance.

share|improve this question
    
This doesn't sound wrong. Are you forking the process when you start it? (Including an & at the end of the startup command) –  meanasspenguin Jan 19 '11 at 21:26
    
Hm, no I am not forking the process from the command line. This is actually my first foray into the world of unix servers. Makes sense, though. Is it simply an ampersand appended to the command itself or is there a special way to do it? –  phobos51594 Jan 19 '11 at 21:52

1 Answer 1

up vote 0 down vote accepted

So, meanasspenguin's comment gave me an idea and I was able to figure it out. The program isn't actually hanging, it is running and simply hasn't exited yet. In order to fix this, simply start the application in daemon mode. I ended up just making a simple shell script so I don't have to remember it next time.

start_openvpn.sh:
#!/bin/bash
ldconfig -Rm /mnt/ZFS1/bin/openvpn/lib
ldconfig -Rm /mnt/ZFS1/bin/openssl/lib
/mnt/ZFS1/bin/openvpn/sbin/openvpn --config /mnt/ZFS1/bin/openvpn/openvpn.conf --daemon

Note: I load the libraries every time as I am running FreeNAS Embedded which lives in a RAM disk. Each reset will wipe out any configuration changes that are not on a mounted disk. I simply set this script to run on startup and everything appears to be golden.

Hope someone else in the same boat as me find's this useful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.