Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 12/07/2011, à 18:54

Elève linuxien

Problème route OpenVPN - [Résolu]

Bonjour à tous,

Après avoir lu et testé pendant 2 semaines des tutos, je viens vous demander de l'aide car je n'arrive pas à trouver la solution...

Mon problème est le suivant :
J'ai à mon bureau :
Une box (192.168.1.1), un routeur D-link (192.168.20.1), 1 serveur Ubuntu 10.04 (192.168.20.100) (serveur Ovpn 10.8.0.1), 2 vista et 2 windows 7 (192.168.20.14/15/16/17) => reseau local workgroup
à mon domicile :
1 box, 1 windows 7 (client Ovpn 10.8.0.4)

J'ai monté un OpenVPN sur le serveur, j'arrive à rentrer dans le réseau depuis mon domicile, à ouvrir les dossier sur le serveur sans problème.

Par contre des que je veux atteindre un poste windows sur le réseau local depuis mon domicile j'ai un message d'erreur me disant qu'il y a un problème d'orthographe... Bref, je pense que j'ai un problème de route car je n'arrive pas à faire de Ping sur l'IP d'un windows bureau.

Voici mon fichier de config serveur :

# Which local IP address should OpenVPN
# listen on? (optional)
;local 192.168.20.100

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys. 
dh dh1024.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.8.0.0/10 255.255.255.0

# 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

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 192.168.20.1 255.255.255.0 192.168.20.50 192.168.20.60

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;push "route 192.168.20.15 255.255.255.0"
;push "route 192.168.20.100 255.255.255.0"

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.20.15 255.255.255.248

# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# 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

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
max-clients 10

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nogroup

# 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

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20

pour mon client :

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap
;dev tun


# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote www.toto.fr 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
;resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
user nobody
group nogroup

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca ca.crt
cert client.crt
key client.key

# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server".  This is an
# important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server".  The build-key-server
# script in the easy-rsa folder will do this.
ns-cert-type server

# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
cipher AES-128-CBC

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20

Voilà ou j'en suis sad

Merci de me dire où est l'erreur ou sur quelle piste je dois chercher.

Cdlt.

Dernière modification par Elève linuxien (Le 03/01/2012, à 13:07)


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#2 Le 13/07/2011, à 15:23

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Up, help please... yikes


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#3 Le 19/07/2011, à 00:43

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Up, up...

Je n'ai tout de même pas acquis un niveau qui dépasserait celui des plus calés !

4ème nuit blanche sur ce problème, plus de clope...

Je vais me coucher !


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#4 Le 05/08/2011, à 14:17

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Up, Up, Up.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#5 Le 01/09/2011, à 10:15

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Up, Up, Up, Up,

C'est la rentrée, qq'un peut me donner un petit coup de pouce ??


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#6 Le 01/09/2011, à 15:34

yoyomoony

Re : Problème route OpenVPN - [Résolu]

Salut.

Dans ton fichier de conf' serveur :
push "route 192.168.20.0 255.255.255.0"
Enlève tes deux push route.

Active l'IP forward sur ton serveur :

echo 1 > /proc/sys/net/ipv4/ip_forward

Ajoute une route sur tes deux postes windows pour pouvoir router le trafic :

route add 10.8.0.0 mask 255.255.255.0 192.168.20.100

Pour développer un peu plus ma réponse :
Tes deux push route sont à mon sens invalides, car elles précisent l'ip d'un poste plutot que l'ip d'un réseau.
L'ip de ton réseau est 192.168.20.0/24.
En ce sens, ton client VPN doit savoir quelle route prendre lorsqu'il souhaite accéder à ce réseau.
Plutot que de sortir par sa passerelle par défaut, cette pushroute va lui dire de sortir par l'interface du VPN pour atteindre le réseau 192.168.20.0/24.

Une fois que le paquet a été routé vers ton serveur, il faut que ton serveur soit capable de router ce paquet sur ton réseau local.
L'activation de l'IP forward permet cela.

