Set of DNS servers under Linux

zhaozj2021-02-16  46

Environment: The IP 34.0.188.99 gateway to the DNS machine to be set 34.0.188.250 Subnet mask 255.255.255.0 Host named Linux.zw.com domain name zzw.com

============================================================================================================================================================================================================= ================

Set up this child's IP address, DNS, host name

(1) IP address: Modify the following file / etc / sysconfig / network-scripts / ifcfg-eth0 device = eth0 onboot = yes bootproto = startic ipaddr = 34.0.188.99 Netmask = 255.0.188.0 Gateway = 34.0.188.250

(2) Modify the machine DNS setting: Modify /etc/resolv.conf file Nameserver 34.0.188.99 # Set this machine's DNS to 34.0.188.99

(3) Modify the host name: a, open / etc / hosts file Add below 34.0.188.99 Linux.zzw.com Linux b, modify / etc / sysconfig / network file hostname = Linux.zzw.com === ============================================================================================================================================================================================================= ================

Setting (1) Modify /etc/named.config this file ###################################################################################################################################################################################################################################################################################### ##################### // generated by named-bootconf.pl

Options {directory "/ var / name"; // Defines the path of NAMED to read and write // query-source address * port 53;}; controls {inet 127.0.0.1 allow {localhost;} keys {rNDCKEY;}; }; zone "in {// In this file, use the zone keyword to define the domain area, a zone keyword defines a domain Type Hint; / * There are three types here, they are Master, respectively. Slave and Hint their meaning: master: Representation definition is the main domain server slave: Representation is the secondary domain server Hint: indicates that the root domain name server * / file "named.ca"; // is used to specify specific specific Store the file} of DNS records};

Zone "localhost" in {// Defines a domain name of the forward zone Type master; file "localhost.zone"; allow-update {none;};

ZONE "0.0.127.in-addr.arpa" in {// Defines a reverse domain Type master; file "named.local"; file "named.local";};

ZONE "zzw.com" in {// Specifies a domain name to zzw.com Type Master; file "zzw.com.db";

Zone "188.0.34.in-addr.Arpa" in {// Defines an IP 34.0.188. * Reverse domain Type Master; File "34.0.188.db";

Include "/etc/rndc.key";######################################################################### ######################################################################################################################################################################################################################################################################################################### DB and 99.188.0.34.in-addr.arpa sets the reverse file 34.0.188.db from the IP address search, these files are from Directory "/ var / named"; here is set here / var / named directory

(2) Establish a forward search file /var/named/zzw.com.db ################################ ####################### $ TTL 83600 @ in SOA Linux.zzw.com. Root.linux.zzw.com. (/ * SOA Indicates the start of the authorization, the above data is used by the Internet standard. And @, represents the corresponding domain name, as representing zzw.com, that is, a domain name record definition. And Linux.zzw .com is the primary domain server of this domain, and root.linux.zzw.com is an administrator's email address. Note that this is in the email address. In place of the common email address in @. and SOA means authorized Start * / 2004071601; Serial / * The number in front of the Bank represents the modified version of the configuration file, the format is the number of modifications modified on the day of the year, and this number should be modified each time you modify this configuration file, or you do it. Modifications do not update to the database of other DNS servers on the web, that is, what you do is likely to reflect your update for the client that doesn't have the DNS server that doesn't have your configured DNS server. Just for them, you have no meaning. * / 28800; Refresh / * defined is that the refresh frequency of the unit is specified that the primary server is queried from the domain name server to ensure that the data from the server is the latest * / 14400; Retry / * The value above is a time interval specified in seconds, that is, when the slave service is attempted to query on the primary server, and the connection fails, this value specifies more services. After a long time, try * / 3600000; EXPIRE / * This is used to specify how long the corresponding record is cleared from the server after the failure of the main service update, the above value is * / 86400 in minutes); Minimum / * The above data is used to specify that the buffer server cannot clear the corresponding record with the primary service. * / @ In ns Linux.zzw.com. // Specify the ns record pointing to @ in mx 10 Linux.zzw .com. // Specify MX record to focus on Linux IN A 34.0.188.99 // Point Linux host to 34.0.188.99my in A 34.0.188.39HQ in a 34.0.188.98www in cname Linux // WWW host corresponding to Linux / * The first column above said the name of the host, I saved the backward domain. NS: indicating that this host is a domain name server, A: Defines a record, that is, the host name to the IP address of the IP address defines a mail record CNAME: Define a alias for the corresponding host * /// Note: The final must have a row, otherwise it seems to be wrong ############################################################################################################################################################################################################################################################################### ################################

(3) Establish a reverse search file / vart/named/34.0.188.db######################################################################################################################################################################################################################################################################### ####################### $ TTL 83600 @ in SOA Linux.zzw.com. Root.linux.zzw.com. (2004071601; Serial 28800; RETRY 3600000; Expire 86400); Minimum @ in ns Linux.zzw.com. @ In mx 10 Linux.zzw.com.1 in ptr Linux.zzw.com. 2 in Ptr WWW. zzw.com. 4 in ptr my.zzw.com. 5 in ptr hq.zzw.com.// The wound area must be added behind "." ################################################################################################################################################################################################################################ ######################################################################

(4) Named.ca, localhost.zone, Named.local These three files basically do not change

(5) Modify the / etc / hosts file: Implement the mapping of other major computers on the Internet, which is usually as a backup of DNS, that is, the HOSTS table is used when the DNS system occurs. Example: 127.0.0.1 Localhost localhost.localdomain localhost 34.0.188.99 Linux.zzw.com Linux // Since each server will have several domain names and IP correspondence is permanent, the Hosts table should be stored.

(6) Modify the /etc/resolv.conf file: Specify the IP and search order of the domain name server. Example: Domain zzw.com // Defines the local domain name. Search zzw.com/A Simplifies the host name entered by the user, that is, when the user enters THJ, make DNS to successfully resolve it to Linux.zzw.com. It is mutually exclusive with Domain, no matter who appears is used to define the search list. * / Nameserver 192.168.10.1 // Defines the IP of the domain name server, up to three, it is recommended to use two.

(7) Modify the /etc/hosts.conf file: How to implement the relationship between the HOSTS table and DNS. Example: Order hosts, bind // Analyze the order of domain name Multi ON / / Allow a computer to have multiple IP

Complete settings

============================================================================================================================================================================================================= ================= Test

[root @ Linux /] # /etc/rc.d/init.d/named restart execution twice to change the change [root @ Linux /] # tail -f / var / log / messages to view DNS boot log [root @ Linux /] # nslookup is used to test forward and reverse> Linux.zzw.com Positive test> 34.0.188.99 reverse test

[root @ Linux /] # iptables -f Remove the firewall [root @ Linux /] # chkconfig named ON to start the service next time

转载请注明原文地址:https://www.9cbs.com/read-15685.html

New Post(0)