Koozali.org: home of the SME Server

openvpn sme lan to lan

Offline MicSme

  • *****
  • 243
  • +0/-0
openvpn sme lan to lan
« on: February 22, 2010, 11:17:37 AM »
Innanzitutto un salutone a tutti!! E subito dopo la domanda...
Sto' sbattendo la testa da un bel po' sulla configurazione di una vpn in sme che abbia
le caratteristiche in oggetto.
Diciamo che livello di vpn road warriors non ci son problemi (openvpn server lato sme e client vpn sia con macchine win che linux), ma se voglio che le due reti si
vedano reciprocamente credo serva una configurazione diversa ...
Qualcuno ha avuto esperienze su questo punto?(x me dolente)
Michele

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #1 on: February 23, 2010, 10:31:40 AM »
...mmm...debbo dedurre come dice Fumetto che ... "nun se po fa'"....
o almeno e' materia per pochi eletti..
la speranza di avere una sola macchina che fa' tutto naufraga sulla vpn
pazienza
un saluto
michele


Offline Fumetto

  • *
  • 899
  • +1/-0
Re: openvpn sme lan to lan
« Reply #2 on: February 23, 2010, 10:34:30 AM »
Non è che "nun se po fa"... nessuno ci ha probabilmente perso tempo nel senso che esistono metodi più "funzionali" per realizzare quello che dici, magari utilizzando altri software/sistemi... ;)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: openvpn sme lan to lan
« Reply #3 on: February 23, 2010, 11:01:45 AM »
...mmm...debbo dedurre come dice Fumetto che ... "nun se po fa'"....
o almeno e' materia per pochi eletti..
la speranza di avere una sola macchina che fa' tutto naufraga sulla vpn
pazienza
un saluto
michele

Michele, lungi da me dal voler polemizzare ma.. questo non è un helpdesk.. significa che chi ti risponde lo fa (senza considerare il quando, che spesso è nel tempo libero) se conosce l'argomento.. ora, se non hai avuto risposta evidentemente qui nessuno ha implementato una cosa del genere..

invece di concludere che "non si può fare", potresti:
- cercare nei forum in inglese (bacino di utenza MOLTO più vasto -> più possibilità)
- cercare su google, perchè SME è linux e quindi si tratta solo di configurazioni.. quindi una ricerca su openvpn (anche generica) può darti l'input

detto questo, il suggerimento di Fumetto è valido.. certe funzioni è meglio delegarle: il firewalling e l'endo point delle vpn possono stare meglio su una macchina dedicata usando strumenti fatti apposta per quello scopo (mi riferisco alle millemila distribuzioni)

ciao

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #4 on: February 23, 2010, 11:32:52 AM »
Grazie dei consigli, resto cmq affascinato dal fatto di avere tutto su un unica
macchina, quindi provo nelle direzioni suggerite da Stefano.
Michele

Offline Fumetto

  • *
  • 899
  • +1/-0
Re: openvpn sme lan to lan
« Reply #5 on: February 23, 2010, 11:35:34 AM »
Se il problema è avere tutto su un'unico server prova a virtualizzare all'interno di SME una distribuzione ad hoc per fare ciò che chiedi (mi pare di averlo già scritto...)

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #6 on: February 24, 2010, 05:12:50 PM »
proseguo in questo topic con una domanda vediamo se a voi viene in mente qualcosa o qualche verifica da fare...
il mio server sme vpn funzia tranquillamente come host to lan
dall'host a pingo il server e viceversa
dall'host b idem cs
ma accidenti...non riesco dall'host a  a pingare il b !!!!!
 :shock:

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: openvpn sme lan to lan
« Reply #7 on: February 24, 2010, 05:53:21 PM »
ma accidenti...non riesco dall'host a  a pingare il b !!!!!

mmmhh... scommetto 1 capello che è un problema di routing...

P.S. i capelli me li taglio a 0 da 20 anni ;-)

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #8 on: February 24, 2010, 06:07:50 PM »
Quote
mmmhh... scommetto 1 capello che è un problema di routing...

che infatti non e' il mio forte cmq:
host A = 10.0.0.100
host B = 10.0.0.101
server = 10.0.0.1
configurazione server:
etc etc..
# Options
keepalive 10 120
push "dhcp-option DOMAIN miodominiodelpiffero.com"
push "dhcp-option DNS 10.0.0.1"
push "dhcp-option WINS 10.0.0.1"

qui' forse ci vorrebbe il famose route ----
pero' e' altresi vero che il file nopn si puo' modificare ..ci vorrebbe un fragment forse

per i capelli io sono a 2 mm circa  :sad:


Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: openvpn sme lan to lan
« Reply #9 on: February 24, 2010, 06:26:55 PM »
mmmh....

