Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3242 connectés 

  FORUM HardWare.fr
  Réseaux grand public / SoHo
  Réseaux

  [RESOLU] Routage à travers un VPN avec OpenVPN

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[RESOLU] Routage à travers un VPN avec OpenVPN

n°517023
louk007
Posté le 23-03-2011 à 14:46:13  profilanswer
 

Bonjour,
 
J'ai monté (au boulot ... à droite sur l'image 192.168.222. et 10.) un petit réseau que j'ai relié à mon réseau (chez moi 192.168.0.) grâce à un réseau virtuel grâce à OpenVPN :
 
http://cedric.todaro.free.fr/net/vpn-s.jpg
Cliquez sur l'image pour l'agrandir
 
Cela marche presque bien ...
Le VPN marche bien :
Ca ping du serveur OpenVPN (172.18.0.1) au client OpenVPN (172.18.0.10)
 
La table de routage du client VPN est bien renseigné car j'ai accès au réseau 192.168.0. depuis le client VPN (et inversement).
C'est d'ailleurs le serveur OpenVPN qui a fournit la route aux clients :

Code :
  1. # Push routes to the client to allow it
  2. # to reach other private subnets behind
  3. # the server.  Remember that these
  4. # private subnets will also need
  5. # to know to route the OpenVPN client
  6. # address pool (10.8.0.0/255.255.255.0)
  7. # back to the OpenVPN server.
  8. push "route 192.168.0.0 255.255.255.0"


 
Par contre j'aimerais pouvoir accéder au serveur FTP (192.168.222.2) depuis le serveur OpenVPN (et accessoirement depuis mon réseau local 192.168.0. mais ça après je sais faire ... configuration de mon routeur NAT ... easy) ...
... et pour ça il faut que j'ajoute une route sur mon serveur OpenVPN vers le réseau 192.168.222.0 et là c'est le drame !!!  :cry:  
 
j'ai essayé ça :

Code :
  1. route add -net 192.168.222.0/24 gw 172.18.0.1 dev tun0

(marche pas)
 
ça :

Code :
  1. route add -net 192.168.222.0/24 192.168.222.0 gw 172.18.0.2 dev tun0

(marche pas)
 
ça:

Code :
  1. route add add -net 192.168.222.0/24 gw 172.18.0.10 dev tun0
  2. SIOCADDRT: Aucun processus de ce type


 
J'ai bien l'impression que c'est un problème de routage mais peut-être que OpenVPN va m'aider à résoudre cela en 'pushant' les routes manquantes au serveur lorsque celui-ci se lance ou que le client se connecte ...
 
Je vous mets les ifconfig du serveur et du client

Code :
  1. serveur:~# ifconfig
  2. eth0      Link encap:Ethernet  HWaddr 00:1c:23:57:f1:ed
  3.           inet adr:192.168.0.2  Bcast:192.168.0.255  Masque:255.255.255.0
  4.           adr inet6: fe80::21c:23ff:fe57:f1ed/64 Scope:Lien
  5.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  6.           RX packets:1272282 errors:0 dropped:0 overruns:0 frame:0
  7.           TX packets:742314 errors:0 dropped:0 overruns:0 carrier:0
  8.           collisions:0 lg file transmission:1000
  9.           RX bytes:1779538902 (1.6 GiB)  TX bytes:115237815 (109.8 MiB)
  10.           Interruption:29 Adresse de base:0xe000
  11. lo        Link encap:Boucle locale
  12.           inet adr:127.0.0.1  Masque:255.0.0.0
  13.           adr inet6: ::1/128 Scope:Hôte
  14.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  15.           RX packets:5487 errors:0 dropped:0 overruns:0 frame:0
  16.           TX packets:5487 errors:0 dropped:0 overruns:0 carrier:0
  17.           collisions:0 lg file transmission:0
  18.           RX bytes:873656 (853.1 KiB)  TX bytes:873656 (853.1 KiB)
  19. tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  20.           inet adr:172.18.0.1  P-t-P:172.18.0.2  Masque:255.255.255.255
  21.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
  22.           RX packets:1217394 errors:0 dropped:0 overruns:0 frame:0
  23.           TX packets:690053 errors:0 dropped:0 overruns:0 carrier:0
  24.           collisions:0 lg file transmission:100
  25.           RX bytes:1675749944 (1.5 GiB)  TX bytes:43361940 (41.3 MiB)


 
 

