shell脚本之dns安装配置

conf="/var/named/chroot/etc/named.conf"

datadir="/var/named/chroot/var/named"

rpm -q bind &> /dev/null

if [ $? -ne 0 ];then

yum -y install bind bind-chroot caching*

echo "

options {

directory \"/var/named\";

};

" > $conf

fi

read -p "please input domain:" domain

grep $domain $conf &> /dev/null

if [ $? -ne 0 ];then

echo "

zone \"$domain\" in {

type master;

file \"$domain\";

};

" >> $conf

echo "

\$ttl 86400

@ in soa $domain. root.$domain. (

2014010101

3h

15m

1w

1d

)

" > $datadir/$domain

fi

while true

do

read -p "please type of record:(ns/a/mx/cname)" type

case $type in

ns)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

@ in ns $head

$head in a $ip

" >> $datadir/$domain

;;

a)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

$head in a $ip

" >> $datadir/$domain

;;

mx)

read -p "head of FQDN:" head

read -p "ip address:" ip

read -p "priority:" priority

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

@ in mx $priority $head

$head in a $ip

" >> $datadir/$domain

;;

cname)

read -p "aliase of FQDN:" aliase

read -p "hostname:" hostname

read -p "Are you sure?(yes/no)" yn

if [ $yn != yes ];then

continue

fi

echo "

$aliase in cname $hostname

" >> $datadir/$domain

;;

*)

echo "usage: type of record (ns/a/mx/cname)"

esac

read -p "continue to do?(yes/no)" yn

if [ $yn != yes ];then

break

fi

done

service named restart

时间: 2024-08-01 00:19:35

shell脚本之dns安装配置的相关文章

shell脚本一键在线安装redis数据库(使用函数实现)

shell脚本一键在线安装redis数据库(使用函数实现) 前面的文章给出了有关手工编译安装redis的流程,并且在模拟搭建redis集群时给出了在线安装redis的过程,于是就想着自己写好在线安装的redis脚本,本文主要使用shell函数来实现并且验证在线安装的过程,执行无误后就想着分享出来. PS:系统环境为Centos7.4 脚本如下: #!/bin/bash function checkroot(){ if [ $UID -ne 0 ] then echo "|------------

DNS 安装配置

DNS 安装配置 实验环境 一台主机:Linux Centos 6.5 32位 安装包: DNS服务:bind.i686 DNS测试工具:bind-utils DNS 服务安装 1.yum安装DNS服务,DNS测试工具 yum -y install bind.i686 yum -y install bind-utils 2.清空主配置文件,重新添加内容,添加权限 vim /etc/named.conf options { directory "/var/named"; }; zone

源码SVN1.9.5 Shell脚本一健安装

SVM1.6.4和1.6.4以上的版本区别在于1.6.4以下的版本在Linux上更新的时候都会在程序子目录出现一个.svn,而1.6.4以上的版本则只会在根目录有.svn这个文件,而子目没有,下面是源码一健安装shell脚本 #!/bin/bash #定义变量 Blueh="\033[36m" Tails="\033[0m" Output="echo -e" dir=`dirname $0`        > install.log . /

部署和调优 3.3 dns安装配置-3

只有一台DNS服务器是不保险的,现在给他配置个从服务器. 在另外一台虚拟机上安装配置DNS服务器.先查看虚拟机ip为:192.168.1.111 ifconfig 给从安装bind和dig命令 yum install -y bind yum install -y bind-utils 打开主配置文件 vim /etc/named.conf listen-on port 53 { 127.0.0.1; }; listen-on-v6 port 53 { ::1; }; 改为 // listen-o

部署和调优 3.1 dns安装配置-1

安装配置DNS服务器 装一个bind,首先搜一下. yum list |grep bind bind.x86_64   我们安装这个 安装 yum install bind.x86_64 -y 看一下他的配置文件 vim /etc/named.conf { listen-on port 53 { 127.0.0.1; };  监听端口是 53 定义监听53端口的ip是 127.0.0.1 回环IP listen-on-v6 port 53 { ::1; };  IP V6的 directory

dns安装配置

一.正向解析 1.安装 yum install -y bind 2.编辑配置文件 vim /etc/named.conf 添加 zone "123.com" IN {        type master;        file "123.com.zone";};3.编辑123.zone文件 vim /var/named/123.com.zone $TTL 1D@       IN SOA  @ admin.123.com. (                  

shell脚本开发环境的配置和优化实践

vim路径等配置知识的整理见表: 相关配置文件 功能描述 .viminfo 用户使用vim的操作历史 .vimrc 当前用户vim的配置文件 /etc/vimrc 系统全局vim的配置文件 /usr/share/vim/vim74/colors/ 配色模板文件存放路径 .vimrc 的配置内容如下: "~/.vimrc " vim config file " date 2018-01-07 " blog:http://aqiang.blog.51cto.com &q

shell脚本自动编译安装Apache

shell脚本自动安装Apache,适用于CentOS #!/bin/bash ##################################################### #Create date 2018.4.10 #Author: wansheng #Function: shell script install apache2.4 #Email: [email protected]  #System: Linux CentOS-7 ######################

Centos6.5上面用Shell脚本一键编译安装mysql5.5.47

操作系统及其mysql配置文件说明:Linux系统:Centos6.5 cat /etc/centos_release     查看centos版本信息 [[email protected] ~]# cat /etc/centos-release CentOS release 6.5 (Final) uname -r        #显示操作系统的发行版号 [[email protected] ~]# uname -r 2.6.32-431.el6.x86_64 uname -a      #显