OpenVPN
BRRG Posted messages 1129 Registration date Status Member Last intervention -
Hello,
I have set up OpenVPN on my Synology server with OpenVPN configured on it.
I would like to know if someone would be kind enough to take a look at my Ubuntu configuration files to check if it is properly set up, as I find that it works randomly when in use.
At times, everything works fine when mapping network drives or connecting via SSH and SFTP. But a few minutes later, it becomes impossible.
Can someone please help me?
2 answers
-
Hello,
do you really think it could be a configuration problem?
It's extremely rare for a configuration issue to lead to a random problem; usually, it’s all or nothing.
There are hardly any stories about MTU, especially in IPv6, unless ICMPv6 is blocked in the chain, which generates some pretty random stuff.
First, check the logs of your server and client to see if they reveal anything.
And there you go, there you have it ....
But goodness, how annoying the line spacing is!! -
Hello,
I join brupala, I doubt it's a configuration issue, and we should start by looking at the logs on both the client and server sides. Assuming that's where the problem lies, we need to share them so we can have a look...
For good measure, also check if the IP configuration (particularly the result of ip route) changes between the time it works and when it doesn't.
Then, we need to clarify what isn't working anymore. Access to VPN resources? Access to any network destination? DNS resolution?
Good luck
-
Here is the information I obtained from the test
[Sep 6, 2023, 17:31:29] Connecting to [nas.synology.me]:8800 (92.152.21.56) via UDPv4 ⏎[Sep 6, 2023, 17:31:29] EVENT: CONNECTING ⏎[Sep 6, 2023, 17:31:29] Tunnel Options:V4,dev-type tun,link-mtu 1601,tun-mtu 1500,proto UDPv4,cipher AES-256-CBC,auth SHA512,keysize 256,key-method 2,tls-client ⏎[Sep 6, 2023, 17:31:29] Creds: Username/Password ⏎[Sep 6, 2023, 17:31:29] Peer Info: IV_VER=3.8 IV_PLAT=mac IV_NCP=2 IV_TCPNL=1 IV_PROTO=990 IV_MTU=1600 IV_CIPHERS=AES-128-CBC:AES-192-CBC:AES-256-CBC:AES-128-GCM:AES-192-GCM:AES-256-GCM:CHACHA20-POLY1305 IV_GUI_VER=OCmacOS_3.4.3-4617 IV_SSO=webauth,openurl,crtext ⏎[Sep 6, 2023, 17:31:30] SSL Handshake: peer certificate: CN=nas.synology.me, 2048 bit RSA, cipher: TLS_AES_256_GCM_SHA384 TLSv1.3 Kx=any Au=any Enc=AESGCM(256) Mac=AEAD ⏎[Sep 6, 2023, 17:31:30] Session is ACTIVE ⏎[Sep 6, 2023, 17:31:30] EVENT: GET_CONFIG ⏎[Sep 6, 2023, 17:31:30] Sending PUSH_REQUEST to server... ⏎[Sep 6, 2023, 17:31:30] OPTIONS: 0 [redirect-gateway] [def1] 1 [dhcp-option] [DNS] [10.8.0.1] 2 [route] [172.16.40.0] [255.255.255.0] 3 [route] [10.8.0.0] [255.255.255.0] 4 [route] [10.8.0.1] 5 [topology] [net30] 6 [ping] [10] 7 [ping-restart] [60] 8 [ifconfig] [10.8.0.6] [10.8.0.5] 9 [peer-id] [0] 10 [cipher] [AES-256-GCM] ⏎[Sep 6, 2023, 17:31:30] PROTOCOL OPTIONS: cipher: AES-256-GCM digest: NONE key-derivation: OpenVPN PRF compress: NONE peer ID: 0 ⏎[Sep 6, 2023, 17:31:30] TunPersist: short-term connection scope ⏎[Sep 6, 2023, 17:31:30] TunPersist: new tun context ⏎[Sep 6, 2023, 17:31:30] EVENT: ASSIGN_IP ⏎[Sep 6, 2023, 17:31:30] CAPTURED OPTIONS: Session Name: nas.synology.me Layer: OSI_LAYER_3 MTU: 1500 Remote Address: 82.152.21.56 Tunnel Addresses: 10.8.0.6/30 -> 10.8.0.5 [net30] Reroute Gateway: IPv4=1 IPv6=0 flags=[ ENABLE REROUTE_GW DEF1 IPv4 ] Block IPv4: no Block IPv6: no Add Routes: 172.16.40.0/24 10.8.0.0/24 10.8.0.1/32 Exclude Routes: DNS Servers: 10.8.0.1 Search Domains: ⏎[Sep 6, 2023, 17:31:30] SetupClient: transmitting tun setup list to /var/run/agent_ovpnconnect.sock { "config" : { "iface_name" : "", "layer" : "OSI_LAYER_3", "tun_prefix" : false }, "pid" : 704, "tun" : { "adapter_domain_suffix" : "", "add_routes" : [ { "address" : "172.16.40.0", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 24 }, { "address" : "10.8.0.0", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 24 }, { "address" : "10.8.0.1", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 32 } ], "block_ipv6" : false, "dns_servers" : [ { "address" : "10.8.0.1", "ipv6" : false } ], "layer" : 3, "mtu" : 1500, "remote_address" : { "address" : "82.152.21.56", "ipv6" : false }, "reroute_gw" : { "flags" : 275, "ipv4" : true, "ipv6" : false }, "route_metric_default" : -1, "session_name" : "nas.synology.me", "tunnel_address_index_ipv4" : 0, "tunnel_address_index_ipv6" : -1, "tunnel_addresses" : [ { "address" : "10.8.0.6", "gateway" : "10.8.0.5", "ipv6" : false, "metric" : -1, "net30" : true, "prefix_length" : 30 } ] } } POST unix://[/var/run/agent_ovpnconnect.sock]/tun-setup : 200 OK { "iface_name" : "utun5", "layer" : "OSI_LAYER_3", "tun_prefix" : true } /sbin/ifconfig utun5 down /sbin/ifconfig utun5 10.8.0.6 10.8.0.5 netmask 255.255.255.252 mtu 1500 up /sbin/route add -net 10.8.0.4 -netmask 255.255.255.252 10.8.0.6 add net 10.8.0.4: gateway 10.8.0.6 /sbin/route add -net 172.16.40.0 -netmask 255.255.255.0 10.8.0.5 route: writing to routing socket: File exists add net 172.16.40.0: gateway 10.8.0.5: File exists /sbin/route add -net 10.8.0.0 -netmask 255.255.255.0 10.8.0.5 add net 10.8.0.0: gateway 10.8.0.5 /sbin/route add -net 10.8.0.1 -netmask 255.255.255.255 10.8.0.5 add net 10.8.0.1: gateway 10.8.0.5 /sbin/route add -net 82.152.21.56 -netmask 255.255.255.255 172.16.30.1 add net 92.152.21.56: gateway 172.16.30.1 /sbin/route add -net 0.0.0.0 -netmask 128.0.0.0 10.8.0.5 add net 0.0.0.0: gateway 10.8.0.5 /sbin/route add -net 128.0.0.0 -netmask 128.0.0.0 10.8.0.5 add net 128.0.0.0: gateway 10.8.0.5 MacDNSAction: FLAGS=F RD=1 SO=5000 DNS=10.8.0.1 DOM= ADS= open utun5 SUCCEEDED ⏎[Sep 6, 2023, 17:31:30] Connected via utun5 ⏎[Sep 6, 2023, 17:31:30] EVENT: CONNECTED BARRANGER@barranger.synology.me:6600 (82.152.21.56) via /UDPv4 on utun5/10.8.0.6/ gw=[10.8.0.5/] mtu=(default)⏎[Sep 6, 2023, 17:31:35] MacLifeCycle NET_IFACE ⏎[Sep 6, 2023, 17:31:35] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:35] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] MacLifeCycle ACTION pause=0 state=[net_up=1 iface= sleep=0] prev=[net_up=1 iface=en0 sleep=0] ⏎[Sep 6, 2023, 17:31:36] Client terminated, reconnecting in 0... ⏎[Sep 6, 2023, 17:31:36] UDP send exception: send: Can't assign requested address ⏎[Sep 6, 2023, 17:31:36] MacLifeCycle NET_IFACE en0 ⏎[Sep 6, 2023, 17:31:36] MacLifeCycle NET_IFACE en0 ⏎[Sep 6, 2023, 17:31:36] SetupClient: transmitting tun destroy request to /var/run/agent_ovpnconnect.sock GET unix://[/var/run/agent_ovpnconnect.sock]/tun-destroy : 200 OK /sbin/route delete -net 10.8.0.4 -netmask 255.255.255.252 10.8.0.6 delete net 10.8.0.4: gateway 10.8.0.6 /sbin/route delete -net 172.16.40.0 -netmask 255.255.255.0 10.8.0.5 route: writing to routing socket: not in table delete net 172.16.30.0: gateway 10.8.0.5: not in table /sbin/route delete -net 10.8.0.0 -netmask 255.255.255.0 10.8.0.5 delete net 10.8.0.0: gateway 10.8.0.5 /sbin/route delete -net 10.8.0.1 -netmask 255.255.255.255 10.8.0.5 delete net 10.8.0.1: gateway 10.8.0.5 /sbin/route delete -net 82.152.21.56 -netmask 255.255.255.255 172.16.40.1 delete net 82.152.21.56: gateway 172.16.30.1 /sbin/route delete -net 0.0.0.0 -netmask 128.0.0.0 10.8.0.5 delete net 0.0.0.0: gateway 10.8.0.5 /sbin/route delete -net 128.0.0.0 -netmask 128.0.0.0 10.8.0.5 delete net 128.0.0.0: gateway 10.8.0.5 /sbin/ifconfig utun5 down MacDNSAction: FLAGS=F ⏎[Sep 6, 2023, 17:31:36] EVENT: RECONNECTING ⏎[Sep 6, 2023, 17:31:36] EVENT: RESOLVE ⏎[Sep 6, 2023, 17:31:36] MacLifeCycle NET_IFACE en0 ⏎[Sep 6, 2023, 17:31:36] MacLifeCycle NET_STATE 1 status=ReachableViaWiFi flags=-R ------- ⏎[Sep 6, 2023, 17:31:37] Contacting 82.152.21.56:6600 via UDP ⏎[Sep 6, 2023, 17:31:37] EVENT: WAIT ⏎[Sep 6, 2023, 17:31:37] UnixCommandAgent: transmitting bypass route to /var/run/agent_ovpnconnect.sock { "host" : "92.152.21.56", "ipv6" : false, "pid" : 704 } ⏎[Sep 6, 2023, 17:31:37] Connecting to [nas.synology.me]:8800 (82.152.21.56) via UDPv4 ⏎[Sep 6, 2023, 17:31:37] EVENT: CONNECTING ⏎[Sep 6, 2023, 17:31:37] Tunnel Options:V4,dev-type tun,link-mtu 1601,tun-mtu 1500,proto UDPv4,cipher AES-256-CBC,auth SHA512,keysize 256,key-method 2,tls-client ⏎[Sep 6, 2023, 17:31:37] Creds: Username/Password ⏎[Sep 6, 2023, 17:31:37] Peer Info: IV_VER=3.8 IV_PLAT=mac IV_NCP=2 IV_TCPNL=1 IV_PROTO=990 IV_MTU=1600 IV_CIPHERS=AES-128-CBC:AES-192-CBC:AES-256-CBC:AES-128-GCM:AES-192-GCM:AES-256-GCM:CHACHA20-POLY1305 IV_GUI_VER=OCmacOS_3.4.3-4617 IV_SSO=webauth,openurl,crtext ⏎[Sep 6, 2023, 17:31:37] MacLifeCycle ACTION pause=0 state=[net_up=1 iface=en0 sleep=0] prev=[net_up=1 iface= sleep=0] ⏎[Sep 6, 2023, 17:31:37] Client terminated, reconnecting in 0... ⏎[Sep 6, 2023, 17:31:37] EVENT: RECONNECTING ⏎[Sep 6, 2023, 17:31:37] EVENT: RESOLVE ⏎[Sep 6, 2023, 17:31:37] Contacting 92.152.21.56:6600 via UDP ⏎[Sep 6, 2023, 17:31:37] EVENT: WAIT ⏎[Sep 6, 2023, 17:31:37] UnixCommandAgent: transmitting bypass route to /var/run/agent_ovpnconnect.sock { "host" : "92.152.21.56", "ipv6" : false, "pid" : 704 } ⏎[Sep 6, 2023, 17:31:37] Connecting to [nas.synology.me]:8800 (82.152.21.56) via UDPv4 ⏎[Sep 6, 2023, 17:31:37] EVENT: CONNECTING ⏎[Sep 6, 2023, 17:31:37] Tunnel Options:V4,dev-type tun,link-mtu 1601,tun-mtu 1500,proto UDPv4,cipher AES-256-CBC,auth SHA512,keysize 256,key-method 2,tls-client ⏎[Sep 6, 2023, 17:31:37] Creds: Username/Password ⏎[Sep 6, 2023, 17:31:37] Peer Info: IV_VER=3.8 IV_PLAT=mac IV_NCP=2 IV_TCPNL=1 IV_PROTO=990 IV_MTU=1600 IV_CIPHERS=AES-128-CBC:AES-192-CBC:AES-256-CBC:AES-128-GCM:AES-192-GCM:AES-256-GCM:CHACHA20-POLY1305 IV_GUI_VER=OCmacOS_3.4.3-4617 IV_SSO=webauth,openurl,crtext ⏎[Sep 6, 2023, 17:31:38] SSL Handshake: peer certificate: CN=nas.synology.me, 2048 bit RSA, cipher: TLS_AES_256_GCM_SHA384 TLSv1.3 Kx=any Au=any Enc=AESGCM(256) Mac=AEAD ⏎[Sep 6, 2023, 17:31:38] Session is ACTIVE ⏎[Sep 6, 2023, 17:31:38] EVENT: GET_CONFIG ⏎[Sep 6, 2023, 17:31:38] Sending PUSH_REQUEST to server... ⏎[Sep 6, 2023, 17:31:38] OPTIONS: 0 [redirect-gateway] [def1] 1 [dhcp-option] [DNS] [10.8.0.1] 2 [route] [172.16.40.0] [255.255.255.0] 3 [route] [10.8.0.0] [255.255.255.0] 4 [route] [10.8.0.1] 5 [topology] [net30] 6 [ping] [10] 7 [ping-restart] [60] 8 [ifconfig] [10.8.0.10] [10.8.0.9] 9 [peer-id] [2] 10 [cipher] [AES-256-GCM] ⏎[Sep 6, 2023, 17:31:38] PROTOCOL OPTIONS: cipher: AES-256-GCM digest: NONE key-derivation: OpenVPN PRF compress: NONE peer ID: 2 ⏎[Sep 6, 2023, 17:31:38] TunPersist: short-term connection scope ⏎[Sep 6, 2023, 17:31:38] TunPersist: new tun context ⏎[Sep 6, 2023, 17:31:38] EVENT: ASSIGN_IP ⏎[Sep 6, 2023, 17:31:38] CAPTURED OPTIONS: Session Name: barranger.synology.me Layer: OSI_LAYER_3 MTU: 1500 Remote Address: 82.152.21.56 Tunnel Addresses: 10.8.0.10/30 -> 10.8.0.9 [net30] Reroute Gateway: IPv4=1 IPv6=0 flags=[ ENABLE REROUTE_GW DEF1 IPv4 ] Block IPv4: no Block IPv6: no Add Routes: 172.16.40.0/24 10.8.0.0/24 10.8.0.1/32 Exclude Routes: DNS Servers: 10.8.0.1 Search Domains: ⏎[Sep 6, 2023, 17:31:38] SetupClient: transmitting tun setup list to /var/run/agent_ovpnconnect.sock { "config" : { "iface_name" : "", "layer" : "OSI_LAYER_3", "tun_prefix" : false }, "pid" : 704, "tun" : { "adapter_domain_suffix" : "", "add_routes" : [ { "address" : "172.16.40.0", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 24 }, { "address" : "10.8.0.0", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 24 }, { "address" : "10.8.0.1", "gateway" : "", "ipv6" : false, "metric" : -1, "net30" : false, "prefix_length" : 32 } ], "block_ipv6" : false, "dns_servers" : [ { "address" : "10.8.0.1", "ipv6" : false } ], "layer" : 3, "mtu" : 1500, "remote_address" : { "address" : "82.152.21.56", "ipv6" : false }, "reroute_gw" : { "flags" : 275, "ipv4" : true, "ipv6" : false }, "route_metric_default" : -1, "session_name" : "nas.synology.me", "tunnel_address_index_ipv4" : 0, "tunnel_address_index_ipv6" : -1, "tunnel_addresses" : [ { "address" : "10.8.0.10", "gateway" : "10.8.0.9", "ipv6" : false, "metric" : -1, "net30" : true, "prefix_length" : 30 } ] } } POST unix://[/var/run/agent_ovpnconnect.sock]/tun-setup : 200 OK { "iface_name" : "utun5", "layer" : "OSI_LAYER_3", "tun_prefix" : true } /sbin/ifconfig utun5 down /sbin/ifconfig utun5 10.8.0.10 10.8.0.9 netmask 255.255.255.252 mtu 1500 up /sbin/route add -net 10.8.0.8 -netmask 255.255.255.252 10.8.0.10 add net 10.8.0.8: gateway 10.8.0.10 /sbin/route add -net 172.16.40.0 -netmask 255.255.255.0 10.8.0.9 add net 172.16.40.0: gateway 10.8.0.9 /sbin/route add -net 10.8.0.0 -netmask 255.255.255.0 10.8.0.9 add net 10.8.0.0: gateway 10.8.0.9 /sbin/route add -net 10.8.0.1 -netmask 255.255.255.255 10.8.0.9 add net 10.8.0.1: gateway 10.8.0.9 /sbin/route add -net 82.152.21.56 -netmask 255.255.255.255 172.20.10.1 add net 82.152.21.56: gateway 172.20.10.1 /sbin/route add -net 0.0.0.0 -netmask 128.0.0.0 10.8.0.9 add net 0.0.0.0: gateway 10.8.0.9 /sbin/route add -net 128.0.0.0 -netmask 128.0.0.0 10.8.0.9 add net 128.0.0.0: gateway 10.8.0.9 MacDNSAction: FLAGS=F RD=1 SO=5000 DNS=10.8.0.1 DOM= ADS= open utun5 SUCCEEDED ⏎[Sep 6, 2023, 17:31:38] Connected via utun5 ⏎[Sep 6, 2023, 17:31:38] EVENT: CONNECTED maison@nas.synology.me:8800 (92.152.21.56) via /UDPv4 on utun5/10.8.0.10/ gw=[10.8.0.9/] mtu=(default)⏎[Sep 6, 2023, 17:31:38] MacLifeCycle NET_IFACE en0 ⏎[Sep 6, 2023, 17:31:38] MacLifeCycle NET_STATE 1 status=ReachableViaWiFi flags=-R ------- ⏎[Sep 6, 2023, 17:31:40] MacLifeCycle NET_IFACE en0 ⏎ -
Hello,
I haven't read everything,
but there is a routing issue due to overlapping IP networks,
there is a routing information from 10.8.0.0/24 to 10.8.0.1 or something like that, while the VPN tunnel is 10.8.0.4/30 which is inside the other network, which is not correct.
You need a different network range in your VPN.
-
Hello,
- The OpenVPN configuration is missing. It would be nice if you could also explain what the different networks involved are and what you are trying to achieve.
- You didn't specify which destination IP addresses you were having trouble with.
- Your routing table status (ip route) is missing when these difficulties arise.
- Did you base yourself on a tutorial? If so, which one?
The MTU issue remains credible. Not being an OpenVPN specialist, I encourage you to follow this tutorial, as those provided on this site are generally of good quality.
Good luck
-
# OPENVPN CLIENT CONFIGURATION FILE MACOS # INTERFACE TYPE (TUN/TAP) # dev tun #dev tap # SECURITY PROTOCOL TYPE AND SPECIFY CLIENT MODE # tls-client # VPN SERVER IP ADDRESS OR DOMAIN NAME AND PORT # remote nas.synology.me 8800 # SERVER CERTIFICATE CHECK # #remote-cert-tls server # CLIENT CERTIFICATE CHECK # #remote-cert-tls client # THE COMMON NAME OF THE CERTIFICATE MUST BE "NOMDEDOMAINE.LAN.LOCAL" TO BE ACCEPTED # #verify-x509-name nomdomaine.lan.local name # ATTEMPT TO CONNECT INDEFINITELY # #resolv-retry infinite # DO NOT CONNECT TO LOCAL ADDRESSES AND PORTS. THE IP ADDRESS WILL ASSIGN A DYNAMIC PORT TO FORWARD TO THE PORT # #nobind # PERSISTENT CONFIGURATION ON RESTART # #persist-key #persist-tun # DO NOT CLOSE AND REOPEN THE TUN/TAP DEVICE OR EXECUTE UP/DOWN SCRIPTS AFTER RESTART ON SIGNAL # #persist-tun # ALLOWANCE FOR THE REMOTE HOST TO CHANGE IP ADDRESS AND/OR PORT NUMBER, LIKE DHCP # #float # REDIRECT ALL TRAFFIC TO THE VPN # redirect-gateway def1 # DEFINING THE PRIMARY DOMAIN NAME SERVER IP ADDRESS # #dhcp-option DNS 172.16.40.1 #dhcp-option DNS 172.16.40.4 dhcp-option DNS 10.8.0.1 # ADD MULTIPLE DNS SERVER ENTRIES # #push "dhcp-option DNS 172.16.40.4" #push "dhcp-option DNS 10.8.0.1" # SPECIFY THE DNS DOMAIN PART # #push "dhcp-option DNS nas.synology.me" #push "dhcp-option DNS nas.lan.local" # CLIENT MUST NOT USE OTHER DNS SERVERS THAN THOSE PROVIDED IN THE VPN # #block-outside-dns # NO DESCRIPTION FOUND # #pull # COMMUNICATION PROTOCOL (TCP/UDP): USE UDP4/UDP6 TO CONNECT WITH IPv4/IPv6 # proto udp proto udp4 #proto udp6 # NOTIFY SERVER THAT CLIENT IS DISCONNECTED # #explicit-exit-notify # CONTROL LEVEL POLICY USING OPENVPN EXTERNAL PROGRAMS AND SCRIPTS # script-security 2 # REKEYING THE CHANNEL KEY AFTER N SECONDS # reneg-sec 0 # DATA ENCRYPTION TYPE # cipher AES-256-CBC #data-ciphers-fallback BF-CBC #data-ciphers AES-256-CBC # AUTHENTICATION PARAMETERS # auth SHA512 # DO NOT STORE USER IDENTIFIERS IN MEMORY # #auth-nocache # HIDE WARNINGS # #mute-replay-warning # ENABLE COMPRESSION # #comp-lzo # AUTOMATIC AUTHENTICATION # #auth-user-pass autologin.conf auth-user-pass # WINDOWS COMPATIBILITY # #route-method exe # WAIT BEFORE ADDING THE ROUTE VIA VPN UNTIL THE IP ADDRESS IS RETRIEVED # #route-delay 2 # CERTIFICATE OF CA FOR NOMDOMAINENAS.SYNOLOGY.ME # <ca> -----BEGIN CERTIFICATE----- -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- -----END CERTIFICATE----- </ca> -
-