Title: IP Support Protocols
1IP Support Protocols
2 ARP
- Address Resolution Protocol
- Returns a MAC sublayer address when given an
Internet address - Commonly used in broadcast LANs so that two hosts
can communicate using IP addresses instead of MAC
sublayer addresses
3ARP
- Solves the problem on a LAN of having to maintain
the routing table of IP-MAC address for each
host - Automatic management
- Leverages broadcast properties of Ethernet, Token
Ring - Q How would ARP work w/o broadcast?
4ARP (contd)
ARP packet containing 128.195.1.38?
ARP
Ethernet Address 0523f43de104 IP
Address 128.195.1.20
Ethernet Address 9822eef1901a IP
Address 128.195.1.38
Ethernet Address 12042c6e119c IP
Address 128.195.1.122
Wants to transmit to 128.195.1.38
Ignored
Answered
5ARP (contd)
ARP response packet containing 9822eef1901a
Repl
Ethernet Address 0523f43de104 IP
Address 128.195.1.20
Ethernet Address 9822eef1901a IP
Address 128.195.1.38
Ethernet Address 12042c6e119c IP
Address 128.195.1.122
6RARP
- Reverse Address Resolution Protocol
- RARP performs the inverse action of ARP
- RARP returns an IP address for a given MAC
sublayer address - Operationally, RARP is the same as ARP
7Domain Name System (DNS)
- Problem statement
- Average brain can easily remember 7 digits
- On average, IP addresses have 10.28 digits
- We need an easier way to remember IP addresses
- Solution
- Use alphanumeric names to refer to hosts
- Add a distributed, hierarchical protocol (called
DNS) to map between alphanumeric host names and
IP addresses - We call this Name Resolution
8Domain Name Hierarchy
...
...
com
edu
net
gov
int
mil
org
ae
us
zw
rutgers
yale
yahoo
cnn
Country Domains
cs
eng
Generic Domains
9Domain Name Management
- The domain name hierarchy is divided into zones
- Zone A separate portion of the DNS hierarchy
- No two zones should overlap
- Name servers
- In each zone, there is a primary name server and
one or more secondary name servers - Name servers contain two kinds of address
mappings - Authoritative mappings For hosts within the zone
- Cached mappings For previously requested
mappings to hosts not in the zone
10Domain Name Hierarchy
...
...
com
edu
net
gov
int
mil
org
ae
us
zw
rutgers
yale
yahoo
cnn
cs
eng
11DNS Protocol
- When client wants to know an IP address for a
host name - Client sends a DNS query to the primary name
server in its zone - If name server contains the mapping, it returns
the IP address to the client - Otherwise, the name server forwards the request
to the root name server - The request works its way down the tree toward
the host until it reaches a name server with the
correct mapping
12DNS ProtocolExample
remus
Scenario remus tries to resolve an IP address
for venus.cs.yale.edu using a recursive query
1
8
ns-lcsr
2
7
a.root-servers.net
3
6
yale.edu
4
5
cs.yale.edu
13DNS ProtocolAnother Example
remus
1
2
ns-lcsr
Some servers do not support Recursive queries
3
4
a.root-servers.net
5
6
Scenario remus tries to resolve an IP address
for venus.cs.yale.edu using an iterative query
yale.edu
7
8
cs.yale.edu
14DNS Packets
- Clients communicate with DNS servers using either
TCP or UDP on port 53
0
15 16
31
Transaction Identification
Flags
Number of Questions
Number of Answer RRs
Number of Authoritative RRs
Number of Additional RRs
Questions (variable length)
Answer Resource Records (variable length)
Authoritative Resource Records (variable length)
Additional Resource Records (variable length)
15DNS Packet Fields
- Transaction Identification Random number used
to match client queries with name server
responses - Flags
- QR 0Query, 1Response
- opcode 0standard query, 1inverse query,
2status request - AA Authoritative answer
- TC Truncated DNS packet
- RD Recursion desired
- RA Recursion available
- rcode Return code. 0no error, 3name error
1 4 1
1 1 1 3
4
QR
opcode
AA
TC
RD
RA
(unused)
rcode
16DNS Packet Fields (contd)
- Transaction Identification Random number used
to match client queries with name server
responses - Number of Questions Number of DNS queries in
the packet - Number of Answer RRs Number of
non-authoritative DNS responses in the packet - Number of Authoritative RRs Number of
authoritative DNS responses in the packet - Number of Additional RRs Number of other DNS
responses in the packet (usually contains other
DNS servers in domain) - Questions Answers Variable length fields to
store DNS queries and DNS server responses
17DNS Queries
DNS Packet Question field contains a sequence of
queries
Query name (variable length)
Query Type
Query Class
Query Name Contains an encoded form of the name
for which we are seeking an IP address Query
Type 1IP address, 2name server, 12pointer
record, etc. Query Class 1Internet address
18Encoding Query Names
- DNS queries must be encoded in a special way
- Divide host address into segments whenever a
period appears - For each segment, store a byte representing the
length of the segment followed by the letters in
the segment - Store a zero byte at the end of the query
19Encoding Query NamesExample
remus
remus rutgers edu
NOTE These count fields are not the ASCII
characters 5, 7, 3 and 0!!!
20DNS Responses
DNS Packet RR fields contain a sequence of
resource records
Domain name (variable length)
Type
Class
Time-to-live
Resource Data (variable
length)
Resource data length
- Domain Name Encoded domain name for query
- Type Class Same as for query (1IP
1Internet) - Time-to-Live How long this responses will be
useful - Resource Data Contains the four-byte IP address
21DNS Compression
- DNS responses are often compressed to save space
- Compression algorithm
- If all or part of the domain name field appears
earlier in the packet (e.g., in a prior RR), then
store a pointer to the earlier copy instead - Pointer 2-byte code
1
1
Index Pointer into DNS Response Packet
22DNS Caching
- Going to the root server and then down the tree
every time we need to resolve an address is
inefficient - Introduce address caching at name servers
- Store host-to-IP-address mappings from recently
requested host names at name server - When the same address is requested later, use the
cached version at the local name server instead
of recursively querying other name servers again
23DNS CachingExample
remus
1
8
First time remus tries to resolve an IP
address for venus.cs.yale.edu using a recursive
query
Later venus.cs.yale.edu has been cached at
ns-lcsr. remus (and any other host that uses
ns-lcsr) will receive the cached IP address for
venus.cs.yale.edu
ns-lcsr
remus
2
7
1
2
a.root-servers.net
ns-lcsr
3
6
yale.edu
4
5
cs.yale.edu
24DNS Negative CachingExample
remus
1
8
First time remus tries to resolve an IP
address for hoopla.cs.yale.edu using a recursive
query
Later hoopla.cs.yale.edu has been cached at
ns-lcsr. remus (and any other host that uses
ns-lcsr) will receive the cached answer for
hoopla.cs.yale.edu There is no such name
ns-lcsr
remus
2
7
1
2
a.root-servers.net
ns-lcsr
3
6
yale.edu
4
5
cs.yale.edu
25Interface to DNS
- nslookup provides interface to DNS
- Default maps name-IP address or IP address-name
- nslookup remus.rutgers.edu
- Server ns-lcsr.rutgers.edu
- Address 128.6.4.4
- Name remus.rutgers.edu
- Address 128.6.13.3
26Bootstrapping DNS
- Sockets work on IP address only
- Socket class does a DNS lookup if given the
string name to connect to. - Q how does a host contact the name server if all
it has is the name and no IP address?
27Bootstrapping DNS
- IP address of at least 1 nameserver must be given
a priori - or with another protocol (bootp, see later)
- File /etc/resolv.conf in unix
- Start - settings- control panel- network
-TCP/IP - properties in windows
28Default Domains
- When Host issues a query to DNS server, can add
the default domain. - Default domain added to end of every DNS query
- Domain search order specified in resolv.conf as
well