Code :
  1. client:~# ifconfig
  2. eth0      Link encap:Ethernet  HWaddr 00:11:09:6e:9e:fc
  3.           inet adr:192.168.222.22  Bcast:192.168.222.255  Masque:255.255.255.0
  4.           adr inet6: fe80::211:9ff:fe6e:9efc/64 Scope:Lien
  5.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  6.           RX packets:3706 errors:0 dropped:0 overruns:0 frame:0
  7.           TX packets:3640 errors:0 dropped:0 overruns:0 carrier:0
  8.           collisions:0 lg file transmission:1000
  9.           RX bytes:389675 (380.5 KiB)  TX bytes:417936 (408.1 KiB)
  10.           Interruption:23 Adresse de base:0xec00
  11. eth2      Link encap:Ethernet  HWaddr 00:30:f1:d1:b2:e8
  12.           inet adr:10.0.0.1  Bcast:10.255.255.255  Masque:255.0.0.0
  13.           adr inet6: fe80::230:f1ff:fed1:b2e8/64 Scope:Lien
  14.           UP BROADCAST MULTICAST  MTU:1500  Metric:1
  15.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  16.           TX packets:0 errors:2 dropped:0 overruns:0 carrier:4
  17.           collisions:0 lg file transmission:1000
  18.           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  19.           Interruption:16 Adresse de base:0xd000
  20. lo        Link encap:Boucle locale
  21.           inet adr:127.0.0.1  Masque:255.0.0.0
  22.           adr inet6: ::1/128 Scope:Hôte
  23.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  24.           RX packets:16 errors:0 dropped:0 overruns:0 frame:0
  25.           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
  26.           collisions:0 lg file transmission:0
  27.           RX bytes:1040 (1.0 KiB)  TX bytes:1040 (1.0 KiB)
  28. tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  29.           inet adr:172.18.0.10  P-t-P:172.18.0.9  Masque:255.255.255.255
  30.           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
  31.           RX packets:314 errors:0 dropped:0 overruns:0 frame:0
  32.           TX packets:284 errors:0 dropped:0 overruns:0 carrier:0
  33.           collisions:0 lg file transmission:100
  34.           RX bytes:35577 (34.7 KiB)  TX bytes:116845 (114.1 KiB)


 
 
 
Si quelqu'un a une idée ?!


Message édité par louk007 le 24-03-2011 à 22:35:34

---------------
.. enjoy life .. :)
mood
Publicité
Posté le 23-03-2011 à 14:46:13  profilanswer
 

n°517024
Neo_t3
Posté le 24-03-2011 à 12:23:54  profilanswer
 

Pour ajouter une route la syntaxe c'est : "route add -net 192.168.222.0/24 dev tun0"
 
Pourquoi ne push tu pas tes routes additionnelles dans ta conf OpenVPN directement ?

n°517025
louk007
Posté le 24-03-2011 à 14:13:23  profilanswer
 

huuum pour le serveur  ? comment ?
 

Code :
  1. route add -net 192.168.222.0/24 dev tun0

dejà essyer marche pas


Message édité par louk007 le 24-03-2011 à 14:15:00

---------------
.. enjoy life .. :)
n°517026
Neo_t3
Posté le 24-03-2011 à 14:15:50  profilanswer
 

"route add -net 192.168.222.0/24 172.18.0.1" ?
 
pardon j'avais mal lu je pensais côté server ;)


---------------
Neo_t3 registered Linux user number 354648. | http://www.ondaflow.com
n°517027
louk007
Posté le 24-03-2011 à 19:52:13  profilanswer
 

ca ne marche pas !


---------------
.. enjoy life .. :)
n°517028
louk007
Posté le 24-03-2011 à 19:52:19  profilanswer
 

bouuuuuuuuuuuuuuh


---------------
.. enjoy life .. :)
n°517029
Je@nb
Modérateur
Kindly give dime
Posté le 24-03-2011 à 20:27:09  profilanswer
 

Ce sujet a été déplacé de la catégorie Systèmes & Réseaux Pro vers la categorie Réseaux grand public / SoHo par Je@nb

n°517034
louk007
Posté le 24-03-2011 à 21:13:20  profilanswer
 

j'ai trouvé :

Citation :


Including multiple machines on the client side when using a routed VPN (dev tun)
 
In a typical road-warrior or remote access scenario, the client machine connects to the VPN as a single machine. But suppose the client machine is a gateway for a local LAN (such as a home office), and you would like each machine on the client LAN to be able to route through the VPN.
 
For this example, we will assume that the client LAN is using the 192.168.4.0/24 subnet, and that the VPN client is using a certificate with a common name of client2. Our goal is to set up the VPN so that any machine on the client LAN can communicate with any machine on the server LAN through the VPN.
 
Before setup, there are some basic prerequisites which must be followed:
 
The client LAN subnet (192.168.4.0/24 in our example) must not be exported to the VPN by the server or any other client sites which are using the same subnet. Every subnet which is joined to the VPN via routing must be unique.
The client must have a unique Common Name in its certificate ("client2" in our example), and the duplicate-cn flag must not be used in the OpenVPN server configuration file.
First, make sure that IP and TUN/TAP forwarding is enabled on the client machine.
 
