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

The process of DNS forward parsing and master-slave replication script

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "the process of DNS forward parsing and master-slave replication script". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the process of DNS forward parsing and master-slave copying scripts".

#! / bin/bash

# Test whether to install bind

[!-f / etc/named.conf] & & echo "DNS service is not installed, install now" & & yum-y install bind & > / dev/null

Echo "DNS package installed!"

# modify the main configuration file

Sed-ri's etc/named.conf 127.0.0.1 etc/named.conf 192.168.220.146

Sed-ri'/ allow-query/s/localhost/any/' / etc/named.conf

# modify zone configuration and zone configuration data file

[- f / etc/named.rfc1912.zones] & & cp / etc/named.rfc1912.zones / etc/named.rfc1912.zones.bak

While:; do

Read-p "Please enter the domain name:" a

Read-p "Zone data profile name:" b

Echo "

Zone\ "$a\" IN {

Type master

File\ "$b\"

Allow-update {none;}

}; "> > / etc/named.rfc1912.zones

Cp-p / var/named/named.localhost / var/named/$b

Sed-I '910d' / var/named/$b

Sed-I "/ SOA/s/A.*\. / A $a. Admin.$a./" / var/named/$b

Sed-I "/ NS/s/@/$a\. /" / var/named/$b

Read-p "Please enter the domain name resolution address:" e

Echo "A $e" > > / var/named/$b

While:; do

Echo-n "Please enter the hostname + IP address (for example: www 192.168.100.100 is divided by spaces, enter Q to exit):"

Read q w

If [$Q = "Q"]; then

Break

Else

Echo "$q IN A $w" > > / var/named/$b

Fi

Done

Read-p "whether to enter the next resolution domain name (enter to continue):" d

[! $d = ""] & & break

Done

Systemctl status named

If [$?-eq 0]; then

Systemctl restart named

Else

Systemctl start named

Fi

Systemctl stop firewalld.service

At this point, I believe you have a deeper understanding of "DNS forward parsing and master-slave copy script process". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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