0% found this document useful (0 votes)
143 views35 pages

DHCP, Arp, Icmp

The document discusses how IP addresses are obtained and configured in computer networks. It explains that Internet Service Providers (ISPs) obtain IP address blocks from Regional Internet Registries, and then ISPs allocate addresses to organizations. Within an organization, hosts obtain IP addresses dynamically from a DHCP server. It also introduces the Address Resolution Protocol (ARP) which maps IP addresses to MAC addresses to allow communication between hosts on a local network.

Uploaded by

abhishek reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views35 pages

DHCP, Arp, Icmp

The document discusses how IP addresses are obtained and configured in computer networks. It explains that Internet Service Providers (ISPs) obtain IP address blocks from Regional Internet Registries, and then ISPs allocate addresses to organizations. Within an organization, hosts obtain IP addresses dynamically from a DHCP server. It also introduces the Address Resolution Protocol (ARP) which maps IP addresses to MAC addresses to allow communication between hosts on a local network.

Uploaded by

abhishek reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Computer Networks

CS F303

Obtaining IP Addresses &


Supporting Protocols
Ashutosh Bhatia
Department of Computer Science and Information Systems
BITS Pilani Birla Institute of Technology and Science
Pilani|Dubai|Goa|Hyderabad Pilani Campus, Pilani
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Outline
• Obtaining IP Addresses (DHCP)
• Supporting Protocols (ARP, ICMP)
• Routing Table
Organization

• IP layer forwarding is based on IP addresses

• Next-hop delivery based on Link addresses (MAC)

• Need to perform IP to MAC address translation

• Answer: Address Resolution Protocol (ARP)

3
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Internet Service Provider (ISP)
• How does an ISP get address blocks?
• Ans: From Regional Internet Registries (RIR) which are controlled by
Internet Corporation for Assigned Names and Numbers (ICANN)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Organization
• How does an organization get an address block?
• Ans: From provider Internet Service Provider (ISP)

During routing process: ISP Routers will advertise “send me anything


with addresses beginning 133.197.128.0/18”
5
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Host

• Organization has an IP prefix


- How does a host get a specific IP address?

• Address needs to be unique and location-dependent


 Re-configurable address

• Before any communication, the host needs an IP


address and default router’s IP address
6
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Configuration
• Manual Configuration
– Windows: control-panel-> Network and Internet -> Network
Connections -> Local Area Connection -> TCP/IPv4 -> properties
– Unix: ifconfig
– Remote configuration difficult, error prone

• Automatic Configuration: Dynamic Host Configuration Protocol


(DHCP)
– Dynamically get address from a server
– “plug-and-play”

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Idea

• DHCP server maintains a pool of available addresses

• Addresses handed out on demand (leased for some specific time)


– Host periodically needs to renew the lease

• Advantages: Ease of configuration (automated), reuse of IP


addresses, supports portability

• But how does the host know address of DHCP server?

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


DHCP Operation
• Operates at application layer using UDP protocol

• A newly booted/attached host ‘broadcasts’ DHCP discover


message
– IP address: 255.255.255.255 goes as link-layer broadcast (broadcast
restricted to physical network)
– Received by all hosts/routers in the physical network

• DHCP Server replies to host (others ignore message)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Relay Operation
• One DHCP server over multiple subnets

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Message Exchange

• Host broadcasts “DHCP discover” msg


• DHCP server responds with “DHCP offer” msg
• Host requests IP address: “DHCP request” msg
• DHCP server confirms address: “DHCP ack” msg
• DHCP server also passes subnet mask, default router, domain
name, DNS server info etc if host asks for it

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


DHCP Packet Format

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Router Configuration

• How are router interface addresses configured?


• By a system administrator manually via a network
management tool

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Summary

• IP addresses crucial for communication


• Organizations get IP prefixes from ISPs
• ISPs get from RIRs
• Hosts gets from DHCP server
• Ahead: Supporting Protocols – ARP, ICMP

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Demo in Linux

• Run a packet capture tool like wireshark or tcpdump


• Run “dhclient eth0” (replace eth0 with whatever is the correct
interface).
• Stop packet capture and analyze captured packets
• Next : Address Resolution Protocol

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Problem Statement

