DNS Server

From MEPIS Documentation Wiki

Jump to: navigation, search

DNS, or Domain Name Service, is a network service that translates IP addresses into Hostnames and vice-versa. DNS is what allows you to browse the web, get email, or do any other network task using computer or website names rather than numerical addresses. DNS services for the Internet are usually provided to you by your ISP, but you may want to set up your own DNS server for a couple of reasons:

  • To allow you to access services on your home network (file shares, browser-based applications, etc) by hostname
  • To cache DNS entries from your ISP's DNS servers that you use frequently, speeding up your access to outside websites

The most popular and powerful DNS servers for Linux are Bind and TinyDNS (a.k.a. djbdns). Both are available through synaptic, though they are very complex and probably overkill for a home network.


Contents

DNSmasq

Although Bind9, and enterprise-grade, industry-standard DNS server, is available in the repositories, it is also next-to-impossible for mere humans to understand. If you are setting up a DNS server at home, chances are you just want to be able to refer to your home computers by name instead of remembering IP's or keeping up with a /etc/hosts file on every computer.

In this scenario you can set up DNSmasq on your server. DNSmasq is available in the repositories, so you can install thus:

apt-get install dnsmasq

Once installed, DNSmasq uses the local /etc/hosts file to serve up name resolution information on your network. So, if you want your server to resolve hostnames on your local network, you need to enter all of them with their IP addresses into the /etc/hosts file of the server; for example:

192.168.1.1    myrouter
192.168.1.10   mydesktop
192.168.1.11   myserver  

If you would prefer, you can use another separate file instead of the hosts file. You simply need to edit /etc/dnsmasq.conf to point to the new file. First, change the line:

#no-hosts

To

no-hosts

Then, edit the line:

#addn-hosts=

Uncomment it (remove the '#'), and append the path to your list of hosts.

Note that your DNS server *MUST* have a static IP address. You must also open port 53 on your firewall, if it is running.

Setting up Clients to use your DNS server

Once you have installed and configured DNSmasq, Bind, or TinyDNS, you need to configure all your clients to use it.

The Mepis (6.5 or later) way

1. Open Konqueror and go to settings:/Network/ 2. Select the MEPIS Network Assistant 3. Under "Configure Domain Name Service Source", select "Use static DNS" and enter your server's IP address. For secondary, you might want to put the DNS address your ISP provides you, so that if your server fails you can still access the Internet. 4. Click "OK"

The command-line way

You can do this by putting an entry in /etc/resolv.conf:

nameserver <ip of dnsmasq server>

Put this as the first nameserver entry, then your normal DNS server (usually provided by your ISP) as the second.

If you use DHCP

If you use DHCP (dynamic addressing) for your network, and you want to be able to access them by name, you can do one of the following:

  • DNSmasq includes an optional DHCP service that communicates with the DNS server. Check the man page for information on how to activate it.
  • If you have a router doing DHCP, you might be able to assign permanent DHCP addresses using each machine's MAC address. Then you can treat them as if they were on static IP's.

Also note that if you use DHCP, you can just put the DNS information in the DHCP server, so that you don't have to configure each client with the server's IP.

Personal tools
In other languages