Skip to main content
added 14 characters in body
Source Link
luckman212
  • 3.7k
  • 3
  • 29
  • 41

One potential solution is to use scoped DNS resolver overrides. I do this for locally-defined hosts as well as for a few VPN connections that I frequently use. This allows you to specify a public anycast DNS resolver e.g. 1.1.1.1 or 8.8.8.8 for general queries, while still allowing certain domains to be explicity resolved via an alternate server(s). This avoids the ambiguity of not knowing which resolver will respond to a query, or whether that response will be correct.

To try this, set your primary OS resolver to 1.1.1.1 in System Settings (e.g. 1.1.1.1). Then, for each domain you wish to override, create a file at /etc/resolver/<domain>

For example, here are the Terminal commands to effect this, routing DNS queries for *.foo.lan to 192.168.4.1:

sudo mkdir -p /etc/resolver            
echo "nameserver 192.168.4.1" | sudo tee -a /etc/resolver/foo.lan

You can specify more than 1 nameserver for the domain file if needed, by simply adding additional nameserver 1.2.3.4 lines.

One potential solution is to use scoped DNS resolver overrides. I do this for locally-defined hosts as well as for a few VPN connections that I frequently use. This allows you to specify a public anycast DNS resolver e.g. 1.1.1.1 or 8.8.8.8 for general queries, while still allowing certain domains to be explicity resolved via an alternate server(s). This avoids the ambiguity of not knowing which resolver will respond to a query, or whether that response will be correct.

To try this, set your OS resolver to 1.1.1.1 in System Settings. Then, for each domain you wish to override, create a file at /etc/resolver/<domain>

For example, here are the Terminal commands to effect this, routing DNS queries for *.foo.lan to 192.168.4.1:

sudo mkdir -p /etc/resolver            
echo "nameserver 192.168.4.1" | sudo tee -a /etc/resolver/foo.lan

You can specify more than 1 nameserver for the domain file if needed, by simply adding additional nameserver 1.2.3.4 lines.

One potential solution is to use scoped DNS resolver overrides. I do this for locally-defined hosts as well as for a few VPN connections that I frequently use. This allows you to specify a public anycast DNS resolver e.g. 1.1.1.1 or 8.8.8.8 for general queries, while still allowing certain domains to be explicity resolved via an alternate server(s). This avoids the ambiguity of not knowing which resolver will respond to a query, or whether that response will be correct.

To try this, set your primary OS resolver in System Settings (e.g. 1.1.1.1). Then, for each domain you wish to override, create a file at /etc/resolver/<domain>

For example, here are the Terminal commands to effect this, routing DNS queries for *.foo.lan to 192.168.4.1:

sudo mkdir -p /etc/resolver            
echo "nameserver 192.168.4.1" | sudo tee -a /etc/resolver/foo.lan

You can specify more than 1 nameserver for the domain file if needed, by simply adding additional nameserver 1.2.3.4 lines.

Source Link
luckman212
  • 3.7k
  • 3
  • 29
  • 41

One potential solution is to use scoped DNS resolver overrides. I do this for locally-defined hosts as well as for a few VPN connections that I frequently use. This allows you to specify a public anycast DNS resolver e.g. 1.1.1.1 or 8.8.8.8 for general queries, while still allowing certain domains to be explicity resolved via an alternate server(s). This avoids the ambiguity of not knowing which resolver will respond to a query, or whether that response will be correct.

To try this, set your OS resolver to 1.1.1.1 in System Settings. Then, for each domain you wish to override, create a file at /etc/resolver/<domain>

For example, here are the Terminal commands to effect this, routing DNS queries for *.foo.lan to 192.168.4.1:

sudo mkdir -p /etc/resolver            
echo "nameserver 192.168.4.1" | sudo tee -a /etc/resolver/foo.lan

You can specify more than 1 nameserver for the domain file if needed, by simply adding additional nameserver 1.2.3.4 lines.