This is an old revision of the document!


Laborator 07: DNS

Demo: Funcționarea serviciului DNS

Pentru a verifica funcționarea serviciului DNS, putem folosi comenzi precum host sau dig care sunt aplicații de tip client DNS. Aceste aplicații interoghează server-ul DNS și afișează informațiile cerute.

Mai jos, aflăm adresa IP a domeniului hotnews.ro folosind host și dig:

student@eg106-pc:~$ host hotnews.ro
hotnews.ro has address 91.195.7.1
hotnews.ro mail is handled by 10 smtp.hotnews.ro.

student@eg106-pc:~$ dig hotnews.ro

; <<>> DiG 9.9.5-9ubuntu0.3-Ubuntu <<>> hotnews.ro
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11548
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;hotnews.ro.			IN	A

;; ANSWER SECTION:
hotnews.ro.		86388	IN	A	91.195.7.1

;; AUTHORITY SECTION:
hotnews.ro.		69394	IN	NS	ns-1701.awsdns-20.co.uk.
hotnews.ro.		69394	IN	NS	ns-1148.awsdns-15.org.
hotnews.ro.		69394	IN	NS	ns-943.awsdns-53.net.
hotnews.ro.		69394	IN	NS	ns-302.awsdns-37.com.

;; ADDITIONAL SECTION:
ns-302.awsdns-37.com.	22667	IN	A	205.251.193.46
ns-943.awsdns-53.net.	22667	IN	A	205.251.195.175
ns-1148.awsdns-15.org.	100500	IN	A	205.251.196.124
ns-1701.awsdns-20.co.uk. 22667	IN	A	205.251.198.165

;; Query time: 1 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Thu Dec 03 13:31:01 EET 2015
;; MSG SIZE  rcvd: 259

Observăm că output-ul dig este mai verbose afișând și informații despre serverele de nume autoritare pe domeniul hotnews.ro. Pentru același comportament din partea comenzii host putem folosi opțiunea -v a acestei comenzi:

student@eg106-pc:~$ host -v hotnews.ro
Trying "hotnews.ro"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35674
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;hotnews.ro.			IN	A

;; ANSWER SECTION:
hotnews.ro.		86129	IN	A	91.195.7.1
[...]

În mod similar, dacă dorim forma scurtă a comenzii dig folosim comanda

student@eg106-pc:~$ dig +short hotnews.ro
91.195.7.1

În comanda de mai sus am folosit pentru interogare serverul DNS configurat implicit în sistem, în fișierul /etc/resolv.conf. Dacă dorim să folosim alt server de nume (de exemplu 8.8.8.8) folosim comenzile în forma de mai jos

student@eg106-pc:~$ host hotnews.ro 8.8.8.8
Using domain server:
Name: 8.8.8.8
Address: 8.8.8.8#53
Aliases: 

hotnews.ro has address 91.195.7.1
hotnews.ro mail is handled by 10 smtp.hotnews.ro.
student@eg106-pc:~$ dig +short hotnews.ro @8.8.8.8
91.195.7.1

De avut în vedere că o comandă de interogare DNS (precum host sau dig) folosește direct serviciul DNS. Nu accesează fișierul /etc/nsswitch.conf și nici resolver-ul sistemului (de obicei o bibliotecă). Putem observa acest lucru în output-ul comenzilor de mai jos:

student@eg106-pc:~$ strace -e open host hotnews.ro
[...[
open("/etc/resolv.conf", O_RDONLY)      = 6
hotnews.ro has address 91.195.7.1
hotnews.ro mail is handled by 10 smtp.hotnews.ro.
[...]

student@eg106-pc:~$ strace -e open ping -c 1 hotnews.ro
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
[...]
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libnss_myhostname.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libnss_mdns4_minimal.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
[...]

Observăm că folosirea comenzii host duce la interogarea directă a fișierului /etc/resolv.conf în vreme ce folosirea comenzii ping duce la interogarea configurației de resolver: sunt deschise și fișierul /etc/nsswitch.conf și /etc/hosts și bibliotecile aferente pentru NSS (Name Service Switch) culminând cu apelarea bibliotecii de resolving (libresolv.so.2).

Urmărire configurare server DNS

Pentru următoarele exerciții folosim mașina virtuală GSR Debian. Mașina virtuală o importăm în VirtualBox folosind imaginea din /mnt/sda5/gsr/GSR Debian.ova.

Pentru autentificarea în mașina virtuală folosim numele de utilizator student cu parola student. Ne putem conecta și prin SSH de pe sistemul fizic folosind comanda

student@eg106-pc:~$ ssh -l student 192.168.56.115
[...]
Last login: Thu Dec  3 13:57:01 2015
student@gsr-server:~$

Contul student are permisiuni privilegiate. Putem accesa drepturile de root folosind comanda

sudo su

TODO

Modificare configurare server DNS

TODO

Delegare server DNS

TODO

Configuare server DNS delegat

TODO

gsr/laboratoare/laborator-07.1449144004.txt.gz · Last modified: 2015/12/03 14:00 by razvan.deaconescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0