当前位置:网站首页>Shell script - automatically deploy DNS services
Shell script - automatically deploy DNS services
2022-07-27 01:43:00 【A simple comparison】
List of articles
Shell Script —— Automatic deployment DNS service
Script
#!/bin/bash
yum -y install bind
read -p " Please enter the local address :" a
# Edit the main configuration file
sed -i '/listen-on port 53/s/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/'$a'/' /etc/named.conf
sed -i '/allow-query/s/localhost/any/g' /etc/named.conf
read -p " Please enter the domain name you need to resolve :" b
# Modify area profile
sed -i '24azone "'$b'" IN {\n type master;\n file "'$b'.zone";\n allow-update { none; };\n};' /etc/named.rfc1912.zones
# Modify the regional data profile
cp -p /var/named/named.localhost /var/named/$b.zone
sed -i '/NS/s/@/'$b'./g' /var/named/$b.zone
sed -i '9s/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/'$a'/' /var/named/$b.zone
sed -i '10aIN MX 10 mail.'$b'\nwww IN A '$a'\nmail IN A '$a'\nftp IN CNAME www\n\* IN A '$a'' /var/named/$b.zone
# Add mapping relationship
echo "$a www.$b" >>/etc/hosts
# Modify mapping file
echo "nameserver $a" >>/etc/resolc.conf
# Opening service
systemctl start named
perform


END
边栏推荐
- Web服务(02)——Web服务器中间件
- Suggestions for beginners of MySQL (strongly recommended ~ don't regret ~ ~)
- Download pronunciation pairs+ship or sheet+tree or three
- Pyqt5 qtablewidget setting gives priority to the text on the right
- Shell(11)括号的用法
- 7、 Loop statement
- 13、 Command gadget
- 十六、awk
- Esp8266---json---c function library provides string functions
- Jenkins -- Basic -- 5.1 -- system configuration -- plug-in management
猜你喜欢
随机推荐
FaceNet
Shell(8)循环
How should CDC be configured for Oracle cluster mode? I can run normally in stand-alone mode, but I can't read the increment in cluster mode
33三剑客awk
Lnmp+discuz Forum
Problem feedback: the synchronization of mobile app failed: the external changes of the data warehouse were damaged. The iPad app also downloaded the warehouse as soon as it was opened, and then flash
GDB的使用
[cloud native | learn kubernetes from scratch] VI. kubernetes core technology pod
Deep learning notes
Pyqt5 qtablewidget setting gives priority to the text on the right
16、 Awk
软件测试面试题之网络基础
Understanding and learning of code blocks
DNS
31 regular expression
Shell
RT-thread学习
Jenkins -- Foundation -- 02 -- Installation
Typescript 14 starting from 0: built in tool type
Download pronunciation pairs+ship or sheet+tree or three