mi fai un disegno della situazione, dando maggiori info?

inoltre, sulla macchina remota connessa via vpn, la netmask qual'è?

hai cercato (google --> ) "openvpn routing"?

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #10 on: February 25, 2010, 02:59:38 PM »
ok allora openvpn server installato su sme in modalità gateway
le interfaccie sono:
eth0 lan = 10.0.0.x netmask 255.255.255.0
eth0 wan = 192.168.1.1 netmask 255.255.255.0 (che' il gw che mette telecom sui sui router e tra l'altro non modificabili ...non ho un contratto business...)
a monte della wan c'e' appunto il router telecom con un suo firewall attivo, e sul quale ho fatto il port mapping (aperto le porte) dei servizi che mi servivano sullo sme, per l'openvpn ho aperto la 1194.
configurazione di un client configrato e funzionante (win xp):
Code: [Select]
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# 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 "OpenVPN"

# 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 miodomioniodelpiffero.com 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 nobody

# 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 cert.crt
key key.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 statickey.txt 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x

# 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

configurazione lato server (sme)
Code: [Select]
#------------------------------------------------------------
#        !!DO NOT MODIFY THIS FILE!!
#
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
# Virtual Interface Configuration
port 1194
proto udp
dev tap0

# Drop down privileges
user nobody
group nobody
chroot /etc/openvpn/bridge

persist-key
persist-tun

# Certificates config
dh pub/dh.pem
ca pub/cacert.pem
cert pub/cert.pem
key priv/key.pem

tls-server
tls-auth priv/takey.pem 0



# CRL file for certificates verification
crl-verify pub/cacrl.pem

# Plugin for user-auth


# Server mode
server-bridge 10.0.0.1 255.255.255.0 10.0.0.20 10.0.0.25

# Options
keepalive 10 120
push "dhcp-option DOMAIN miodominiodelpiffero.com"
push "dhcp-option DNS 10.0.0.1"
push "dhcp-option WINS 10.0.0.1"

mtu-test


reneg-sec 3600
nice 5


# Management interface
management localhost 11194 management-pass.txt

# Clients options
client-config-dir ccd
max-clients 20
comp-lzo


# Log
status-version 2
status bridge-status.txt
verb 3

questo e' l'openvpn.conf dello sme

Michele



Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: openvpn sme lan to lan
« Reply #11 on: February 25, 2010, 03:44:57 PM »
ok..

se da un client connesso in vpn dai
Code: [Select]
route print


