Indice   FAQ  
Iscriviti  Login
Indice RouterOS RouterOS

Aiuto Creazione VPN

Tutto su questo sistema operativo linux based - Configurazioni, dubbi, problematiche &....

Aiuto Creazione VPN

Messaggioda kris89 » mar 6 mag 2014, 0:06

Come da oggetto ho bisogno di aiuto per la creazione di un tunnel VPN tra un Server Linux e un RB750GL che sarà client, utilizzando OpenVPN...
Ho tentato in passato, scrivendo anche qui, ma nulla... E così ho continuato ad utilizzare " mini client " linux ed IP tables... Però vorrei sfruttare ed imparare ad usare Mikrotik...
Il mio scopo è quello di scavalcare delle reti NAT per poter così mettere in ascolto porte di alcuni hardware che si trovano in essa...
Ho seguito numerose guide, ma con mikrotik non ne vengo proprio a capo... Elenco pertanto cosa faccio :
Codice: Seleziona tutto
Imposto dei DNS 8.8.8.8 8.8.4.4
E dico alla RB di utilizzare quest'ultimi
Importo i certificati
client.crt
client.key
ca.crt
creo un interfaccia ovpn client
setto nome utente client
setto certificato cert1 = client.crt+client.key
salvo

Il link sembra stabilito, ma se provo a fare ping da new terminal verso il server e viceversa ho sempre timeout...
La RB è impostata di default su gateway... dovrei settarla su bridge ?
Ho molti dubbi e spero che qualcuno possa seguirmi un po'...
PS.. Queste RB andranno sempre collegate sotto altri router ( tele*om ecc.. )

Aspetto un aiuto... Saluti kris89
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50

Re: Aiuto Creazione VPN

Messaggioda kris89 » mer 7 mag 2014, 17:19

Un aiuto perfavore..
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50

Re: Aiuto Creazione VPN

Messaggioda xanio » gio 8 mag 2014, 17:15

posta la configurazione della tua RB con un export (nascondi ip e password ovviamente ;)
---
MTCNA - MTCRE
Avatar utente
xanio
Staff rosIT
Staff rosIT
 
Messaggi: 1054
Iscritto il: lun 31 ott 2011, 18:15
Località: Sicilia
Uso routerOS dalla Versione: v4.x
Certificazioni Mikrotik: MTCNA - MTCRE
Altre certificazioni: Milestone - Yeastar - Cambium
Preferred Training Centre: Grifonline

Re: Aiuto Creazione VPN

Messaggioda kris89 » ven 9 mag 2014, 0:39

Eccomi qui con l'export della RB client... Il server è un VPS ubuntu che utilizzo già da tempo con altri client ovpn :

Codice: Seleziona tutto
# jan/02/1970 00:10:02 by RouterOS 5.26

/interface ethernet
set 0 arp=proxy-arp name=ether1-gateway
set 1 arp=proxy-arp name=ether2-master-local
set 2 master-port=ether2-master-local name=ether3-slave-local
set 3 name=ether4-slave-local
set 4 name=ether5-slave-local
/interface ovpn-client
add add-default-route=yes certificate=cert1 connect-to=xxx.zzz.yyy.sss \
    mac-address=xx:zz:yy:aa:qq:ww name=ovpn-out1 port=12345 user=client100
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=ether2-master-local \
    name=default
/interface bridge port
add interface=ether4-slave-local
add interface=ether5-slave-local
add disabled=yes interface=ovpn-out1
/interface pptp-server server
set authentication=pap,chap,mschap1,mschap2 enabled=yes
/ip address
add address=192.168.88.1/24 comment="default configuration" interface=\
    ether2-master-local
add address=192.168.1.250/24 interface=ether1-gateway
/ip dhcp-client
add default-route-distance=0 disabled=no interface=ether1-gateway \
    use-peer-dns=no
/ip dhcp-server network
add address=192.168.88.0/24 comment="default configuration" dns-server=\
    192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add chain=input comment="default configuration" protocol=icmp
add chain=input comment="default configuration" connection-state=\
    established
add chain=input comment="default configuration" connection-state=related
/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" \
    out-interface=ether1-gateway
add action=masquerade chain=srcnat out-interface=ovpn-out1
/ip neighbor discovery
set ether1-gateway disabled=yes
/ip route
add distance=1 gateway=ether1-gateway
/ppp secret
add comment=kris89 local-address=10.10.10.1 name=user1 password=user1 \
    remote-address=10.10.10.2 service=pptp
