当前位置:网站首页>Shell脚本——自动部署DNS服务
Shell脚本——自动部署DNS服务
2022-07-26 22:44:00 【单纯的一比】
Shell脚本——自动部署DNS服务
脚本
#!/bin/bash
yum -y install bind
read -p "请输入本机地址:" a
#编辑主配置文件
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 "请输入您需要解析的域名:" b
#修改区域配置文件
sed -i '24azone "'$b'" IN {\n type master;\n file "'$b'.zone";\n allow-update { none; };\n};' /etc/named.rfc1912.zones
#修改区域数据配置文件
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
#添加映射关系
echo "$a www.$b" >>/etc/hosts
#修改映射文件
echo "nameserver $a" >>/etc/resolc.conf
#开启服务
systemctl start named
执行


END
边栏推荐
猜你喜欢

Unity Line接入
![[Oracle] get the latest working day and the previous N working days](/img/c6/d8ce426f4a39cdfa556cb1b3bdbe21.png)
[Oracle] get the latest working day and the previous N working days

Unity ugui text text box adaptation

C language to realize the three chess game

The MySQL character set is set to UTF-8, but the console still has the problem of Chinese garbled code

Iptables firewall (I)

Six ways for the Internet of things to improve our lives

Longest common substring

ESP8266 AP_TCP_Client

Plantcv Chinese document
随机推荐
Finding the greatest common divisor
Database interim (II)
MakeFile
Plantcv Chinese document
RS485 signal measurement
记一次RawImage渲染出来的场景错乱
Unity screenshot widget
MySQL closes the problem of automatic submission of connection transactions
14、 Sed
Unity ugui text text box adaptation
ESP8266 AP_ UDP_ Server
ESP8266连接乐鑫云平台IOT_Demo
ESP8266 AP_TCP_Client
3. Boxing champion Ali
The difference between if and else if
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
MQTT协议------上
7、 Loop statement
Some simple extension methods commonly used by unity
ESP8266-----JSON----c函数库提供字符串函数