Ecrit par Gervais COQUIL
Une partie pour ceux connaissant déjà openvpn et ayant une configuration sous la main.
Une deuxième partie pour les débutants, installation et configuration pas à pas d'openvpn.
Partie I :
Pré-requis :
- Optware installé
- Bases sur l'administration sous linux
- Firmware v3.1.1
- Connaître openvpn
- Disposer d'une configuration openvpn (server.conf, ca.crt, serveur.key, serveur.crt et dh1024.pem)
Se connecter en ssh sur votre NAS :
ssh admin@ip
Installation du paquet openvpn :
ipkg install openvpn
Mettre vos fichiers de configuration (server.conf, ca.crt, serveur.key, serveur.crt et dh1024.pem) dans :
/opt/etc/openvpn/
Installation du module tun :
ipkg install kernel-module-tun
Pour information le fichier tun.ko se trouve :
/opt/lib/modules/2.6.22.18/kernel/drivers/net/tun.ko
Modification du fichier S20openvpn :
nano /opt/etc/init.d/S20openvpn
#!/bin/sh
#
# Startup script for openvpn as standalone server
#
# Make sure IP forwarding is enabled
echo 1 > /proc/sys/net/ipv4/ip_forward
# Make device if not present (not devfs)
if ( [ ! -c /dev/net/tun ] ) then
# Make /dev/net directory if needed
if ( [ ! -d /dev/net ] ) then
mkdir -m 755 /dev/net
fi
mknod /dev/net/tun c 10 200
fi
# Make sure the tunnel driver is loaded
if ( !(lsmod | grep -q "^tun") ); then
insmod /opt/lib/modules/2.6.22.18/kernel/drivers/net/tun.ko #<----------------------------- Modification du chemin
fi
# I you want a standalone server (not xinetd), comment out the return statement below
#return 0 #<----------------------------------------------------------------------------------------------------Mise en commentaire
## This is for standalone servers only!!!!
# Kill old server if still there
if [ -n "`pidof openvpn`" ]; then
/bin/killall openvpn 2>/dev/null
fi
# Start afresh - add as many daemons as you want
/opt/sbin/openvpn --daemon --cd /opt/etc/openvpn --config server.conf #<--------------------------Votre fichier de configuration server.conf
Démarrer openvpn :
/opt/etc/init.d/S20openvpn start
Partie II :
En cours.