Académique Documents
Professionnel Documents
Culture Documents
Dns 3
Dns 3
cours rseaux
SSI-4, fvrier 2003
mars et octobre 2004,
et ctobre 2005.
documentation
RFC-2535 Donald Eastlake
scurisation du dns
DNS-HOWTO Nicolai Langfeld
mise en route de named
RFC 1034
Paul Mockapetris
principe des espaces de noms
RFC 1035
Paul Mockapetris
spcification techniques du DNS
(2000)
(1999)
(1985)
(1985)
plan
Gnralits
Rsolution : utilisateur
Les espaces de noms
Principe de rsolution
Rsolution : serveur.
Configuration de named
attaques des serveurs de noms
Gnralits
importance des noms
gestion sur arpanet
problmes
service de noms de domaine
rhodes.univ-tln.fr
mail.univ-tln.fr
www.univ-tln.fr
Les inconvnients
La taille du fichier hosts.txt augmente avec le
nombre dhtes
En 1983, le rseau amorce son expansion
exponentielle.
La frquence des mises--jours des tables devient
proportionnelle au nombre de machines
La consommation de bande passante est
proportionnelle au carr du nombre dhtes
J. Postel
P. Mockapetris
standardisation
En 1985,
lIETF standardise le DNS au
travers des RFC1034 et RFC1035.
RR : Record Ressource
Protocoles : udp + tcp.
(1) Internet Entreprise Task Force
chronologie
Dcembre 1973
Novembre 1983
Octobre 1984
Janvier
1985
Novembre 1987
Novembre 1988
Avril 1993
Juin 1994
HOSTS.TXT
(RFC 606)
invention du DNS
(RFC 882)
.com,.org, .mil, .gov, .edu, .net
SRI dmarre le DNS service
spcification DNS
(RFCs 1034, 1035)
.int domain
NSI/InterNIC
utilisations commerciales
2
Gnralits
Rsolution : utilisateur.
objectifs
fichiers
rsolveurs
trame dns : ping, ftp.
objectif
ftp.domaine.xz
www.domaine.xz
mail.domaine.xz
rsolveurs
Les fonctions :
gethostbyname()
gethostbyaddr()
/*
* exemple de programme
* quivalent nslookup
*/
#include <stdio.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
void
erreur( void )
{
switch ( h_errno ) {
case HOST_NOT_FOUND :
puts("L'hte indiqu est inconnu.");
break;
case NO_ADDRESS :
puts("Le nom est valide mais ne
possde pas d'adresse IP.");
break;
case NO_RECOVERY :
puts("Une erreur fatale du serveur de
noms est apparue.");
break;
case TRY_AGAIN : puts("Try
again");
}
exit(1);
lookup.c
int
main(int argc, char *argv[])
{
struct hostent *infos;
struct in_addr addr;
unsigned long *tempo;
if (inet_aton(argv[1], &addr) != 0 ) {
infos = gethostbyaddr(
(char *)( &(addr.s_addr)),sizeof(addr.s_addr),AF_INET);
if ( ! infos )
erreur();
printf("\nnom:%s",infos -> h_name);
} else {
infos = gethostbyname(argv[1]);
if ( ! infos )
erreur();
tempo = (unsigned long int *)(infos -> h_addr);
addr.s_addr = *tempo;
printf("\nip:%s",inet_ntoa(addr));
}
printf("\nbye...\n");
}
fichiers
rseau
application
rsolveur
serveur
de
noms
/etc/hosts
recherche des
correspondance
rsolveur
/etc/resolv.conf
domaines et
serveurs de noms
127.0.0.1
194.214.66.29
194.214.246.33
194.214.68.17
194.214.68.2
195.220.98.157
10.1.65.1
10.1.66.15
10.1.66.16
192.168.168.1
192.168.169.1
#10.1.65.53
10.1.65.106
10.1.65.119
10.1.65.125
10.1.66.127
192.168.168.2
192.168.169.2
/etc/hosts
localhost
routeur-ft-utv
routeur-ft-coeur-toulon
routeur-ft-coeur-marseille1
routeur-ft-coeur-marseille2
routeur-rrthd-renater
mail.univ-tln.fr mail
mail1.univ-tln.fr
mail1
mail2.univ-tln.fr
mail2
mail1-ics0
member1-icstcp0
iut.univ-tln.fr
iut
www2.univ-tln.fr www2
listes.univ-tln.fr listes
comweb.univ-tln.fr
comweb
mail3
mail2-ics0
member2-icstcp0
/etc/resolv.conf
# /etc/resolv.conf
search domaine.xz autre.fr
nameserver 10.1.65.1
www.univ
www.univ.domaine.xz
www.univ.
www.univ.autre.fr
exp. ftp
epsilon.ut.fr.1038 > port-aci.ut.fr.ftp:
port-aci.ut.fr.ftp > epsilon.ut.fr.1038:
epsilon.ut.fr.1038 > port-aci.ut.fr.ftp:
port-aci.ut.fr.32779 > epsilon.ut.fr.auth:
epsilon.ut.fr.auth > port-aci.ut.fr.32779:
port-aci.ut.fr.32770 > pcs.ut.fr.domain:15225+ PTR? 2.65.1.10.in-addr.arpa.
pcs.ut.fr.domain > port-aci.ut.fr.32770:15225* 1/1/1 PTR epsilon.ut.fr.
port-aci.ut.fr.32770 > pcs.ut.fr.domain:15226+ A? epsilon.ut.fr.
pcs.ut.fr.domain > port-aci.ut.fr.32770:15226* 1/1/1 A epsilon.ut.fr
port-aci.ut.fr.32770 > pcs.ut.fr.domain:15227+ PTR? 2.65.1.10.in-addr.arpa.
pcs.ut.fr.domain > port-aci.ut.fr.32770:15227* 1/1/1 PTR epsilon.ut.fr.
port-aci.ut.fr.ftp > epsilon.ut.fr.1038:
epsilon.ut.fr.1038 > port-aci.ut.fr.ftp:
arp who-has pcs.ut.fr tell port-aci.ut.fr
arp reply pcs.ut.fr is-at 0:60:8:28:99:d8
epsilon.ut.fr.1038 > port-aci.ut.fr.ftp:
port-aci.ut.fr.ftp > epsilon.ut.fr.1038:
3
Rsolution : utilisateur.
espaces de noms
organisation hierarchique
top level domain
smantique des noms
zone zone fr.
ressources
Principe de rsolution.
hierarchie
top level domaine
domaines gographiques
.acAscension Island
.adAndorra
.aeUnited Arab Emirates
.afAfghanistan
.agAntigua and Barbuda
.aiAnguilla
.alAlbania
.amArmenia
.anNetherlands Antilles
.aoAngola
.aqAntarctica
.arArgentina
.asAmerican Samoa
.atAustria
.auAustralia
.awAruba
.azAzerbaijan
.baBosnia and Herzegovina
.bbBarbados
.bdBangladesh
.beBelgium
.bfBurkina Faso
.bgBulgaria
.bhBahrain
.biBurundi
.bjBenin
.bmBermuda
.bnBrunei Darussalam
.boBolivia
.brBrazil
.bsBahamas
.btBhutan
.bvBouvet Island
.bwBotswana
.byBelarus
.bzBelize
.caCanada
.ccCocos Islands
.cdCongo,
.cfCentral African Rep
.cgCongo, Republic of
.chSwitzerland
.ciCote d'Ivoire
.ckCook Islands
.clChile
.cmCameroon
.cnChina
.coColombia
.crCosta Rica
.cuCuba
.cvCap Verde
.cxChristmas Island
.cyCyprus
.czCzech Republic
.deGermany
.djDjibouti
.dkDenmark
.dmDominica
.doDominican Rep
.dzAlgeria
.ecEcuador
.eeEstonia
.egEgypt
.ehWestern Sahara
.erEritrea
.esSpain
.etEthiopia
.fiFinland
.fjFiji
.fkFalkland Islands
.fmMicronesia,
.foFaroe Islands
.frFrance
.gaGabon
.gdGrenada
.geGeorgia
.gfFrench Guiana
.ggGuernsey
.ghGhana
.giGibraltar
.glGreenland
.gmGambia
.gnGuinea
.gpGuadeloupe
.gqEquatorial Guinea
.grGreece
.gsSouth Georgia
Islands
.gtGuatemala
.guGuam
.gwGuinea-Bissau
.gyGuyana
.hkHong Kong
.hmHeard and
.hnHonduras
.hrCroatia/Hrvatska
.htHaiti
.huHungary
.idIndonesia
.ieIreland
.ilIsrael
.imIsle of Man
.inIndia
.ioBritish IndiaOce.
.iqIraq
.irIran
.isIceland
.itItaly
.jeJersey
.jmJamaica
.joJordan
.jpJapan
.keKenya
.kgKyrgyzstan
.khCambodia
.kiKiribati
.kmComoros
.knSaint Kitts and Nevis
.kpKorea, Democratic People's Republic
.krKorea, Republic of
.kwKuwait
.kyCayman Islands
.kzKazakhstan
.laLao People's Democratic Republic
.lbLebanon
.lcSaint Lucia
.liLiechtenstein
.lkSri Lanka
.lrLiberia
.lsLesotho
.ltLithuania
.luLuxembourg
.lvLatvia
.lyLibyan Arab Jamahiriya
.maMorocco
.mcMonaco
.mdMoldova, Republic of
.mgMadagascar
.mhMarshall Islands
.mkMacedonia, Former Yugoslav Republic
.mlMali
.mmMyanmar
.mnMongolia
.moMacau
.reReunion Island
.roRomania
.ruRussian Federation
.rwRwanda
.saSaudi Arabia
.sbSolomon Islands
.scSeychelles
.sdSudan
.seSweden
.sgSingapore
.shSt. Helena
.siSlovenia
.sjSvalbard and Jan Mayen Islands
.skSlovak Republic
.slSierra Leone
.smSan Marino
.snSenegal
.soSomalia
.srSuriname
.stSao Tome and Principe
.svEl Salvador
.sySyrian Arab Republic
.szSwaziland
.tcTurks and Caicos Islands
.tdChad
.tfFrench Southern Territories
.tgTogo
.thThailand
.tjTajikistan
.tkTokelau
.tmTurkmenistan
.tnTunisia
.toTonga
.tpEast Timor
.trTurkey
com
chez
edu
fr
com
www
www.infosecurity.com.fr.
univ-tln
infosecurity
maill
www
zone
zone
Une zone est un sous arbre de larbre des noms
de domaines sur lesquels un NS possde une
information complte.
Une zone est gr par une entit administrative
particulire. Lautorit sur ce sous-arbre est
dlgue.
La dlgation est totale : libre organisation,
changements sans pravis et dlgation de
sous-zones.
zone fr.
AFNIC (NIC France)
164059 domaines dlgus
serveurs de la zone:
dns.cs.wisc.edu
128.105.2.10
dns.inria.fr
193.51.208.13
dns.princeton.edu
128.112.129.15
ns1.nic.fr
192.93.0.1
ns2.nic.fr
192.93.0.4
ns3.domain-registry.nl 193.176.144.6
ns3.nic.fr
192.134.0.49
ns-ext.vix.com
204.152.184.64
.fr
139941
.com.fr
7886
.tm.fr
6238
.asso.fr
5664
.nom.fr
2237
.experts-comptables.fr
442
avocat.fr
284
.presse.fr
196
.cci.fr
192
10
.gouv.fr
183
ressources
RR
Un enregistrement de ressource est
compos de cinq champs :
OWNER
domaine
du RR
TYPE
CLASS
A
CNAME
HINFO
MX
NS
PTR
SOA.
IN, CH
TTL
dure de vie
en cache
Sur 32-bits
RDATA
A
CNAME
MX
PTR
SOA
adresse dhote
CNAME
nom canonique
NS
serveur autoris
SOA
sphre dautorit
PTR
Principes de rsolution
Espaces de noms
Principes de rsolution
format des questions
parcours de larborescence
commandes : nslookup, host et dig
exemple
format trame dns
Principes de rsolution
Parcours de larborescence
commande host
Elle permet dinterroger les ressources
dun serveur arbitraire, voir aussi nslookup
(obsolte) et dig (plus efficace).
Les principales options :
host
host
host
host
a
host
serveur
t ns domaine serveur
t soa domaine serveur
-l
domaine serveur
Exemple
www.security.com.fr
Partons dun des serveurs de la racine :
a.root-servers.net.
#host -a www.infosecurity.com.fr
;; opcode: QUERY, status: NOERROR, id: 56938
;; flags: qr rd ra; QUERY:1, ANSWER:1, AUTHORITY: 2,
ADDITIONAL: 2
;; QUESTION SECTION:
;www.infosecurity.com.fr.
IN
ANY
;; ANSWER SECTION:
www.infosecurity.com.fr. 403 IN
A
62.4.73.140
;; AUTHORITY SECTION:
infosecurity.com.fr. 403
IN
NS
ns0.imaginet.net.
infosecurity.com.fr. 403
IN
NS
ns1.imaginet.net.
;; ADDITIONAL SECTION:
ns0.imaginet.net.
328
IN
A
195.68.0.11
ns1.imaginet.net.
328
IN
A
195.68.0.12
format QR dns
en-tete
question
rponse
autorit
Information
en-tete
identificateur de la requte
qr
opcode
aa tc rd ra Z
rcode
QDCOUNT
ANCOUNT
NCOUNT
ARCOUNT
nombre de RR en information
aa : rponse dautorit tc : message tronqu
rd : rcursion dsir ra : rcursion accepte:
tcpdump -a
host -a microbe.utv.fr
10.1.74.93.32769 > pcs.utv.fr.domain:
13405+ A? microbe.utv.fr. (37)
pcs.utv.fr.domain > 10.1.74.93.32769:
13405* 1/1/1 A 10.1.65.3 (87)
tcpdump a -s128
tait ncessaire
4
principes de rsolution
Rsolution : serveur.
schma
exemple de mise en cache
zone
fichier matre
vers la racine
opration de maintenance
schma
rsolveur
fichiers
maitres
serveur
de
noms
cache
mmoire
serveur
de
noms
distant
exemple de trames
host -a www.univ-mrs.fr
17:54:30.178351 10.1.74.93.32769 > pcs.univ-tln.fr.domain:
17:54:30.188351 pcs.univ-tln.fr.1025 > ns-ext.vix.com.domain:
17:54:30.188351 pcs.univ-tln.fr.1025 > ns3.nic.fr.domain:
17:54:30.198351 pcs.univ-tln.fr.1185 > 212.27.32.5.domain:
17:54:30.488351 ns3.nic.fr.domain > pcs.univ-tln.fr.1025: 7117:54:30.498351 pcs.univ-tln.fr.1025 > riluminy.univ-mrs.fr.domain:
17:54:30.538351 ns-ext.vix.com.domain > pcs.univ-tln.fr.1025:
17:54:30.598351 212.27.32.5.domain > pcs.univ-tln.fr.1185:
17:54:30.608351 pcs.univ-tln.fr.1185 > 212.27.32.5.domain:
17:54:30.698351 riluminy.univ-mrs.fr.domain > pcs.univ-tln.fr.1025:
17:54:30.708351 pcs.univ-tln.fr.1025 > ns-ext.vix.com.domain:
17:54:30.708351 pcs.univ-tln.fr.1025 > dns.cs.wisc.edu.domain:
17:54:30.708351 pcs.univ-tln.fr.1025 > dns.Princeton.EDU.domain:
17:54:30.708351 pcs.univ-tln.fr.1025 > ns1.nic.fr.domain: 22
17:54:30.708351 pcs.univ-tln.fr.1025 > ns3.domain-registry.nl.domain:
17:54:30.718351 pcs.univ-tln.fr.1025 > dns.inria.fr.domain:
17:54:30.718351 pcs.univ-tln.fr.1025 > ns2.nic.fr.domain: 8275
17:54:30.818351 212.27.32.5.domain > pcs.univ-tln.fr.1185:
17:54:30.828351 pcs.univ-tln.fr.1185 > 212.27.32.5.domain:
17:54:31.008351 ns1.nic.fr.domain > pcs.univ-tln.fr.1025: 22
17:54:31.018351 pcs.univ-tln.fr.1025 > romarin.univ-aix.fr.domain:
17:54:31.038351 ns3.domain-registry.nl.domain > pcs.univ-tln.fr.1025:
17:54:31.068351 ns2.nic.fr.domain > pcs.univ-tln.fr.1025: 8275
17:54:31.078351 dns.inria.fr.domain > pcs.univ-tln.fr.1025:
17:54:31.098351 dns.Princeton.EDU.domain > pcs.univ-tln.fr.1025:
17:54:31.108351 dns.cs.wisc.edu.domain > pcs.univ-tln.fr.1025:
17:54:31.148351 212.27.32.5.domain > pcs.univ-tln.fr.1185:
17:54:31.158351 pcs.univ-tln.fr.1185 > 212.27.32.5.domain:
17:54:31.158351 ns-ext.vix.com.domain > pcs.univ-tln.fr.1025:
17:54:31.218351 romarin.univ-aix.fr.domain > pcs.univ-tln.fr.1025:
17:54:31.228351 pcs.univ-tln.fr.domain > 10.1.74.93.32769:
23896+
A? www.univ-mrs.fr. (33)
41809+
A? www.univ-mrs.fr. OPT UDPsize=2048 (44)
71+
A? www.univ-mrs.fr. OPT UDPsize=2048 (44)
50676+
PTR? 64.184.152.204.in-addr.arpa. (45)
0/3/4 (161)
5241+
A? www.univ-mrs.fr. OPT UDPsize=2048 (44)
418090/3/4 (161)
50676*
1/3/5 (262)
50677+
PTR? 49.0.134.192.in-addr.arpa. (43)
5241* 2/3/3
CNAME[|domain] (DF)
72 [1au]
A? www.univ-aix.fr. OPT UDPsize=2048 (44)
36 [1au]
A? www.univ-aix.fr. OPT UDPsize=2048 (44)
44 [1au]
A? www.univ-aix.fr. OPT UDPsize=2048 (44) (DF)
A? www.univ-aix.fr. (33)
11
A? www.univ-aix.fr. (33)
7167
A? www.univ-aix.fr. (33)
A? www.univ-aix.fr. (33)
50677*
3/3/4 (266)
50678+
PTR? 2.1.124.139.in-addr.arpa. (42)
0/3/3 (154)
6995 [1au]
A? www.univ-aix.fr. OPT UDPsize=2048 (44)
1
0/3/3 (154)
0/3/3 (154)
7167
0/3/3 (154)
44
0/3/4 (165)
36
FormErr% [0q] 0/0/0 (12)
50678*
1/3/3 (208)
50679+
PTR? 10.2.105.128.in-addr.arpa. (43)
720/3/4 (165)
6995*
1/3/2 A www.univ-aix.fr (149)
23896
2/3/0 CNAME[|domain]
host -a www.univ-mrs.fr
17:55:12.778351 10.1.74.93.32769 > pcs.univ-tln.fr.domain: 23480+ A? www.univ-mrs.fr. (33)
17:55:12.788351 pcs.univ-tln.fr.domain > 10.1.74.93.32769: 23480 2/3/0 CNAME[|domain]
zone
Une zone est contrle par un
ensemble de serveurs disperss sur le
rseau pour des raisons de scurit et
defficacit.
fichiers matres
Les fichiers matres dcrivent les RR
dinitialisation dune zone.
Ils renseignent sur les paramtres de
maintenance : noms des serveurs
secondaires, dlais relatifs aux
informations caches.
Ils contiennent les enregistrements des
htes et sous-zones.
accs la racine
oprations de maintenance
Numro de srie
: serial
priodicit des vrifications : refresh
dlai entre deux tentatives : retry
dure de validit
: expire
Les serveurs secondaires sont informs
priodiquement ( refresh) du numro de
srie de la zone. En cas daugmentation,
ils contactent la zone pour mise jour.
4
Rsolution : serveurs.
configuration de named
fichiers /etc/ .conf
exemple de /etc/named.conf
la zone racine
zone locale
zone bidon
/etc/named.conf
Les paramtres dinitialisation du daemon named
du systme de noms de domaine du package
BIND.
Berkeley Internet Name Daemon.
sont dcrits dans /etc/named.conf.
Le fichier de configuration qui contient toutes les
informations des zones. Voir aussi :
/etc/hosts.conf
hosts : files dns
/etc/nsswitch.conf order hosts, bind
multi on
/etc/named.conf
// generated by namedbootconf.pl
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none ; };
};
zone "univ-tln.fr" IN {
type master;
file "named.univ-tln.fr";
};
zone "65.1.10.in-addr.arpa" IN {
type master;
notify no;
file "db.10.1";
};
named.univ-tln.fr
@ IN
@
@
; serveur de noms
pcs
IN
A 10.1.65.1
@
IN
NS
16.7.27.1
; noms canoniques
www
CNAME pcs.univ-tln.fr.
; adresse ip des machines du reseau
epsilon
IN
A 10.1.65.2
microbe
IN
A 10.1.65.3
/var/named/db10.1.65
@ IN SOA pcs.univ-tln.fr. postmaster.pcs.univ-tln.fr. (
20020201
28800;
14400;
604800;
86400 ) ;
;serveur de noms
@ IN NS pcs.univ-tln.fr.
;adresse ip inverse
1 IN PTR pcs.univ-tln.fr.
2 IN PTR epsilon.univ-tln.fr.
3 IN PTR microbe.univ-tln.fr.
rsolution inverse
host -a -r 193.in-addr.arpa.
Trying "193.in-addr.arpa."
opcode: QUERY, status: NOERROR, id: 43026
;; flags: qr ra;
;; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 8
;; QUESTION SECTION:
;193.in-addr.arpa.
IN
ANY
;; ANSWER SECTION:
193.in-addr.arpa. 5662 IN SOA ns.ripe.net.
2003030201 43200 7200 1209600 7200
;; AUTHORITY SECTION:
193.in-addr.arpa.
84858
IN NS
ns.ripe.net.
193.in-addr.arpa.
84858
IN NS
NS.APNIC.net.
193.in-addr.arpa.
84858
IN NS
NS2.NIC.FR.
193.in-addr.arpa.
84858
IN NS
SUNIC.SUNET.SE.
193.in-addr.arpa.
84858
IN NS
AUTH03.NS.UU.net.
193.in-addr.arpa.
84858
IN NS
MUNNARI.OZ.AU.
;; ADDITIONAL SECTION:
ns.ripe.net.
171259
IN AAAA
2001:610:240:0:193::193
ns.ripe.net.
171285
IN A 193.0.0.193
NS.APNIC.net.
171257
IN A 203.37.255.97
NS2.NIC.FR.
171257
IN A 192.93.0.4
SUNIC.SUNET.SE.
171257
IN A 192.36.125.2
AUTH03.NS.UU.net.
171257
IN A 198.6.1.83
MUNNARI.OZ.AU.
5685
IN AAAA
2001:388:c02:4000::1:21
MUNNARI.OZ.AU.
172494
IN A 128.250.1.21
Received 384 bytes from 212.27.32.5#53 in 195 ms
suite
host -a -r 96.49.193.in-addr.arpa. ns.ripe.net
Trying "96.49.193.in-addr.arpa."
Using domain server: ns.ripe.net
Address: 193.0.0.193#53
Aliases:
;; opcode: QUERY, status: NOERROR, id: 46237
;; flags: qr;
;; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
;96.49.193.in-addr.arpa.
IN
ANY
;; AUTHORITY SECTION:
96.49.193.in-addr.arpa. 86400 IN
NS
dns.inria.fr.
96.49.193.in-addr.arpa. 86400 IN
NS
rhodes.univ-tln.fr.
Received 96 bytes from 193.0.0.193#53 in 194 ms
domaine in-addr.arpa.
ns.naif.fr
Id0 : mac ptr 10.1.0.13
ns.pirate.fr
10.1.0.13
mac.naif.fr
10.1.0.2
ns.naif.fr
10.1.0.13
ns.pirate.fr
Idz r: 10.1.0.13
Id0 q: A ? mc.dom.nil
Idx q: A ? mc.dom.nil
ns.dom.nil