unbraid

Guides · Published

WireGuard split tunnel on macOS by IP or app

To set up a WireGuard split tunnel on macOS, list the destination IP ranges you want in the peer’s AllowedIPs. If an entire app should take that tunnel wherever it connects, use a client that can assign routes by app.

The official WireGuard app for Mac supports the first kind of split and has no setting for the second. Forum answers that say “you can’t split tunnel WireGuard on a Mac” usually mean the second. This guide covers both.

Split by address or split by app

A split tunnel decides, for each connection, whether it goes into the tunnel or out over your normal connection.

By destination. The rule looks at where the connection is going. Traffic to 192.168.1.0/24 goes through the tunnel, everything else doesn’t, and every app on the Mac gets the same treatment. The official WireGuard app for Mac sets this up from AllowedIPs.

By app. The rule looks at which program opened the connection. Your browser goes through the tunnel wherever it connects, and your mail app never does. WireGuard doesn’t match traffic by application, so this has to come from the client or from the operating system.

You want What does it In the official WireGuard app
Reach your home or office network, rest of the internet as normal AllowedIPs with those ranges Yes
All IPv4 through the tunnel except your local network Exclude private IPs, or your own list Yes
One app through the tunnel for all its traffic A client with per-app routes No
One app outside a full tunnel A client with per-app routes No

How the official app builds routes

The WireGuard app for macOS runs as a Network Extension. When a tunnel starts, it creates a route for each range in the peer’s AllowedIPs, plus a route for the subnet of the Address line. You can read this in WireGuardKit’s settings generator. WireGuard itself also uses AllowedIPs to decide which peer may carry which destinations, as AllowedIPs explained describes.

With 0.0.0.0/0 that’s all of IPv4. With 192.168.1.0/24, 10.8.0.0/24 it’s your home LAN and the tunnel’s own network. 0.0.0.0/0 covers IPv4 only: IPv6 goes into the tunnel only if you add ::/0 or other IPv6 ranges.

To change an existing tunnel, select it in the WireGuard window, click Edit, change the AllowedIPs line, and click Save. If the tunnel is running, deactivate and activate it to be sure the new routes are in use.

With one peer and 0.0.0.0/0, the editor offers a checkbox, Exclude private IPs. Ticking it replaces the IPv4 default route with a fixed list that leaves out the usual private network ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and a few reserved ones. The config’s DNS servers are added back so lookups still reach them, and your IPv6 ranges stay as they were. Your printer and router stay reachable over the local network.

The app also has On-Demand, which starts the tunnel on Wi-Fi or Ethernet, optionally only on some network names (SSIDs) or on all but some. It decides when the tunnel runs, not which traffic it carries.

A subnet example

Say your home network is 192.168.50.0/24, your WireGuard server at home gives clients addresses in 10.8.0.0/24, and you want to open your NAS at 192.168.50.10 from a café. The client config could look like this (keys and the public address shortened):

[Interface]
PrivateKey = <your private key>
Address = 10.8.0.2/24

[Peer]
PublicKey = <server public key>
Endpoint = home.example.net:51820
AllowedIPs = 192.168.50.0/24, 10.8.0.0/24
PersistentKeepalive = 25

In the WireGuard app, use Import Tunnel(s) from File…. Or choose Add Empty Tunnel…, give it a name, replace the text it generates with your own config, keep the private key from your file and click Save. Then click Activate.

With this config, every app on the Mac reaches the NAS and the server’s tunnel address 10.8.0.1 through WireGuard. Public sites such as example.com load over the café’s Wi-Fi, with the café’s public address.

To reach a single machine instead of the whole LAN, list it with /32, which means one IPv4 address: AllowedIPs = 192.168.50.10/32, 10.8.0.1/32. AllowedIPs takes addresses only, never domain names.

On the server’s side, its [Peer] for you needs 10.8.0.2/32 in AllowedIPs, the server must forward traffic into the LAN, and the NAS must be able to send its replies back, either through a route to 10.8.0.0/24 on your router or through NAT on the WireGuard server. If the NAS doesn’t load by address, check those. If it loads by address but not by name, look at DNS below.

To see which way macOS sends one address, run route -n get 192.168.50.10 in Terminal. The interface line shows a utun interface when the tunnel takes it.

Pick an uncommon range for your home LAN if you can. A café or hotel that also uses 192.168.1.0/24 puts the same addresses on both sides, and the routes conflict.

What happens to DNS

Splitting traffic by address doesn’t split DNS lookups, because the DNS = line doesn’t follow AllowedIPs.

When a config has a DNS = line, the official Mac app makes that server the first choice for ordinary macOS lookups while the tunnel is up, also for sites outside the tunnel. The settings generator sets the tunnel’s DNS to match all domains. Apps with their own DNS, such as a browser using DNS over HTTPS, can still go their own way.

  • DNS = 10.8.0.1 or 192.168.50.1 (a resolver at home, inside AllowedIPs). Ordinary lookups, public names included, travel through the tunnel to your home resolver. Home names work. Public sites still load over the café’s connection, but your home resolver sees the names you look up.
  • DNS = 9.9.9.9 (a public resolver, outside AllowedIPs). macOS tries that server for lookups, over your normal connection, so the network you’re on has to let it through. Names that only your home resolver knows, like nas.home.arpa, don’t resolve.
  • No DNS = line. The app installs no DNS settings and macOS keeps the network’s own resolver. Home names don’t resolve unless that resolver knows them, so open home devices by address.

