Setup your own dns server


















December 21, The domain name system is a critical part of the internet, but it is often overlooked. Broadly speaking, there are two types of DNS servers. Recursive resolvers are the type users are more likely to be familiar with. When your computer needs to perform a DNS lookup, it will ask a recursive resolver. Authoritative name servers are the source of truth in the domain name system.

When you buy a domain name, in the most technical sense the thing you are buying is the right to act as the authoritative name server for that DNS zone. If you are interesting in learning more about DNS, this webcomic serves as a great introduction. It is possible to own a domain and run a website without giving much of a thought at all to DNS. This is because nearly every domain registrar offers free DNS hosting as a benefit to their customers.

So given this, why would I want to run my own name servers? By the end of this tutorial, we will have a primary DNS server, ns1 , and optionally a secondary DNS server, ns2 , which will serve as a backup. Note: Text that is highlighted in red is important!

It will often be used to denote something that needs to be replaced with your own settings or that it should be modified or added to a configuration file. For example, if you see something like host1. On both servers, edit the bind9 service parameters file:. We will start with configuring the options file.

This is where we will define list of clients that we will allow recursive DNS queries from i. Using our example private IP addresses, we will add ns1 , ns2 , host1 , and host2 to our list of trusted clients:. Now that we have our list of trusted DNS clients, we will want to edit the options block. Currently, the start of the block looks like the following:. Below the directory directive, add the highlighted configuration lines and substitute in the proper ns1 IP address so it looks something like this:.

Now save and exit named. Aside from a few comments, the file should be empty. Here, we will specify our forward and reverse zones. Assuming that our private subnet is If your servers span multiple private subnets but are in the same datacenter, be sure to specify an additional zone and zone file for each distinct subnet.

When you are finished adding all of your desired zones, save and exit the named. Now that our zones are specified in BIND, we need to create the corresponding forward and reverse zone files. According to our named. We will base our forward zone file on the sample db. Copy it to the proper location with the following commands:. First, you will want to edit the SOA record. It should look something like this:.

Now delete the three records at the end of the file after the SOA record. At the end of the file, add your nameserver records with the following lines replace the names with your own. Then add the A records for your hosts that belong in this zone. By submitting your email, you agree to the Terms of Use and Privacy Policy. DNS is the system that translates a domain name like example. This could look like Whenever you make a network request using a domain name, your system will perform a DNS lookup to determine the server address it should contact.

This adds an overhead to every request you make. Although your device will cache DNS responses, visits to new domains will incur a DNS round-trip before the actual request begins.

This occurs at the level of the OS networking stack, invisible to you as the user. Running your own DNS server gives you more control over your network. One common motivation is being able to configure network-level domain mappings, such as web-server to Configuring your router to use your DNS would result in any of your connected devices being able to access An in-house DNS server can also improve performance and provide an extra layer of resilience.

I use dot. In this case, I might setup a myuniquedns. If you use dot. What this does is tell the current domain authority dot. Otherwise it keeps referring back to the. See here for a fuller explanation. Another good explanation is here. To do this you need to check with the authority responsible how this is done, or become the authority yourself. Your two hosts will be called ns1. Note, you may need to wait a few hours or longer for this to take effect.

If really unsure, give it a day. There are two parts this with two files involved: named. The logging at the bottom is optional I think. I added it a while ago, and I leave it in here for interest. Before setting up your dynamic DNS you need to set up your ssh keys so that your home server can access the DNS servers. If there is an error ie there is a new IP address to update on the DNS server , then the subshell is run. You may be wondering why I do this in the age of cloud services and outsourcing.



0コメント

  • 1000 / 1000