Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Steps for linux to build a cached domain name server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "the steps of building a cached domain name server in linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Build a cached domain name server

Specific steps:

Insert the installation CD and mount it, then install the bind package and related packages. As shown in the figure:

Edit the main configuration file.

The main configuration file named.conf is usually located in the / etc/ directory. If the bind-chroot package is installed, the main configuration file is located in the / var/named/chroot/etc/ directory by default and needs to be manually created by the user. In the named.conf file, it mainly includes two parts: global configuration and regional configuration. The line of each configuration record ends with a semicolon, and the part starting with the sign "#" or "/ /" indicates the comment file (large comments can be in the format of "/ … /"). As shown in the figure:

In the above configuration content, other configuration items can be omitted except that the directory item is usually retained. If the listen-on configuration item is not specified, named listens to the service on UDP port 53 of all interfaces by default; when the allow-query configuration item is not specified, it will respond to query requests from all clients by default. Configuration items such as dump-file, statistics-file, memstatistics-file, etc., are used to specify the location of cached database files and state statistics files. The root locale of the "zone". "in {};" section has been added. Although the cache server does not have autonomous control of the zone data, it can iterate the query to the root server and feed back the final parsing results to the customer.

Sometimes, in order to improve the parsing efficiency, instead of querying the root partition, the query request from the client can be forwarded to the DNS server of the domestic telecom operator (such as 202.106.0.20 and 202.106.148.1 in Beijing). The cache server receives the returned query result and then passes it to the client. This function can be achieved by removing the setting of "zone". "in {…};" and setting the forwarders parameter correctly in the global configuration. As follows:

[root@localhost ~] # vim / var/named/chroot/etc/named.conf

Options {

…… / / omit part of the content

Forwarders {202.106.0.20 * 202.106.148.1}

}

Confirm the regional database file named.ca for the root domain

The zone database file for the root zone is located by default in the file / var/named/chroot/var/named/named.ca, which records the domain name and IP address of 13 root domain servers in Internet. As shown in the figure:

Start the named service

Execute the "service named start" command, start the named service, and confirm the port listening status of the named service through the netstat command. If the service fails to start or it is found that the UDP 53 port is not listening properly, you can troubleshoot the error according to the error message (or the log record in the / var/log/messages file), and then restart the service. As shown in the figure:

Cache server built successfully!

Set up a primary domain name server

Specific steps:

Set the IP address and host name of the machine by modifying the network configuration file. In addition, in order to improve the efficiency of domain name resolution, it is recommended that the address mappings of the two DNS servers be written directly to the / etc/hosts file, and the addresses of the two DNS servers are specified in the / etc/resolv.conf file. As shown in the figure:

Establish the main configuration file named.conf

For the newly created named.conf main configuration file, since you only need to provide forward resolution of the benet.com domain and reverse resolution of the 173.16.16.0and24 network segment, you can add these two areas accordingly. Other configuration contents such as root zone, loop domain, etc., can be omitted. As shown in the figure:

When there is no need to establish a slave domain name server, the "allow-transfer …" in the above configuration content Parts may not be added; when reverse parsing is not required, "zone" 16.16.173.in-addr.arpa "…" Part of it can also be removed.

Establish forward and reverse area data files

According to the zone locale in named.conf, the forward regional data file benet.com.zone and the reverse regional data file 173.16.16.arpa are established respectively. You can refer to the zone data file / var/named/chroot/var/named/localdomain.zone of the loopback domain and modify it according to the actual situation.

The zone data configuration file is usually located in the / var/named/ directory. If the bind-chroot package is installed, it is located by default in the / var/named/chroot/var/named/ directory and needs to be built manually. Each zone data file corresponds to a DNS parsing area, and the file name and content are set by the administrator of the domain.

In the regional data file, it mainly includes TTL configuration item, SOA (Start Of Authority, authorization information start) record, address resolution record. The comment information in the file begins with the semicolon ";". As shown in the figure:

In the above configuration, the time unit defaults to seconds, and the following units can also be used: M (minutes), H (hours), W (weeks), D (days). The "@" symbol in the file indicates the current DNS zone domain name, which is equivalent to "benet.com.", "admin.benet.com." Represents the email address of the domain administrator (because the "@" symbol already has another meaning, use the "@" in the mail address with "." Replace). The update sequence number in the SOA record is used to synchronize the zone data of the master and slave server. when judging the zone update from the slave server, if it is found that the sequence number in the master server is the same as that in the local zone data, it will not be downloaded. Among them, the "@" symbol at the beginning of the NS and MX records can be omitted (the @ information at the beginning of the SOA records is inherited by default), but a space or tab stop must be retained.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report