OpenWrt Forum Archive

Topic: openvpn on openwrt as client

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hello everybody,
i have got from our sysadmin my keyfiles and my ovpn.config file to connect to the openvpn server in my company.
i would like _not_ to use openvpn-gui or such tools.

is it possible to configure my openwrt openvpn as a client?
if yes could you please give my a short introduction?

ps: i have found many threads with the same issue but all are not solved :-(

thanks in adcance

(Last edited by visora on 1 Dec 2008, 21:55)

Hi-

Installation method depends on the OpenWrt version you use. Do you already have experience in manually setting up openvpn on, for example, a linux pc?

~ JoW

make sure openvpn-server is not running

/etc/init.d/openvpn stop
/etc/init.d/openvpn disable

create openvpn directory

mkdir /etc/openvpn

copy config and key to openvpn directory

cp xyz.conf /etc/openvpn
cp xyz.key /etc/openvpn

change path in config so that secret points to /etc/openvpn/xyz.key

create openvpn-client startup-script as /etc/init.d/openvpn-client
(the following is not very elegant but it works)

#!/bin/sh /etc/rc.common
START=90
start () {
   logger -t "openvpn" "starting openvpn-client"
   /usr/sbin/openvpn --daemon --config /etc/openvpn/xyz.conf
}
stop () {
   logger -t "openvpn" "stopping openvpn-client"
   killall openvpn
   sleep 3
}

make startup-script executable

chmod 0755 /etc/init.d/openvpn-client

start and permanently enable openvpn-client

/etc/init.d/openvpn-client enable
/etc/init.d/openvpn-client start

hope this helps

EDIT: changed path-typo in startup-script (openvpn is in /usr/sbin)

(Last edited by lgvienna on 3 Dec 2008, 11:06)

your keyfile should have 600 attributes otherways openvpn complains (depends on version could not run at all)
regards
Brano

Another thing to remember: OpenVPN can get upset if the time on the box is not correct.

The discussion might have continued from here.