How to I make a domain resolve to different IP's when resolved from internal network and external network?

In BIND 9, you can define multiple "views": in effect, BIND shows one version of a DNS zone to specified clients and another version to others. This seems to be exactly what you'll need.

Here is a nice introduction to using views in BIND 9: https://kb.isc.org/article/AA-00851/0/Understanding-views-in-BIND-9-by-example.html

In your case, though, the external view would say:

match-clients { any; };

rather than specifying any network segments.


There are at least 3 solutions :

  • you can use /etc/hosts to override DNS answers
  • you can use a second tld eg account.codingblocks.com would give 222.222.222.222 and account.example.mytld would give 10.10.10.2
  • you can have 2 different DNS servers (one private and internal and the other public) that would give different results.