Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #210470 > unrolled thread

Setting up bind9/DNS

Started byDennis Wicks <wix@mgssub.com>
First post2019-06-28 18:50 +0200
Last post2019-07-03 08:50 +0200
Articles 5 — 5 participants

Back to article view | Back to linux.debian.user


Contents

  Setting up bind9/DNS Dennis Wicks <wix@mgssub.com> - 2019-06-28 18:50 +0200
    Re: Setting up bind9/DNS john doe <johndoe65534@mail.com> - 2019-06-28 19:50 +0200
    Re: Setting up bind9/DNS Bob Weber <bobrweber@gmail.com> - 2019-06-28 20:00 +0200
    Re: Setting up bind9/DNS Joe <joe@jretrading.com> - 2019-06-28 22:10 +0200
      Re: Setting up bind9/DNS Alessandro Vesely <vesely@tana.it> - 2019-07-03 08:50 +0200

#210470 — Setting up bind9/DNS

FromDennis Wicks <wix@mgssub.com>
Date2019-06-28 18:50 +0200
SubjectSetting up bind9/DNS
Message-ID<ye2et-60I-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#210471

Fromjohn doe <johndoe65534@mail.com>
Date2019-06-28 19:50 +0200
Message-ID<ye3ax-6Ax-1@gated-at.bofh.it>
In reply to#210470
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

[toc] | [prev] | [next] | [standalone]


#210472

FromBob Weber <bobrweber@gmail.com>
Date2019-06-28 20:00 +0200
Message-ID<ye3ke-6DV-5@gated-at.bofh.it>
In reply to#210470

[Multipart message — attachments visible in raw view] — view raw

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:

<VirtualHost *:80>
     ServerName host1.home
     DocumentRoot "/var/www/host1"
</VirtualHost>

<VirtualHost *:80>
     ServerName cookbook.home
     DocumentRoot "/var/www/cookbook"
</VirtualHost>

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*

[toc] | [prev] | [next] | [standalone]


#210473

FromJoe <joe@jretrading.com>
Date2019-06-28 22:10 +0200
Message-ID<ye5m2-848-9@gated-at.bofh.it>
In reply to#210470
On Fri, 28 Jun 2019 11:44:54 -0500
Dennis Wicks <wix@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

[toc] | [prev] | [next] | [standalone]


#210633

FromAlessandro Vesely <vesely@tana.it>
Date2019-07-03 08:50 +0200
Message-ID<yfHfz-2qk-3@gated-at.bofh.it>
In reply to#210473
On Fri 28/Jun/2019 22:02:52 +0200 Joe wrote:
> On Fri, 28 Jun 2019 11:44:54 -0500 Dennis Wicks <wix@mgssub.com> 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
-- 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web