Transcript Document

Overview
Last Lecture
» Internet Protocols (1)
» Source: chapter 15
This Lecture
» Internet Protocols (2)
» Source: chapter 15
Next Lecture
» Internet Protocols (3)
» Source: chapter 15
TELE202 Lecture 10 Internet Protocols (2)
1
Lecturer Dr Z. Huang
IP and MAC address
IP uses MAC frames as vehicles to
transfer IP packets
» The MAC address of the destination is needed
to transfer an IP packet
Hardware MAC addresses
» Ethernet 6 bytes
» Token ring 2 or 6 bytes
» FDDI 2 or 6 bytes
A station normally knows only the IP
address of the destination
How does an IP address get mapped
into a MAC address?
» Manual configuration is tedious and may not
be easy to adapt to change
» An Address Resolution Protocol (ARP) is
used for automatic mapping
Address Resolution Protocol
» RFC 826
» The sending host broadcasts a frame onto the
Ethernet asking “who owns the IP address
specified?
» The host who has the IP address will respond
with its Ethernet address
» Then the sending host will use the Ethernet
address to send packets
TELE202 Lecture 10 Internet Protocols (2)
2
Lecturer Dr Z. Huang
ARP
Host X wants to resolve the MAC
address of host Z
» X broadcasts ARP request
» X gets unicast ARP reply from Z
ARP packet format
TELE202 Lecture 10 Internet Protocols (2)
3
Lecturer Dr Z. Huang
ARP
RARP: Reverse ARP
» Map a MAC address to an IP address
» For devices that cannot store IP, usually
diskless workstations
» Need to set up a server with a RARP table
ARP packet header
» Hardware type: Ethernet,1;ARCNET,7;
» Network protocol type: IP, 0x0800
» hlen:length of hardware address
– 6 bytes for Ethernet addresses
» plen: length of network address:4 bytes for IP
» ARP operation: ARP request,1; ARP reply,2;
RARP request, 3; RARP reply, 4
Example of ARP request packet
TELE202 Lecture 10 Internet Protocols (2)
4
Lecturer Dr Z. Huang
ARP
Example of ARP reply packet
ARP mechanism
» Each host maintains an ARP cache
» ARP first looks up the cache in the host
– If an entry in the cache is not refreshed
for a period, say 15 minutes, it is deleted.
» A host can add an entry to the cache or
refresh it if an ARP request is received
Proxy ARP
» A router can answer ARP request for hosts
» Useful for interconnected LANs
TELE202 Lecture 10 Internet Protocols (2)
5
Lecturer Dr Z. Huang
Subnetwork
A network can be further divided
into multiple subnetworks
» Host portion of address partitioned into
subnetwork number and host number
» A subnetwork mask is used to indicate which
bits are subnetwork number and which are
host number
Why subnetworking?
» Simplify Internet management, e.g. routing
– Insulate overall internet from growth of
network numbers and routing
complexity
» Allow arbitrary complexity of internetworked
LANs within organization
– Site looks to rest of internet like single
network
– Each LAN assigned subnetwork number
– Local routers route within subnetworks
with small routing tables
» Make good use of IP addresses
– C classes can be aggregated to be a large
network with subnetworks
TELE202 Lecture 10 Internet Protocols (2)
6
Lecturer Dr Z. Huang
Subnetwork
Example
» A network with class B address 158.108.0.0
can be divided into 254 subnetworks, with the
third byte as the subnetwork id
– From 158.108.1.0 to 158.108.254.0
» The subnetwork mask is 255.255.255.0
» Bit-wise AND operation between an IP
address and the mask yields the network id
and the subnetwork id
Subnetwork - class B example
Subnetwork - class C example
TELE202 Lecture 10 Internet Protocols (2)
7
Lecturer Dr Z. Huang
Subnetwork
Exercise
» The following figure shows a local complex
consisting of three LANs and two routers
» To the rest of the Internet, this complex is a
single network with a class C address
– 192.228.17.0
» Both routers R1 and R2 are configured with a
subnetwork mask 255.255.255.224
» Query 1: How to route a datagram with
address 192.228.17.57 in R1?
» Query 2: How to route a datagram with
address 192.228.17.97 in R1 and R2?
TELE202 Lecture 10 Internet Protocols (2)
8
Lecturer Dr Z. Huang
ICMP
Internet Control Message Protocol
» RFC 792
Used for flow and error control
» Routers use ICMP to inform source if packet
discarded, so that source may modify
transmission strategy
» Routers use ICMP to send flow control
packets, i.e. choke packets, to request the
source to reduce flow
Feedback about problems
» Time to live expired
» Destination unreachable
Useful diagnostics about network
» Ping, traceroute
ICMP messages are never generated
in the following situations in order to
prevent broadcast storms
» Errors of ICMP messages themselves
» Broadcast/multicast
Broadcast storm
» A large number of broadcast datalink frames
have been transmitted nearly simultaneously
from several hosts
» LAN may have been brought to a standstill
TELE202 Lecture 10 Internet Protocols (2)
9
Lecturer Dr Z. Huang
ICMP
An ICMP packet is encapsulated in
an IP datagram.
» ICMP is not reliable
ICMP header
» Type: specify the type of ICMP message
» Code: specify the parameters of the message
that can be encoded in one or a few bits
» Checksum: checksum for the entire message
» Content-specific: specify more lengthy
parameters
TELE202 Lecture 10 Internet Protocols (2)
10
Lecturer Dr Z. Huang
ICMP
ICMP types
»
»
»
»
»
»
»
»
»
»
»
»
»
»
»
»
Type/code
0/0
3/0
3/1
3/3
4/0
5/0
8/0
9/0
10/0
11/0
12/0
13/0
14/0
17/0
18/0
meaning
echo reply
network is unreachable
host is unreachable
port is unreachable
source quench
redirect
echo request
router advertisement
router solicitation
time exceeded
parameter problem
time stamp request
time stamp reply
address mask request
address mask reply
Echo request/reply
» Identifier and sequence number are used to
identify datagrams
» Optional data is a variable length and set by
the sender and will be returned in the reply
» Ping sends echo requests and waits for replies
TELE202 Lecture 10 Internet Protocols (2)
11
Lecturer Dr Z. Huang
ICMP
Destination unreachable
» A router sends the message when it is unable
to deliver an IP packet due
Source quench
» If a router sends to a host to reduce flow
» A host may take no action to the request
Redirect
» Used by a router to suggest a more suitable
route to a host
TELE202 Lecture 10 Internet Protocols (2)
12
Lecturer Dr Z. Huang
Utilities using ICMP
Ping
» Ping sends an ICMP echo request to a remote
host, which then returns an ICMP echo reply
to the sender
» Ping is used to debug the network, such as
timing info, connection reliability, host is
reachable, etc
Traceroute
» A command to determine the active route to a
destination
» How it works?
– Send an IP packet to the destination with
time-to-live (ttl) set to 1
– The first router decreases ttl to 0, then
returns an ICMP time exceeded message
– The traceroute sets ttl=2, retransmits the
packet; this time the packet goes one
more router (hop)
– Increase ttl until the IP packet reaches
the destination
– The returned ICMP messages tell the
traceroute the routers of the route
TELE202 Lecture 10 Internet Protocols (2)
13
Lecturer Dr Z. Huang
Summary
Mapping between IP and MAC
addresses
»
»
»
»
Address Resolution Protocol (ARP)
ARP packet format
ARP mechanism
Proxy ARP
Subnetting
» How to divide a Class B network into small
subnetworks?
» How to route packets in subnetworks?
ICMP
» ICMP packet format
» Types of ICMP packets
» Utilities using ICMP
– Ping
– Traceroute
TELE202 Lecture 10 Internet Protocols (2)
14
Lecturer Dr Z. Huang