Linux DNS server BIND configuration - LinuxConfig.org

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

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?

Lubos Rendek -> Groosha

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

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)

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

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

this not work… you need explain certanly exactly if some these local ip is taken of the pc given command line or what is… all linux support given at most of the times just bad command lines… i just need some facts to create new types of websites, but, It crashes my Linux op as ever support community does… why? is fun crash our op syst… or all of you just ignore the facts that we trust to find and answer to fix our jobs… we all are developers… what a hell are all you think that doing with Us?

that’s selfishness and lack of good manners
Benny Langston

Hi Benjamin Langston,

Welcome to our forums.

Please kindly describe your issue in more detail, which may allow us to understand the problem better. Did you try to set up a BIND server, and it crashed the operating system under it?

Hi Sandmann thanks for this great tutorial ! I made sure to follow it all but whenever i put in the command “sudo systemctl start bind9” it says “Failed to start bind9.service: Unit bind9.service not found.” I tried installing the app again and different names and still didnt work… I believe i need this so that my proxychains can start accepting private proxys other than just TOR… I have been trying to figure this out for a day now, please help