[Resolved] Can't connect to OpenVPN Server from MacOS Client.

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Locked
fpolig01
OpenVpn Newbie
Posts: 5
Joined: Tue Nov 16, 2021 2:56 pm

[Resolved] Can't connect to OpenVPN Server from MacOS Client.

Post by fpolig01 » Tue Nov 16, 2021 3:19 pm

Fresh install of OpenVPN on Ubuntu 20.04.3 and I'm having issues connecting a client from my MacOS.

I created a client for my iPhone and it connects with no issue (*edit* just tested from Windows box and it works fine), so that seemiling rules out a lot of things. When I look at the server logs located at /var/log/syslog, I see no mention of the connect attempt from the Mac, but I do see all the connection info from the iphone. So there is definitely some sort of disconnect. I was thinking maybe firewall on my Mac?

Here is part of the OpenVPN log file on my MacOS. I see this repeated several times. Any help is appreciated as I'm traveling soon and really would like to be able to access my home network!
Note* I replaced the domain name it's trying to connect to with xxx for privacy.

[Nov 16, 2021, 07:12:45] Connecting to [xxxxxxx.net]:1398 (192.168.0.228) via UDPv4
[Nov 16, 2021, 07:12:55] Server poll timeout, trying next remote entry...
[Nov 16, 2021, 07:12:55] EVENT: RECONNECTING ⏎[Nov 16, 2021, 07:12:55] EVENT: RESOLVE ⏎[Nov 16, 2021, 07:12:55] Contacting 192.168.0.228:1398 via UDP
[Nov 16, 2021, 07:12:55] EVENT: WAIT ⏎[Nov 16, 2021, 07:12:55] UnixCommandAgent: transmitting bypass route to /var/run/agent_ovpnconnect.sock
{
"host" : "192.168.0.228",
"ipv6" : false,
"pid" : 597
}

[Nov 16, 2021, 07:12:55] Connecting to [xxxxxxxxx.ddns.net]:1398 (192.168.0.228) via UDPv4
[Nov 16, 2021, 07:13:05] Server poll timeout, trying next remote entry...
[Nov 16, 2021, 07:13:05] EVENT: RECONNECTING ⏎[Nov 16, 2021, 07:13:05] EVENT: RESOLVE ⏎[Nov 16, 2021, 07:13:05] Contacting 192.168.0.228:1398 via UDP
[Nov 16, 2021, 07:13:05] EVENT: WAIT ⏎[Nov 16, 2021, 07:13:05] UnixCommandAgent: transmitting bypass route to /var/run/agent_ovpnconnect.sock
{
"host" : "192.168.0.228",
"ipv6" : false,
"pid" : 597
}

I also see this message multiple times early in the logs. But havent seen it recently, meaning subsequent attempts to connect do not produce this message, it just produces the messages above.

[Nov 16, 2021, 05:43:35] UDP send exception: send: Can't assign requested address
Last edited by fpolig01 on Tue Nov 16, 2021 3:36 pm, edited 1 time in total.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by TinCanTech » Tue Nov 16, 2021 3:22 pm

fpolig01 wrote:
Tue Nov 16, 2021 3:19 pm
Note* I replaced the domain name it's trying to connect to with xxx for privacy.

[Nov 16, 2021, 07:12:45] Connecting to [xxxxxxx.net]:1398 (192.168.0.228) via UDPv4
Why does your internet Domain name resolve to a non-routable address ?

fpolig01
OpenVpn Newbie
Posts: 5
Joined: Tue Nov 16, 2021 2:56 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by fpolig01 » Tue Nov 16, 2021 3:31 pm

What do you mean by that? If you're asking why is it trying to connect to xxxxxxx.net which is not resolvable, it's because I replaced the values for privacy just in the log file that I shared. In reality, the value is something different which IS resolvable.

If it helps, I also just tested connectivity from a Windows machine and it worked there as well. So it seems to be isolated to something with my Mac.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by TinCanTech » Tue Nov 16, 2021 4:05 pm

What address does Windows resolve the name to ?

fpolig01
OpenVpn Newbie
Posts: 5
Joined: Tue Nov 16, 2021 2:56 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by fpolig01 » Tue Nov 16, 2021 4:35 pm

This is from the windows log. I replaced the values with x's again for privacy. But it's connecting to the same exact domain name that Mac is trying to connect to.

⏎[Nov 16, 2021, 10:26:18] EVENT: CONNECTED [xxxxxx]:1398 (xx.xx.xx.xx) via /UDPv4 on TUN_WIN/10.8.0.3/ gw=[10.8.0.1/]⏎[Nov 16, 2021, 10:26:28] SetupClient: signaling tun destroy event

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by TinCanTech » Tue Nov 16, 2021 4:53 pm

fpolig01 wrote:
Tue Nov 16, 2021 4:35 pm
This is from the windows log. I replaced the values with x's again for privacy. But it's connecting to the same exact domain name
You changed the IP though ..

If your Public DNS name is resolving to an internet-non-routable address then your VPN is not going to work from anywhere except in your LAN.

fpolig01
OpenVpn Newbie
Posts: 5
Joined: Tue Nov 16, 2021 2:56 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by fpolig01 » Tue Nov 16, 2021 6:21 pm

The IP address that I changed IS a public facing IP address. I just copy/pasted it into a browser and it goes where I expect it to. The VPN works on my iPhone outside of my LAN.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by TinCanTech » Tue Nov 16, 2021 7:05 pm

fpolig01 wrote:
Tue Nov 16, 2021 3:19 pm
Connecting to [xxxxxxxxx.ddns.net]:1398 (192.168.0.228) via UDPv4
https://en.wikipedia.org/wiki/Private_network

fpolig01
OpenVpn Newbie
Posts: 5
Joined: Tue Nov 16, 2021 2:56 pm

Re: Can't connect to OpenVPN Server from MacOS Client.

Post by fpolig01 » Tue Nov 16, 2021 7:27 pm

Thank you!! Silly mistake on my part - on the Mac I had an entry in /etc/hosts file for my xxxxx.ddns.net address that I totally forgot about (was doing unrelated testing months ago). Because of this, xxxx.ddns.net was in fact pointing to an internal address on my local network. This explains why it was working on windows, but not my Mac. Windows did not have this entry in the hosts file.

After I commented that line out, it worked immediately.

Locked