If you start tunnels with wg-quick from Homebrew’s wireguard-tools instead, it sets the DNS = servers on the Mac’s network services with networksetup (see the wg-quick manual). Those settings aren’t limited to the destinations in AllowedIPs either.

Can you split by app on macOS?

macOS itself supports per-app VPN. Apple’s VPN overview for device deployment describes it for Macs, set up with a per-app VPN mapping payload or a managed app configuration, usually delivered by a device management service. It’s meant for organizations that manage their Macs, and the VPN app has to support it.

The official WireGuard app has no per-app setting. You can’t pick an app in its window, and no AllowedIPs value can say “only Safari”.

On a personal Mac, use a client that supports per-app routing and import the same WireGuard config there. Or split by destination, if the app only talks to a few servers with known addresses. You’ll then need to update AllowedIPs whenever those servers change addresses, and every other app going to the same addresses follows the same route.

One app through WireGuard with unbraid

unbraid for Mac is a VPN client that routes by app. It runs one packet tunnel and uses the program that owns a connection to choose its route. Some connections can’t be matched to a program; VPN for one app only on Mac explains what happens to those and what counts as “the app”. It needs macOS 26 or later and provides no servers, so you import your own WireGuard config. Use Providers for an internet exit and Home access for a home tunnel.

Import an internet exit

The config has to carry the whole internet. unbraid accepts a config whose AllowedIPs covers every public IPv4 address, such as 0.0.0.0/0 or the list Exclude private IPs writes, and it must have exactly one [Peer]. A config that only reaches a few subnets is refused with a message pointing you to Home access. AmneziaWG configs aren’t supported. The tunnel carries IPv4: the config needs an IPv4 Address and IPv4 AllowedIPs, though the server’s Endpoint may be an IPv6 address.

unbraid uses the tunnel for all of an app’s internet traffic, whichever of those lists you import. What happens to your local network is decided by unbraid’s own Home access settings, not by the private ranges the config left out.

  1. Open Settings, Providers, Import WireGuard or OpenVPN File…, choose the .conf, name the server and click Import. It appears under My Servers.
  2. If every other app should use your normal connection, make Direct the default: right-click Direct in the sidebar and choose Make Default. If Direct is already the default, the menu doesn’t offer it.
  3. Click the plus beside Routes, open My Servers, select your server and click Use followed by its name.
  4. In All Apps, open the app’s Route menu and choose that route.
  5. Click Connect. The first time, macOS asks you to allow the network extension and the VPN configuration.

Apps you haven’t assigned now use Direct, and the app you picked uses the WireGuard route for its internet connections, unless a rule under Websites sends a site elsewhere. For the reverse, make the WireGuard route the default and set the one app to Direct.

Import a home tunnel

For a config that only reaches your home network, use Settings, Home access, Home WireGuard tunnel, Import…. unbraid keeps the AllowedIPs ranges that fall entirely inside the private networks it handles (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 and 100.64.0.0/10) and ignores the rest. If none qualify, it uses the private subnet from the config’s Address line. Each app keeps its own route for the internet.

Ordinary app connections to those home ranges go through the home tunnel, even when the app’s internet route is a VPN server in another country. Blocked apps can’t reach the home network.

The home config’s DNS = line isn’t used to look up names, so your lookups don’t all go home. Open home devices by address. If you run a DNS server at home, you can enter it under Settings, Protection, Your own server; when its address is inside the home tunnel’s ranges, unbraid reaches it through that tunnel.

Check the result

  1. A private service. On a network other than your home one, such as a phone hotspot, open your NAS or router by address, http://192.168.50.10. If it loads, the subnet route works. Try it by name too, to see what your DNS setup does.
  2. A public destination. Open an IP check page in the app you care about. With the subnet config above, it shows your normal public address. With an app on a WireGuard route in unbraid, it shows your server’s public address.
  3. A second app. Open the same IP check page in another browser. With an address split, both browsers show the same address, because the routes apply to every app. With an app route, the browser you didn’t assign shows your normal address.

In unbraid you can also select the route in the sidebar while connected. unbraid checks the route’s public address and shows it once the check succeeds. That checks the exit, not which apps use it, so check the address in the browser too. Use an IP check site that has no rule under Websites, or both browsers show that rule’s route.

Questions

Does WireGuard allow split tunneling? Yes, by destination. WireGuard sends the ranges in AllowedIPs to the peer, and the official Mac app routes only those ranges into the tunnel. Splitting by app is up to the client, and the official app doesn’t offer it on macOS.

Can I use split tunneling with a VPN on macOS? Yes. The official WireGuard app splits by address. For per-app rules you need a client that matches programs, or a Mac with per-app VPN set up through device management.

Why does my home server load but public sites feel slow? Check the DNS = line. If it points at a home resolver, ordinary lookups may have to reach your home first, even for sites that then load over your normal connection.

Split tunneling on Mac explains how unbraid handles lookups, home access and the kill switch levels in more depth.

Bring your own VPN

unbraid is a VPN client with no servers of its own. You sign in with an account you already have, or add your own server. It has built-in support for AirVPN, ExpressVPN, IVPN, Mullvad, NordVPN (affiliate link), Private Internet Access, Proton VPN (Free included), Surfshark (affiliate link) and Windscribe. For CyberGhost, you import config files from your account, with step-by-step help in the app.

We earn a commission if you subscribe through a link marked (affiliate link). It helps keep unbraid free. If you're about to subscribe to a VPN service, thank you for considering doing it through one of them.