Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP, DNS, SNMP
Debashis Saha
MIS Group, IIM Calcutta
[email protected]
Thursday, May 17, 2007 1
Lecture on DHCP, DNS & SNMP Debashis Saha
First Question
• How does your computer know which IP
to use?
• How does your computer know that
www.iimcal.ac.in is at IP 202.54.116.3?
• How can you track your network’s health?
Thursday, May 17, 2007 2
Lecture on DHCP, DNS & SNMP Debashis Saha
The Internet and Addressing
• All machines on the Internet are accessed via
their IP address
– Dotted quad: xxx.xxx.xxx.xxx
• Problem: IP addresses are hard to remember and
hard to statically assign on large networks
• Solution: Need to come up with a way to
automatically assign IP addresses and a text based
representation of machine addresses instead of
just 4 numbers
Thursday, May 17, 2007 3
Lecture on DHCP, DNS & SNMP Debashis Saha
Addressing Solutions
• Two protocols have been developed to solve
these problems
– DHCP – automatic network configuration (including IP
address)
– DNS – translates textual based names into IP addresses
and vice versa
Thursday, May 17, 2007 4
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP – Dynamic Host Configuration
Protocol
Thursday, May 17, 2007 5
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP
• Allows client machines to receive an IP
address, DNS information, etc
automatically
• Before DHCP came into use, users had to
type in all this information by hand, which
is bad:
– Easy to mistype something when entering by hand
– Manually changing network configuration every time you
move your laptop is a pain
– Bootp resolved some of these issues
• … and DHCP still uses the same port as bootp
Thursday, May 17, 2007 6
Lecture on DHCP, DNS & SNMP Debashis Saha
Purpose of DHCP
From RFC-2131 (the Internet standard):
• The Dynamic Host Configuration Protocol
(DHCP) provides a framework for passing
configuration information to hosts on a TCP/IP
network.
• DHCP consists of two components:
– a protocol for delivering host-specific configuration
parameters from a DHCP server to a host and
– a mechanism for allocation of network addresses to hosts.
Thursday, May 17, 2007 7
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP functional goals
• A host without a valid IP address locates
and communicates with a DHCP server
• A DHCP server passes configuration
parameters, including an IP address, to the
host
• The DHCP server may dynamically allocate
addresses to hosts and reuse addresses
• Hosts can detect when they require a new IP
address
• Unavailability of DHCP server has minimal
effect on operation of hosts
Thursday, May 17, 2007 8
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: Basics
• A client leases an IP address from a DHCP
server for a given amount of time
• When lease expires, the client must ask
DHCP server for a new address (clients
attempt to renew lease after 50% of the
lease time has expired)
• Typical leases may last for from 30
seconds to 24 hours, or even longer.
Thursday, May 17, 2007 9
Lecture on DHCP, DNS & SNMP Debashis Saha
What does DHCP do?
• Provides protocol stack, application and
other configuration parameters to hosts
• Eliminates need for individual, manual
configuration for hosts
• Includes administrative controls for
network administrators
• Backward compatible packet format for
BOOTP interoperation (RFC 1542)
• Can coexist with hosts that have pre-
assigned IP addresses and hosts that do
not participate in DHCP
Thursday, May 17, 2007 10
Lecture on DHCP, DNS & SNMP Debashis Saha
Design Goals
• Eliminate manual configuration of hosts
• Prevent use of any IP address by more than
one host
• Should not require a server on every subnet
• Allow for multiple DHCP servers
• Provide a mechanism, not a policy
• Provide the same configuration - including
IP address - to a host whenever possible
Thursday, May 17, 2007 11
Lecture on DHCP, DNS & SNMP Debashis Saha
What can you do with DHCP
• Plug-and-play
• Move desktop PCs between offices
• Renumber
• Other restructuring - change subnet masks
• Mobile IP - laptops
• Moving equipment - cartable
Thursday, May 17, 2007 12
Lecture on DHCP, DNS & SNMP Debashis Saha
What DHCP doesn’t do
• Support multiple addresses per interface
• Inform running host that parameters have changed
• Propagate new addresses to DNS
• Support inter-server communication
• Provide authenticated message delivery
• Configure routers and other network equipment
• Design network addressing plan
• Determine other configuration parameters
• Locate other servers
Thursday, May 17, 2007 13
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: Messages Overview
• Several messages are sent back and forth
between a client and the DHCP server
before it can successfully obtain an IP
address
Thursday, May 17, 2007 14
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: DISCOVER
• Hardcoding the addresses of DHCP servers
kind of defeats the purpose of automatic
configuration
• Solution: A client using DHCP will broadcast
a DISCOVER message to all computers on
its subnet (addr 255.255.255.255) to
figure out the IP address of any DHCP
servers
• Most routers are configured to pass this
request within the campus or enterprise
Thursday, May 17, 2007 15
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: OFFER
• (Optionally) sent from server in response
to a DISCOVER
• Contains an IP address, other configuration
information as well (subnet mask, DNS
servers, default gateway, search domains,
etc)
• Note that all DHCP servers that receive a
DISCOVER request may send an OFFER;
– since a client typically does not need more than one IP
address, more messages needed to zero on one IP
Thursday, May 17, 2007 16
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: REQUEST
• Sent by client to request a certain IP address
– Usually the one sent by an OFFER, but also used to renew
leases. Also can be sent to try to get same address after a
reboot
• This message is broadcast
• Most OSs by default will send a REQUEST for the
first OFFER they receive – this means that if
there is a rogue DHCP server on your subnet, most
clients will ignore the OFFERs from the campus
DHCP servers (since the OFFER from the rogue
server gets to the user’s PC first)!
Thursday, May 17, 2007 17
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: ACK/NACK
• Sent by server in response to a REQUEST
• ACK: Request accepted, client can start
using the IP it REQUESTed
• NACK: Something is wrong with the client’s
REQUEST (for example they requested an
IP address they’re not supposed to have)
Thursday, May 17, 2007 18
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: RELEASE
• Sent by client to end a lease
• Not strictly required, but is the “polite” thing to
do if done with the IP (could just let the lease
expire)
• Some clients may not send RELEASEs in an
attempt to keep the same IP address for as long
as possible
Thursday, May 17, 2007 19
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: Big Picture
Thursday, May 17, 2007 20
Lecture on DHCP, DNS & SNMP Debashis Saha
Summary
• DHCP works today as a tool for automatic
configuration of TCP/IP hosts
• It is an open Internet standard and
interoperable client implementations are
widely available
• Provides automation for routine
configuration tasks, once network architect
has configured network and addressing plan
• Ongoing work will extend DHCP with
authentication, DHCP-DNS interaction and
inter-server communication
Thursday, May 17, 2007 21
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP: Conclusion
• Efficient way of assigning computers IP
addresses and delivering configuration
information to those computers
• Does not solve other problem of addressing
– that IP addresses are hard to remember
Thursday, May 17, 2007 22
Lecture on DHCP, DNS & SNMP Debashis Saha
IETF standards
• Formal process for development, review and
acceptance of TCP/IP protocol suite
standards
• Initial specifications published as Internet
Drafts (I-Ds)
• Accepted specifications published as
Request for Comments (RFCs)
Thursday, May 17, 2007 23
Lecture on DHCP, DNS & SNMP Debashis Saha
Protocol status
• DHCP has been accepted as a Draft
Standard; the specifications are
published in:
– RFC 2131: Dynamic Host Configuration Protocol
– RFC 2132: DHCP Options and BOOTP Vendor
Extensions
• Several additional options are in
development
Thursday, May 17, 2007 24
Lecture on DHCP, DNS & SNMP Debashis Saha
Implementation status
• DHCP is an open standard, with freely
available specifications
• Can be (and has been) implemented entirely
from the specification
• Commercial implementations are widely
available
• Non-commerical implementations are also
available
Thursday, May 17, 2007 25
Lecture on DHCP, DNS & SNMP Debashis Saha
DHCP Resources
• Compilation of DHCP-related WWW links and
other information:
http://www.dhcp.org
• DHCP FAQ (maintained by John Wobus)
• [email protected] mailing list (admin
requests to [email protected])
• IETF information can be retrieved from:
http://www.ietf.cnri.reston.va.us
• I-Ds and RFCs can also be retrieved from:
http://www.rfc-editor.org
Thursday, May 17, 2007 26
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS – Domain Name System
Thursday, May 17, 2007 27
Lecture on DHCP, DNS & SNMP Debashis Saha
Second Question
• How does your computer know which IP to
use?
• How does your computer know that
www.iimcal.ac.in is at IP 202.54.116.3?
• How can you track your network’s health?
Thursday, May 17, 2007 28
Lecture on DHCP, DNS & SNMP Debashis Saha
Domain Name System (DNS)
• The first IP networks distributed host
files on a regular basis
– This became a burden and an automated distributed
solution was needed
• IP Addresses are great for computers
– IP address includes information used for routing.
• IP addresses are tough for humans to
remember.
• IP addresses are impossible to guess.
– ever guessed at the name of a WWW site?
Thursday, May 17, 2007 29
Lecture on DHCP, DNS & SNMP Debashis Saha
Hostnames
• DNS is born
• Domain names comprise a hierarchy so that
names are unique, yet easy to remember.
• The domain name system is usually used to
translate a host name into an IP address .
– Ex: www.xxx.org <-> IP 212.87.7.181
• (which one would you rather remember?)
Thursday, May 17, 2007 30
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS: Basics
• Hierarchical namespace
• Distributed system – very few core servers
• Stores other information than simple
hostname <-> IP mappings
• Request/response protocol
Thursday, May 17, 2007 31
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Hierarchy
edu com org in
rpi albany ac
iimcal
Thursday, May 17, 2007 32
Lecture on DHCP, DNS & SNMP Debashis Saha
Host name structure
• Each host name is made up of a sequence of
labels separated by periods.
– Each label can be up to 63 characters
– The total name can be at most 255 characters.
• Examples:
– whitehouse.gov
– barney.the.purple.dinosaur.com
– monica.cs.rpi.edu
Thursday, May 17, 2007 33
Lecture on DHCP, DNS & SNMP Debashis Saha
Domain Name
• The domain name for a host is the
sequence of labels that lead from the host
(leaf node in the naming tree) to the top of
the worldwide naming tree.
• A domain is a subtree of the worldwide
naming tree.
Thursday, May 17, 2007 34
Lecture on DHCP, DNS & SNMP Debashis Saha
Hierarchical Naming
arpa
com edu gov mil net org us
colordao
cs foobar.cs.colorado.edu
foobar
Thursday, May 17, 2007 35
Lecture on DHCP, DNS & SNMP Debashis Saha
Top level domains
• edu, gov, com, net, org, mil, …
• Countries each have a top level domain (2
letter domain name).
– Such as .in, .uk, .it, etc.
• New top level domains include:
.aero .biz .coop .info .name .pro
Thursday, May 17, 2007 36
Lecture on DHCP, DNS & SNMP Debashis Saha
Domain Naming System
edu com gov mil org net uk fr
harvard …mit cisco…yahoonasa…nsf arpa…navy acm…ieee
hbs ee physics
www
Thursday, May 17, 2007 37
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS: Architecture
• DNS servers are responsible for one or more
domains of any level
• “Root servers” are maintained throughout the
world (one is in Palo Alto) and are responsible for
all of the top-level domains
– When you register a domain, an entry for that domain is added
to the appropriate root server
• Owners of each regular domain or subdomain
maintain (or outsource) their own DNS servers
containing the correct information
Thursday, May 17, 2007 38
Lecture on DHCP, DNS & SNMP Debashis Saha
Name Servers
• Partition hierarchy into zones
edu com gov mil org net uk fr
princeton … mit cisco … yahoo nasa … nsf arpa … navy acm … ieee
cs ee physics
ux01 ux04 Root
name server
Each zone implements two or
more name servers
1. Primary Princeton
name server
… Cisco
name server
2. secondary
CS … EE
name server name server
Thursday, May 17, 2007 39
Lecture on DHCP, DNS & SNMP Debashis Saha
Hierarchical Administration - “Zones”
arpa
arpa com in gov mil net org us
ac
iimcal
www.iimcal.ac.in
www
Thursday, May 17, 2007 40
Lecture on DHCP, DNS & SNMP Debashis Saha
Administration - Zones
• A zone is a subtree of the DNS tree that is
independently managed
– Second-level domains (“ac.in”) are usually an independent
zone
– Most sub-domains (“iimcal.ac.in”) are also independent.
• A zone must provide multiple name servers.
This server records the members in the
domain.
– You typically need a primary name server and one or more
secondary name servers.
– Secondary retrieves information from primary using a zone
transfer.
Thursday, May 17, 2007 41
Lecture on DHCP, DNS & SNMP Debashis Saha
Resolving an address
• A.C.D wants to know about F.E.D
D
C E
Name
servers
A B F G
• Host “A.C.D” asks “B.C.D” (the local name
server) to resolve “F.E.D”
Thursday, May 17, 2007 42
Lecture on DHCP, DNS & SNMP Debashis Saha
Resolving an address
• B.C.D doesn’t know the answer.
• It wants to ask the primary domain server for the
“E.D” domain, so it asks the parent of the “B.C”
domain (“D” in this example) to resolve “E.D”.
• D asks H, the root server.
• H doesn’t know the answer, but it’s the top-level
domain and knows that “G.E.D” is the primary
domain server for the “E.D” domain
• B.C.D now knows the primary domain server for the
E.D domain, and can now ask “G.E.D” about “F.E.D”
Thursday, May 17, 2007 43
Lecture on DHCP, DNS & SNMP Debashis Saha
Domain servers
• What kind of records can be requested for a given
domain?
– Address translation
– Caching information
– Mail server information
– Authoritative nameserver information
• How is this data requested?
– Each record has a type and certain data associated with it –
clients request records of a certain type from a server
Thursday, May 17, 2007 44
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Organization
• Distributed Database
– The organization that owns a domain name is responsible
for running a DNS server that can provide the mapping
between hostnames within the domain to IP addresses.
– So - some machine run by RPI is responsible for
everything within the rpi.edu domain.
Thursday, May 17, 2007 45
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Distributed Database
• There is one primary server for a domain,
and typically a number of secondary
servers containing replicated databases.
rpi.edu DNS server
rpi.edu
rpi.edu rpi.edu
rpi.edu
DNS DB
DNS DB DNS
DNSDBDB
Authoritative Replicas
Thursday, May 17, 2007 46
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Clients
• A DNS client is called a resolver.
• A call to gethostbyname()is handled by a
resolver (typically part of the client).
• Most Unix workstations have the file
/etc/resolv.conf that contains the local
domain and the addresses of DNS servers
for that domain.
Thursday, May 17, 2007 47
Lecture on DHCP, DNS & SNMP Debashis Saha
/etc/resolv.conf
domain rpi.edu
128.113.1.5
128.113.1.3
Thursday, May 17, 2007 48
Lecture on DHCP, DNS & SNMP Debashis Saha
nslookup
• nslookup is an interactive resolver that
allows the user to communicate directly
with a DNS server.
• nslookup is usually available on Unix
workstations. (dig and host are also DNS
clients).
Thursday, May 17, 2007 49
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Servers
• Servers handle requests for their domain
directly.
• Servers handle requests for other domains
by contacting remote DNS server(s).
• Servers cache external mappings.
Thursday, May 17, 2007 50
Lecture on DHCP, DNS & SNMP Debashis Saha
Server - Server Communication
• If a server is asked to provide the mapping
for a host outside it’s domain (and the
mapping is not in the server cache):
– The server finds a nameserver for the target domain.
– The server asks the nameserver to provide the host
name to IP translation.
• To find the right nameserver, use DNS!
Thursday, May 17, 2007 51
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Data
• DNS databases contain more than just
hostname-to-address records:
– Name server records NS
– Hostname aliases CNAME
– Mail Exchangers MX
– Host Information HINFO
Thursday, May 17, 2007 52
Lecture on DHCP, DNS & SNMP Debashis Saha
The Root DNS Server
• The root server needs to know the address
of 1st (and many 2nd) level domain
nameservers.
edu com org jp
rpi albany
Thursday, May 17, 2007 53
Lecture on DHCP, DNS & SNMP Debashis Saha
Server Operation
• If a server has no clue about where to find
the address for a hostname, ask the root
server.
• The root server will tell you what
nameserver to contact.
• A request may get forwarded a few times.
Thursday, May 17, 2007 54
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Message Format
HEADER
HEADER
QUERIES
QUERIES
Response
Response RESOURCE
RESOURCE RECORDS
RECORDS
Response
Response AUTHORITY
AUTHORITY RECORDS
RECORDS
Response
Response ADDITIONAL
ADDITIONAL INFORMATION
INFORMATION
Thursday, May 17, 2007 55
Lecture on DHCP, DNS & SNMP Debashis Saha
DNS Message Header
• query identifier
16 bit fields
• flags
• # of questions
• # of RRs
•
•
# of authority RRs
# of additional RRs } Response
Thursday, May 17, 2007 56
Lecture on DHCP, DNS & SNMP Debashis Saha
Message Flags
• QR: Query=0, Response=1
• AA: Authoritative Answer
• TC: response truncated (> 512 bytes)
• RD: recursion desired
• RA: recursion available
• rcode: return code
Thursday, May 17, 2007 57
Lecture on DHCP, DNS & SNMP Debashis Saha
Recursion
• A request can indicate that recursion is
desired - this tells the server to find out
the answer (possibly by contacting other
servers).
• If recursion is not requested - the
response may be a list of other name
servers to contact.
Thursday, May 17, 2007 58
Lecture on DHCP, DNS & SNMP Debashis Saha
Question Format
• Name: domain name (or IP address)
• Query type (A, NS, MX, …)
• Query class (1 for IP)
Thursday, May 17, 2007 59
Lecture on DHCP, DNS & SNMP Debashis Saha
Response Resource Record
• Domain Name
• Response type
• Class (IP)
• Time to live (in seconds)
• Length of resource data
• Resource data
Thursday, May 17, 2007 60
Lecture on DHCP, DNS & SNMP Debashis Saha
UDP & TCP
• Both UDP and TCP are used:
– TCP for transfers of entire database to secondary
servers (replication).
– UDP for lookups
– If more than 512 bytes in response - requestor
resubmits request using TCP.
Thursday, May 17, 2007 61
Lecture on DHCP, DNS & SNMP Debashis Saha
Lots more
• This is not a complete description !
• If interested - look at:
– RFC 1034: DNS concepts and facilities.
– RFC 1035: DNS implementation and protocol
specification.
– play with nslookup.
– Look at code for BIND (DNS server code).
Thursday, May 17, 2007 62
Lecture on DHCP, DNS & SNMP Debashis Saha
References
• RFC 1034
• RFC 1035
Thursday, May 17, 2007 75
Lecture on DHCP, DNS & SNMP Debashis Saha
SNMP - Simple Network
Management Protocol
Thursday, May 17, 2007 76
Lecture on DHCP, DNS & SNMP Debashis Saha
Third Question
• How does your computer know which IP to
use?
• How does your computer know that
www.iimcal.ac.in is at IP 202.54.116.3?
• How can you track your network’s
health?
Thursday, May 17, 2007 77
Lecture on DHCP, DNS & SNMP Debashis Saha
SNMP is …
• A network management tool
– Designed to allow data acquisition from SNMP capable
network equipment
– Allows control of SNMP capable equipment by the distant
controller
• Based on inquiry/response architecture
with simple response parameters
Thursday, May 17, 2007 78
Lecture on DHCP, DNS & SNMP Debashis Saha
SNMP is …
• Used for management of fault conditions –
prevention of and response to network
failure
• Designed to manage performance – coping
with deterioration of performance due to
congestion, changing traffic conditions
Thursday, May 17, 2007 79
Lecture on DHCP, DNS & SNMP Debashis Saha
SNMP Message Protocol
• Messages use UDP, ports 161 (requests/responses)
and 162 (notifications)
• Message types:
– GetRequest: request values of variables from device
– GetNextRequest: request value of variable following the one
supplied
– GetResponse: return values
– SetRequest: instruct device to set values of variables
– Trap: from device - notify monitor / manager of value change
Thursday, May 17, 2007 80
Lecture on DHCP, DNS & SNMP Debashis Saha
To know more on SNMP
• “Essential SNMP”, Douglas R Mauro & Kevin
J Schmidt, Shroff Publishers &
Distributors, Calcutta, 2001
Thursday, May 17, 2007 81