#1 Le 17/04/2014, à 10:39
- wantonin
Unable to add forward map from bobpc.geovar.lan to 10.1.1.30 : not fou
Bonjour
Impossibilité de faire du dynamic dns update par dhcp.
Je réalise des tests en labo, l'objectif étant de prévoir une migration vers samba 4.
J'ai un server Ubuntu trusty 14.04 et un desktop Ubuntu 12.04. Lors de la mise à jour du dns, j'ai le message unable to add forward map from billpc.geovar.lan to 10.1.130 :not found
j'ai installé samba(4.1.6), ntp, cups, bind9, isc-dhcp-server.
Dans dhcpd.conf je fais appel un script pour faire la mise à jour automatique du dns.
Quand j'exécute le script manuellement avec l'utilisateur dhcp la mise à jour ce fait. Par contre quand la mise à jour doit se lancer automatiquement j'ai le message "Unable to add forward map from bobpc.geovar.lan to 10.1.1.30 : not found".
J'ai mis en disable usr.sbin.dhcpd et usr.sbin.named, qulequ'un aurait une piste?
J'ai rajouté dans dhcpd.conf :
on commit {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientName = pick-first-value(option host-name, host-decl-name);
execute("/etc/dhcp/update.sh", "add", ClientIP, ClientName);
}
on release {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientName = pick-first-value(option host-name, host-decl-name);
execute("/etc/dhcp/update.sh", "delete", ClientIP, ClientName);
}
on expiry {
set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
set ClientName = pick-first-value(option host-name, host-decl-name);
execute("/etc/dhcp/update.sh", "delete", ClientIP, ClientName);
}
Le script update.sh :
#!/bin/bash
# Begin /etc/dhcpd/update.sh
set -x
# Variables
KRB5CC=/tmp/krb5cc_`id -u`
KEYTAB=/etc/dhcp/dhcpd.keytab
DOMAIN=geovar.lan
REALM=GEOVAR.LAN
PRINCIPAL=dhcp@${REALM}
NAMESERVER=pdc1.${DOMAIN}
ZONE=${DOMAIN}
ACTION=$1
IP=$2
HNAME=$3
export KRB5CC KEYTAB DOMAIN REALM PRINCIPAL NAMESERVER ZONE ACTION IP HNAME
/etc/dhcp/dnsupdate.sh -m &
# End /etc/dhcpd/update.sh
Le script dnsupdate.sh :
set -x
sleep 5
# Disassemble IP for reverse lookups
OCT1=$(echo $IP | cut -d . -f 1)
OCT2=$(echo $IP | cut -d . -f 2)
OCT3=$(echo $IP | cut -d . -f 3)
OCT4=$(echo $IP | cut -d . -f 4)
RZONE="$OCT3.$OCT2.$OCT1.in-addr.arpa"
kerberos_creds() {
export KRB5_KTNAME="$KEYTAB"
kinit -k -t "$KEYTAB" "$PRINCIPAL" || { logger -s -p daemon.error -t dhcpd kinit for dynamic DNS failed; exit 11; }
klist
}
add_host(){
logger -s -p daemon.info -t dhcpd -- [add_host] Adding A record for host $HNAME with IP $IP to zone $ZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [add_host] samba-tool dns add $NAMESERVER $ZONE $HNAME A $IP -k yes
samba-tool dns add $NAMESERVER $ZONE $HNAME A $IP -k yes ${DEBUG}
host -t A $HNAME >/dev/null
if [ "${?}" != 0 ]; then
logger -s -p daemon.error -t dhcpd -- [add_host] Failed adding A record for host $HNAME with IP $IP to zone $ZONE on server $NAMESERVER
fi
}
delete_host(){
logger -s -p daemon.info -t dhcpd -- [delete_host] Removing A record for host $HNAME with IP $IP from zone $ZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [delete_host] samba-tool dns delete $NAMESERVER $ZONE $HNAME A $IP -k yes
samba-tool dns delete $NAMESERVER $ZONE $HNAME A $IP -k yes ${DEBUG}
host -t A $HNAME >/dev/null
if [ "${?}" == 0 ]; then
logger -s -p daemon.error -t dhcpd -- [delete_host] Failed removing A record for host $HNAME with IP $IP from zone $ZONE on server $NAMESERVER
fi
}
update_host(){
CURIP=$(host -t A $HNAME | cut -d " " -f 4)
logger -s -p daemon.info -t dhcpd -- [update_host] Removing A record for host $HNAME with IP $CURIP from zone $ZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [update_host] samba-tool dns delete $NAMESERVER $ZONE $HNAME A $CURIP -k yes
samba-tool dns delete $NAMESERVER $ZONE $HNAME A $CURIP -k yes ${DEBUG}
host -t A $HNAME >/dev/null
if [ "${?}" == 0 ]; then
logger -s -p daemon.error -t dhcpd -- [update_host] Failed removing A record for host $HNAME with IP $CURIP from zone $ZONE on server $NAMESERVER
fi
add_host
}
add_ptr(){
logger -s -p daemon.info -t dhcpd -- [add_ptr] Adding PTR record $OCT4 with hostname $HNAME to zone $RZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [add_ptr] samba-tool dns add $NAMESERVER $RZONE $OCT4 PTR $HNAME.$DOMAIN -k yes
samba-tool dns add $NAMESERVER $RZONE $OCT4 PTR $HNAME.$DOMAIN -k yes ${DEBUG}
host -t PTR $IP >/dev/null
if [ "${?}" != 0 ]; then
logger -s -p daemon.error -t dhcpd -- [add_ptr] Failed adding PTR record $OCT4 with hostname $HNAME to zone $RZONE on server $NAMESERVER
fi
}
delete_ptr(){
logger -s -p daemon.info -t dhcpd -- [delete_ptr] Removing PTR record $OCT4 with hostname $HNAME from zone $RZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [delete_ptr] samba-tool dns delete $NAMESERVER $RZONE $OCT4 PTR $HNAME.$DOMAIN -k yes
samba-tool dns delete $NAMESERVER $RZONE $OCT4 PTR $HNAME.$DOMAIN -k yes ${DEBUG}
host -t PTR $IP >/dev/null
if [ "${?}" == 0 ]; then
logger -s -p daemon.error -t dhcpd -- [delete_ptr] Failed removing PTR record $OCT4 with hostname $HNAME to zone $RZONE on server $NAMESERVER
fi
}
update_ptr(){
CURHNAME=$(host -t PTR $IP | cut -d " " -f 5)
logger -s -p daemon.info -t dhcpd -- [update_ptr] Removing PTR record $OCT4 with hostname $CURHNAME from zone $RZONE on server $NAMESERVER
logger -s -p daemon.info -t dhcpd -- [update_ptr] samba-tool dns delete $NAMESERVER $RZONE $OCT4 PTR $CURHNAME -k yes
samba-tool dns delete $NAMESERVER $RZONE $OCT4 PTR $CURHNAME -k yes ${DEBUG}
host -t PTR $IP >/dev/null
if [ "${?}" == 0 ]; then
logger -s -p daemon.error -t dhcpd -- [update_ptr] Failed removing PTR record $OCT4 with hostname $CURHNAME to zone $RZONE on server $NAMESERVER
fi
add_ptr
}
case "$ACTION" in
add)
kerberos_creds
host -t A $HNAME.$DOMAIN > /dev/null
if [ "${?}" == 0 ]; then
update_host
else
add_host
fi
host -t PTR $IP > /dev/null
if [ "${?}" == 0 ]; then
update_ptr
else
add_ptr
fi
;;
del|delete)
kerberos_creds
host -t A $HNAME.$DOMAIN > /dev/null
if [ "${?}" == 0 ]; then
delete_host
fi
host -t PTR $IP > /dev/null
if [ "${?}" == 0 ]; then
delete_ptr
fi
;;
*)
echo "Error: Invalid action '$ACTION'!" && exit 12
;;
esac
# End samba-dnsupdate.sh
Fgdsg
Fuyu
Pouvez-vous me donner une piste, svp.
Hors ligne