26
TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass), Prof. B. Yener (Rensselaer Polytechnic Institute)

TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Embed Size (px)

Citation preview

Page 1: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

TCOM 509 – Internet Protocols (TCP/IP)

Lecture 03_a

Instructor: Dr. Li-Chuan ChenDate: 09/15/2003

Based in part upon slides of Prof. J. Kurose (U Mass), Prof. B. Yener (Rensselaer Polytechnic Institute)

Page 2: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Outline

• Chapter 5 – mapping Internet Addresses to Physical Addresses (ARP)

• Chapter 6

• Chapter 7

Page 3: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Address Resolution Problems

• Problem: given an IP address, need to find its equivalent physical address

• Sender must map the intermediate router’s IP address and destination IP address to their corresponding physical addresses.

• Solutions:– Direct Mapping– Table lookup– Dynamic Binding via ARP (Address Resolution Protocol)

Page 4: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Address Resolution Mechanisms

• Direct mappingMake the physical addresses equal to the host ID portion.– Mapping is easy.– Only possible if admin has power to choose

both IP and physical address or when size of physical address < IP address.

– Cannot apply to Ethernet addresses (Ethernet addresses are 48 bits vs. IP addresses which are 32-bits).

Page 5: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Address Resolution Mechanisms• Table Lookup

Searching or indexing to get MAC addresses– Similar to lookup in /etc/hosts for names– Problem: change Ethernet card => change table

IP Address MAC Address

197.15.3.1 0A:4B:00:00:07:08197.15.3.2 0B:4B:00:00:07:00197.15.3.3 0A:5B:00:01:01:03

Page 6: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Address Resolution Mechanisms• Dynamic Binding (ARP)

– The host broadcasts a request: “What is the MAC address of 216.109.11.67?”

– The host whose IP address is 216.109.11.67 replies back: “The MAC address for 216.109.11.67 is 8A-5F-3C-23-45-5616”

– Broadcast is expensive. – ARP responses are cached. Issues

• Broken hardware: use timer.• Table full: least recently used (LRU)

– Each host updates its table when receiving an ARP broadcast.

Page 7: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

ARP Message Format

• Hardware (HW) Type: 1 for Ethernet• Protocol Type: 080016 = IP address• HW Len and Protocol Len allows arbitrary networks to be used• Operation: 1 = ARP Request, 2 = ARP Response

3 = RARP Request, 4 = RARP Response• ARP messages are sent directly to MAC layer• ARP message is 28 octets long.

HW Len Protocol Len OperationHW Type

Sender HW Address (6 bytes)

Protocol Type

Sender IP Address (4 bytes)

Target IP Address (4 bytes)

Target HW Address (6 bytes)

0 8 16 24 31

Sender HW Address

Sender IP Address

Target HW Address

Page 8: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

ARPLet Ia = IP address and pa =physical address• To send an internet packet across a physical net,

the network software must map Ia to pa and use the pa to transmit the frame.

• If Ia < pa, use direct mapping. Else, use ARP to perform dynamic mapping.

• Given an IP address, a host uses ARP to find the corresponding hardware address.

• To make ARP efficient, all hosts on the network receive the ARP request and update its cache.

• The host with the same Ia replies directly to the sender.

Page 9: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Outline

• Chapter 4.1 – 4.18

• Chapter 5

• Chapter 6 – Determining An Internet Address At Startup (RARP)

• Chapter 7

Page 10: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

RARPProblems: Given pa, how do we find Ia ? Solution: Reverse ARP (RARP)• Use the same message format as ARP.• Sender broadcast a RARP request (fills its pa in the target

field).• Only RARP server replies.• Typically used in Ethernet LAN.• If only one RARP server available on the network, use

larger delay time before retransmit another request.• More RARP servers?

– Pros – reliable– Cons – overload the network. (assign primary and

secondary server to solve this problem)

Page 11: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

RARP• Diskless host needs to find its IP address at

startup before it can communicate using TCP/IP.• Give physical address, a host can use RARP to

find its IP address from a RARP server on the network.

Page 12: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Outline

• Chapter 4.1 – 4.18

• Chapter 5

• Chapter 6

• Chapter 7 – Internet Protocol: Connectionless Datagram Delivery

Page 13: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Internet Services

The three conceptual layers of internet services.

Connectionless Packet Delivery Services

Reliable Transport Services

Application Service

Page 14: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Datagram Format

Vers HLen TOS Total LengthIdentification Flags

Time to live Protocol Header ChecksumFragment Offset

Source IP AddressDestination IP Address

IP Options (if any) Padding

Data

0 4 8 16 31

