码迷,mamicode.com
首页 > 系统相关 > 详细

Shell脚本——DNS自动部署

时间:2015-04-21 22:34:09      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

详细说明查看:

(一)跟我一起玩Linux网络服务:DNS服务——BIND(/etc/named.conf、/var/named)设置实现和解释

 

 1 #! /bin/bash
 2 IP="10.10.10"
 3 RIP="10.10.10"
 4 DN="gr.org"
 5 Name="10.10.10.10"
 6 
 7 cat >> /etc/named.conf << +END+
 8 zone "$DN." IN {
 9         type master;
10         file "gr.org.db";
11 };
12 zone "$RIP.in-addr.arpa" IN{
13         type master;
14         file "$IP.db";
15 };
16 +END+
17 cat > /var/named/$DN.db <<+END+
18 \$TTL 86400
19 @    IN  SOA    ns.$DN.  root.$DN. (
20        20150317  6H  30M  1W  15M)
21      IN  NS     ns.$DN.
22      IN  MX  10   mail.$DN.
23 bbs  IN  CNAME  www.$DN.
24 ns   IN  A      $IP.10
25 www  IN  A      $IP.10
26 mail IN  A      $IP.11
27 +END+
28 cat > /var/named/$IP.db <<+END+
29 \$TTL 86400
30 @       IN      SOA     ns.$DN.       root.$DN.(
31                 20150317  6H  30M  1W  15M)
32         IN      NS      ns.$DN.
33 10      IN      PTR     ns.$DN.
34 10      IN      PTR     www.$DN.
35 11      IN      PTR     mail.$DN.
36 +END+
37 cat > /etc/resolv.conf <<+END+
38 nameserver $Name
39 +END+
40 
41 service named start

 

Shell脚本——DNS自动部署

标签:

原文地址:http://www.cnblogs.com/miao-zp/p/4445528.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!