The Domain Name System (DNS) is a hierarchical distributed database that maps domain names to IP addresses. It uses a client-server model where clients submit queries and servers respond authoritatively. DNS provides mapping from human-readable domain names to numerical IP addresses to make the internet easier to use. It is a critical service that enables users to access internet resources by name.
1. 1
Domain Name System (DNS)
&
K. PALANIVEL
Systems Analyst, Computer Centre
Pondicherry University, Puducherry – 605014.
LECTURE 7
COMS 525: TCPIP
COURSE
TOPIC
Dynamic Host Configuration Protocol - DHCP
2. Domain Name System - DNS
• DNS is a host name to IP address translation service
• DNS is
a distributed database implemented in a hierarchy
of name servers
an application level protocol for message
exchange between clients and servers
3. Domain Name System - DNS
• Provides mapping from ASCII domain names to IP
addresses
Hierarchical naming system.
The set of names is divided into mutually exclusive parts.
• Supplies mechanism for global data storage and information
retrieval.
• Most important principles:
Distributed system – set of servers sharing information.
Efficiency - most of the requests resolved by local
servers.
Use of Caching.
Reliability – works even if some of the servers fail.
4. Why DNS?
It is easier to remember a host name than it is to
remember an IP address.
An name has more meaning to a user than a 4 byte
number.
Applications such as FTP, HTTP, email, etc., all
require the user to input a destination.
The user generally enters a host name.
The application takes the host name supplied by the
user and forwards it to DNS for translation to an IP
address.
8. Reliability over UDP
•DNS is an application which runs over UDP
Advantage: not as complex as TCP.
Disadvantage: requires reliability implementation
at application level .
•Reliability scheme:
Time out.
Retransmissions - resends timed out query to a
different server.
9. DNS Terms
Domain name: any name represented in the DNS
format
mail.yahoo.com
.name.example
DNS label: each string between two ".“
ac.il – 2 labels
DNS zone: a set of names that are under the same
authority
cs.pondiuni.edu.in, ee.pondiuni.edu.in.il and www.
pondiuni.edu.in
Delegation: transfer of authority for a domain
example.org is a delegation from org.
9
10. DNS Elements
Resolver:
stub: simple, only asks questions;
recursive: takes simple query and makes all
necessary steps to get the full answer.
Server (some perform both roles at the same time):
authoritative: the servers that contain the zone file
for a zone, one Primary, one or more Secondaries;
caching: a recursive resolver that stores prior results
and reuses them.
10
11. How Does DNS Work?
The resolver sends a DNS request message over UDP to a
local domain name server.
DNS caches store data for a short time defined by TTL on the
Record.
When a name server does not have the requested information,
it starts at longest match on query name it has when
looking for data.
The root server knows the IP address of each second-level
domain name server.
Every server knows how to reach servers that are authorities
for names further down the hierarchy.
The resolver follows delegations until it receives an answer.
12. DNS Query Example (from IETF slides)
Root Server
Ietf.org Server
Org
Server
Ask org NS
Ask ietf.org NS
www.ietf.org A
65.256.255.51
www.ietf.org A
65.256.255.51
Recursive
Resolver
www.ietf.org
Stub resolver
14. DNS Protocol and Messages
DNS protocol: query and reply messages, both with
same message format, msg header
14
identification: 16 bit #
for query, reply to query
uses same #
flags:
query or reply
recursion desired
recursion available
reply is authoritative
15. 15
Name, type fields
for a query
RRs in response
to query
records for
authoritative servers
additional “helpful”
info that may be used
DNS Protocol and Messages
18. DNS can use either UDP or TCP.
In both cases the well-known port used by the server
is port 53.
UDP is used when the size of the response message
is less than 512 bytes because most UDP packages
have a 512-byte packet size limit.
If the size of the response message is more than 512
bytes, a TCP connection is used.
Header format
19. Dynamic Domain Name System(DDNS)
The DNS master file must be updated dynamically.
The Dynamic Domain Name System (DDNS)
therefore was devised to respond to this need. In
DDNS, when a binding between a name and an
address is determined, the information is sent,
usually by DHCP to a primary DNS server. The
primary server updates the zone.
The secondary servers are notified either actively or
passively.
21. Dynamic Assignment of IP addresses
Dynamic assignment of IP addresses is desirable for
several reasons:
IP addresses are assigned on-demand
Avoid manual IP configuration
Support mobility of laptops
21
22. Solutions for dynamic assignment of IP addresses
Reverse Address Resolution Protocol (RARP)
Works similar to ARP
Broadcast a request for the IP address associated with a
given MAC address
RARP server responds with an IP address
Only assigns IP address (not the default router and
subnetmask)
RARP
Ethernet MAC
address
(48 bit)
ARPIP address
(32 bit)
22
23. BOOTstrap Protocol (BOOTP)
• BOOTstrap Protocol (BOOTP)
• From 1985
• Host can configure its IP parameters at boot time.
• 3 services.
– IP address assignment.
– Detection of the IP address for a serving machine.
– The name of a file to be loaded and executed by the
client machine (boot file name)
– Not only assign IP address, but also default router, network
mask, etc.
– Sent as UDP messages (UDP Port 67 (server) and 68 (host))
– Use limited broadcast address (255.255.255.255):
• These addresses are never forwarded23
24. Dynamic Host Configuration Protocol - DHCP
• Runs over UDP as well
• Provides automatic configuration of the host
connected to network or booted
• Provides hosts with initial configuration information
upon bootup:
IP address with subnet mask,
default gateway,
IP address of the DNS server .
25. BOOTP Interaction
Argon
00:a0:24:71:e4:44 BOOTP Server
BOOTP Request
00:a0:24:71:e4:44
Sent to 255.255.255.255
25
• BOOTP can be used for
downloading memory
image for diskless
workstations
• Assignment of IP addresses
to hosts is static
Argon
128.143.137.144
00:a0:24:71:e4:44 DHCP Server
BOOTP Response:
IP address: 128.143.137.144
Server IP address: 128.143.137.100
Boot file name: filename
(a)
(b)
(c)
27. DHCP (cont.)
server A
client
server B
determine
configuration
determine
configuration
DHCP discoverDHCP discover
DHCP offer
DHCP offer
select configuration
DHCP requestDHCP request
DHCP ack
Initialization completes
graceful shutdown
DHCP release
discard lease
using the allocated configuration
(selected)(not selected)
28. DHCP Operation
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCPDISCOVER
Sent to 255.255.255.255
DHCP Server
DCHP DISCOVER
28
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCP Server
DHCPOFFER
DHCPOFFER
DCHP OFFER
29. DHCP Operation
29
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCP Server
DHCPREQUEST
DHCPACK
DCHP DISCOVER
At this time, the DHCP
client can start to use the IP
address
DHCP Client
00:a0:24:71:e4:44 DHCP Server
DHCP Server
DHCPREQUEST
DHCPACK
Renewing a Lease
(sent when 50% of lease
has expired)
If DHCP server sends
DHCPNACK, then
address is released.
31. DHCP Messages
• DHCPDISCOVER
– The client broadcasts message in search of available DHCP
servers.
• DHCPOFFER
– The server response to the client DHCPDISCOVER with
offer of configuration parameters .
• DHCPREQUEST
– The client broadcasts to the server, requesting offered
parameters from one server specifically.
– Confirms correctness of previously allocated address after,
e.g., system reboot.
– Extends the lease on a particular network address.
• DHCPRELEASE
– The client-to-server communication, relinquishing network
address and canceling remaining lease.
31
32. DHCP Messages (Cont.)
•DHCPACK
–The server-to-client communication with configuration
parameters, including committed network address.
•DHCPNAK
–Server to client indicating client's notion of network address
is incorrect (e.g., client has moved to new subnet) or client's
lease as expired
•DHCPDECLINE
–The client-to-server communication, indicating that the
network address is already in use.
•DHCPINFORM
–The client-to-server communication, asking for only local
configuration parameters that the client already has
externally configured as an address.
33. DHCP message format
•xid
Transaction ID.
•ciaddr
Client IP address
•yiaddr
Your IP address.
•siaddr
Server IP address.
•chaddr
Client MAC address
33
34. BOOTP/DHCP Message Format
Number of Seconds
OpCode Hardware Type
Your IP address
Unused (in BOOTP)
Flags (in DHCP)
Gateway IP address
Client IP address
Server IP address
Hardware Address
Length
Hop Count
Server host name (64 bytes)
Client hardware address (16 bytes)
Boot file name (128 bytes)
Transaction ID
Options
(There are >100 different options)
35. DHCP message format (cont.)
Transaction ID - a random number that is used by the
client to match incoming DHCP messages with pending
requests.
Client IP address - used when client knows its IP
address.
Your IP address - the DHCP server will place the
offered client IP address in this field, if the client IP
address is 0.0.0.0.
Server IP address - the DHCP server address, if it is
known. Otherwise, it is used in DHCPOFFER and
DHCPACK.
Options - DHCP defines a 'client identifier' option that is
used to pass an explicit client identifier to a server.
36. DHCP Message Filtering
• DHCPOFFER
Only the client waiting for this message will accept it in
UDP layer.
But what if two clients are waiting for the offer
simultaneously?
• The filtering is possible only at the application layer.
• The transaction ID field is responsible for this
filtering.
• DHCPREQUEST
The message is broadcasted to all the servers.
The server knows if its offer was accepted only upon
reading the server identifier field in the DHCP message.
36
37. DHCP as UDP application
• DHCP server - port 67, client - port 68
• Reliability is not provided by UDP.
• Client is responsible for reliability
The client implements timer to measure timeout for the
messages that were not responded.
The client adopts a retransmission strategy that
incorporates a randomized exponential backoff algorithm
to determine the delay between retransmissions.
Every next message acts as an acknowledgment for the
previous step.
• For example, DHCPREQUEST is an ACK for
DHCPOFFER.
38. DHCP Pros
• It relieves the network administrator of a great deal of
manual configuration work.
• The ability for a device to be moved from network to
network and to automatically obtain valid
configuration parameters for the current network can
be of great benefit to mobile users.
• Because IP addresses are only allocated when clients
are actually active, it is possible, by the use of
reasonably short lease times and the fact that mobile
clients do not need to be allocated more than one
address, to reduce the total number of addresses in use
in an organization.
38
39. DHCP Cons
• Uses UDP, an unreliable and insecure protocol.
• DNS cannot be used for DHCP configured hosts.