/tool mac-server
add disabled=no interface=ether2-master-local
add disabled=no interface=ether3-slave-local
add disabled=no interface=ether4-slave-local
add disabled=no interface=ether5-slave-local
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether2-master-local
add interface=ether3-slave-local
add interface=ether4-slave-local
add interface=ether5-slave-local



Con questa configurazione il link risulta stabilito e in running, ma se provo a fare ping da client a server o viceversa ho sempre timeout... come se fosse disconnesso...
Di sicuro ometto qualcosa, delle regole di firewall, di routing ecc.. ma non riesco a trovare cosa !?!?!?!?!

Aiutatemi perfavore...
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50

Re: Aiuto Creazione VPN

Messaggioda xanio » ven 9 mag 2014, 9:48

partiamo dal presupposto che io di solito faccio un bel "system reset-configuration no-default=yes" in modo da avere un router pulito al 100% e fare una configurazione ad-hoc.

Prova a fare la stessa cosa, visto che per il resto la configurazione sembra corretta.
---
MTCNA - MTCRE
Avatar utente
xanio
Staff rosIT
Staff rosIT
 
Messaggi: 1054
Iscritto il: lun 31 ott 2011, 18:15
Località: Sicilia
Uso routerOS dalla Versione: v4.x
Certificazioni Mikrotik: MTCNA - MTCRE
Altre certificazioni: Milestone - Yeastar - Cambium
Preferred Training Centre: Grifonline

Re: Aiuto Creazione VPN

Messaggioda kris89 » dom 11 mag 2014, 0:51

Eccomi dinuovo, ho ripulito il router al 100%, e rieseguito le configurazioni una ad una... ma il risultato sembra sempre lo stesso..
ho questo link vpn stabilito, però da terminale non riesco a fare ping verso il server ( timeout )... e di conseguenza tutte le connessioni che provo a fare risultano inesistenti...
dovrei settare delle regole nel firewall... ?? manca qualcosa alla mia configurazione ?
Aiuto
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50

Re: Aiuto Creazione VPN

Messaggioda ppraz » dom 11 mag 2014, 9:12

Ciao,
credo che il problema possano essere le rotte, cioè vedo solo un default gateway nella conf ma credo servano rotte verso l'altra sede con gateway il tunnel instaurato
Poi vedo che hai applicato "masquerade" anche quando esci dal tunnel VPN e non solo quando esci dalla eth1
Non ho modo di testare la cosa ma a occhio direi che queste due cose potrebbero far cambiare qualcosa
ppraz
Staff rosIT
Staff rosIT
 
Messaggi: 997
Iscritto il: sab 12 mar 2011, 14:13
Uso routerOS dalla Versione: v3.x

Re: Aiuto Creazione VPN

Messaggioda kris89 » dom 11 mag 2014, 19:16

Ciao,
ho provato ad aggiungere manualmente le rotte :

Codice: Seleziona tutto
0.0.0.0/0
gateway ovpn-out1

1.1.1.0/24
gateway ovpn-out1


ho eliminato masquerade come regola sul tunnell, ma niente... risulta un tunnell in running, ma non comunico tra le sedi...
Riepilogo i miei passaggi :

Dal server linux creo i certificati necessari senza utilizzo di password :

Codice: Seleziona tutto
client.key
client.crt
ca.crt


Le configurazioni del server vpn sono le stesse che utilizzo per altre connessioni e funzionano su windows e su linux e sono tcp di tipo tun...

Prendo il router mikrotik :
Codice: Seleziona tutto
con winbox creo un interfaccia gateway su eth1 e una lan master su eth2
creo le regole dhcp e tutto l'occorrente per raggiungere internet
imposto dei server DNS da utilizzare al posto del router isp a cui sono collegato...
verifico che funzioni
importo i certificati vpn creati
creo un interfaccia ovpn client
spunto add defaul route inserendo i parametri di connessione
sembra in running
controllo le rotte e trovo oltre le rotte lan e router isp anche quelle della vpn
a questo punto provo a fare ping da new terminal
ottengo però solo timeout
provo ad aggiungere manualmente le rotte, ma stesso risultato...


Non capisco cosa sbaglio.. eppure online ci sono numerose guide ( spesso tutte diverse tra loro ) ma non riesco a far funzionare niente lo stesso...
Potremmo ricominciare da zero ? Vorrei cercare di capire quello che faccio, dove sbaglio e non buttarmi in un copia incolla...
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50

Re: Aiuto Creazione VPN

Messaggioda jethro » mer 14 mag 2014, 2:09