Une fois que le poste sous windows à reçu le paquet, il faut qu'il sache vers qui le renvoyer.
Il doit le renvoyer au serveur VPN.
Donc, tout ce qui vient de 10.8.0.0/24 doit retourver vers ton serveur vpn 192.168.20.100.

Dis moi si ça a marché.

Bonne journée.

Dernière modification par yoyomoony (Le 02/09/2011, à 11:50)

Hors ligne

#7 Le 22/10/2011, à 13:37

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Merci de ton aide et désolé pour ma réponse tardive.

J'ai suivi tes conseils mais ça marche tjs pas...

Je pense qu'ilfaut que je me penche du coté de l'IP table, mais actuellement je n'ai pas le temps.

Je reviendrai donc résoudre se poste ou demander de l'aide un peu plus tard.

Merci encore.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#8 Le 23/11/2011, à 17:21

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Bonjour à tous !

Eh oui me revoilà, car le problème n'est toujours pas résolu... sad

J'ai relu plusieurs postes, notamment celui de droopy191, celui ci, mais rien de mieux que la dernière fois.

Cependant, j'ai remarqué que mon fichier server.conf est en dev-tap avec la notion server et pas server-bridge. c'est comme cela que j'arrive à atteindre mon serveur de fichier.
J'ai retenté des config de base comme décrit sur le tuto là en mode bridge et routé. La connexion se fait (les deux écrans sont vert) mais je n'ai pas d'ordi dans le réseau de windows.

Dois je maintenir ma config et travailler du coté des routes ?
Configurer en bridge/routé et chercher là aussi comment router pour voir les ordi du réseau ?

Si droopy191 est de passage par ici ses conseils m’intéressent car il a l'air de maitriser OVPN.

Voilà, merci encore à ceux qui se penchent sur mon problème.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#9 Le 23/11/2011, à 21:34

droopy191

Re : Problème route OpenVPN - [Résolu]

Salut,

Le voisinage réseau windows est capricieux ( pour ne pas dire aléatoire). 
Le poste Win7 est tout seul, pas besoin d'ajouter d'autres machines depuis chez vous ?
Quelle est l'adresse du réseau domestique, 192.168.1.0 par ex ?

Une box (192.168.1.1), un routeur D-link (192.168.20.1),

Vous avez donc un sous réseau 192.168.1.0 entre la box et le routeur D-link ? Ca doit etre transparent au vu de votre explication mais c'est pour bien comprendre.

Si oui, à la question 1, je vous proposerais de faire un vpn bridgé entre votre poste seven chez vous et le réseau entreprise. Votre poste aura une ip dans le réseau 192.168.20.0 et ca devrait marcher.
Sinon, je ne suis pas sur de pouvoir vous aider complétement. Le problème est que le voisinage réseau windows ne passe pas bien entre réseaux différents ( c'est tout à fait possible mais c'est plus complexe).

