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

How to build DNS Server in linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

It is believed that many inexperienced people have no idea about how to build their own DNS server in linux. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1 DNS server installation

Yum install bind

2 DNS server configuration

2.1 DNS server startup

Yum enable named & & yum start named

2.2 DNS server status view

2.3 DNS server configuration

The main configuration files for DNS are:

1) / etc/named.conf # main configuration file

2) / etc/named.rfc1912.zones # Domain name profile

3) / var/named/ # zone configuration file directory

2.3.1 modify / etc/named.conf file

The named.conf file is the main configuration file for the DNS server, and the key properties are as follows:

Listen-on / / listen for IPV4 address

Listen-on-v6 / / listen for IPV6 address

Allow-query / / sets the client that can access the dns server

The modified file is as follows:

Options {

Listen-on port 53 {any;}

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"

Recursing-file "/ var/named/data/named.recursing"

Secroots-file "/ var/named/data/named.secroots"

Allow-query {any;}

Recursion yes

Dnssec-enable yes

Dnssec-validation yes

/ * Path to ISC DLV key * /

Bindkeys-file "/ etc/named.iscdlv.key"

Managed-keys-directory "/ var/named/dynamic"

Pid-file "/ run/named/named.pid"

Session-keyfile "/ run/named/session.key"

}

Logging {

Channel default_debug {

File "data/named.run"

Severity dynamic

}

}

Zone "." IN {

Type hint

File "named.ca"

}

Include "/ etc/named.rfc1912.zones"

Include "/ etc/named.root.key"

2.3.2 modify / etc/named.rfc1912.zones file

Add nexus.com domain name configuration (custom domain name is: jiuxi.nexus.com):

Zone "nexus.com" IN {

Type master

File "nexus.com.zone"

}

Zone "localhost.localdomain" IN {

Type master

File "named.localhost"

Allow-update {none;}

}

Zone "localhost" IN {

Type master

File "named.localhost"

Allow-update {none;}

}

Zone "1.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.loopback"

Allow-update {none;}

}

Zone "1.0.0.127.in-addr.arpa" IN {

Type master

File "named.loopback"

Allow-update {none;}

}

Zone "0.in-addr.arpa" IN {

Type master

File "named.empty"

Allow-update {none;}

}

2.4 create / var/named/nexus.com.zone file

Note that the file name should be the same as the file set in the domain name configuration file:

Cp-p / var/named/named.localhost / var/named/nexus.com.zone

Edit the nexus.com.zone file:

$TTL 1D

@ IN SOA @ jiuxi.nexus.com. (

0; serial

1D; refresh

1H; retry

1W; expire

3H); minimum

@ NS jiuxi

Jiuxi A 10.110.101.100

2.5 DNS server configuration check

Named-checkconf

Named-checkzone nexus.com / var/named/nexus.com.zone

2.6 DNS server profile permission modification

Chmod 777 / etc/named.conf

Chmod 777 / etc/named.rfc1912.zones

2.7 restart the DNS server

Systemctl restart named

2.8View DNS server startup status

Systemctl status named

2.9 turn off the server firewall

Systemctl stop firewalld

Since then, the entire DNS server configuration has been completed.

3 DNS linux client configuration

3.1Setting linux client

Find another linux client to test. Modify the / etc/resovled.conf file to add the DNS server IP:

Nameserver 10.110.101.105

Or modify the / etc/sysconfig/network-scripts/ifcfg-XXXXXX network card file, add DNS information, and set the custom DNS server to DNS1, and then restart the network:

DNS1=10.110.101.105 # Custom DNS Server IP

DNS2=114.114.114.114 # Public DNS Server IP

Systemctl restart network # restart the network

After a successful restart, look at the / etc/resolved.conf file and find that the custom DNS change was successful.

3.2verifying linux client

Yum install bind-utils

Nslookup jiuxi.nexus.com

Dig jiuxi.nexus.com

Ping jiuxi.nexus.com

4 DNS windows client configuration

4.1 set up the windows client

Open "run" and enter "ncpa.cpl":

Select the network connection you are currently using:

Select the TCP/IPv4 protocol:

Fill in the DNS configuration information. Notice that the custom DNS is set to "preferred":

Select the Advanced tab, select the WINS tab in the pop-up box, and disable NetBIOS:

4.2 verify the windows client

Open the console:

Ipconfig/flushdns

Verify the win client:

Nslookup jiuxi.nexus.com

Ping jiuxi.nexus.com

Since then, the whole self-built DNS has been completed.

After reading the above, have you mastered the method of how to build your own DNS server in linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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