Lato server cosa dice il log?
Ho notato che nelle conf postate della rb la data è errata, impostala mediante un server ntp altrimenti hai problemi di validità dei certificati.
Ciao.
jethro
Mikrotik Curious User
Mikrotik Curious User
 
Messaggi: 4
Iscritto il: mar 11 mar 2014, 23:24

Re: Aiuto Creazione VPN

Messaggioda kris89 » mer 14 mag 2014, 18:05

Ciao, la data non l'avevo proprio considerata, ora l'ho messa a posto... ma non riesco comunque a connettermi... ecco il log del mio server :


Codice: Seleziona tutto
Wed May 14 11:40:17 2014 us=701239 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1544,tun-mtu 1500,proto TCPv4_CLIENT,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Wed May 14 11:40:17 2014 us=701260 Local Options hash (VER=V4): 'c0103fa8'
Wed May 14 11:40:17 2014 us=701272 Expected Remote Options hash (VER=V4): '69109d17'
Wed May 14 11:40:17 2014 us=701302 TCP connection established with [AF_INET]xxx:14061
Wed May 14 11:40:17 2014 us=701314 TCPv4_SERVER link local: [undef]
Wed May 14 11:40:17 2014 us=701324 TCPv4_SERVER link remote: [AF_INET]xxx:14061
Wed May 14 11:40:17 2014 us=701557 xxx:14061 TLS: Initial packet from [AF_INET]xxx:14061, sid=bfff7830 a36d637b
Wed May 14 11:40:22 2014 us=46402 xxx:14061 VERIFY OK: depth=1, /C=NA/ST=EU/L=NA/O=xxx/OU=NA/CN=xxx/name=NA/emailAddress=xxx
Wed May 14 11:40:22 2014 us=46608 xxx:14061 VERIFY OK: depth=0, /C=NA/ST=EU/L=NA/O=xxx/OU=NA/CN=client7/name=NA/emailAddress=xxx
Wed May 14 11:40:24 2014 us=55863 xxx:14061 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1544', remote='link-mtu 1543'
Wed May 14 11:40:24 2014 us=55940 xxx:14061 WARNING: 'comp-lzo' is present in local config but missing in remote config, local='comp-lzo'
Wed May 14 11:40:24 2014 us=56247 xxx:14061 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed May 14 11:40:24 2014 us=56271 xxx:14061 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed May 14 11:40:24 2014 us=56347 xxx:14061 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed May 14 11:40:24 2014 us=56362 xxx:14061 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed May 14 11:40:24 2014 us=665385 xxx:14061 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Wed May 14 11:40:24 2014 us=665456 xxx:14061 [client7] Peer Connection Initiated with [AF_INET]xxx:14061
Wed May 14 11:40:24 2014 us=665514 client7/xxx:14061 MULTI_sva: pool returned IPv4=1.1.1.6, IPv6=d8c6:47b:7f7f::
Wed May 14 11:40:24 2014 us=665573 client7/xxx:14061 MULTI: Learn: 1.1.1.6 -> client7/xxx:14061
Wed May 14 11:40:24 2014 us=665586 client7/xxx:14061 MULTI: primary virtual IP for client7/xxx:14061: 1.1.1.6
Wed May 14 11:40:24 2014 us=665640 client7/xxx:14061 PUSH: Received control message: 'PUSH_REQUEST'
Wed May 14 11:40:24 2014 us=665652 client7/xxx:14061 send_push_reply(): safe_cap=960
Wed May 14 11:40:24 2014 us=665679 client7/xxx:14061 SENT CONTROL [client7]: 'PUSH_REPLY,route 1.1.1.0 255.255.255.0,topology net30,ping 10,ping-restart 60,ifconfig 1.1.1.6 1.1.1.5' (status=1)
Wed May 14 11:41:35 2014 us=404746 MULTI: multi_create_instance called
Wed May 14 11:41:35 2014 us=404826 Re-using SSL/TLS context
Wed May 14 11:41:35 2014 us=404860 LZO compression initialized
Wed May 14 11:41:35 2014 us=404948 Control Channel MTU parms [ L:1544 D:140 EF:40 EB:0 ET:0 EL:0 ]
Wed May 14 11:41:35 2014 us=404975 Data Channel MTU parms [ L:1544 D:1450 EF:44 EB:135 ET:0 EL:0 AF:3/1 ]
Wed May 14 11:41:35 2014 us=405011 Local Options String: 'V4,dev-type tun,link-mtu 1544,tun-mtu 1500,proto TCPv4_SERVER,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-server'
Wed May 14 11:41:35 2014 us=405020 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1544,tun-mtu 1500,proto TCPv4_CLIENT,comp-lzo,cipher BF-CBC,auth SHA1,keysize 128,key-method 2,tls-client'
Wed May 14 11:41:35 2014 us=405036 Local Options hash (VER=V4): 'c0103fa8'
Wed May 14 11:41:35 2014 us=405048 Expected Remote Options hash (VER=V4): '69109d17'
Wed May 14 11:41:35 2014 us=405078 TCP connection established with [AF_INET]xxx:13442
Wed May 14 11:41:35 2014 us=405091 TCPv4_SERVER link local: [undef]
Wed May 14 11:41:35 2014 us=405100 TCPv4_SERVER link remote: [AF_INET]xxx:13442
Wed May 14 11:41:35 2014 us=425170 xxx:13442 TLS: Initial packet from [AF_INET]xxx:13442, sid=cc013639 65b21be7
Wed May 14 11:41:39 2014 us=881436 xxx:13442 VERIFY OK: depth=1, /C=NA/ST=EU/L=NA/O=xxx/OU=NA/CN=xxx/name=NA/emailAddress=xxx
Wed May 14 11:41:39 2014 us=881726 xxx:13442 VERIFY OK: depth=0, /C=NA/ST=EU/L=NA/O=xxx/OU=NA/CN=client7/name=NA/emailAddress=xxx
Wed May 14 11:41:41 2014 us=800345 xxx:13442 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1544', remote='link-mtu 1543'
Wed May 14 11:41:41 2014 us=800490 xxx:13442 WARNING: 'comp-lzo' is present in local config but missing in remote config, local='comp-lzo'
Wed May 14 11:41:41 2014 us=800728 xxx:13442 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed May 14 11:41:41 2014 us=800746 xxx:13442 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed May 14 11:41:41 2014 us=800806 xxx:13442 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed May 14 11:41:41 2014 us=800820 xxx:13442 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed May 14 11:41:42 2014 us=400113 xxx:13442 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Wed May 14 11:41:42 2014 us=400183 xxx:13442 [client7] Peer Connection Initiated with [AF_INET]xxx:13442
Wed May 14 11:41:42 2014 us=400407 client7/xxx:13442 TCP/UDP: Closing socket
Wed May 14 11:41:42 2014 us=400493 MULTI: new connection by client 'client7' will cause previous active sessions by this client to be dropped.  Remember to use the --duplicate-cn option if you want multiple clients using the same certificate or username to concurrently connect.
Wed May 14 11:41:42 2014 us=400533 MULTI_sva: pool returned IPv4=1.1.1.6, IPv6=387b:77b:7f7f::
Wed May 14 11:41:42 2014 us=400574 MULTI: Learn: 1.1.1.6 -> client7/xxx:13442
Wed May 14 11:41:42 2014 us=400586 MULTI: primary virtual IP for client7/xxx:13442: 1.1.1.6
Wed May 14 11:41:42 2014 us=400633 client7/xxx:13442 PUSH: Received control message: 'PUSH_REQUEST'
Wed May 14 11:41:42 2014 us=400647 client7/xxx:13442 send_push_reply(): safe_cap=960
Wed May 14 11:41:42 2014 us=400673 client7/xxx:13442 SENT CONTROL [client7]: 'PUSH_REPLY,route 1.1.1.0 255.255.255.0,topology net30,ping 10,ping-restart 60,ifconfig 1.1.1.6 1.1.1.5' (status=1)



Ci sono diversi Warning... Configurazioni mancanti nel mio mikrotik client ?
comunque noto che ogni 60 secondi il link cade per poi riconnettersi... ma io comunque in quei secondi non riesco a fare ping o connessioni tra server e client e viceversa...

Ecco le configurazioni lato server :

Codice: Seleziona tutto
port xxxxx
proto tcp
dev tun
ca /etc/openvpn/keys0/ca.crt
cert /etc/openvpn/keys0/VPN_server.crt
key /etc/openvpn/keys0/VPN_server.key
dh /etc/openvpn/keys0/dh1024.pem
server 1.1.1.0 255.255.255.0
max-clients 100
comp-lzo
keepalive 10 60
client-to-client
log-append /etc/openvpn/openvpn.log
status /etc/openvpn/openvpn-status.log
verb 4
client-config-dir /etc/openvpn/ccd



Aiuto
kris89
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 34
Iscritto il: lun 4 nov 2013, 13:50


Prossimo

Torna a RouterOS

Chi c’è in linea

Visitano il forum: Nessuno e 5 ospiti