Sounds like you may want something like PiHole. You can set your local dns using either the web interface or by editing the config at: “/etc/pihole/custom.list”
Self-Hosted Main
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
For Example
- Service: Dropbox - Alternative: Nextcloud
- Service: Google Reader - Alternative: Tiny Tiny RSS
- Service: Blogger - Alternative: WordPress
We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.
Useful Lists
- Awesome-Selfhosted List of Software
- Awesome-Sysadmin List of Software
PiHole is probably the easier option, but if you're cool like me and end up going the Bind route, then the option you are looking for is called Response Policy Zones (or RPZ).
I use pihole and added a custom config to dnsmasq to resolve some domains to a local IP. This is then known as split DNS. Network devices inside my network using pihole as a dns server and gets the local ip.
my_custom_dnsmaq.conf
address=/myservice.example.com/192.168.2.5