Aller au contenu
Communauté

[TUTO] Installer un serveur OpenVPN sur votre routeur OpenWrt v.24.x


Messages recommandés

Posté(e) (modifié)

Bonjour,
Sur base d'un ancien tuto qui n'est plus fonctionnel

 

Je vous partage ici les lignes de commandes pour l'installation sur un OpenWrt 24.10.0 :
Vous pouvez tout saisir dans la meme instance de Putty.
Les lignes avec des "//" sont des commentaire personnel

opkg update
opkg install openvpn-openssl
opkg install openvpn-easy-rsa
opkg install luci-app-openvpn
opkg install luci-i18n-openvpn-fr
opkg install openssh-sftp-server

uci set network.vpn0="interface"
uci set network.vpn0.ifname="tun0"
uci set network.vpn0.proto="none"
uci set network.vpn0.auto="1"
uci commit network

uci add firewall rule // cette commmande renvoi une valeur ( on s'en fou ) 
uci set firewall.@rule[-1].name="Autoriser-OpenVPN"
uci set firewall.@rule[-1].target="ACCEPT"
uci set firewall.@rule[-1].src="wan"
uci set firewall.@rule[-1].proto="udp"
uci set firewall.@rule[-1].dest_port="1194"
uci add firewall zone // cette commmande renvoi une valeur ( on s'en fou )
uci set firewall.@zone[-1].name="vpn"
uci set firewall.@zone[-1].input="ACCEPT"
uci set firewall.@zone[-1].forward="ACCEPT"
uci set firewall.@zone[-1].output="ACCEPT"
uci set firewall.@zone[-1].masq="1"
uci set firewall.@zone[-1].network="vpn0"
uci add firewall forwarding // cette commmande renvoi une valeur ( on s'en fou )
uci set firewall.@forwarding[-1].src="vpn"
uci set firewall.@forwarding[-1].dest="wan"
uci add firewall forwarding // cette commmande renvoi une valeur ( on s'en fou )
uci set firewall.@forwarding[-1].src="vpn"
uci set firewall.@forwarding[-1].dest="lan"
uci commit firewall
/etc/init.d/network reload
/etc/init.d/firewall reload

cd /etc/easy-rsa
easyrsa build-ca nopass // Pour moi ca a mis quelques secondes a générer.
// Ca demande de saisir un 'Common Name', saisir 'OPENVPNSERVER'


easyrsa build-server-full OPENVPNSERVER nopass // ca mouline quelques seconde et ca demande de saisie 'yes'

easyrsa build-client-full OPENVPNCLIENT nopass // ca mouline quelques seconde et ca demande de saisie 'yes'

openvpn --genkey secret /etc/easy-rsa/pki/ta.key

easyrsa gen-dh // Ca a mis 30min a ce générer

uci set openvpn.OPENVPNSERVER=OPENVPNSERVER

uci set openvpn.OPENVPNSERVER.dev='tun'
uci set openvpn.OPENVPNSERVER.ifconfig='10.0.0.1 10.0.0.2'
uci set openvpn.OPENVPNSERVER.keepalive='10 60'
uci set openvpn.OPENVPNSERVER.verb='3'
uci set openvpn.OPENVPNSERVER.log='/var/log/openvpn.log'
uci set openvpn.OPENVPNSERVER.status='/var/run/openvpn.status 5'
uci set openvpn.OPENVPNSERVER.mute='5'
uci set openvpn.OPENVPNSERVER.mode='server'
uci set openvpn.OPENVPNSERVER.port='1194'
uci set openvpn.OPENVPNSERVER.route_gateway='dhcp'
uci set openvpn.OPENVPNSERVER.persist_tun='1'
uci set openvpn.OPENVPNSERVER.persist_key='1'
uci set openvpn.OPENVPNSERVER.server='10.8.0.0 255.255.255.0'
uci set openvpn.OPENVPNSERVER.client_to_client='1'
uci set openvpn.OPENVPNSERVER.tls_server='1'

uci set openvpn.OPENVPNSERVER.cert='/etc/easy-rsa/pki/issued/OPENVPNSERVER.crt'
uci set openvpn.OPENVPNSERVER.key='/etc/easy-rsa/pki/private/OPENVPNSERVER.key'
uci set openvpn.OPENVPNSERVER.tls_auth='/etc/easy-rsa/pki/ta.key 0'
uci set openvpn.OPENVPNSERVER.user='nobody'
uci set openvpn.OPENVPNSERVER.group='nogroup'
uci set openvpn.OPENVPNSERVER.dh='/etc/easy-rsa/pki/dh.pem'
uci set openvpn.OPENVPNSERVER.enabled='1'
uci set openvpn.OPENVPNSERVER.ca='/etc/easy-rsa/pki/ca.crt'
uci set openvpn.OPENVPNSERVER.comp_lzo='yes'

uci set openvpn.OPENVPNSERVER.push='persist-key'
uci add_list openvpn.OPENVPNSERVER.push='persist-tun'
uci add_list openvpn.OPENVPNSERVER.push='user nobody'
uci add_list openvpn.OPENVPNSERVER.push='topology subnet'
uci add_list openvpn.OPENVPNSERVER.push='route-gateway dhcp'
uci add_list openvpn.OPENVPNSERVER.push='redirect-gateway def1'
uci add_list openvpn.OPENVPNSERVER.push='dhcp-option DNS 208.67.222.222'
uci add_list openvpn.OPENVPNSERVER.push='dhcp-option DNS 208.67.220.220'
uci add_list openvpn.OPENVPNSERVER.push='block-outside-dns'   
uci set openvpn.OPENVPNSERVER.proto='udp'
uci commit

//changer le nom dans fichier
vi /etc/config/openvpn
// Faire la modif : config OPENVPNSERVER 'OPENVPNSERVER' en config openvpn 'OPENVPNSERVER'
//Appuyez sur Échap (la touche Esc) pour sortir du mode d’insertion.
//Tapez :wq puis appuyez sur Entrée.

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

// Redemarrer votre Router

 

Modifié par sHnouL
  • Perplexe 1
Posté(e)

Sur la derniere étape, dans le fichier OVPN client.ovpn saisir
 

user nobody
group nogroup
dev tun
nobind
client
remote VOTREIPPUBLIC 1194 udp
auth-nocache
remote-cert-tls server
ca ca.crt
cert OPENVPNCLIENT.crt
key OPENVPNCLIENT.key
tls-auth ta.key 1

Remplacer "VOTREIPPUBLIC" par votre ip votre DDNS

Posté(e)

Bonjour @sHnouL votre tutoriel qui n'en est pas un puisqu'il n'y a aucune explication ni illustration n'est pas à la place optimale 

Voyez l'espace BLOG ou vous pourrez poster des tutoriels qui j'espère seront plus explicites que ce que vous proposez ici 

  • Plusser (+1) 2

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

Invité
Répondre à ce sujet…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

  • En ligne récemment   0 membre est en ligne

    • Aucun utilisateur enregistré regarde cette page.
×
×
  • Créer...