Configure DNS server and nslookup commands in Linux

Source: Internet
Author: User
Tags nameserver nslookup
Some commands for configuring the DNS server and nslookup in Linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. There are two email servers: 192.168.1.1 (B .test.cn in windows) and 192.168.1.3 (a.test.com in linux ).
Configure the DNS server in linux. The following are some files set during the configuration process,
The specific content of the/etc/hosts file is as follows:
# Do not remove the following line, or various programs
# That require network functionality will fail.
127.0.0.1 localhost. localdomain localhost fc4
192.168.1.3 a.test.com
192.168.1.1 B .test.cn B

/Etc/host. conf file:
Order hosts, bind
Indicates that the hosts file is used for resolution and DNS resolution.

/Etc/resolv. conf file:
; Generated by NetworkManager, do not edit!

Search test.com
Nameserver 127.0.0.1
Search test.cn
Nameserver 192.168.1.1

Nameserver 61.144.56.100

/Etc/named. conf file:
//
// Named. conf for Red Hat caching-nameserver
//

Options {
Directory "/var/named ";
Dump-file "/var/named/data/cache_dump.db ";
Statistics-file "/var/named/data/named_stats.txt ";
/*
* If there is a firewall between you and nameservers you want
* To talk to, you might need to uncomment the query-source
* Directive below. Previous versions of BIND always asked
* Questions using port 53, but BIND 8.1 uses an unprivileged
* Port by default.
*/
// Query-source address * port 53;
};

//
// A caching only nameserver config
//
Controls {
Inet 127.0.0.1 allow {localhost;} keys {rndckey ;};
};

Zone "." IN {
Type hint;
File "named. ca ";
};

Zone "test.com" IN {
Type master;
File "test.com ";
Allow-update {none ;};
};

Zone "1.168.192.in-addr. arpa" IN {
Type master;
File "192.168.1.rev ";
Allow-update {none ;};
};

Zone "test.cn" IN {
Type master;
File "test.cn ";
Allow-update {none ;};
};


Zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
Type master;
File "named. ip6.local ";
Allow-update {none ;};
};

Zone "255. in-addr.arpa" IN {
Type master;
File "named. broadcast ";
Allow-update {none ;};
};

Zone "0. in-addr.arpa" IN {
Type master;
File "named. zero ";
Allow-update {none ;};
};

Include "/etc/rndc. key ";

In the/var/name/test.com file:
$ TTL 86400
@ In soa a.test.com. root.a.test.com (
42; serial (d. adams)
3 H; refresh
15 M; retry
1 W; expiry
1D); minimum

In ns a.test.com.
In mx 10 mail.test.com.
A in a 192.168.1.3
Mail in a 192.168.1.3
// The meaning of root.a.test.com is the administrator's email address.

Under the/var/name/test.cn file:
$ TTL 86400
@ In soa B .test.cn. root.a.test.com (
42; serial (d. adams)
3 H; refresh
15 M; retry
1 W; expiry
1D); minimum

In ns B .test.cn.
In mx 10 mail.test.cn.
B IN A 192.168.1.1
Mail in a 192.168.1.1

In the/var/name/192.168.1.rev file:
$ TTL 86400
@ In soa 1.168.192.in-addr. arpa. root.test.com .(
1997022700; Serial
28800; Refresh
14400; Retry
3600000; Expire
86400); Minimum
In ns a.test.com.
In ns B .test.cn.
In mx 10 mail.test.com.
In mx 10 mail.test.cn.

3 in ptr a.test.com.
3 in ptr mail.test.com.
1 in ptr B .test.cn.
1 in ptr mail.test.cn.

Then use/etc/init. d/named restart: restart the DNS service. During the restart process, I have encountered several errors. According to the error prompt, named is displayed. the number of lines in the conf file is incorrect. Or you may be prompted about the problems in the files that contain such as test.cn, and then exclude them one by one.

Finally, some nslookup commands are useful:
Set all is used to display information about the DNS server on this machine using nslookup.
Set type = any displays the complete information, including the name and IP address of the email server and Master/Slave DNS server in the domain.
Server 192.168.0.1: Replace the queried DNS server address.
Related Article

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.