In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use BIND to set up a DNS server on Linux". In daily operation, I believe many people have doubts about how to use BIND to set up a DNS server on Linux. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to use BIND to set up a DNS server on Linux". Next, please follow the editor to study!
Configure BIND
When BIND is installed on your system, you can configure it in a variety of ways. One of the two most commonly used settings is the ISP type setting, where the DNS server accepts and parses requests from anyone (or a set of predefined users), and the other is Web hosting, where the server parses only requests for the service domain name. When the use of the server changes, you can also change the type of configuration at any time.
The DNS server can be either a master server or a secondary server. The master server, also known as the master server, is the final source of the domain name. The master server is also the source of the zone transfer (zone transfer) to the secondary server. The secondary server receives all zone information from the master server. A common mistake is to try to change the zone database file on the secondary server without changing the zone database file (zone file) on the master server. Why two servers? Using redundancy in any configuration is a good idea, which is a native part of BIND and DNS. Fortunately, adding a second Linux machine to the computer room as a secondary DNS server will generally not affect your budget.
Keep in mind that when there are two types of servers, the master server can also act as a secondary server for other domains. This can be seen in most ISP environments where customers have their own master DNS server while using ISP as a secondary server for backup purposes. This type of configuration, as well as almost all other configuration items in BIND, is done through the named.conf file. This file stores server information and zone information in plain text. As shown in Table A.
Named.conf file exampl
Options {notify-source 10.0.0.2; pid-file "/ var/run/named.pid";}; zone "." {type master; file "root.db";}; zone "example.com" {type master; file "/ var/named/sample.com.zone";}
There are a variety of options available for the DNS server, and if you need some special installation, I recommend that you read through the accompanying documentation. In the above example, notify-source indicates where the server sends the zone change notification (NOTIFY) message, which is sent to the secondary server when the master server detects a change in the zone database file. The pid-file option simply tells the daemon (daemon) the path where the ID information is written by the server, usually / var/run/named.pid, but you can change it as needed if you reset the layout of the directory.
In the above example, * zone registration entries are used to inform BIND of where to locate the root server. The server sends and receives not only your own domain information, but also all domain messages on the Internet. Not every server has a registration entry for every domain name, but every server knows how to get information. Of course, since the list is updated regularly, it should also be recorded on a regular basis.
The second zone registration entry in the named.conf sample file is a "master" domain entry, which means that this DNS server holds valid information about example.com, and all other DNS servers on Internet will use it to refer to any information related to this domain. The Example.com entry references the file / var/named / sample.com.zone. This is a plain text file that tells the DNS server all the information about example.com, including the series value, refresh rate, all DNS records, and other items. Table B shows an example of a database file for this area.
Example of DNS zone database file
@ IN SOA ns1.sample.com. (200101111; serial 14400; refresh after 4 hours 3600; retry after 1 hour 604800; expire after 1 week 86400); minimum TTL of 1 day;; Nameservers; IN NS ns1.sample.com. ; IN NS ns2.sample.com. ;; Domain Mail Handlers; sample.com. IN MX 10 mail;; Hosts in order; www IN A 212.204.219.71 ftp IN A 212.204.219.71 mail IN A 212.204.219.71 pop IN CNAME mail
SOA is the abbreviation of Start of Authority, and all zone files should start with it. The sequence number (serial) enables the server to record updates made, and as soon as the number increases after the last startup of the daemon, it reads the information back into the database. For example, you can start at 0 and add a number after each update, or you can use a date item such as 200101111. This is useful because it allows you to see the latest update and to see if there have been multiple updates in a day. The next four lines deal with refresh and timeout periods in seconds. If there is no manual or server-wide refresh of the BIND database, the server will automatically re-read the information. The values listed here do not need to be changed frequently, but only if the fields change their information very frequently for some reason. Then the domain name is listed so that BIND will know who controls the entire domain.
Next up is the MX record, which lets the server know what message should be sent when an e-mail message requests sample.com, and in this case, the priority of mail.samle.com is 10. You can list multiple MX records as backups for your mail server. The smaller the number, the higher the priority. Note that there is also a corresponding A record that gives the IP address of the mail.sample.com, which is necessary so that the DNS server can know how to send mail requests directly based on the domain. An A record simply assigns an IP address to a subdomain entry, such as www, mail, ftp, or ns, which must be entered in the above format and must be associated with an IP address. For example, when a user requests www.sample.com, he will be directed to the IP address 212.104.219.71 of the Web server where the domain is located.
There is also a CNAME entry in the above example. CNAME refers to canonical name, which is used to specify aliases for IP addresses. When using these aliases, you still have to refer back to the A record that has been used.
After looking at the master server section in name.conf, let's take a look at the secondary server section:
Zone "sample2.com" {type slave; file "/ var/named/sample2.com.zone"; master {10.0.0.1;}
One of the two main differences is type, which can be either master or slave, and the other is that the IP address specifies the master DNS server. Everything else is the same as the Master item.
Start BIND
The program used to start the DNS service is named, pronounced "name D". You can run this program by executing the / etc/rc.d/init.d/named start command. If the server is already running, you can use the restart command. This script should be placed in the correct directory at installation time, and it runs the line to initialize the server at startup. You should always check to see if named is running with the ps aux command, which lists all current processes.
At this point, the study on "how to use BIND to set up a DNS server on Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.