Verbindungsproblem mit OpenVPN auf OPNsense Systemen

Started by BenMD, November 05, 2019, 02:30:35 PM

Previous topic - Next topic
Hallo liebe Gemeinschaft,

ich habe mir derzeit eine Testumgebung aufgebaut, da wir auf OPNsense umsteigen wollen.
Insgesammt sollen 3 Standorte per VPN vernetzt werden und ich teste derzeit die VPN Dienste.
Bei OpenVPN bin ich da auf ein Problem gestoßen!

Wenn ich OpenVPN im Modus Peer to Peer (Shared Key) betreibe funktioniert das Routing Problemlos.
Einzige einschränkung ist die mangelnde Übertragungsgeschwindigkeit von 2-5 MBytes/sec.
Was ich erstmal auf die virtuelle Umgebung und mein Notebook schieben würde.
Stelle ich jedoch den Server und den Client auf Peer to Peer (SSL/TLS) um, endet die erreichbarkeit mit der IP Adresse des Tunnels auf der Zielseite.

Ping von 192.168.1.100 (Client Site A) auf

192.168.1.1 (GW Site A LAN1) geht 
192.168.2.1 (GW Site A LAN2) geht
192.168.32.128 (WAN Site A) geht 
10.11.11.1 (VPN Site A) geht 
192.168.32.130 (WAN Site B) geht
10.11.11.2 (VPN Site A) geht 

192.168.3.1 (GW Site B LAN1) geht nicht
192.168.3.100 (Client Site B LAN1) geht nicht

Hat von euch einer eine Idee weshalb der Modus Peer to Peer (SSL/TLS) bei mir Probleme macht?

Im 2. Post sende ich die Routingtabellen, VPN Configs und Logs der Fuktionierenden Einstellung per PSK.
Nachfolgend die Netzdiagramme, VPN Configurationen und weitere technische Informationen.
OpenVPN Logs sind als Anlagen beigefütgt.

Im Anschluss daran soll noch MultiWAN dazu kommen.
Ich bedanke mich im Vorraus für hilfreiche hinweise :) und verbleibe mit freundlichen Grüßen :)

Topologie Site A:


      WAN / Internet   -----------------------------------+
            :                                             |
            : Netz: 192.168.32.0/24                       |
            :                                             |
      .-----+-----.  Gateway IP: 192.168.32.2             |
      |  Gateway  |  VM Ware Workstaion                   |
      '-----+-----'                                       |
            |                                             | Open VPN
            |                                             | Netz: 10.11.11.0/24
            |                                             | IP Lokal: 10.11.11.1
            |  WAN                                        |
            |  IP 192.168.32.128                          |
            |                                             |
      .-----+------.                                      |
      |  OPNsense  +--------------------------------------+
      '-----+------'
            |
            |
            |
            |
            +------------------------------------------------+
            |                                                |
            |  LAN 1                                         |  LAN2
            |  Netzadresse:                                  |  Netzadresse:
            |  192.168.1.0/24                                |  192.168.2.0/24
            |  IP GW: 192.168.1.1                            |  IP GW: 192.168.2.1
            |                                                |
      .-----+------.                                   .-----+------.
      | LAN-Switch |                                   | LAN-Switch |
      '-----+------'                                   '-----+------'
            |                                                |
            |                                                |
    ...-----+------...                               ...-----+------...
      192.168.1.100...     Clients Server etc...       192.168.2.100...




Topologie Site B:


      WAN / Internet   -----------------------------------+
            :                                             |
            : Netz: 192.168.32.0/24                       |
            :                                             |
      .-----+-----.  Gateway IP: 192.168.32.2             |
      |  Gateway  |  VM Ware Workstaion                   |
      '-----+-----'                                       |
            |                                             | Open VPN
            |                                             | Netz: 10.11.11.0/24
            |                                             | IP Lokal: 10.11.11.2
            |  WAN                                        |
            |  IP 192.168.32.130                          |
            |                                             |
      .-----+------.                                      |
      |  OPNsense  +--------------------------------------+
      '-----+------'
            |
            |
            |
            |
            +------------------------------------------------+
            |                                                |
            |  LAN 1                                         |  LAN2
            |  Netzadresse:                                  |  Netzadresse:
            |  192.168.3.0/24                                |  192.168.4.0/24
            |  IP GW: 192.168.3.1                            |  IP GW: 192.168.4.1
            |                                                |
      .-----+------.                                   .-----+------.
      | LAN-Switch |                                   | LAN-Switch |
      '-----+------'                                   '-----+------'
            |                                                |
            |                                                |
    ...-----+------...                               ...-----+------...
      192.168.3.100...     Clients Server etc...       192.168.4.100...



