Open the dnsmasq configuration file by running the following command in your terminal:
sudo nano /usr/local/etc/dnsmasq.conf
Add the following line to include your custom configuration file (replace /Users/codenathan/dnsmasq-snathan.conf with the actual path to your custom configuration file):
conf-file=/Users/codenathan/dnsmasq-snathan.conf
Within this file, specify the domains you want to send to 127.0.0.1. For example:
address=/club/127.0.0.1
address=/cx/127.0.0.1
address=/cz/127.0.0.1
address=/fun/127.0.0.1
address=/icu/127.0.0.1
listen-address=127.0.0.1
You'll need to create additional resolvers for each of these domains. Follow the instructions below.
macOS allows you to configure additional resolvers by creating configuration files in the /etc/resolver/ directory.
If this directory doesn't exist, create it by running the following command:
sudo mkdir -p /etc/resolver
Navigate to the newly created directory:
cd /etc/resolver
For each domain extension (e.g., xyz), create a new configuration file with that extension as the filename (e.g., /etc/resolver/xyz).
nameserver 127.0.0.1
Now, your custom dnsmasq configuration is set up to redirect specified domains to 127.0.0.1, and you have created additional resolvers for each of these domains. Make sure your dnsmasq service is running to apply these changes effectively.