• IP layer forwarding is based on IP addresses

• Next-hop delivery based on Link addresses (MAC)

• Need to perform IP to MAC address translation

• Answer: Address Resolution Protocol (ARP)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Address Resolution Protocol (ARP)
• Operates at Link layer (Frame type = 0x0806)

• Based on broadcast: What is the MAC address corresponding


to given IP address?
– Host with matching IP address replies

• Each host maintains a cache with IP to MAC translations


– Entries in cache timed out periodically (15 min)
– arp –a shows all the ARP cache entries

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Address Resolution Protocol (ARP)

• Originator: Add entry to cache corresponding to target

• Target: Add entry to cache corresponding to the originator


(sender)

• Intermediate hosts: Refresh existing entries


• When forwarding a datagram, check cache, if no mapping,
invoke ARP

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


ARP Packet Format

Numbers in brackets capture mapping IP


addresses to Ethernet addresses

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Proxy ARP
• Router answers ARP requests for a host on of the network on another
interface
• The sender of the ARP request thinks that the router is the destination host
• The router acts as proxy agent for the destination host, and relays its packets
• Motivation
– Can hide a number of machines
– All packets for these machines have to pass through the router running
Proxy ARP, where the packets can be examined
– The sender does not know that its packets are passing through a machine
and are being checked

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


How Does Proxy ARP Work?
• The Host A (172.16.10.100) on Subnet A needs to send
packets to Host D (172.16.20.200) on Subnet B.

• As Host A has a /16 subnet mask, it believes that it is


directly connected to Host D, so it sends an ARP request
to Host D. But does not reach Host D.

• The router sends Proxy ARP reply to Host A telling its


own MAC address as the host D MAC address .

• Upon receipt of this ARP reply, Host A updates its ARP


table

• Later whenever router receives a packet for host D at


interface e0 from anybody in subnet A, it relays the
packet to interface e1
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Gratuitous ARP
• Wireshark/Tcpdump Output
– arp who-has IP_x tell IP_y
– Source protocol address: IP_y
– Target protocol address: IP_x

• Sometimes, one sees IP_x= IP_y


– The sender knows its address; yet it issues a request asking to resolve its address
– Hence “gratuitous”
– Does not expect a reply

• But if a reply arrives: misconfigured system!

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Gratuitous ARP

• A feature of ARP
– Host H has an entry in its ARP cache for IP address X
– It receives an ARP request from IP address X for some
address Y
– Even though H does not reply to the ARP request, it updates
its ARP cache with X’s hardware address (contained in the
ARP Req)
– “Latest” hardware address is maintained

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Uses of Gratuitous ARPs
• Backup server taking over from a failed server

• After detecting that the primary server has failed, the backup
server

– Issues a gratuitous ARP request, with the primary server’s IP address and
its own hardware address

– Causes all machines to update their ARP cache entries, so that the
backup’s hardware address is noted

– Henceforth, all traffic is directed to the backup server

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


ICMP: Internet Control Message Protocol

• Used by hosts & routers to communicate network-level


information
– Error reporting: unreachable host, network, port, protocol
– Diagnostic purposes: Echo request/reply (used by ping)
– Routing: Source quench

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


ICMP Packet Format
• ICMP messages carried in IP datagrams
• 8 bytes of header followed by data.
• Data field in error messages carry
– entire IP header and first 8 bytes of data of IP packet that caused the
error

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Select ICMP Messages

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Select ICMP Messages

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Routing Table
• Typical entries
– Destination network (netid or net-subnetid) or host
– Routing table mask (may be implicit)
– Next-hop IP address (often denoted as “gateway”)
– Outgoing interface
– Flags to indicate
• whether destination address (in table) is a network/host address
• destination (in table) is directly connected

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Routing Table

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Routing Table: Basic Operation
• Pick up the packet’s destination address
• Apply the routing table mask
– Routing table mask may default to the subnet mask of the associated
interface
• The network-prefix of the packet’s destination address is extracted
• Now match this extracted id with entries in the column named
“Destination”
• If match is seen, obtain the next hop address from the “Gateway”
column

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Routing tables: an example

What is the routing table used by machine A?

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Routing Table (BSD systems)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


IP Routing Table (BSD systems)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

You might also like