Routingtabelle Site A (Server mit SSL/TLS) (Routing bei VPN ohne Funtion):


Proto   Destination                     Gateway             Flags   Use     MTU     Netif   Netif (name)   Expire
ipv4    default                         192.168.32.2        UGS     4415    1500    em0     wan 
ipv4    10.11.11.0/24                   10.11.11.2          UGS     0       1500    ovpns1       
ipv4    10.11.11.1                      link#8              UHS     0       16384   lo0     
ipv4    10.11.11.2                      link#8              UH      0       1500    ovpns1       
ipv4    127.0.0.1                       link#4              UH      15158   16384   lo0     
ipv4    192.168.1.0/24                  link#3              U       131364  1500    em2     LAN1     
ipv4    192.168.1.1                     link#3              UHS     2       16384   lo0     
ipv4    192.168.2.0/24                  link#2              U       0       1500    em1     LAN2     
ipv4    192.168.2.1                     link#2              UHS     0       16384   lo0     
ipv4    192.168.3.0/24                  10.11.11.2          UGS     0       1500    ovpns1       
ipv4    192.168.4.0/24                  10.11.11.2          UGS     0       1500    ovpns1       
ipv4    192.168.32.0/24                 link#1              U       538     1500    em0     wan 
ipv4    192.168.32.2                    00:0c:29:8c:10:0b   UHS     4718    1500    em0     wan 
ipv4    192.168.32.128                  link#1              UHS     0       16384   lo0     
ipv6    ::1                             link#4              UH      148     16384   lo0     
ipv6    fe80::%em0/64                   link#1              U       0       1500    em0     wan 
ipv6    fe80::20c:29ff:fe8c:100b%em0    link#1              UHS     0       16384   lo0     
ipv6    fe80::%em1/64                   link#2              U       0       1500    em1     LAN2     
ipv6    fe80::20c:29ff:fe8c:1029%em1    link#2              UHS     0       16384   lo0     
ipv6    fe80::%em2/64                   link#3              U       6       1500    em2     LAN1     
ipv6    fe80::20c:29ff:fe8c:1033%em2    link#3              UHS     0       16384   lo0     
ipv6    fe80::%lo0/64                   link#4              U       0       16384   lo0     
ipv6    fe80::1%lo0                     link#4              UHS     0       16384   lo0     
ipv6    fe80::20c:29ff:fe8c:100b%ovpns1 link#8              UHS     0       16384   lo0     

Showing 1 to 24 of 24 entries



Routing Tabelle Site B (Client SSL/TLS) (Routing bei VPN ohne Funtion):


Proto   Destination                     Gateway             Flags   Use     MTU     Netif   Netif (name)    Expire
ipv4    default                         192.168.32.2        UGS     4020    1500    em0     wan 
ipv4    10.11.11.0/24                   10.11.11.1          UGS     0       1500    ovpnc1       
ipv4    10.11.11.1                      link#8              UH      0       1500    ovpnc1       
ipv4    10.11.11.2                      link#8              UHS     0       16384   lo0     
ipv4    127.0.0.1                       link#4              UH      21238   16384   lo0     
ipv4    192.168.1.0/24                  10.11.11.1          UGS     0       1500    ovpnc1       
ipv4    192.168.2.0/24                  10.11.11.1          UGS     0       1500    ovpnc1       
ipv4    192.168.3.0/24                  link#3              U       95169   1500    em2     LAN1     
ipv4    192.168.3.1                     link#3              UHS     2       16384   lo0     
ipv4    192.168.4.0/24                  link#2              U       0       1500    em1     LAN2     
ipv4    192.168.4.1                     link#2              UHS     0       16384   lo0     
ipv4    192.168.32.0/24                 link#1              U       419     1500    em0     wan 
ipv4    192.168.32.2                    00:50:56:34:73:5d   UHS     4056    1500    em0     wan 
ipv4    192.168.32.130                  link#1              UHS     0       16384   lo0     
ipv6    ::1                             link#4              UH      148     16384   lo0     
ipv6    fe80::%em0/64                   link#1              U       0       1500    em0     wan 
ipv6    fe80::250:56ff:fe34:735d%em0    link#1              UHS     0       16384   lo0     
ipv6    fe80::%em1/64                   link#2              U       0       1500    em1     LAN2     
ipv6    fe80::250:56ff:fe3a:a97b%em1    link#2              UHS     0       16384   lo0     
ipv6    fe80::%em2/64                   link#3              U       6       1500    em2     LAN1     
ipv6    fe80::250:56ff:fe31:a7c2%em2    link#3              UHS     0       16384   lo0     
ipv6    fe80::%lo0/64                   link#4              U       0       16384   lo0     
ipv6    fe80::1%lo0                     link#4              UHS     0       16384   lo0     
ipv6    fe80::%ovpnc1/64                link#8              U       0       1500    ovpnc1       
ipv6    fe80::250:56ff:fe34:735d%ovpnc1 link#8              UHS     0       16384   lo0     

