Re: Setting up bind9/DNS

2019-07-03 Thread Alessandro Vesely
On Fri 28/Jun/2019 22:02:52 +0200 Joe wrote:
> On Fri, 28 Jun 2019 11:44:54 -0500 Dennis Wicks  wrote:
> 
>> 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.
> 
> There are probably simpler solutions, but BIND works fine.

yep!

> 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.

Oh, well, RPZ is certainly a nice addon, but I wouldn't call it a 
simplification.

Actually, BIND doesn't need a file for each host.  It needs a file for each
zone, which is what is called a /zone file/.  So long as all virtual hosts
share the same TLD, they fit on the same zone file.

Bind allows different views.  That feature allows you to use internal network
number and names on the internal view only, in case you use the server also to
maintain a public domain name.

And of course, you can configure ISC DHCP to work with it.


Good luck
Ale
-- 








Re: Setting up bind9/DNS

2019-06-28 Thread Joe
On Fri, 28 Jun 2019 11:44:54 -0500
Dennis Wicks  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



Re: Setting up bind9/DNS

2019-06-28 Thread Bob Weber

On 6/28/19 12:44 PM, Dennis Wicks 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!


TIA!
Dennnis


First you will need to read about Apache virtual hosts here:

http://httpd.apache.org/docs/current/vhosts/name-based.html

Basically what happens is the browser sends the name that it is trying to reach 
in its header and Apache uses that info to direct that request to the 
appropriate directory.  All the different names will point to the same address 
... the address of your host.  To use bind for this then all your hosts on your 
network will have to use the bind DNS server as their DNS server.  I use a 
debian box as my router/firewall so it is easy for me to change DNS entrys for 
my home network.


It might be easier if your router would allow you to add entries to its DNS 
server.  If not then you could use each machines hosts file to put in your 
private addresses.  You will have to make up your own names.  Example:


host1.home

cookbook.home

forum.home

These would all point to the address of host1 but Apache would be able to direct 
the requests to different directories under /var/www depending on the name 
used.  I use this method on a VM at digital ocean to serve 4 or 5 different web 
sites from the one address.


Your apache config might look like this:


    ServerName host1.home
    DocumentRoot "/var/www/host1"



    ServerName cookbook.home
    DocumentRoot "/var/www/cookbook"


etc...

Make sure all the files under /var/www are owned by www-data and group www-data 
(chown www-data.www-data files).


--


*...Bob*


Re: Setting up bind9/DNS

2019-06-28 Thread john doe
On 6/28/2019 6:44 PM, Dennis Wicks 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!
>

I'm not so sure why you need DNS if it is already working assuming that
you are starting with DNS I would suggest you to use Dnsmasq instead of
Bind.

As far as I understand your question, I would simply "open access" to
your web server for all your hosts.

--
John Doe



Setting up bind9/DNS

2019-06-28 Thread Dennis Wicks

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!


TIA!
Dennnis