There are some important files in this directory:. This file contains all your network information regarding the server and zones you want to resolve locally from nameservers. The named. In other words, zones that are enabled.
By default, BIND is configured to serve the localhost only. This means that any request that comes from outside your server will be rejected by BIND itself unless you have it properly configured. First, we will set the DNS server to listen to all IP addresses to send requests to the DNS server from various places: From the server, from a different network, or when you are using the Internet. Forward lookup zones are the most common kind of zone files.
They map a domain name to an IP address and are used in resolving domain names to IP addresses for email, web pages, etc. The next step is to create a forward lookup zone file. Note : A valid internet-accessible IP address must be set on your server if you plan to resolve external domains from within your network. This is a master domain zone file. Now, we are going to create a file for each zone declared above:.
In this file, replace the values linuxhint with your domain name, followed by a dot. This is necessary, and this is NOT an error. This is required to make the server accessible from the internet. Reverse lookup zones are used to map an IP address into a domain name and are generally required for sending e-mail. The next step is to create a reverse zone file.
Now, we will check the configuration syntax in each file for errors. To do this, we will have a query named with the following command:. DNS is one of the most important services on a server. Everybody uses it. For more information, please check the other articles found on LinuxHint. Because YAML uses indentation and whitespace to define its data structure, make sure that your definition uses consistent indentation to avoid errors. Next, tell Netplan to attempt to use the new configuration file by using netplan try.
If there are problems that cause a loss of networking, Netplan will automatically roll back the changes after a timeout:. If the countdown is updating correctly at the bottom, the new configuration is at least functional enough to not break your SSH connection.
Scroll down until you see the section for your private network interface. You should see the private IP addresses for your DNS servers listed first, followed by some fallback values. Inside, find the dns-nameservers line. If it is attached to the lo interface, move it to your networking interface eth0 or eth1 for example. Next, prepend your own name servers in front of the list that is currently there. Below that line, add a dns-search option pointed to the base domain of your infrastructure.
Now, restart your networking services, applying the new changes with the following commands. Make sure you replace eth0 with the name of your networking interface:. This should restart your network without dropping your current connection. If it worked correctly, you should see something like this:. You may have to substitute eth0 with the name of your primary network interface:. Use nslookup to test if your clients can query your name servers. For example, we can perform a forward lookup to retrieve the IP address of host1.
The output of the command above would look like the following:. If all of the names and IP addresses resolve to the correct values, that means that your zone files are configured properly.
If you receive unexpected values, be sure to review the zone files on your primary DNS server e. Your internal DNS servers are now set up properly! Now we will cover maintaining your zone records. Now that you have a working internal DNS, you need to maintain your DNS records so they accurately reflect your server environment. Whenever you add a host to your environment in the same datacenter , you will want to add it to DNS.
Here is a list of steps that you need to take:. If you remove a host from your environment or want to just take it out of DNS, just remove all the things that were added when you added the server to DNS i. This makes configuration of services and applications easier because you no longer have to remember the private IP addresses, and the files will be easier to read and understand. Also, now you can change your configurations to point to a new servers in a single place, your primary DNS server, instead of having to edit a variety of distributed configuration files, which eases maintenance.
Once you have your internal DNS set up, and your configuration files are using private FQDNs to specify network connections, it is critical that your DNS servers are properly maintained. If they both become unavailable, your services and applications that rely on them will cease to function properly. This is why it is recommended to set up your DNS with at least one secondary server, and to maintain working backups of all of them. Where would you like to share this to? Twitter Reddit Hacker News Facebook.
Share link Tutorial share link. Sign Up. DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source. By Justin Ellingwood Published on September 6, Not using Debian 9? Choose a different version or distribution. Debian 9. Introduction An important part of managing server configuration and infrastructure includes maintaining an easy way to look up network interfaces and IP addresses by name, by setting up a proper Domain Name System DNS.
Prerequisites To complete this tutorial, you will need the following infrastructure. Installing BIND using packages provided with your distribution is the recommended way.
Select this installation mode for an easy installation and to automatically receive updates when available. For details how to install packages, see the distribution's package manager documentation. Alternatively, use your operating system tools, such as systemctl or service , to start the daemon.
See your distribution's documentation for details. Anonymous Not logged in Create account Log in. Namespaces Page Discussion.
0コメント