Showing 1 to 25 of 25 entries



VPN Konfig. Site A (Server mit SSL/TLS) (Routing bei VPN ohne Funtion):
Screenshot siehe Anlage (OPNsesne1-VPN-Config-SSL-TLS.png) oder Text.

root@OPNsense1:/var/etc/openvpn # less server1.conf
dev ovpns1
verb 5
dev-type tun
tun-ipv6
dev-node /dev/tun1
writepid /var/run/openvpn_server1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp
cipher AES-256-CBC
auth SHA512
up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup
down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown
local 192.168.32.128
client-connect "/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_setup_cso.php server1"
tls-server
server 10.11.11.0 255.255.255.0
client-config-dir /var/etc/openvpn-csc/1
ifconfig 10.11.11.1 10.11.11.2
tls-verify "/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_auth_verify tls 'OPNsense1' 1"
lport 1194
management /var/etc/openvpn/server1.sock unix
push "route 192.168.1.0 255.255.255.0"
push "route 192.168.2.0 255.255.255.0"
route 192.168.3.0 255.255.255.0
route 192.168.4.0 255.255.255.0
ca /var/etc/openvpn/server1.ca
cert /var/etc/openvpn/server1.cert
key /var/etc/openvpn/server1.key
dh /usr/local/etc/dh-parameters.4096.sample
crl-verify /var/etc/openvpn/server1.crl-verify
tls-auth /var/etc/openvpn/server1.tls-auth 0
comp-lzo no
topology subnet
sndbuf 524288
rcvbuf 524288
auth-nocache
#client-connect /etc/openvpn/scripts/Connection-Log.sh
#client-disconnect /etc/openvpn/scripts/Connection-Log.sh
script-security 2
#persist-key
#persist-tun

server1.conf (END)



VPN Konfig. Site B (Client mit SSL/TLS) (Routing bei VPN ohne Funtion):
Screenshot siehe Anlage (OPNsense2-VPN-Config-SSL-TLS.png) oder Text.

root@OPNsense2:/var/etc/openvpn # less client1.conf
dev ovpnc1
verb 5
dev-type tun
tun-ipv6
dev-node /dev/tun1
writepid /var/run/openvpn_client1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp
cipher AES-256-CBC
auth SHA512
up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup
down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown
local 192.168.32.130
tls-client
client
lport 0
management /var/etc/openvpn/client1.sock unix
remote 192.168.32.128 1194
ifconfig 10.11.11.2 10.11.11.1
route 192.168.1.0 255.255.255.0
route 192.168.2.0 255.255.255.0
ca /var/etc/openvpn/client1.ca
cert /var/etc/openvpn/client1.cert
key /var/etc/openvpn/client1.key
tls-auth /var/etc/openvpn/client1.tls-auth 1
comp-lzo no
route-nopull
resolv-retry infinite
sndbuf 524288
rcvbuf 524288
auth-nocache
client1.conf (END)




FW Rules Site A (Server):

LAN1:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    LAN1 net * *               * * *         Default allow LAN to any rule    
IPv6 *    LAN1 net * *               * * *         Default allow LAN IPv6 to any rule

LAN2:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    LAN2 net * *               * * *         Default allow LAN to any rule    
IPv6 *    LAN2 net * *               * * *         Default allow LAN IPv6 to any rule

OpenVPN:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    *        * *               * * *         Default allow to any rule    

WAN1:
Protocol       Source Port Destination Port Gateway Schedule Description
IPv4 *         *        * *               * * *         all in (Testzwecke)    
IPv4 TCP/UDP   *        * WAN addr        1194    * *         OpenVPN



FW Rules Site B (Client):

LAN1:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    LAN1 net * *               * * *         Default allow LAN to any rule    
IPv6 *    LAN1 net * *               * * *         Default allow LAN IPv6 to any rule

