Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Config serveur DNS et DHCP (debian)

4 réponses
Avatar
Youri
Bonjour (ou bonsoir),

J'ai installé sur une machine debian Woody 3.0r2 un serveur DNS (bind9) et un
serveur DHCP (dhcp3-server).
Le serveur DHCP est configuré pour mettre à jour le DNS lorsque des machines se
connectent. Ça fonctionne bien pour une machine qui boote sur un CD knoppix et
une machine virtuelle Windows 98 (sous VMware) que j'ai reconfigurée après
l'installation du serveur DHCP pour qu'elle utilise DHCP au lieu d'une adresse
fixe. Par contre, j'ai une machine sous RedHat 9.0 qui avait aussi une adresse
IP fixe et que j'ai aussi modifiée pour qu'elle utilise DHCP, mais quand elle
démarre elle obtient bien une adresse IP dans la plage spécifiée par le serveur
DHCP, mais le serveur DNS n'est pas mis à jour pour cette machine, d'où est-ce
que ça peut venir ? Du serveur ? Du client ? Si je démarre cette même machine
avec knoppix au lieu de RH, le serveur DNS est bien mis à jour.

Toute aide est la bienvenue.

Ci-dessous mes fichiers de config DHCP et DNS :

# cat /etc/dhcp3/dhcpd.conf
option domain-name "youri.net";
option domain-name-servers 192.168.1.30;
default-lease-time 120;
max-lease-time 120;
authoritative;
ddns-update-style interim;
key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret xxx;
};
zone youri.net. {
primary 127.0.0.1;
key DHCP_UPDATER;
}
zone 1.168.192.in-addr.arpa. {
primary 127.0.0.1;
key DHCP_UPDATER;
}
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.100 192.168.1.150;
option routers 192.168.1.11;
}

# cat /etc/bind/named.conf
options {
directory "/var/cache/bind";
forwarders {
194.117.200.10;
194.117.200.15;
};
auth-nxdomain no; # conform to RFC1035
};
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
key DHCP_UPDATER {
algorithm HMAC-MD5.SIG-ALG.REG.INT;
secret xxx;
};
zone "youri.net" {
type master;
file "/var/cache/bind/youri.net.zone";
allow-update { key DHCP_UPDATER; };
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/var/cache/bind/1.168.192.db";
allow-update { key DHCP_UPDATER; };
};

# cat /var/cache/bind/youri.net.zone
$ORIGIN .
$TTL 86400 ; 1 day
youri.net IN SOA ns.youri.net. root.ns.youri.net. (
2004052918 ; serial
86400 ; refresh (1 day)
300 ; retry (5 minutes)
2592000 ; expire (4 weeks 2 days)
86400 ; minimum (1 day)
)
NS ns.youri.net.
MX 10 www.youri.net.
$ORIGIN youri.net.
chivas A 192.168.1.10
inetgw A 192.168.1.11
$TTL 60 ; 1 minute
J2U7M3 A 192.168.1.148
TXT "xxx"
Knoppix A 192.168.1.149
TXT "xxx"
$TTL 86400 ; 1 day
mailhost CNAME www
nomade A 192.168.1.250
ns CNAME www
sannois A 192.168.1.252
www A 192.168.1.30

# cat /var/cache/bind/1.168.192.db
$ORIGIN .
$TTL 86400 ; 1 day
1.168.192.in-addr.arpa IN SOA ns.1.168.192.in-addr.arpa.
root.ns.1.168.192.in-addr.arpa. (
2004052912 ; serial
86400 ; refresh (1 day)
300 ; retry (5 minutes)
2592000 ; expire (4 weeks 2 days)
86400 ; minimum (1 day)
)
NS ns.1.168.192.in-addr.arpa.
MX 10 www.1.168.192.in-addr.arpa.
$ORIGIN 1.168.192.in-addr.arpa.
10 PTR chivas.youri.net.
11 PTR inetgw.youri.net.
$TTL 60 ; 1 minute
148 PTR J2U7M3.youri.net.
149 PTR Knoppix.youri.net.
$TTL 21600 ; 6 hours
198 PTR Knoppix.youri.net.
$TTL 86400 ; 1 day
250 PTR nomade.youri.net.
252 PTR sannois.youri.net.
30 PTR www.youri.net.
chivas A 192.168.1.10
inetgw A 192.168.1.11
mailhost CNAME www
ns CNAME www
www A 192.168.1.30


Sur la machine RedHat 9.0, j'ai ça comme config :

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes

[root@paris root]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=paris
#GATEWAY=192.168.1.11
NOZEROCONF=1


--
Youri

4 réponses

Avatar
TiChou
Dans le message <news:40b93761$0$314$,
*Youri* tapota sur f.c.o.l.configuration :

Bonjour (ou bonsoir),


Bonjour,

[...]

En plus de toutes les informantions nombreuses et utiles que vous nous avez
donné, il serait intéressant de nous donner aussi les logs des requêtes et
de la négociation DHCP du côté serveur et du côté client.

