Linux-dns Service-Configuration of the primary name server (medium)

Source: Internet
Author: User
Tags domain name server nameserver nslookup

Configure a primary domain name server as follows
① domain name is linux.net, network segment is 192.168.10.0/24, server IP is 192.168.10.10, host name is Dns.linux.net
② servers to resolve include: Www.linux.net (192.168.10.11)
Ftp.linux.net (192.168.10.12)
Mail.linux.net (192.168.10.13)
******
1. Set IP
#vi/etc/sysconfig/network-scripts/ifcfg-eth0 (if it is not practice, it is best not to use the Ifconfig command, to use the way to modify the configuration file or Netconfig, the Ifconfig command is recommended)

Device=eth0
Onboot=yes
bootproto=static
ipaddr=192.168.10.10
netmask=255.255.255.0
GATEWAY= 192.168.10.100
#service Network Restart (valid later)
2. Configure/etc/resolv.conf files
nameserver 192.168.10.10 (If you do not specify the server native IP as the DNS address, then the default server will be 127.0.0.1)
Search linux.net
#service named restart (valid later)
***********
1. Configure the Master profile/etc/named.conf
① Configure forward Zone
Add the following code between any zone and zone:

Zone "Linux.net" in {//define a forward region named Linux.net
Type master; Type primary Domain name server
File "Linux.net"; Specifies that the database file for this zone is linux.net
};
② Configuring the Reverse Zone
Zone "10.168.192.in-addr.arpa" in {//the name here is fixed, that is, it can only be used in this format. (Otherwise, it cannot be parsed!) )
Type master;
File "Back-linux"; Name any but it's better to have some meaning

}

2. Configuring the Forward zone database file
Enter the/var/named/chroot/var/named directory to create and save the Linux.net file (which is the same as the file name of the forward zone database defined in/etc/named.conf)
#cd/var/nemed/chroot/var/named
#ls
Data Localhost.zone named.ca named.local Slaves
Localdomain.zone named.broadcast named.ip6.local Named.zero
To make it easier to edit content, copy the file named.local and then modify it.
#cp named.conf linux.net
#vi linux.net
$TTL 86400
@ in SOA dns.linux.net. Root.dns.linux.net. (
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In NS dns.linux.net.
In MX ten mail.linux.net. If you have a mail server, you must not forget the priority here, 10 here is mail.linux.net. The priority level
DNS in A 192.168.10.10
www in A 192.168.10.11
FTP in A 192.168.10.12
Mail in A 192.168.10.13

3. Configure the Reverse zone database file
#cp named.conf Back-linux
#vi Back-linux
$TTL 86400
@ in SOA dns.linxu.net. Root.dns.linux.net. (
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In NS dns.linux.net.
Ten in PTR dns.linux.net.
One in PTR www.linux.net.
In PTR ftp.linux.net.
In PTR mail.linux.net.

4. Configure the native reverse zone file (this file mainly resolves 127.0.0.1 to localhost)
$TTL 86400
@ in SOA localhost. Root.localhost. (
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In NS dns.linux.net.
1 in PTR localhost. If this line is not available, the server can only resolve localhost to 127.0.0.1, but cannot parse 127.0.0.1 to localhost

Note: After configuring these files, you must enter the following command to take effect
#service Network Restart
#service named restart (very critical!) )

5. Testing the DNS service
Client
① use Netconfig to configure IP, gateway, DNS for clients (or Use modify config file + Modify/etc/ Resolv.conf the resolv.conf in NameServer point to 192.168.10.10), the Netconfig command is recommended, because after DNS is configured with Netconfig,/etc/ Resolv.conf will be automatically modified.
② has three commands to test the DNS service: nslookup, host, dig
Take Nslookup for example only:
#nslookup
> dns.linux.net//forward parsing
server:192.168.10.10
address:192.168.10.10#53

Name:dns.linux.net//forward parsing
address:192.168.10.10
> www.linux.net.
server:192.168.10.10
address:192.168.10.10#53

Name:www.linux.net
address:192.168.10.11
> 192.168.10.10//Reverse parsing
server:192.168.10.10
address:192.168.10.10#53

10.10.168.192.in-addr.arpa name = Dns.linux.net.
> 192.168.10.11//Reverse parsing
server:192.168.10.10
address:192.168.10.10#53

11.10.168.192.in-addr.arpa name = Www.linux.net.
***********

Linux-dns Service-configuration of the primary Domain name server (medium)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.