LAN2:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    LAN2 net * *               * * *         Default allow LAN to any rule    
IPv6 *    LAN2 net * *               * * *         Default allow LAN IPv6 to any rule

OpenVPN:
Protocol  Source Port Destination Port Gateway Schedule Description
IPv4 *    *        * *               * * *         Default allow to any rule    

WAN1:
Protocol       Source Port Destination Port Gateway Schedule Description
IPv4 *         *        * *               * * *         all in (Testzwecke)    

November 05, 2019, 02:47:46 PM #1 Last Edit: November 05, 2019, 02:56:08 PM by BenMD
So hier die Konfiguration ohne Probleme mit PSK.
In der Log.7z sind auch die Logs der nicht laufenden Verbindung.
Bei den Einstellungen mit SSL/TLS wurde die Config mit und ohne Statischem Key versucht.


Routingtabelle Site A (Server mit PSK):


Proto   Destination                     Gateway             Flags   Use     MTU     Netif   Netif (name)    Expire
ipv4    default                         192.168.32.2        UGS     8010    1500    em0     wan 
ipv4    10.11.11.1                      link#8              UHS     0       16384   lo0     
ipv4    10.11.11.2                      link#8              UH      0       1500    ovpns1       
ipv4    127.0.0.1                       link#4              UH      34394   16384   lo0     
ipv4    192.168.1.0/24                  link#3              U       154312  1500    em2     LAN1     
ipv4    192.168.1.1                     link#3              UHS     2       16384   lo0     
ipv4    192.168.2.0/24                  link#2              U       0       1500    em1     LAN2     
ipv4    192.168.2.1                     link#2              UHS     0       16384   lo0     
ipv4    192.168.3.0/24                  10.11.11.2          UGS     0       1500    ovpns1       
ipv4    192.168.4.0/24                  10.11.11.2          UGS     0       1500    ovpns1       
ipv4    192.168.32.0/24                 link#1              U       96846   1500    em0     wan 
ipv4    192.168.32.2                    00:0c:29:8c:10:0b   UHS     56467   1500    em0     wan 
ipv4    192.168.32.128                  link#1              UHS     0       16384   lo0     
ipv6    ::1                             link#4              UH      148     16384   lo0     
ipv6    fe80::%em0/64                   link#1              U       0       1500    em0     wan 
ipv6    fe80::20c:29ff:fe8c:100b%em0    link#1              UHS     0       16384   lo0     
ipv6    fe80::%em1/64                   link#2              U       0       1500    em1     LAN2     
ipv6    fe80::20c:29ff:fe8c:1029%em1    link#2              UHS     0       16384   lo0     
ipv6    fe80::%em2/64                   link#3              U       6       1500    em2     LAN1     
ipv6    fe80::20c:29ff:fe8c:1033%em2    link#3              UHS     0       16384   lo0     
ipv6    fe80::%lo0/64                   link#4              U       0       16384   lo0     
ipv6    fe80::1%lo0                     link#4              UHS     0       16384   lo0     
ipv6    fe80::20c:29ff:fe8c:100b%ovpns1 link#8              UHS     0       16384   lo0     
Showing 1 to 23 of 23 entries



Routing Tabelle Site B (Client PSK):


Proto   Destination                     Gateway             Flags   Use     MTU     Netif   Netif (name)    Expire
ipv4    default                         192.168.32.2        UGS     6612    1500    em0     wan 
ipv4    10.11.11.1                      link#8              UH      0       1500    ovpnc1       
ipv4    10.11.11.2                      link#8              UHS     0       16384   lo0     
ipv4    127.0.0.1                       link#4              UH      42188   16384   lo0     
ipv4    192.168.1.0/24                  10.11.11.1          UGS     0       1500    ovpnc1       
ipv4    192.168.2.0/24                  10.11.11.1          UGS     0       1500    ovpnc1       
ipv4    192.168.3.0/24                  link#3              U       109166  1500    em2     LAN1     
ipv4    192.168.3.1                     link#3              UHS     2       16384   lo0     
ipv4    192.168.4.0/24                  link#2              U       0       1500    em1     LAN2     
ipv4    192.168.4.1                     link#2              UHS     0       16384   lo0     
ipv4    192.168.32.0/24                 link#1              U       22021   1500    em0     wan 
ipv4    192.168.32.2                    00:50:56:34:73:5d   UHS     6651    1500    em0     wan 
ipv4    192.168.32.130                  link#1              UHS     0       16384   lo0     
ipv6    ::1                             link#4              UH      148     16384   lo0     
ipv6    fe80::%em0/64                   link#1              U       0       1500    em0     wan 
ipv6    fe80::250:56ff:fe34:735d%em0    link#1              UHS     0       16384   lo0     
ipv6    fe80::%em1/64                   link#2              U       0       1500    em1     LAN2     
ipv6    fe80::250:56ff:fe3a:a97b%em1    link#2              UHS     0       16384   lo0     
ipv6    fe80::%em2/64                   link#3              U       6       1500    em2     LAN1     
ipv6    fe80::250:56ff:fe31:a7c2%em2    link#3              UHS     0       16384   lo0     
ipv6    fe80::%lo0/64                   link#4              U       0       16384   lo0     
ipv6    fe80::1%lo0                     link#4              UHS     0       16384   lo0     
ipv6    fe80::250:56ff:fe34:735d%ovpnc1 link#8              UHS     0       16384   lo0     
Showing 1 to 23 of 23 entries



