lecture
in color
/etc/hosts (locally valid list of names)
/etc/hosts for a local network)
/etc/passwd in a frightfully insecure manner.
/etc/hosts for an enterprise of hosts).
/etc/hosts for the internet)
BIND): DNS)
org: US non-profit
edu: US educational
gov: US government
com: US commercial (for-profit)
mil: US military organizations.
net: US network support organizations. (This has changed!)
info, biz, us: new toplevel domains
us: United States
fi: Finland
sg: Singapore
de: Germany. (Deutschland)
ch: Switzerland(!)
edu
/ \
tufts.edu mit.edu
|
eecs.tufts.edu
tualatin.eecs.tufts.edu: completely untrusted.
Only works on the local wire within EECS.
conmoto.eecs.tufts.edu: serves eecs.tufts.edu,
trusted by ns1.tufts.edu serving tufts.edu. ns1.tufts.edu: serves tufts.edu, trusted by ns1.highwire.org.
nslookup and digdig
tualatin{couch}55: dig conbrio.eecs.tufts.edu
; <<>> DiG 9.2.1 <<>> conbrio.eecs.tufts.edu
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29696
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;conbrio.eecs.tufts.edu. IN A
;; ANSWER SECTION:
conbrio.eecs.tufts.edu. 60 IN A 130.64.23.39
;; AUTHORITY SECTION:
eecs.tufts.edu. 60 IN NS ns2.tufts.edu.
eecs.tufts.edu. 60 IN NS ns2.highwire.org.
eecs.tufts.edu. 60 IN NS ns1.tufts.edu.
eecs.tufts.edu. 60 IN NS ns1.highwire.org.
;; ADDITIONAL SECTION:
ns1.tufts.edu. 83967 IN A 130.64.1.8
ns1.highwire.org. 2475 IN A 171.66.121.100
ns2.tufts.edu. 84364 IN A 130.64.5.8
ns2.highwire.org. 2475 IN A 171.66.232.36
;; Query time: 1 msec
;; SERVER: 130.64.23.38#53(130.64.23.38)
;; WHEN: Mon Mar 15 13:43:49 2004
;; MSG SIZE rcvd: 204
tualatin{couch}56: dig -x 130.64.23.38
; <<>> DiG 9.2.1 <<>> -x 130.64.23.38
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39953
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:
;38.23.64.130.in-addr.arpa. IN PTR
;; ANSWER SECTION:
38.23.64.130.in-addr.arpa. 60 IN PTR conmoto.eecs.tufts.edu.
;; AUTHORITY SECTION:
23.64.130.in-addr.arpa. 60 IN NS ns2.tufts.edu.
23.64.130.in-addr.arpa. 60 IN NS ns2.highwire.org.
23.64.130.in-addr.arpa. 60 IN NS ns1.tufts.edu.
23.64.130.in-addr.arpa. 60 IN NS ns1.highwire.org.
;; ADDITIONAL SECTION:
ns1.tufts.edu. 83839 IN A 130.64.1.8
ns1.highwire.org. 2347 IN A 171.66.121.100
ns2.tufts.edu. 84236 IN A 130.64.5.8
ns2.highwire.org. 2347 IN A 171.66.232.36
;; Query time: 1 msec
;; SERVER: 130.64.23.38#53(130.64.23.38)
;; WHEN: Mon Mar 15 13:45:57 2004
;; MSG SIZE rcvd: 227
tualatin{couch}63: nslookup
Note: nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead. Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
> set type=ptr
> 38.23.64.130.in-addr.arpa.
Server: 130.64.23.38
Address: 130.64.23.38#53
38.23.64.130.in-addr.arpa name = conmoto.eecs.tufts.edu.
>
set type=PTR: use address-to-name rather than name-to-address mapping.
38.23.64.130: address in reverse.
.in-addr.arpa.: magical suffix of address-to-name mapping
in-addr: internet addresses.
arpa: in arpanet (the predecessor of the internet).
libresolv.a of programs that translates names of
particular servers, on demand.
/etc/resolv.conf that determines how the library works
/sbin/nslookup (/usr/sbin/nslookup) that
allows one to test the infrastructure (also see /sbin/dig) /etc/nsswitch.conf that determines
which sources of names are locally valid.
/usr/lib/libresolv.a: the name resolution library.
/etc/resolv.conf: configuration file.
/usr/sbin/named: name service daemon.
/etc/named.conf or equivalent.
/etc/nsswitch.conf
domain eecs.tufts.edu search eecs.tufts.edu tufts.edu nameserver 130.64.23.38 # conmoto.eecs.tufts.edu nameserver 130.64.5.5 # tufts.edu
.).
telnet allegro.eecs.tufts.edu.
.).
telnet allegro
allegro.eecs.tufts.edu.
followed by allegro.tufts.edu.telnet allegro.eecs.tufts.edutries to translate all of
allegro.eecs.tufts.edu., allegro.eecs.tufts.edu.eecs.tufts.edu. and allegro.eecs.tufts.edu.tufts.edu(!). First match wins. contents of names/nsswitch.conf... # # /etc/nsswitch.conf # # An example Name Service Switch config file. This file should be # sorted with the most-used services at the beginning. # # The entry '[NOTFOUND=return]' means that the search for an # entry should stop if the search in the previous entry turned # up nothing. Note that if the search failed due to some other reason # (like no NIS server responding) then the search continues with the # next entry. # # Legal entries are: # # nisplus or nis+ Use NIS+ (NIS version 3) # nis or yp Use NIS (NIS version 2), also called YP # dns Use DNS (Domain Name Service) # files Use the local files # db Use the local database (.db) files # compat Use NIS on compat mode # hesiod Use Hesiod for user lookups # [NOTFOUND=return] Stop searching if not found so far # # To use db, put the "db" in front of "files" for entries you want to be # looked up first in the databases # # Example: #passwd: db files nisplus nis #shadow: db files nisplus nis #group: db files nisplus nis passwd: files ldap shadow: files ldap group: files ldap #hosts: db files nisplus nis dns hosts: files dns # Example - obey only what nisplus tells us... #services: nisplus [NOTFOUND=return] files #networks: nisplus [NOTFOUND=return] files #protocols: nisplus [NOTFOUND=return] files #rpc: nisplus [NOTFOUND=return] files #ethers: nisplus [NOTFOUND=return] files #netmasks: nisplus [NOTFOUND=return] files bootparams: nisplus [NOTFOUND=return] files ethers: files netmasks: files networks: files protocols: files ldap rpc: files services: files ldap netgroup: files ldap publickey: nisplus automount: files ldap aliases: files nisplus ...end of names/nsswitch.conf
udp port 42
named.conf: instructions about what information to serve.
contents of names/named.conf...
// generated by named-bootconf.pl
options {
directory "/var/named";
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
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 "pz/127.0.0";
allow-update { none; };
};
zone "eecs.tufts.edu" { // name to address
type master; // standalone
notify no; // don't do zone transfers
allow-update { none; };
file "pz/eecs.tufts.edu"; // where to get zone info
};
zone "118.10.10.in-addr.arpa" { //address to name
type master; // standalone
notify no; // don't do zone transfers
allow-update { none; };
file "pz/118.10.10"; // where to get zone info
};
include "/etc/rndc.key";
...end of names/named.conf
named.ca: "cache" of all the root servers on the Internet:
contents of names/named.ca... ; This file holds the information on root name servers needed to ; initialize cache of Internet domain name servers ; (e.g. reference this file in the "cache . <file>" ; configuration file of BIND domain name servers). ; ; This file is made available by InterNIC ; under anonymous FTP as ; file /domain/named.cache ; on server FTP.INTERNIC.NET ; ; last update: Nov 5, 2002 ; related version of root zone: 2002110501 ; ; ; formerly NS.INTERNIC.NET ; . 3600000 IN NS A.ROOT-SERVERS.NET. A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 ; ; formerly NS1.ISI.EDU ; . 3600000 NS B.ROOT-SERVERS.NET. B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107 ; ; formerly C.PSI.NET ; . 3600000 NS C.ROOT-SERVERS.NET. C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 ; ; formerly TERP.UMD.EDU ; . 3600000 NS D.ROOT-SERVERS.NET. D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90 ; ; formerly NS.NASA.GOV ; . 3600000 NS E.ROOT-SERVERS.NET. E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 ; ; formerly NS.ISC.ORG ; . 3600000 NS F.ROOT-SERVERS.NET. F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 ; ; formerly NS.NIC.DDN.MIL ; . 3600000 NS G.ROOT-SERVERS.NET. G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 ; ; formerly AOS.ARL.ARMY.MIL ; . 3600000 NS H.ROOT-SERVERS.NET. H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 ; ; formerly NIC.NORDU.NET ; . 3600000 NS I.ROOT-SERVERS.NET. I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 ; ; operated by VeriSign, Inc. ; . 3600000 NS J.ROOT-SERVERS.NET. J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 ; ; housed in LINX, operated by RIPE NCC ; . 3600000 NS K.ROOT-SERVERS.NET. K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ; ; operated by IANA ; . 3600000 NS L.ROOT-SERVERS.NET. L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12 ; ; housed in Japan, operated by WIDE ; . 3600000 NS M.ROOT-SERVERS.NET. M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 ; End of File ...end of names/named.ca
eecs.tufts.edu: zone file for name to address
contents of names/eecs.tufts.edu...
;
; Zone file for comp150net.eecs.tufts.edu
;
; The full zone file
;
$TTL 3D
@ IN SOA ns.eecs.tufts.edu. hostmaster.eecs.tufts.edu. (
200403102 ; serial, todays date + todays serial #
8H ; refresh, seconds
2H ; retry, seconds
4W ; expire, seconds
1D ) ; minimum, seconds
;
NS ns ; Inet Address of name server
;
hostmaster CNAME tualatin
ns CNAME tualatin
localhost A 127.0.0.1
tualatin A 10.10.118.1
host01 A 10.10.118.129
host02 A 10.10.118.130
...
host28 A 10.10.118.156
host29 A 10.10.118.157
couch A 10.10.118.33
ningwu A 10.10.118.35
bgrubi01 A 10.10.118.36
asidrane A 10.10.118.37
ipapas A 10.10.118.165
dcasaz01 A 10.10.118.166
jmeattle A 10.10.118.167
...
cbradley A 10.10.118.225
pjoshi01 A 10.10.118.226
tthomas A 10.10.118.227
...end of names/eecs.tufts.edu
118.10.10: zone file for reverse map (address to name).
contents of names/118.10.10...
$TTL 3D
@ IN SOA ns.eecs.tufts.edu. hostmaster.eecs.tufts.edu. (
200403102 ; Serial, todays date + todays serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL
NS ns.eecs.tufts.edu.
1 PTR ns
33 PTR couch
35 PTR ningwu
36 PTR bgrubi01
37 PTR asidrane
129 PTR host01
130 PTR host02
131 PTR host03
132 PTR host04
...
156 PTR host28
157 PTR host29
165 PTR ipapas
166 PTR dcasaz01
167 PTR jmeattle
...
226 PTR pjoshi01
227 PTR tthomas
...end of names/118.10.10
SOA: start of authority
NS: name server
A: name to address
PTR: address to name
MX: mail exchanger
CNAME: canonical name (alias)
HINFO: host information.
WKS: well known service.
@ IN SOA NS1.Tufts.EDU. jco.EECS.Tufts.EDU. (
2001030203 ; Serial number of this file,
; MUST be incremented upon ANY change.
; Format is YYYYMMDDXX where XX is 00-...
7200 ; Secondaries Refresh every 2 hours.
1800 ; Retry failed refresh every 30 min.
604800 ; Secondaries Expire data after 1 week
; isolation from primary.
86400 ) ; TTL's default to 1 day.
; here we list all our backup servers; they're
; `authorized' to serve as authoritative for our domain
IN NS Ns1.Tufts.EDU.
IN NS Ns2.Tufts.EDU.
IN NS Ns1.Highwire.ORG.
IN NS Ns2.Highwire.ORG.
IN: internet naming.
SOA: start of authority record.
NS: name server record.
@ name is magic. It stands for the domain we're
trying to define (eecs.tufts.edu).
Yogi IN A 130.64.23.171
Yogi: the name we're translating.
IN A: define the address of the record.
130.64.23.171: number corresponding to name.
Smtp IN CNAME Allegro.EECS.Tufts.EDU.
Smtp: name of alias (implicitly append eecs.tufts.edu!)
IN CNAME: define Internet canonical name.
Allegro.EECS.Tufts.EDU: translation of that name.
@ IN MX 10 Allegro.EECS.Tufts.EDU.
@: for eecs.tufts.edu
IN MX: define an Internet mail exchanger.
10: priority 10 (lowest wins).
Allegro.EECS.Tufts.EDU: the server for mail in this domain.
Yogi IN HINFO Pentium-II Redhat-6.2
Yogi: host to define.
IN HINFO: define host information.
Pentium-II: hardware.
Redhat-6.2: software.
kill -HUP $PIDwhere
$PID is the process identifier of named. This tells the process to re-read its tables. It does not kill the process.
dig and nslookup spy on names.
/etc/resolv.conf determines name sources.
/etc/nsswitch.conf determines whether DNS is enabled.
ping <address>
arp -a
traceroute <address>
netstat -rn
traceroute to the desired host?
/usr/sbin/nslookup
/local/bin/dig
lecture
in color