Linux DNS server BIND configuration - LinuxConfig.org


#1
This article is a quick configuration manual of a Linux DNS server using bind. I believe that bind do not need much introduction, but before you proceed with the installation and configuration of bind nameserver make sure that bind DNS server is exactly what you want.
This is a companion discussion topic for the original entry at https://linuxconfig.org/linux-dns-server-bind-configuration

#2

Groosha

Hello! I did everything as you wrote, dig works fine (both forward and reverse), however curl/wget fail with “Cannot resolve host”. Any ideas?


#3

Lubos Rendek -> Groosha

Paste here both, the dig and wget outputs please. Also check the content of your /etc/resolv.conf


#4

Groosha -> Lubos Rendek

My problem is now solved (I don’t know how honestly), just shut down all test machines yesterday and turned them on tomorrow. Anyway, maybe you might point some errors in my setup.

I have 3 machines all running Ubuntu 16.04 or 17.04 (mixed). I’ll call them Client, Server and Router (the last one is just a gateway to connect Client and Server, so it doesn’t matter at all).
A Server has one interface with 11 IP addresses bound to that single interface. There is also an Apache installed on Server with 10 websites: site1.ruw (yes, incorrect domain name to prevent false DNS queries in the real world) on IP1, site2.ruw on IP2… site10.ruw on IP10 and DNS Server (bind9) on IP11.
A Client has IP11 set as “dns-nameservers” parameter in his local /etc/network/interfaces. Bind9 has both normal DNS and reverse DNS installed so that if:

  1. Client requests “dig site1.ruw”, he receives IP1 (ok)
  2. Client requests “dig -x IP1” he receives site1.ruw (ok).
    However when I tried “curl site1.ruw” or “wget site1.ruw” they both failed because “cannot resolve host site1.ruw”

As I said in the beginning now it works, maybe because DNS caches got invalidated.
/etc/resolv.conf on Client shows IP11 (DNS server on Server) and 127.0.0.53 (stub)


#5

Steven Davidson

It works for me ,but I have one problem. In my network I have 1 host that run on IP 192.168.100.100:8096, I name it emby.home.local. I want DNS to translate IP and Port ,but I get stuck. If I just using the IP it work, but how can I add port that IP so that client just type “emby.home.local” then it go to 192.168.100.100:8096, No need to type: “emby.home.local:8096” the . Any comment to help . Thank


#6

Erwin Balk -> Steven Davidson

an HTTP redirect (the kind that changes the address bar) can never be done in DNS alone; DNS providers who offer this kind of service simply point the name to their own HTTP server and configure the redirect there.

You need to install Apache on the target machine that hosts a page that redirect the user to the correct port. So Apache serves a redirect page on emby.home.local that redirects the user to http(s)://emby.home.local:8096 this is not a limitation of the DNS service but from browsers. http://emby.home.local will always be opening emby.home.local:80
https://emby.home.local will always be opening emby.home.local:443