
In the Network Preference section on your Macbook running MacOS, you can define a Location. This location will allow you to define settings for different locations you will be at. Yet, you may be looking for a more elegant solution that does not require to open the settings each time you switch to another network. If you are using your device (for example: laptop or tablet) almost exclusively at home, this may be a sufficiently good solution for you. The solution could be to always redefine the DNS servers when switching between home and non-home networks. The result is: ‘no internet’, no webpage will load when on a non-home Wi-FI network. This is a problem because for example the McDonald’s Free Wi-Fi network will not recognise the internal IP address of my Raspberry Pi. The problem however I faced on MacOS was the following: when I set a custom DNS server (which pointed to my AdGuard service running on a Raspberry Pi) for my home Wi-FI network, the same DNS server would be used when connecting to other Wi-Fi networks. In the DNS tab, set the DNS server(s) which will be the internal IP address of your PI-Hole or AdGuard instance.Open Network Preferences and select Advanced.On my MacBook Pro, configuring the DNS server is as follows: This requires me to manually set my DNS server for each device. Each DNS request is sent to AdGuard and requests from advertisement networks are blocked.

This is a great adblocking tool – it works basically the same as Pi-Hole (which I tried before using AdGuard and its one of the best Raspberry Pi use cases). Currently I am running AgGuard to block ads when I am connected to my local network via Wi-Fi.
