divers params
This commit is contained in:
parent
00da92bdf9
commit
874bbac6e7
@ -1,27 +1,45 @@
|
|||||||
#/bin/bash
|
#!/bin/bash
|
||||||
set -u
|
set -u
|
||||||
set -e
|
set -e
|
||||||
# cree les fichiers de configuration bind9
|
# cree les fichiers de configuration bind9
|
||||||
# - ficher de zone directe
|
# - ficher de zone directe
|
||||||
# - ficher de zone inverse
|
# - ficher de zone inverse
|
||||||
#
|
#
|
||||||
readonly zone="domaine.lan"
|
|
||||||
|
zone="domaine.lan"
|
||||||
|
|
||||||
|
|
||||||
|
initialize () {
|
||||||
readonly zonenet="192.168.56"
|
readonly zonenet="192.168.56"
|
||||||
readonly zonerev="56.168.192.in-addr.arpa"
|
readonly zonerev="56.168.192.in-addr.arpa"
|
||||||
|
|
||||||
|
# NS1
|
||||||
readonly nsname="srv1"
|
readonly nsname="srv1"
|
||||||
readonly nsip="${zonenet}.10"
|
readonly nsip="${zonenet}.10"
|
||||||
readonly nsiprev=$(echo ${nsip}|cut -d. -f4) # dernier octet pour classe C
|
readonly nsiprev=$(echo ${nsip}|cut -d. -f4) # dernier octet pour classe C
|
||||||
|
|
||||||
|
# NS2
|
||||||
readonly nsname2="srv2"
|
readonly nsname2="srv2"
|
||||||
readonly nsip2="${zonenet}.11"
|
readonly nsip2="${zonenet}.11"
|
||||||
readonly nsiprev2=$(echo ${nsip2}|cut -d. -f4)
|
readonly nsiprev2=$(echo ${nsip2}|cut -d. -f4)
|
||||||
readonly ttl="86400"
|
readonly ttl="86400"
|
||||||
|
|
||||||
|
# Global
|
||||||
readonly nsfqdn="${nsname}.${zone}"
|
readonly nsfqdn="${nsname}.${zone}"
|
||||||
readonly nsfqdnp="${nsfqdn}."
|
readonly nsfqdnp="${nsfqdn}."
|
||||||
readonly zonep="${zone}."
|
readonly zonep="${zone}."
|
||||||
readonly date=$(date +%Y%m%d00)
|
readonly date=$(date +%Y%m%d00)
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# != 1 ]] ; then
|
||||||
|
echo "usage : $0 <dns-zone>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
zone=$1
|
||||||
|
initialize
|
||||||
|
|
||||||
|
|
||||||
|
echo "Generation fichier named.conf.local ..."
|
||||||
cat <<EOT > "named.conf.local"
|
cat <<EOT > "named.conf.local"
|
||||||
|
|
||||||
# fichier zone ${zone}
|
# fichier zone ${zone}
|
||||||
@ -39,7 +57,8 @@ zone "${zonerev}" {
|
|||||||
|
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
# fichier de zone directe
|
||||||
|
echo "Generation fichier de zone directe db.${zone} ..."
|
||||||
cat <<EOT > "db.${zone}"
|
cat <<EOT > "db.${zone}"
|
||||||
; fichier zone ${zone}
|
; fichier zone ${zone}
|
||||||
; le $(date)
|
; le $(date)
|
||||||
@ -68,11 +87,11 @@ ${nsname2} IN A ${nsip2}
|
|||||||
|
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
echo "Generation fichier de zone inverse db.${zone}.rev ..."
|
||||||
cat <<EOT > "db.${zone}.rev"
|
cat <<EOT > "db.${zone}.rev"
|
||||||
; fichier zone inverse ${zone}
|
; fichier zone inverse ${zone}
|
||||||
; le $(date)
|
; le $(date)
|
||||||
\$TTL ${ttl} ; (1 day)
|
\$TTL ${ttl} ; (1 day)
|
||||||
#\$ORIGIN ${zonep}
|
|
||||||
@ IN SOA ${nsfqdnp} root.${nsfqdnp} (
|
@ IN SOA ${nsfqdnp} root.${nsfqdnp} (
|
||||||
${date} ; serial YYYYMMDDnn
|
${date} ; serial YYYYMMDDnn
|
||||||
14400 ; refresh (4 hours)
|
14400 ; refresh (4 hours)
|
||||||
@ -81,12 +100,23 @@ cat <<EOT > "db.${zone}.rev"
|
|||||||
3600 ; minimum (1 hour)
|
3600 ; minimum (1 hour)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ IN NS ${nsname}
|
@ IN NS ${nsname}.${zone}.
|
||||||
@ IN NS ${nsname2}
|
@ IN NS ${nsname2}.${zone}.
|
||||||
|
|
||||||
|
|
||||||
${nsiprev} IN PTR ${nsname}
|
${nsiprev} IN PTR ${nsname}.${zone}.
|
||||||
${nsiprev2} IN PTR ${nsname2}
|
${nsiprev2} IN PTR ${nsname2}.${zone}.
|
||||||
|
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
echo "Generation fichier /etc/resolv.conf ..."
|
||||||
|
cat <<EOT > "/etc/reolv.conf"
|
||||||
|
|
||||||
|
# fichier resolv.conf ${zone}
|
||||||
|
# le $(date)
|
||||||
|
domain "${zone}"
|
||||||
|
search "${zone}"
|
||||||
|
nameserver 127.0.0.1
|
||||||
|
EOT
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user