#!/bin/bash
#Centos_DNS_master_slave.sh
#两个互为主从DNS服务
###############################
### Master #######
###############################
#root@Master:~#vi /etc/sysconfig/network-scripts/ifcfg-eth0
#DEVICE="eth0"
#BOOTPROTO="static"
#HWADDR="00:0c:29:58:0e:86"
#NM_CONTROLLED="no"
#ONBOOT="yes"
#IPADDR=192.168.95.50
#NETMASK=255.255.255.0
#GATEWAY=192.168.95.2
echo 'options {
listen-on port 53 { 192.168.95.50; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
zone "rabbit.org" IN {
type master;
file "rabbit.org";
allow-update { none; };
};
zone "mouse.org" IN {
type slave;
masters { 192.168.95.51; };
file "slaves/mouse.org";
allow-update { none ; };
};
zone "95.168.192.in-addr.arpa" IN {
type master;
file "192.168.95.zone";
allow-update { none; };
};' >/etc/named.conf
echo '$TTL 60
@ IN SOA master.rabbit.org. dns-admin.master.rabbit.org. (
2011012401 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns1.goole.org.
IN MX 1 ns1.rabbit.org.
ns1 IN A 192.168.95.52
@ IN NS ns2.rabbit.org.
IN MX 2 ns2.rabbit.org.
ns2 IN A 192.168.95.53
www CNAME ns1.rabbit.org.
ftp CNAME ns1.rabbit.org.
mail CNAME ns2.rabbit.org.
linux CNAME ns2.rabbit.org' >/var/named/rabbit.org
echo '$TTL 1800
@ IN SOA revers.rabbit.org. dns-admin.revers.rabbit.org. (
2011012402 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
95.168.192.in-addr.arpa. IN NS ns1.rabbit.org.
95.168.192.in-addr.arpa. IN NS ns2.rabbit.org.
52 IN PTR ns1.rabbit.org.
53 IN PTR ns2.rabbit.org.' >/var/named/192.168.95.zone
chown root.named /var/named/rabbit.org
chown root.named /var/named/192.168.95.zone
#!/bin/bash
###############################
##### Slave #######
###############################
#root@Slave:~#vi /etc/sysconfig/network-scripts/ifcfg-eth0
#DEVICE="eth0"
#BOOTPROTO="static"
#HWADDR="00:0c:29:59:8d:f1"
#NM_CONTROLLED="no"
#ONBOOT="yes"
#IPADDR=192.168.95.51
#NETMASK=255.255.255.0
#GATEWAY=192.168.95.2
echo 'options {
listen-on port 53 { 192.168.95.51; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
zone "mouse.org" IN {
type master;
file "mouse.org";
allow-update { none; };
};
zone "rabbit.org" IN {
type slave;
masters { 192.168.95.50; };
file "slaves/rabbit.org";
allow-update { none; };
};
zone "95.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.95.50; };
file "slaves/192.168.95.zone";
allow-update { none; };
};' >/etc/named.conf
echo '$TTL 60
@ IN SOA slave.mouse.org. dns-admin.slave.mouse.org. (
2011012403 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS ns3.mouse.org.
IN MX 3 ns3.mouse.org.
ns3 IN A 192.168.95.54
@ IN NS ns4.mouse.org.
IN MX 4 ns4.mouse.org.
ns4 IN A 192.168.95.55
www IN CNAME ns3.mouse.org.
ftp IN CNAME ns3.mouse.org.
mail IN CNAME ns4.mouse.org.
linux IN CNAME ns4.mouse.org.' >/var/named/mouse.org
chown root.named /var/named/mouse.org
Centos_DNS_master_slave.sh
最新推荐文章于 2022-12-26 09:16:08 发布