passez votre vpn en "dev tun" et voyez si vous pouvez pinguer le serveur 10.8.0.1 ( c'est pour vérifier que la config vpn est ok)

(Soyez patient, je suis pas trop dispo en ce moment.)

Dernière modification par droopy191 (Le 23/11/2011, à 21:41)

Hors ligne

#10 Le 24/11/2011, à 00:57

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Bonjour,

Merci pour votre aide !

Pour répondre a vos questions :
Le Windows7 est un nomade ; il pourra effectivement y avoir plusieurs nomades (un minimum de deux, dans un premier temps, mais sur différent site)
Le réseau domestique est effectivement en 192.168.1.0
A mon bureau il y a une box (192.168.1.1)->DMZ (wan 192.168.1.14) -> routeur (192.168.20.1) -> PCs (ubuntu 192.168.20.100 + windows 14/15/...)

Lorsque je passe en dev-tun / server 10.8.0.0 les ping ne fonctionnent pas..??
le fichier indique ceci

Wed Nov 23 22:44:07 2011 toto/109.x.x.x:59146 Need IPv6 code in mroute_extract_addr_from_packet

En mode bridge le nomade est bien en 192.168.20.40; là aussi le ping ne fonctionne pas sur le 192.168.20.100..??
le fichier indique ceci :

wed Nov 23 23:10:10 2011 toto/109.x.x.x:52785 Authenticate/Decrypt packet error: bad packet ID (may be a replay): [ #57 ] -- see the man page entry for --no-replay and --replay-window for more info or silence this warning with --mute-replay-warnings

La seul chose qui fonctionne c'est en dev-tap / server 10.8.0.0/24

je remets ci-dessous le fichier server.conf

#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients <-> one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine <-> single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# "C:\\Program Files\\OpenVPN\\config\\foo.key" #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################

# Which local IP address should OpenVPN
# listen on? (optional)
;local 192.168.20.100

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca ca.crt
cert serveurPC.crt
key serveurPC.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys. 
dh dh1024.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
;server 192.168.20.50/60 255.255.255.0
server 10.8.0.0/24 255.255.255.0

# 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

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 192.168.20.100 255.255.255.0 192.168.20.40 192.168.20.50

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;route 192.168.20.0 255.255.255.0 (ne fonctionne pas, coute les connexions VNC) 
;route add -net 192.168.20.0 gw 192.168.20.1
;route add -net 192.168.20.0/200 gw 10.8.0.1
;push "route 192.168.20.0 255.255.255.0"


# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.20.15 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# 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

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
max-clients 10

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nogroup

# 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

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20

Que le voisinage réseau fonctionne ou pas ce n'est pas très important du moment que j'arrive à atteindre les ordi (serveur et windows).

Je ne voie pas quelle peut être mon erreur.

Encore merci.

Cdlt.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#11 Le 24/11/2011, à 10:10

droopy191

Re : Problème route OpenVPN - [Résolu]

la  ligne server est erronée amha

server 10.8.0.0/24 255.255.255.0
->
server 10.8.0.0 255.255.255.0

Ce n'est pas utile pour la suite mais il faut etre sur que toute la partie vpn fonctionne avant d'aller plus loin.


Si ca marche, vous pouvez commencer par aller sur le d-link:
je vous propose de reserver la plage 192.168.20.220 - 192.20.250 pour le vpn
reduisez la plage dhcp du routeur d-link pour cette plage vpn soit en dehors.

Hors ligne

#12 Le 25/11/2011, à 21:29

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

bonjour,

J'ai fait la modification sur le fichier server.conf, mais ça marche pas...

Je lance ovpn sur le server, l'initialisation se fait correctement. Dans le terminal de lancement il est précisé les adresse IP pour les deux nomades en 10.8.0.4 et 8 ; mais quand je connecte le nomade son ip est 10.8.0.10 ???

Dans le terminal de lancement cela met tjs :

Fri Nov 25 19:34:50 2011 toto/x.x.x.x:51957 Need IPv6 code in mroute_extract_addr_from_packet

avec ma config qui fonctionne +/-, lorsque les deux nomades sont connectés j'arrive à les pinguer entre eux (normal je pense puisqu'il sont sur la même plage ip).

Concernant le routeur, j'ai bien mis le dhcp en 192.168.20.2/150 ; mais je ne voie pas ou réserver la plage pour ovpn.

voila. Encore merci de votre aide.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne

#13 Le 28/11/2011, à 10:01

droopy191

Re : Problème route OpenVPN - [Résolu]

Donc vous etes bien en mode routé "dev tun"  sur le serveur et le client?
Le message d'erreur sur ipv6 ne me parait pas bloquant.

Il n'y a pas de plage dhcp à reserver dans la config dur routeur. Il faudra configurer openvpn pour utiliser une plage en dehors de 192.168.20.2/150. Faites aussi attention à ne pas avoir de machine en ip fixe dans la plage ip associée à openvpn.

Ca me semble ok ? qu'est ce qui vous gene "J'ai fait la modification sur le fichier server.conf, mais ça marche pas." ?

Je vous envoie la suite pour le mode bridge.

Dernière modification par droopy191 (Le 28/11/2011, à 10:13)

Hors ligne

#14 Le 28/11/2011, à 10:09

droopy191

Re : Problème route OpenVPN - [Résolu]

Soyez sur d'avoir un accès physique au serveur en cas de mauvaise manip

Installons bridge-utils

apt-get install bridge-utils

Adressage ip du serveur
/etc/network/interfaces

# bridge eth0 sur br0 pour Openvpn
auto br0
iface br0 inet static
    address 192.168.20.200
    netmask 255.255.255.0
    broadcast 192.168.20.255
    gateway 192.168.20.1
    pre-up /etc/openvpn/bridge.sh br0 eth0 tap0 up && /etc/init.d/openvpn start server
    pre-down /etc/init.d/openvpn stop
    post-down /etc/openvpn/bridge.sh br0 eth0 tap0 down

script de montage du bridge
/etc/openvpn/bridge.sh
faites un chmod ug+x  sur le script

#!/bin/sh
# Script de démarrage /arret du BRIDGE vpn
# prend 4 arguments en compte
# $1 nom du BRIDGE
# $2 interface ethernet
# $3 interface du vpn
# $4 arret/démarrage  up/down
# ex:   BRIDGE br0 eth0 tap0 up

BRIDGE=$1
ETH_interface=$2
VPN_interface=$3
updown=$4

case $updown in
"up")
openvpn --mktun --dev $VPN_interface
brctl addbr $BRIDGE
brctl addif $BRIDGE $ETH_interface
brctl addif $BRIDGE $VPN_interface
ifconfig $ETH_interface promisc up
ifconfig $VPN_interface promisc up
;;
"down")
brctl delif $BRIDGE $ETH_interface
brctl delif $BRIDGE $VPN_interface
openvpn --rmtun --dev $VPN_interface
brctl delbr $BRIDGE
;;
esac

