Anyone who has thought about blocking ads via DNS sinkholing on an iPhone has inadvertently noticed that while Wi-Fi connections allow you to specify a custom DNS server, this is not possible on a cellular connection (e.g., LTE or 5G).

In this blog article I will show you how to get around this limitation and how to configure your iPhone to use AdGuard public resolvers to get DNS-based ad blocking running on your device.

The quirks of local VPN interfaces on an iPhone

While analysing various VPN apps on the AppStore, I noticed that WireGuard for iOS allows the creation of custom VPN configurations, including an option to specify DNS servers. While experimenting with the app, I noticed that no actual foreign VPN server or connection is neccessary to get a local DNS configuration applied to an iPhone.

This means you can set up a local VPN profile in WireGuard, set the AdGuard public DNS as the DNS server and start blocking ads on your iPhone with an on-device configuration!

WireGuard Setup

Go ahead and download the WireGuard app from the AppStore. Afterwards open the app, tap the "+" and hit the button "Create from scratch".

Give your new profile a name (e.g., "local DNS adblock"). Then tap on "Generate keypair". Afterwards, continue entering the following two AdGuard public DNS resolvers as the DNS servers (comma separated):

94.140.14.14, 94.140.15.15

Go ahead and save the profile. It should look like this:

Now you have created your own DNS AdBlock configuration that runs on a local setup (apart from the external DNS resolution)!

Turning On Cellular DNS AdBlocking

As the next step, you just need to enable the newly created interface. This can either be done via WireGuard or by using Apple's Settings App switch:

The Result

While apps like YouTube have taken deeper measures against AdBlocking, our setup works with several apps that have not decided to serve ads through their own domains. This includes in-app advertisements, like typical banners, as well as dynamically loaded ads for some music players or other applications.

The following shows an example of our AdBlock on a BPM counter app:

App serving ads before we activate our local DNS VPN configuration

After enabling the VPN toggle, the ad is blocked, even on a cellular connection!

No ads anymore after enabling the VPN toggle - notice how we are on a cellular connection!

I hope you enjoy ad free iOS apps with this simple solution.

iOS DNS Adblocking while on Cellular

Configuring a loopback VPN interface that uses AdGuard DNS blocking for cellular connections