Linux-centos7.4-dns (build a DNS server)

Source: Internet
Author: User
Tags file permissions nslookup nslookup command to domain

Related concepts:
Forward parsing: Resolving a domain name to an IP address
Reverse parsing: Resolving IP addresses to domain names
Environment: Linux Server One, IP address: 192.168.80.10

The first step: Getting Ready for work
[[email protected] ~]# yum install bind//Installation DNS service
[[email protected] ~]# systemctl stop FIREWALLD//Turn off firewall
[[email protected] ~]# Setenforce 0//Turn off SELinux
Step Two: Edit the configuration file
---------------1. Edit the master configuration file-------------
[Email protected] ~]# vi/etc/named.conf
What to modify:
Options {
Listen-on Port 53 {192.168.80.10;}; Change to the IP of your server
Listen-on-v6 Port 53 {:: 1;};
Directory "/var/named";
Dump-file "/var/named/data/cache_dump.db";
Statistics-file "/var/named/data/named_stats.txt";
Memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query {any;}; Anyone can access


Save exit
[[email protected] named]# named-checkconf//Check syntax error (if there is an error, if there is an error, there is no hint)
---------------2. Edit the Zone profile----------------
[Email protected] ~]# Vi/etc/named.rfc1912.zones
..................
Add the following:
Forward zone configuration
Zone "Hello.com" in {
Type master;
File "Hello.com.zone";
allow-update {none;};
};
Reverse zone configuration
Zone "80.168.192.in-addr.arpa" in {
Type master;
File "Hello.com.local";
allow-update {none;};
};
Save exit
[[email protected] named]# named-checkconf//Check syntax error
-------------3. Edit the Forward zone data profile--------------
[Email protected]ocalhost ~]# cd/var/named
[[email protected] named]# cp-p named.localhost hello.com.zone//Note: To keep the source file permissions when copying a configuration file
[Email protected] named]# VI hello.com.zone
To modify the configuration content:
$TTL 1D
@ in SOA @ rname.invalid. (
0; Serial
1D; Refresh
1H; Retry
1W; Expire
3H); Minimum
NS @
A 192.168.80.10//This server address
www in A 192.168.80.10//www.hello.com corresponding address
FTP in A 192.168.80.10//ftp.hello.com corresponding address
Mail in CNAME www//mail.hello.com is another name for www.hello.com

  • In A 192.168.80.2//If the suffix is hello.com but not in the previous content record, return 192.168.80.2 this address to the query host
    Save exit
    [[email protected] named]# named-checkconf//Check syntax error
    -------------------4. Edit the reverse zone Data profile--------------------
    [Email protected] named]# cp-p hello.com.zone hello.com.local
    [Email protected] named]# VI hello.com.local
    $TTL 1D
    @ in SOA hello.com. Rname.invalid. (//Here @ variable to be changed to domain name, note the "." At the back of the You can't miss it.
    0; Serial
    1D; Refresh
    1H; Retry
    1W; Expire
    3H); Minimum
    NS @
    A 192.168.80.10
    Ten in PTR www.hello.com. Notice the "." At the back. Don't miss out.
    Save exit
    [[email protected] named]# named-checkconf//Check syntax error
    Step Three: Start the service
    [Email protected] named]# Systemctl start named
    [Email protected] named]# Netstat-anpu | grep name//view service running status, UDP 53 port is listening,

    Fourth Step: test, verify
    [[email protected] named]# vi/etc/resolv.conf//configure server DNS
    Add the following line, all the others are erased:
    NameServer 192.168.80.10
    Save exit
    [[email protected] ~]# Yum install bind-utils-y//Install parse query command nslookup
    Use the nslookup command to verify the resolution of the domain name and address

    Parse success

Linux-centos7.4-dns (build a DNS server)

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.