OPNsense Forum

English Forums => Virtual private networks => Topic started by: gromit on April 26, 2022, 04:07:37 PM

Title: Split DNS for IKEv2 IPSec VPN on macOS
Post by: gromit on April 26, 2022, 04:07:37 PM
I have a "road warrior" IPSec IKEv2 VPN setup that is working for me, at least when it comes to split-tunnelling. I have been trying to get it to work with a split-DNS configuration so that VPN clients only use the VPN-provided DNS servers for the local VPN DNS domain and all other DNS requests (for domains other than that) should use the client's default DNS resolver.  It's the split-DNS setup that isn't working for me.

Can anyone confirm whether or not they've got this working with the built-in IKEv2 client in macOS Big Sur or newer?  If so, what was the magic needed to get this working?

I use Apple Configurator to create IKEv2 VPN profiles for macOS, so I don't mind if the solution involves that.
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: gromit on May 04, 2022, 05:07:56 PM
Here is an update on this from me:

Well, it appears that split-DNS was actually "largely working" for me with the macOS IKEv2 built-in client.  It was the way I was testing it that made it seem like it wasn't working at all.

"Largely working" means that resolver-based client DNS resolution works.  More simply, hostname resolution works for commands such as ssh, ping, curl, etc.  Where DNS resolution fails is for tools such as host and dig. These use the wrong resolver at the client side.  (I had been testing with host and dig.)

Although it would be nice for everything to work, I can live with the "largely working" state right now.  :)

One thing that I did actually have to do to get split-DNS (or any IPSec VPN DNS) working is to add the IPSec client network range as an explicit access list in Services -> Unbound DNS -> Access Lists.  I believe this is because IPSec is not available as an interface to select in Services -> Unbound DNS -> General -> Network Interfaces, and so doesn't get included in the "Internal" access lists.  Without this explicit access list entry, I was getting REFUSED responses to DNS lookups from the VPN client to the server.
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: gromit on May 04, 2022, 05:09:26 PM
PS: If anyone has any insight on how to get DNS tools like host and dig to work from the client side I'd be glad to hear about it.
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: gctwnl on December 03, 2022, 05:17:48 PM
I've also been wrestling with Apple & IPsec.

https://forum.opnsense.org/index.php?topic=31330.0

I read you have a working .mobileconfig that uses cert + XAuth I'd be very happy.
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: gctwnl on December 05, 2022, 04:20:30 PM
I was able to get IKEv2 EAP-RADIUS to work with iOS with all traffic over the VPN without a .mobileconfig file and macOS/iOS devices where each device gets its own IP based o the RADIUS User info. The key elements were:

On the device (macOS, iOS) make sure the certificate and the 'certificate authority' certificate are installed.  Make sure in macOS that they are trusted.
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: ddeacon22 on March 09, 2023, 10:26:08 PM
Are you guys using EAP-RADIUS to get these IKEv2 connection working with macOS and iOS? I decided to migrate from pfSense to OPNsense on the weekend and can't for the life of me get my VPN working following all the guides for OPNsense. I've even tried a direct copy on my config from pfSense where I had EAP-TLS working with nothing but certificates and Apple Configurator profiles but for some reason same config won't work on OPNsense.

Best progress I can make is EAP-RADIUS but the tunnels never some up after successful RADIUS authentication. I'd prefer an EAP-TLS connection but VPN logs say it is not supported on the client, which is wrong as I had it working on pfSense. This is the error I get in OPNsense VPN logs.

16[IKE] <con1|11> configured EAP-only authentication, but peer does not support it
Title: Re: Split DNS for IKEv2 IPSec VPN on macOS
Post by: ddeacon22 on March 12, 2023, 01:16:39 AM
Finally figured it out after a day of troubleshooting certificate extended usage keys. I now have EAP-TLS working through the EAP-RADIUS profile so I am passwordless with client/server certs only.