fichier  de conf du server

# Which local IP address should OpenVPN
# listen on? (optional)
;local 192.168.20.100

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server?
;proto tcp
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
dev tap0
;dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca ca.crt
cert serveurPC.crt
key serveurPC.key  # This file should be kept secret

# Diffie hellman parameters.
# Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys. 
dh dh1024.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
;server 192.168.20.50/60 255.255.255.0

# 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

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
server-bridge 192.168.20.200 255.255.255.0 192.168.20.201 192.168.20.220

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge

# Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;route 192.168.20.0 255.255.255.0 (ne fonctionne pas, coute les connexions VNC) 
;route add -net 192.168.20.0 gw 192.168.20.1
;route add -net 192.168.20.0/200 gw 10.8.0.1
;push "route 192.168.20.0 255.255.255.0"


# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.20.15 255.255.255.248
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
client-to-client

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn

# 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

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# The maximum number of concurrently connected
# clients we want to allow.
max-clients 10

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nogroup

# 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

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
;log-append  openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20

Empechez openvpn de démarrer en automatique
Editez /etc/default/openvpn

#AUTOSTART="all"
AUTOSTART="none"

redemarrez et priez

Dernière modification par droopy191 (Le 28/11/2011, à 10:13)

Hors ligne

#15 Le 03/01/2012, à 13:06

Elève linuxien

Re : Problème route OpenVPN - [Résolu]

Bonjour à tous et bonne année !!!

Je reviens vers vous car je n'ai pas réussi à faire fonctionner bien que j'ai prié comme me l'a conseillé droopy191.

Donc, pour ne pas continuer à polluer droopy191,  je suis resté sur ma config initial qui me permet de connecter les clients au serveur.

Pour les dossiers entre les Windows (notamment les agendas partagés qui me posaient problème) je les ai fait migrer sur le serveur.

Voilà...

Un grand merci à droopy191 qui a été réactif et qui m'a fait partager ses compétences ! wink

Bon 2012 avec Ubuntu.


"Les ordinateurs sont inutiles : ils ne donnent que les réponses."
Pablo Picasso

Hors ligne