--
TiChou

Avatar
Youri
TiChou wrote:

En plus de toutes les informantions nombreuses et utiles que vous nous avez
donné, il serait intéressant de nous donner aussi les logs des requêtes et
de la négociation DHCP du côté serveur et du côté client.


Alors, quand je boote le client sous Knoppix, j'ai ça sur le serveur :

- dans /var/log/syslog :
May 30 22:47:45 www dhcpd: DHCPDISCOVER from 00:40:f4:19:03:f1 via eth0
May 30 22:47:46 www dhcpd: DHCPOFFER on 192.168.1.150 to 00:40:f4:19:03:f1 via
eth0
May 30 22:47:46 www dhcpd: DHCPDISCOVER from 00:40:f4:19:03:f1 via eth0
May 30 22:47:46 www dhcpd: DHCPOFFER on 192.168.1.150 to 00:40:f4:19:03:f1
(Knoppix) via eth0
May 30 22:47:46 www named[160]: client 127.0.0.1#1027: updating zone
'youri.net/IN': adding an RR
May 30 22:47:46 www named[160]: client 127.0.0.1#1027: updating zone
'youri.net/IN': adding an RR
May 30 22:47:46 www dhcpd: Added new forward map from Knoppix.youri.net to
192.168.1.150
May 30 22:47:46 www named[160]: client 127.0.0.1#1027: updating zone
'1.168.192.in-addr.arpa/IN': deleting an rrset
May 30 22:47:46 www named[160]: client 127.0.0.1#1027: updating zone
'1.168.192.in-addr.arpa/IN': adding an RR
May 30 22:47:46 www dhcpd: added reverse map from 150.1.168.192.in-addr.arpa. to
Knoppix.youri.net
May 30 22:47:46 www dhcpd: DHCPREQUEST for 192.168.1.150 (192.168.1.30) from
00:40:f4:19:03:f1 (Knoppix) via eth0
May 30 22:47:46 www dhcpd: DHCPACK on 192.168.1.150 to 00:40:f4:19:03:f1
(Knoppix) via eth0

où on voit que le DNS est mis à jour avec Knoppix à 192.168.1.150

et ça à l'expiration du bail :
May 30 22:49:46 www named[160]: client 127.0.0.1#1027: updating zone
'youri.net/IN': deleting an RR
May 30 22:49:46 www dhcpd: if Knoppix.youri.net IN TXT
"0020324bb0275a6c51dcbceb0f3d4b88b7" rrset exists and Knoppix.youri.net IN A
192.168.1.150 rrset exists delete Knoppix.youri.net IN A 192.168.1.150:
success.
May 30 22:49:46 www named[160]: client 127.0.0.1#1027: updating zone
'youri.net/IN': deleting an RR
May 30 22:49:46 www dhcpd: if Knoppix.youri.net IN A rrset doesn't exist delete
Knoppix.youri.net IN TXT "0020324bb0275a6c51dcbceb0f3d4b88b7": success.
May 30 22:49:46 www named[160]: client 127.0.0.1#1027: updating zone
'1.168.192.in-addr.arpa/IN': deleting an rrset
May 30 22:49:46 www dhcpd: removed reverse map on 150.1.168.192.in-addr.arpa.


- dans /var/lib/dhcp3/dhcpd.leases :
lease 192.168.1.150 {
starts 0 2004/05/30 20:47:46;
ends 0 2004/05/30 20:49:46;
binding state active;
next binding state free;
hardware ethernet 00:40:f4:19:03:f1;
set ddns-rev-name = "150.1.168.192.in-addr.arpa.";
set ddns-txt = "0020324bb0275a6c51dcbceb0f3d4b88b7";
set ddns-fwd-name = "Knoppix.youri.net";
client-hostname "Knoppix";
}

et ça à l'expiration du bail :
lease 192.168.1.150 {
starts 0 2004/05/30 20:47:46;
ends 0 2004/05/30 20:49:46;
tstp 0 2004/05/30 20:49:46;
binding state free;
hardware ethernet 00:40:f4:19:03:f1;
}


Par contre, si je boote la machine sous RedHat 9, j'ai ça sur le serveur:

- dans /var/log/syslog :
May 30 22:52:07 www dhcpd: DHCPDISCOVER from 00:40:f4:19:03:f1 via eth0
May 30 22:52:08 www dhcpd: DHCPOFFER on 192.168.1.150 to 00:40:f4:19:03:f1 via
eth0
May 30 22:52:08 www dhcpd: DHCPREQUEST for 192.168.1.150 (192.168.1.30) from
00:40:f4:19:03:f1 via eth0
May 30 22:52:08 www dhcpd: DHCPACK on 192.168.1.150 to 00:40:f4:19:03:f1 via
eth0

-> aucune mise à jour du DNS, le serveur DHCP semble ne pas connaitre le
hostname de la machine (il n'en fait aucune mention alors qu'avec Knoppix il
est mentionné)