Next, we will deal with the necessary configuration changes on the server side. If the server configuration file does not currently reference a client configuration directory, add one now:
 

Code :
  1. client-config-dir ccd


 
In the above directive, ccd should be the name of a directory which has been pre-created in the default directory where the OpenVPN server daemon runs. On Linux this tends to be /etc/openvpn and on Windows it is usually \Program Files\OpenVPN\config. When a new client connects to the OpenVPN server, the daemon will check this directory for a file which matches the common name of the connecting client. If a matching file is found, it will be read and processed for additional configuration file directives to be applied to the named client.
 
The next step is to create a file called client2 in the ccd directory. This file should contain the line:
 

Code :
  1. iroute 192.168.4.0 255.255.255.0


 
This will tell the OpenVPN server that the 192.168.4.0/24 subnet should be routed to client2.
 
Next, add the following line to the main server config file (not the ccd/client2 file):

Code :
  1. route 192.168.4.0 255.255.255.0


 
Why the redundant route and iroute statements, you might ask? The reason is that route controls the routing from the kernel to the OpenVPN server (via the TUN interface) while iroute controls the routing from the OpenVPN server to the remote clients. Both are necessary.
 
Next, ask yourself if you would like to allow network traffic between client2's subnet (192.168.4.0/24) and other clients of the OpenVPN server. If so, add the following to the server config file.
 
client-to-client
push "route 192.168.4.0 255.255.255.0"
This will cause the OpenVPN server to advertise client2's subnet to other connecting clients.
 
The last step, and one that is often forgotten, is to add a route to the server's LAN gateway which directs 192.168.4.0/24 to the OpenVPN server box (you won't need this if the OpenVPN server box is the gateway for the server LAN). Suppose you were missing this step and you tried to ping a machine (not the OpenVPN server itself) on the server LAN from 192.168.4.8? The outgoing ping would probably reach the machine, but then it wouldn't know how to route the ping reply, because it would have no idea how to reach 192.168.4.0/24. The rule of thumb to use is that when routing entire LANs through the VPN (when the VPN server is not the same machine as the LAN gateway), make sure that the gateway for the LAN routes all VPN subnets to the VPN server machine.
 
Similarly, if the client machine running OpenVPN is not also the gateway for the client LAN, then the gateway for the client LAN must have a route which directs all subnets which should be reachable through the VPN to the OpenVPN client machine.


Message édité par louk007 le 24-03-2011 à 22:35:07

---------------
.. enjoy life .. :)
n°634404
alpha2011
Posté le 26-01-2013 à 05:04:51  profilanswer
 

@louk007 J'ai le même problème mais comme je ne comprend pas bien l'anglais, j'ai pas pigé comment tu as fais? tu peux m'expliquer stp ?
 
MErci

n°634417
louk007
Posté le 26-01-2013 à 08:22:27  profilanswer
 

En résumé tu ne peux pas entrer les routes statiques au client avec route add ! Tu dois spécifier au client les routes à ajouter à sa table par le serveur ... C'est lui qui va lui dire : "ajoute cette route à ta table de routage"
 
C'est dans le fichier de configuration du client sur le serveur qu'il faut rajouter les iroute ...


---------------
.. enjoy life .. :)
mood
Publicité
Posté le 26-01-2013 à 08:22:27  profilanswer
 

n°673601
Makimei
MakimEI
Posté le 08-06-2013 à 15:58:06  profilanswer
 

Bonjour !! je déterre ce topic désolé :/ mais je pense etre dans a peu pres la même situation. j'arrive à ping de chaque coté (et encore pas tout le temps j'ai des pertes de temps en temps je sais pas trop d'où ça vient :/ bref.)  
 
le reseau entreprise est en 192.168.18.x
et chez moi je suis sur du 192.168.1.x (ou 192.168.0.x chez ma copine)
 
et je n'arrive pas du tout à voir les dossiers partages de l'entreprise :/ Et donc encore moins pouvoir lancer une RemoteApp
 
Si je comprend bien je dois configurer le fichier client pour router l'adresse VPN (192.168.5.x) en "adresse entreprise"(192.168.18.x) C'est ça ? et si oui je fais comment ? (je trouve pas non plus de doc avec les options de routage pour OpenVPN :/ )


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Réseaux grand public / SoHo
  Réseaux

  [RESOLU] Routage à travers un VPN avec OpenVPN

 

Sujets relatifs
Reconnection automatique VPN sous win 7Faisabilité et aide pour serveur Nas en VPN
Besoin d'aide pour mon VPNConnexion VPN
Créer serveur VPN sous seven puis s'y connecter via un iphone[LIVEBOX] configuration routage interne
[LIVEBOX] configuration routage interneQuel VPN choisir ?
Transmettre les requêtes DHCP au travers d'OpenVPN 
Plus de sujets relatifs à : [RESOLU] Routage à travers un VPN avec OpenVPN


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR