DNS-GSLB简单部署脚本

#!/bin/bash

yum -y install bind* cachingnameserver*

touch /var/named/zone.client
touch /var/named/zone.server
touch /var/named/client.cyhd.com.cn
touch /var/named/server.cyhd.com.cn


cat>/var/named/chroot/etc/named.conf<<EOF

options
{
  directory "/var/named";
  recursion yes;
  version "0.0.0";
  zone-statistics yes;
  max-cache-size 50M;
};

logging {
  channel my_warning
  {
    file "data/warnings.txt" versions 30 size 20M;
    #severity warning;
    #print-category yes;
    #print-severity yes;
    print-time yes;
  };

  channel general
  {
    file "data/general.txt" versions 30 size 20M;
    #severity info;
    #print-category yes;
    #print-severity yes;
    print-time yes;
  };

  category default { my_warning; };
  category queries { general; };
};
 
  view "client" {
    match-clients         { 10.0.101.0/24; };
    include "zone.client";
  };
 
  view "server" {
    match-clients         { 10.0.0.0/24; };
    include "zone.server"; 
};

EOF
#############################################################################
cat>/var/named/chroot/var/named/zone.client<<EOF
zone "cyhd.com.cn" {
  type master;
  file "client.cyhd.com.cn";
};
EOF
#############################################################################
cat>/var/named/chroot/var/named/zone.server<<EOF
zone "cyhd.com.cn" {
  type master;
  file "server.cyhd.com.cn";
};
EOF
#############################################################################

cat>/var/named/chroot/var/named/client.cyhd.com.cn<<EOF
\$ORIGIN .
\$TTL 86400      ; 1 day
cyhd.com.cn            IN SOA  cyhd.com.cn. root.cyhd.com.cn. (
                                2010043000 ; serial
                                3600       ; refresh (1 hour)
                                300        ; retry (5 minutes)
                                86400      ; expire (1 day)
                                43200      ; minimum (12 hours)
                                )
                        NS      ns1.cyhd.com.cn.
\$ORIGIN cyhd.com.cn.
ns1                     A       10.0.101.248
www1                    A       10.0.101.241
www2                    A       10.0.101.242
www3                    A       10.0.101.243

EOF
#############################################################################
cat>/var/named/chroot/var/named/server.cyhd.com.cn<<EOF
\$ORIGIN .
\$TTL 86400      ; 1 day
cyhd.com.cn            IN SOA  cyhd.com.cn. root.cyhd.com.cn. (
                                2010043000 ; serial
                                3600       ; refresh (1 hour)
                                300        ; retry (5 minutes)
                                86400      ; expire (1 day)
                                43200      ; minimum (12 hours)
                                )
                        NS      ns1.cyhd.com.cn.
\$ORIGIN cyhd.com.cn.
ns1                     A       10.0.0.248
www1                    A       10.0.0.241
www2                    A       10.0.0.242
www3                    A       10.0.0.243
EOF
#############################################################################

你可能感兴趣的:(shell,bind,dns,休闲,GSLB)