(et rien dans ce fichier à l'expiration du bail)

- dans /var/lib/dhcp3/dhcpd.leases :
lease 192.168.1.150 {
starts 0 2004/05/30 20:52:08;
ends 0 2004/05/30 20:54:08;
binding state active;
next binding state free;
hardware ethernet 00:40:f4:19:03:f1;
}

et à l'expiration du bail :
lease 192.168.1.150 {
starts 0 2004/05/30 20:52:56;
ends 0 2004/05/30 20:54:56;
tstp 0 2004/05/30 20:54:56;
binding state free;
hardware ethernet 00:40:f4:19:03:f1;
}



Sur les clients, que ce soit sous Knoppix ou RedHat, je n'ai pas trouvé de trace
dans les logs, où faut-il regarder ?



Tiens, dans la foulée, j'ai fait un tcpdump sur le serveur pour voir ce qui se
passe au boot du client :
(j'ai essayé tethereal mais j'y arrive pas à cette heure...
# tethereal -i eth0 -V -ta 'eth.src eq 00:40:f4:19:03:f1'
tethereal: Unable to parse filter string (parse error).
)

# tcpdump -i eth0 -vvv ether host 00:40:f4:19:03:f1
tcpdump: listening on eth0

Boot avec Knoppix :

23:00:07.690261 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0x2db10b19
[|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:00:07.692280 www.youri.net > 192.168.1.150: icmp: echo request (DF) (ttl 64,
id 0, len 48)
23:00:08.009032 www.youri.net.bootps > 192.168.1.150.bootpc: xid:0x2db10b19
Y:192.168.1.150 S:www.youri.net [|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:00:08.012670 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0x2eb10b19
[|bootp] [tos 0x10] (ttl 16, id 0, len 576)
23:00:08.015724 www.youri.net.bootps > 192.168.1.150.bootpc: xid:0x2eb10b19
Y:192.168.1.150 S:www.youri.net [|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:00:08.018982 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0x2fb10b19
[|bootp] [tos 0x10] (ttl 16, id 0, len 576)
23:00:08.471699 www.youri.net.bootps > 192.168.1.150.bootpc: xid:0x2fb10b19
Y:192.168.1.150 S:www.youri.net [|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:00:12.687789 arp who-has 192.168.1.150 tell www.youri.net
23:00:12.688096 arp reply 192.168.1.150 is-at 0:40:f4:19:3:f1

Boot avec RedHat :

23:04:11.825691 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0xd6a3fb31
[|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:04:11.827701 www.youri.net > 192.168.1.150: icmp: echo request (DF) (ttl 64,
id 0, len 48)
23:04:12.009062 www.youri.net.bootps > 192.168.1.150.bootpc: xid:0xd6a3fb31
Y:192.168.1.150 S:www.youri.net [|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:04:12.009847 0.0.0.0.bootpc > 255.255.255.255.bootps: xid:0xd6a3fb31
[|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:04:12.094527 www.youri.net.bootps > 192.168.1.150.bootpc: xid:0xd6a3fb31
Y:192.168.1.150 S:www.youri.net [|bootp] [tos 0x10] (ttl 16, id 0, len 328)
23:04:16.818059 arp who-has 192.168.1.150 tell www.youri.net
23:04:16.818460 arp reply 192.168.1.150 is-at 0:40:f4:19:3:f1

Il y a apparemment un échange supplémentaire avec Knoppix, mais je n'arrive pas
à avoir le contenu...

Merci pour toute aide, et n'hésitez pas à demander plus d'infos si besoin.

--
Youri

Avatar
Youri
Bon, alors j'avance un peu, à petits pas...
J'ai pu faire une vraie trace complète avec tethereal pour un boot avec Knoppix
et pour un boot avec RedHat.
Les traces complètes sont accessibles là pour ceux qui ont du courage... :
http://perso.club-internet.fr/youri/dhcp/teth.knoppix
http://perso.club-internet.fr/youri/dhcp/teth.redhat
(pour éviter de polluer le forum avec des milliards de lignes).

On voit dans ces traces que le client Knoppix envoit son hostname (Frame 4 -
Option 12: Host Name = "Knoppix"), alors que le client sous RH n'envoie jamais
cette information. C'est peut-être pour ça que le serveur DHCP ne fait pas de
mise à jour du DNS, n'ayant pas le nom de la machine... Il doit y avoir une
option quelque part sur le client DHCP pour préciser s'il doit envoyer son
hostname au serveur ou pas, mais je n'ai pas encore trouvé de ce côté. Si
quelqu'un a une piste... ?



--
Youri
Avatar
Youri
Youri wrote:

[problèmes DHCP/DNS]

Ca y est, j'ai trouvé.
En fait, c'était donc le client RedHat qui n'envoyait pas son hostname
au serveur.
En ajoutant la ligne
DHCP_HOSTNAME=paris
dans le fichier /etc/sysconfig/network-scripts/ifcfg-eth0, ça fonctionne
comme je le souhaitais...

--
Youri