Page 15: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Datagram Format

• Internet datagram: basic transfer unit– VERS - Version (4 bits): IPv4– HLEN - Internet header length (4 bits): units of

32-bit words. Min header is 20 bytes or 5 words.

– Total Length (16 bits): header + data. Units of bytes. Total must be less than 64 K (216) octets.

Page 16: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header

• TOS - Type of service (8 bits)– precedence (3 bits), delay, throughput, and

reliability. – Not widely supported.

Page 17: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header • How big can a datagram be?

• What happens when a datagram is larger than the frame size of the underlying physical network?

Page 18: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Maximum Transmission Unit (MTU)• Each subnet has a maximum frame size

Ethernet: 1500 octetsFDDI: 4470 octets per frameToken Ring: 2K to 4K octets

• Transmission Unit = IP datagram (data + header)• Each subnet has a maximum IP datagram length

(header + payload) = MTU

BBNet 1

MTU = 1500Net 3

MTU = 1500

Net 2

MTU = 620R1 R2AA

Page 19: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Fragmentation• Datagrams larger than MTU are fragmented• Original header is copied to each fragment and

then modified (fragment flag, fragment offset, length,...)

• Fragments must be a multiple of 8-octets.

IP Header Original Datagram

IP Hdr 1 Data 1 IP Hdr 3 Data 3IP Hdr 2 Data 2

Page 20: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Reassembly• Reassembly only at the final destination• Partial datagrams are discarded after a timeout• Fragments can be further fragmented along the

path. Subfragments have a format similar to fragments.

• Minimum MTU along a path Path MTU

BBNet 1

MTU = 1500Net 3

MTU = 1500

Net 2

MTU = 620R1 R2AA

Page 21: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header • Fragmentation

– Identifier (16 bits): used in reassembly to uniquely identify all the pieces of a fragment chain.

– Flags (3 bits): more fragments (MF), don’t fragment (DF), and reserved bit.

– Fragment offset (13 bits): In units of 8 octets

Page 22: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Fragmentation Example

• Payload size 1400 bytes needs to be transmitted, Packet ID = 2222• Networks: Ethernet (MTU=1500) and Net2 (MTU=620)• Use smallest MTU size (620) to find payload size for the fragment packet. IP Header = 20 bytes => Payload = MTU – IP Header = 600 bytes• Fragments need to be multiples of 8-bytes.

– Nearest multiple to 600 is still 600 bytes– Fragment offset length = 600/8 = 75

• Number of fragments = 1400/600 = 2.33 = 3 • frag1 = 600, frag2 = 600, frag3 = 200, Packet ID = 2222 for all fragments Offset1 = 0, Offset2 = 75, Offset3 = 150

MF1 bit = 1, MF2 bit = 1, MF3 bit = 0

BBNet 1

MTU = 1500Net 3

MTU = 1500

Net 2

MTU = 620R1 R2AA

H1 frag1

H2 frag2

H3 frag3

Net works

Min MTU = 620

0 75 150

frag1 frag2 frag3

Page 23: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header• Time to live (TTL) 8 bits:

– Specifies how long the datagram is allowed to live in the network (in seconds). Typically use number of hops visited.

• Protocol (8 bits)– Next level protocol to receive the data, e.g., ICMP (1),

IGMP (2), TCP (6), UDP (17).

• Header checksum (16 bits)– 1’s complement sum of all 16-bit words in the header.

Page 24: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header • Source Address (32 bits): Original source.

Does not change along the path • Destination Address (32 bits): Final

destination. Does not change along the path.• Options (variable length): security, source route,

record route, stream id, timestamp recording• Padding (variable length):

Makes header length a multiple of 4• Payload Data (variable length): Data + header <

65,535 bytes

Page 25: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

IP Header Options – for network testing or debugging• Security - for military purpose and is only supported by

some products.• Source route – a list of IP address that the datagram

must take.• Record route – the nodes in the path must return their

IP address.• Stream id - used for voice for reserved resources• Timestamp – the time through the node is returned, so

that delays may be measured.

If entries in the options must be recorded by nodes, the sender must reserve sufficient space for the option data.

Page 26: TCOM 509 – Internet Protocols (TCP/IP) Lecture 03_a Instructor: Dr. Li-Chuan Chen Date: 09/15/2003 Based in part upon slides of Prof. J. Kurose (U Mass),

Summary

• Internetworking Problem• IP header: supports connectionless delivery,

variable length pkts/headers/options, fragmentation/reassembly,

• Fragmentation/Reassembly, Path MTU discovery.

• ARP, RARP: address mapping• Internet architectural principles