On Fri, 28 Jun 2019 11:44:54 -0500 Dennis Wicks <w...@mgssub.com> wrote:
> Greetings, > > I have apache2 installed on my local machine with a bunch of > virtual hosts that I use for test and development of html, > wordpress, etc. It works fine to access the virt hosts > locally, but I want to access them from other systems on my > local network; windows/IE of various versions, smart phones, > tablets, laptops, etc. > > They all can access my base host name because my DSL > modem/router has DHCP and DNS in it and when it sets up an > address with DHCP it puts an entry in its DNS and everything > is fine. (All systems on the local net use the modem/router > for dns.) But nothing like this happens with the virtual hosts! > > I was thinking that I could setup a nameserver on my machine > with enries in it for the virtual hosts and have my local > network address in the list of nameservers in my > modem/router, and that is where I need the help. > > I have installed bind9, running on buster. So how do I set > up the name server and populate it with the info for my > virtual hosts? Pointers to forums, cookbooks, etc. would be > appreciated as well as hints and tips! > There are probably simpler solutions, but BIND works fine. The thing you need to know is 'rpz', Response Policy Zone. Otherwise you would have to set up a separate zone file for each of your domains. With rpz, you can just throw any hostname and IP address into one file, a sort of /etc/hosts for BIND. This is a good quick tutorial: https://www.redpill-linpro.com/sysadvent/2015/12/08/dns-rpz.html Assuming the standard BIND architecture on Debian hasn't changed in the last few years: the db.rpz file goes in /etc/bind, along with other 'system' db files. The zone definition goes in /etc/bind/named.conf.local. The 'response-policy ( zone "rpz"; );' (don't forget the semicolons) goes in /etc/bind/named.conf.options. Don't worry about the logging. When you add another host to db.rpz, don't forget to increment the serial, which tells BIND that things have changed. The tutorial shows a date-related large number for this, but you can start it at 1. If there's anything that isn't clear, look for more tutorials and compare them, I don't know any more than is in this one. Oh, always check the syslog after restarting BIND. If it finds the slightest error in a configuration file, it will silently fail to restart, or at best, not use the offending zone. -- Joe