da prompt, cosa ottieni? e con ipconfig?

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #12 on: February 25, 2010, 04:06:08 PM »
con xp digitando cmd non riesco a copiare e incollare i risultati :D

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #13 on: February 25, 2010, 04:19:56 PM »
ecco allora ho imparato una cosa nuova ...
--> route PRINT
[/code]
Microsoft Windows XP [Versione 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\utente>route PRINT
===========================================================================
Elenco interfacce
0x1 ........................... MS TCP Loopback interface
0x2 ...00 19 db 8d 28 43 ...... Intel(R) PRO/100 VE Network Connection - Minipor
t dell'UtilitÓ di pianificazione pacchetti
0x3 ...00 11 95 24 e0 93 ...... NIC Fast Ethernet PCI Realtek RTL8139 Family - M
iniport dell'UtilitÓ di pianificazione pacchetti
0x4 ...08 00 27 00 0c bd ...... VirtualBox Host-Only Ethernet Adapter - Miniport
 dell'UtilitÓ di pianificazione pacchetti
0x5 ...00 ff 67 93 d3 7d ...... TAP-Win32 Adapter V8 - Miniport dell'UtilitÓ di
pianificazione pacchetti
0x6 ...08 00 27 00 d4 6f ...... VirtualBox Host-Only Ethernet Adapter #2 - Minip
ort dell'UtilitÓ di pianificazione pacchetti
===========================================================================
===========================================================================
Route attive:
Indirizzo rete             Mask             Gateway       Interfac.  Metric
          0.0.0.0          0.0.0.0     192.168.7.254    192.168.7.131       20
         10.0.0.0    255.255.255.0       10.0.0.200      10.0.0.200       30
       10.0.0.200  255.255.255.255        127.0.0.1       127.0.0.1       30
        10.0.10.0    255.255.255.0      10.0.10.254     10.0.10.254       20
      10.0.10.254  255.255.255.255        127.0.0.1       127.0.0.1       20
        10.0.20.0    255.255.255.0      10.0.20.254     10.0.20.254       20
      10.0.20.254  255.255.255.255        127.0.0.1       127.0.0.1       20
   10.255.255.255  255.255.255.255       10.0.0.200      10.0.0.200       30
   10.255.255.255  255.255.255.255      10.0.10.254     10.0.10.254       20
   10.255.255.255  255.255.255.255      10.0.20.254     10.0.20.254       20
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
      169.254.0.0      255.255.0.0     192.168.7.131    192.168.7.131       20
       192.168.7.0    255.255.255.0     192.168.7.131    192.168.7.131       20
     192.168.7.131  255.255.255.255        127.0.0.1       127.0.0.1       20
   172.16.255.255  255.255.255.255     192.168.7.131    192.168.7.131       20
        224.0.0.0        240.0.0.0       10.0.0.200      10.0.0.200       30
        224.0.0.0        240.0.0.0      10.0.10.254     10.0.10.254       20
        224.0.0.0        240.0.0.0      10.0.20.254     10.0.20.254       20
        224.0.0.0        240.0.0.0     192.168.7.131    192.168.7.131       20
  255.255.255.255  255.255.255.255       10.0.0.200               2       1
  255.255.255.255  255.255.255.255       10.0.0.200      10.0.0.200       1
  255.255.255.255  255.255.255.255      10.0.10.254     10.0.10.254       1
  255.255.255.255  255.255.255.255      10.0.20.254     10.0.20.254       1
  255.255.255.255  255.255.255.255     192.168.7.131    192.168.7.131       1
Gateway predefinito:      192.168.7.254
===========================================================================
Route permanenti:
  Nessuno
Code: [Select]
-->ipconfig
[code]
Configurazione IP di Windows


Scheda Ethernet Connessione alla rete locale(LAN)_:

        Stato supporto . . . . . . . . . . . : Supporto disconnesso

Scheda Ethernet Connessione alla rete locale (LAN):

        Suffisso DNS specifico per connessione:
        Indirizzo IP. . . . . . . . . . . . . : 192.168.7.131
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0
        Gateway predefinito . . . . . . . . . : 192.168.7.254

Scheda Ethernet VirtualBox Host-Only Network #(sme):

        Suffisso DNS specifico per connessione:
        Indirizzo IP. . . . . . . . . . . . . : 10.0.10.254
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0
        Gateway predefinito . . . . . . . . . :

Scheda Ethernet OpenVPN:

        Suffisso DNS specifico per connessione: gottardi.gotdns.com
        Indirizzo IP. . . . . . . . . . . . . : 10.0.0.200
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0
        Gateway predefinito . . . . . . . . . :

Scheda Ethernet VirtualBox Host-Only Network #(sme1):

        Suffisso DNS specifico per connessione:
        Indirizzo IP. . . . . . . . . . . . . : 10.0.20.254
        Subnet mask . . . . . . . . . . . . . : 255.255.255.0

Offline MicSme

  • *****
  • 243
  • +0/-0
Re: openvpn sme lan to lan
« Reply #14 on: March 01, 2010, 09:33:22 AM »
Ho risolto , ecco allora mi autorispondo per i posteri:
ho creato un fragment nella cartella
/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf
l'ho chiamato 70routetemplate ed il contenuto e' il seguente
push "route 10.0.0.0 255.255.255.0"
push "route 192.168.7.0 255.255.255.0"
push "route 172.16.7.0 255.255.255.0"
route 192.168.7.0 255.255.255.0"
route 172.16.7.0 255.255.255.0"
client-to-client
dove 10.0.0.0 e' la la dello sme e le altre due sono le rispettive lan dalla quale
si collegano i client
poi naturalmente il solito
Code: [Select]
expand-template /etc/openvpn
adesso i client collegati si pingano
Michele


~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"70routetemplate" 7L, 196C                                    7,0-1         Tut


Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: openvpn sme lan to lan
« Reply #15 on: March 01, 2010, 09:57:50 AM »
Ho risolto , ecco allora mi autorispondo per i posteri:
ho creato un fragment nella cartella
/etc/e-smith/templates/etc/openvpn/bridge/openvpn.conf
l'ho chiamato 70routetemplate ed il contenuto e' il seguente
push "route 10.0.0.0 255.255.255.0"
push "route 192.168.7.0 255.255.255.0"
push "route 172.16.7.0 255.255.255.0"
route 192.168.7.0 255.255.255.0"
route 172.16.7.0 255.255.255.0"
client-to-client
dove 10.0.0.0 e' la la dello sme e le altre due sono le rispettive lan dalla quale
si collegano i client
poi naturalmente il solito
Code: [Select]
expand-template /etc/openvpn
adesso i client collegati si pingano
Michele

ottimo, ma il fragment va in

/etc/e-smith/templates-custom/etc/openvpn/bridge/openvpn.conf ;-)


~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"70routetemplate" 7L, 196C                                    7,0-1         Tut



mmmhh... magie del cut&paste? :)