VPN Konfig. Site A (Server PSK):
Screenshot siehe Anlage (OPNsesne1-VPN-Config-PSK.png) oder Text.

root@OPNsense1:/var/etc/openvpn # less server1.conf
dev ovpns1
verb 5
dev-type tun
tun-ipv6
dev-node /dev/tun1
writepid /var/run/openvpn_server1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp
cipher AES-256-CBC
auth SHA512
up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup
down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown
local 192.168.32.128
ifconfig 10.11.11.1 10.11.11.2
lport 1194
management /var/etc/openvpn/server1.sock unix
push "route 192.168.1.0 255.255.255.0"
push "route 192.168.2.0 255.255.255.0"
route 192.168.3.0 255.255.255.0
route 192.168.4.0 255.255.255.0
secret /var/etc/openvpn/server1.secret
comp-lzo no
sndbuf 524288
rcvbuf 524288
auth-nocache
#client-connect /etc/openvpn/scripts/Connection-Log.sh
#client-disconnect /etc/openvpn/scripts/Connection-Log.sh
script-security 2
#persist-key
#persist-tun

server1.conf (END)


VPN Konfig. Site B (Client PSK):
Screenshot siehe Anlage (OPNsense2-VPN-Config-PSK.png) oder Text.

root@OPNsense2:/var/etc/openvpn # less client1.conf
dev ovpnc1
verb 5
dev-type tun
tun-ipv6
dev-node /dev/tun1
writepid /var/run/openvpn_client1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp
cipher AES-256-CBC
auth SHA512
up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup
down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown
local 192.168.32.130
lport 0
management /var/etc/openvpn/client1.sock unix
remote 192.168.32.128 1194
ifconfig 10.11.11.2 10.11.11.1
route 192.168.1.0 255.255.255.0
route 192.168.2.0 255.255.255.0
secret /var/etc/openvpn/client1.secret
comp-lzo no
route-nopull
resolv-retry infinite
sndbuf 524288
rcvbuf 524288
auth-nocache
client1.conf (END)

In der PSK-Config ist z. B. der Haken bei "Topology" gesetzt, bei der anderen Config nicht!

Hallo bewue,

mit dem Parameter Topology habe ich bei beiden Konfigurationen rumgetestet ohne erfolg.
PSK geht und SSL nicht.

Weiß sonst noch wer etwas?

Liebe Grüße

In der "OPNsense2-openvpn.log" steht z. B. folgendes (fehlt in "OPNsense2-openvpn-PSK.log")

Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: timers and/or timeouts modified
Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: --ifconfig/up options modified
Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: route-related options modified
Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: peer-id set
Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: adjusting link_mtu to 1625
Nov  5 13:42:12 OPNsense2 openvpn[8916]: OPTIONS IMPORT: data channel crypto options modified


Ich kann mir nicht vorstellen dass dieser Unterschied durch die "Server Mode" Einstellung hervorgerufen wird.
Falls dem so ist wären die Logdaten bei sonst gleichen Settings hilfreich denke ich.

Vielen Dank ich schau mir das mal an.
Bis auf Server Mode von PSK zu SSL und die damit verbundenen Einstellungen wurde nichts umgestellt.
Also Bei SSL dann die Zertifikate halt noch.
Der Rest ist alles gleich ausser das ich wahlweise bei beiden (PSK und SSL) zu testzwecken Topology mal an und aus gestellt hatte.. Was bei SSL aber keine abhilfe brachte.