internetworking tcpip

858
Internetworking With TCP/IP Douglas Comer Computer Science Department Purdue University 250 N. University Street West Lafayette, IN 47907-2066 http://www.cs.purdue.edu/people/comer Copyright 2005. All rights reserved. This document may not be reproduced by any means without written consent of the author.

Upload: arifbudianto

Post on 10-Jun-2015

808 views

Category:

Documents


13 download

TRANSCRIPT

Page 1: internetworking tcpip

InternetworkingWith TCP/IP

Douglas Comer

Computer Science DepartmentPurdue University

250 N. University StreetWest Lafayette, IN 47907-2066

http://www.cs.purdue.edu/people/comer

Copyright 2005. All rights reserved. This document may notbe reproduced by any means without written consent of the author.

Page 2: internetworking tcpip

PART I

COURSE OVERVIEWAND

INTRODUCTION

Internetworking With TCP/IP vol 1 -- Part 1 1 2005

Page 3: internetworking tcpip

Topic And Scope

Internetworking: an overview of concepts, terminology, andtechnology underlying the TCP/IP Internet protocol suite andthe architecture of an internet.

Internetworking With TCP/IP vol 1 -- Part 1 2 2005

Page 4: internetworking tcpip

You Will Learn

d Terminology (including acronyms)

d Concepts and principles

– The underlying model

– Encapsulation

– End-to-end paradigm

d Naming and addressing

d Functions of protocols including ARP, IP, TCP, UDP,SMTP, FTP, DHCP, and more

d Layering model

Internetworking With TCP/IP vol 1 -- Part 1 3 2005

Page 5: internetworking tcpip

You Will Learn(continued)

d Internet architecture and routing

d Applications

Internetworking With TCP/IP vol 1 -- Part 1 4 2005

Page 6: internetworking tcpip

What You Will NOT Learn

d A list of vendors, hardware products, software products,services, comparisons, or prices

d Alternative internetworking technologies (they have alldisappeared!)

Internetworking With TCP/IP vol 1 -- Part 1 5 2005

Page 7: internetworking tcpip

Schedule Of Topics

d Introduction

d Review of

– Network hardware

– Physical addressing

d Internet model and concept

d Internet (IP) addresses

d Higher-level protocols and the layering principle

d Examples of internet architecture

Internetworking With TCP/IP vol 1 -- Part 1 6 2005

Page 8: internetworking tcpip

Schedule Of Topics(continued)

d Routing update protocols

d Application-layer protocols

Internetworking With TCP/IP vol 1 -- Part 1 7 2005

Page 9: internetworking tcpip

Why Study TCP/IP?

d The Internet is everywhere

d Most applications are distributed

Internetworking With TCP/IP vol 1 -- Part 1 8 2005

Page 10: internetworking tcpip

Remainder Of This Section

d History of Internet protocols (TCP/IP)

d Organizations

d Documents

Internetworking With TCP/IP vol 1 -- Part 1 9 2005

Page 11: internetworking tcpip

Vendor Independence

d Before TCP/IP and the Internet

– Only two sources of network protocols

* Specific vendors such as IBM or Digital Equipment

* Standards bodies such as the ITU (formerly knownas CCITT)

d TCP/IP

– Vendor independent

Internetworking With TCP/IP vol 1 -- Part 1 10 2005

Page 12: internetworking tcpip

Who Built TCP/IP?

d Internet Architecture Board (IAB)

d Originally known as Internet Activities Board

d Evolved from Internet Research Group

d Forum for exchange among researchers

d About a dozen members

d Reorganized in 1989 and 1993

d Merged into the Internet Society in 1992

Internetworking With TCP/IP vol 1 -- Part 1 11 2005

Page 13: internetworking tcpip

Components Of TheIAB Organization

d IAB (Internet Architecture Board)

– Board that oversees and arbitrates

– URL is

http://www.iab.org/iab

d IRTF (Internet Research Task Force)

– Coordinates research on TCP/IP and internetworking

– Virtually defunct, but may re-emerge

Internetworking With TCP/IP vol 1 -- Part 1 12 2005

Page 14: internetworking tcpip

Components Of TheIAB Organization

(continued)

d IETF (Internet Engineering Task Force)

– Coordinates protocol and Internet engineering

– Headed by Internet Engineering Steering Group (IESG)

– Divided into N areas (N is 10 plus or minus a few)

– Each area has a manager

– Composed of working groups (volunteers)

– URL is

http://www.ietf.org

Internetworking With TCP/IP vol 1 -- Part 1 13 2005

Page 15: internetworking tcpip

ICANN

d Internet Corporation for Assigned Names and Numbers

http://www.icann.org

d Formed in 1998 to subsume IANA contract

d Not-for-profit managed by international board

d Now sets policies for addresses and domain names

d Support organizations

– Address allocation (ASO)

– Domain Names (DNSO)

– Protocol parameter assignments (PSO)

Internetworking With TCP/IP vol 1 -- Part 1 14 2005

Page 16: internetworking tcpip

ICANN

d Internet Corporation for Assigned Names and Numbers

http://www.icann.org

d Formed in 1998 to subsume IANA contract

d Not-for-profit managed by international board

d Now sets policies for addresses and domain names

d Support organizations

– Address allocation (ASO)

– Domain Names (DNSO)

– Protocol parameter assignments (PSO)

d For fun see http://www.icannwatch.org

Internetworking With TCP/IP vol 1 -- Part 1 14 2005

Page 17: internetworking tcpip

World Wide Web Consortium

d Organization to develop common protocols for World WideWeb

d Open membership

d Funded by commercial members

d URL is

http://w3c.org

Internetworking With TCP/IP vol 1 -- Part 1 15 2005

Page 18: internetworking tcpip

Internet Society

d Organization that promotes the use of the Internet

d Formed in 1992

d Not-for-profit

d Governed by a board of trustees

d Members worldwide

d URL is

http://www.isoc.org

Internetworking With TCP/IP vol 1 -- Part 1 16 2005

Page 19: internetworking tcpip

Protocol SpecificationsAnd Documents

d Protocols documented in series of reports

d Documents known as Request For Comments (RFCs)

Internetworking With TCP/IP vol 1 -- Part 1 17 2005

Page 20: internetworking tcpip

RFCs

d Series of reports that include

– TCP/IP protocols

– The Internet

– Related technologies

d Edited, but not peer-reviewed like scientific journals

d Contain:

– Proposals

– Surveys and measurements

– Protocol standards

Internetworking With TCP/IP vol 1 -- Part 1 18 2005

Page 21: internetworking tcpip

RFCs

d Series of reports that include

– TCP/IP protocols

– The Internet

– Related technologies

d Checked and edited by IESG

d Contain:

– Proposals

– Surveys and measurements

– Protocol Standards

– Jokes!

Internetworking With TCP/IP vol 1 -- Part 1 19 2005

Page 22: internetworking tcpip

RFCs(continued)

d Numbered in chronological order

d Revised document reissued under new number

d Numbers ending in 99 reserved for summary of previous100 RFCs

d Index and all RFCs available on-line

Internetworking With TCP/IP vol 1 -- Part 1 20 2005

Page 23: internetworking tcpip

Requirements RFCs

d Host Requirements Documents

– Major revision/clarification of most TCP/IP protocols

– RFC 1122 (Communication Layers)

– RFC 1123 (Application & Support)

– RFC 1127 (Perspective on 1122-3)

d Router Requirements

– Major specification of protocols used in IP gateways(routers)

– RFC 1812 (updated by RFC 2644)

Internetworking With TCP/IP vol 1 -- Part 1 21 2005

Page 24: internetworking tcpip

Special Subsets Of RFCs

d For Your Information (FYI)

– Provide general information

– Intended for beginners

d Best Current Practices (BCP)

– Engineering hints

– Reviewed and approved by IESG

Internetworking With TCP/IP vol 1 -- Part 1 22 2005

Page 25: internetworking tcpip

A Note About RFCs

d RFCs span two extremes

– Protocol standards

– Jokes

d Question: how does one know which are standards?

Internetworking With TCP/IP vol 1 -- Part 1 23 2005

Page 26: internetworking tcpip

TCP/IP Standards (STD)

d Set by vote of IETF

d Documented in subset of RFCs

d Found in Internet Official Protocol Standards RFC and onIETF web site

– Issued periodically

– Current version is RFC 3600

Internetworking With TCP/IP vol 1 -- Part 1 24 2005

Page 27: internetworking tcpip

Internet Drafts

d Preliminary RFC documents

d Often used by IETF working groups

d Available on-line from several repositories

d Either become RFCs within six months or disappear

Internetworking With TCP/IP vol 1 -- Part 1 25 2005

Page 28: internetworking tcpip

Obtaining RFCs AndInternet Drafts

d Available via

– Email

– FTP

– World Wide Web

http://www.ietf.org/

d IETF report contains summary of weekly activity

http://www.isoc.org/ietfreport/

Internetworking With TCP/IP vol 1 -- Part 1 26 2005

Page 29: internetworking tcpip

Summary

d TCP/IP is vendor-independent

d Standards set by IETF

d Protocol standards found in document series known asRequest For Comments (RFCs)

d Standards found in subset of RFCs labeled STD

Internetworking With TCP/IP vol 1 -- Part 1 27 2005

Page 30: internetworking tcpip

Questions?

Page 31: internetworking tcpip

PART II

REVIEW OFNETWORK HARDWARE AND

PHYSICAL ADDRESSING

Internetworking With TCP/IP vol 1 -- Part 2 1 2005

Page 32: internetworking tcpip

The TCP/IP Concept

d Use existing network hardware

d Interconnect networks

d Add abstractions to hide heterogeneity

Internetworking With TCP/IP vol 1 -- Part 2 2 2005

Page 33: internetworking tcpip

The Challenge

d Accommodate all possible network hardware

d Question: what kinds of hardware exist?

Internetworking With TCP/IP vol 1 -- Part 2 3 2005

Page 34: internetworking tcpip

Network Hardware Review

d We will

– Review basic network concepts

– Examine example physical network technologies

– Introduce physical (hardware) addressing

Internetworking With TCP/IP vol 1 -- Part 2 4 2005

Page 35: internetworking tcpip

Two Basic CategoriesOf Network Hardware

d Connection oriented

d Connectionless

Internetworking With TCP/IP vol 1 -- Part 2 5 2005

Page 36: internetworking tcpip

Connection Oriented(Circuit Switched Technology)

d Paradigm

– Form a ‘‘connection’’ through the network

– Send / receive data over the connection

– Terminate the connection

d Can guarantee bandwidth

d Proponents argue that it works well with real-timeapplications

d Example: ATM network

Internetworking With TCP/IP vol 1 -- Part 2 6 2005

Page 37: internetworking tcpip

Connectionless(Packet Switched Technology)

d Paradigm

– Form ‘‘packet’’ of data

– Pass to network

d Each packet travels independently

d Packet includes identification of the destination

d Each packet can be a different size

d The maximum packet size is fixed (some technologies limitpacket sizes to 1,500 octets or less)

Internetworking With TCP/IP vol 1 -- Part 2 7 2005

Page 38: internetworking tcpip

Broad Characterizations OfPacket Switching Networks

d Local Area Network (LAN)

d Wide Area Network (WAN)

d Categories are informal and qualitative

Internetworking With TCP/IP vol 1 -- Part 2 8 2005

Page 39: internetworking tcpip

Local Area Networks

d Engineered for

– Low cost

– High capacity

d Direct connection among computers

d Limited distance

Internetworking With TCP/IP vol 1 -- Part 2 9 2005

Page 40: internetworking tcpip

Wide Area Networks(Long Haul Networks)

d Engineered for

– Long distances

– Indirect interconnection via special-purpose hardware

d Higher cost

d Lower capacity (usually)

Internetworking With TCP/IP vol 1 -- Part 2 10 2005

Page 41: internetworking tcpip

Examples Of PacketSwitched Networks

d Wide Area Nets

– ARPANET, NSFNET, ANSNET

– Common carrier services

d Leased line services

– Point-to-point connections

d Local Area Nets

– Ethernet

– Wi-Fi

Internetworking With TCP/IP vol 1 -- Part 2 11 2005

Page 42: internetworking tcpip

ARPANET (1969-1989)

d Original backbone of Internet

d Wide area network around which TCP/IP was developed

d Funding from Advanced Research Project Agency

d Initial speed 50 Kbps

Internetworking With TCP/IP vol 1 -- Part 2 12 2005

Page 43: internetworking tcpip

NSFNET (1987-1992)

d Funded by National Science Foundation

d Motivation: Internet backbone to connect all scientists andengineers

d Introduced Internet hierarchy

– Wide area backbone spanning geographic U.S.

– Many mid-level (regional) networks that attach tobackbone

– Campus networks at lowest level

d Initial speed 1.544 Mbps

Internetworking With TCP/IP vol 1 -- Part 2 13 2005

Page 44: internetworking tcpip

ANSNET (1992-1995)

End-User Site

MCI Point of Presence

d Backbone of Internet before commercial ISPs

d Typical topology

Internetworking With TCP/IP vol 1 -- Part 2 14 2005

Page 45: internetworking tcpip

Wide Area Networks AvailableFrom Common Carriers

d Point-to-point digital circuits

– T-series (e.g., T1 = 1.5 Mbps, T3 = 45 Mbps)

– OC-series (e.g., OC-3 = 155 Mbps, OC-48 = 2.4 Gbps)

d Packet switching services also available

– Examples: ISDN, SMDS, Frame Relay, ATM

Internetworking With TCP/IP vol 1 -- Part 2 15 2005

Page 46: internetworking tcpip

Example Local AreaNetwork: Ethernet

d Extremely popular

d Can run over

– Copper (twisted pair)

– Optical fiber

d Three generations

– 10Base-T operates at 10 Mbps

– 100Base-T (fast Ethernet) operates at 100 Mbps

– 1000Base-T (gigabit Ethernet) operates at 1 Gbps

d IEEE standard is 802.3

Internetworking With TCP/IP vol 1 -- Part 2 16 2005

Page 47: internetworking tcpip

Ethernet Frame Format

8 octets 6 octets 6 octets 2 octets 46–1500 octets 4 octets

PreambleDestination

AddressSource

AddressFrameType Frame Data CRC

d Header format fixed (Destination, Source, Type fields)

d Frame data size can vary from packet to packet

– Maximum 1500 octets

– Minimum 46 octets

d Preamble and CRC removed by framer hardware beforeframe stored in computer’s memory

Internetworking With TCP/IP vol 1 -- Part 2 17 2005

Page 48: internetworking tcpip

Example Ethernet Frame In Memory

02 07 01 00 27 ba 08 00 2b 0d 44 a7 08 00 45 00

00 54 82 68 00 00 f f 01 35 21 80 0a 02 03 80 0a

02 08 08 00 73 0b d4 6d 00 00 04 3b 8c 28 28 20

0d 00 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15

16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25

26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35

36 37

d Octets shown in hexadecimal

d Destination is 02.07.01.00.27.ba

d Source is 08.00.2b.0d.44.a7

d Frame type is 08.00 (IP)

Internetworking With TCP/IP vol 1 -- Part 2 18 2005

Page 49: internetworking tcpip

Point-to-Point Network

d Any direct connection between two computers

– Leased line

– Connection between two routers

– Dialup connection

d Link-level protocol required for framing

d TCP/IP views as an independent network

Note: some pundits argue the terminology is incorrect because aconnection limited to two endpoints is not technically a‘‘network’’

Internetworking With TCP/IP vol 1 -- Part 2 19 2005

Page 50: internetworking tcpip

Hardware Address

d Unique number assigned to each machine on a network

d Used to identify destination for a packet

Internetworking With TCP/IP vol 1 -- Part 2 20 2005

Page 51: internetworking tcpip

Hardware Address Terminology

d Known as

– MAC (Media Access Control) address

– Physical address

– Hardware unicast address

d Hardware engineers assign fine distinctions to the aboveterms

d We will treat all terms equally

Internetworking With TCP/IP vol 1 -- Part 2 21 2005

Page 52: internetworking tcpip

Use Of Hardware Address

d Sender supplies

– Destination’s address

– Source address (in most technologies)

d Network hardware

– Uses destination address to forward packet

– Delivers packet to proper machine.

d Important note: each technology defines its own addressingscheme

Internetworking With TCP/IP vol 1 -- Part 2 22 2005

Page 53: internetworking tcpip

Three Types Of HardwareAddressing Schemes

d Static

– Address assigned by hardware vendor

d Configurable

– Address assigned by customer

d Dynamic

– Address assigned by software at startup

Internetworking With TCP/IP vol 1 -- Part 2 23 2005

Page 54: internetworking tcpip

Examples Of Hardware Address Types

d Configurable: proNET-10 (Proteon)

– 8-bit address per interface card

– All 1s address reserved for broadcast

– Address assigned by customer when device installed

d Dynamic MAC addressing: LocalTalk (Apple)

– Randomized bidding

– Handled by protocols in software

Internetworking With TCP/IP vol 1 -- Part 2 24 2005

Page 55: internetworking tcpip

Examples Of Hardware Address Types(continued)

d Static MAC addressing: Ethernet

– 48-bit address

– Unicast address assigned when device manufactured

– All 1s address reserved for broadcast

– One-half address space reserved for multicast (restrictedform of broadcast)

d Ethernet’s static addressing is now most common form

Internetworking With TCP/IP vol 1 -- Part 2 25 2005

Page 56: internetworking tcpip

Bridge

d Hardware device that connects multiple LANs and makesthem appear to be a single LAN

d Repeats all packets from one LAN to the other and viceversa

d Introduces delay of 1 packet-time

d Does not forward collisions or noise

d Called Layer 2 Interconnect or Layer 2 forwarder

d Makes multiple LANs appear to be a single, large LAN

d Often embedded in other equipment (e.g., DSL modem)

Internetworking With TCP/IP vol 1 -- Part 2 26 2005

Page 57: internetworking tcpip

Bridge(continued)

d Watches packets to learn which computers are on whichside of the bridge

d Uses hardware addresses to filter

Internetworking With TCP/IP vol 1 -- Part 2 27 2005

Page 58: internetworking tcpip

Layer 2 Switch

d Electronic device

d Computers connect directly

d Applies bridging algorithm

d Can separate computers onto virtual networks (VLANswitch)

Internetworking With TCP/IP vol 1 -- Part 2 28 2005

Page 59: internetworking tcpip

Physical Networks AsViewed By TCP/IP

d TCP/IP protocols accommodate

– Local Area Network

– Wide Area Network

– Point-to-point link

– Set of bridged LANs

Internetworking With TCP/IP vol 1 -- Part 2 29 2005

Page 60: internetworking tcpip

The Motivation For Heterogeneity

d Each network technology has advantages for someapplications

d Consequence: an internet may contain combinations oftechnologies

Internetworking With TCP/IP vol 1 -- Part 2 30 2005

Page 61: internetworking tcpip

Heterogeneity And Addressing

d Recall: each technology can define its own addressingscheme

d Heterogeneous networks imply potential for heterogeneousaddressing

d Conclusion: cannot rely on hardware addressing

Internetworking With TCP/IP vol 1 -- Part 2 31 2005

Page 62: internetworking tcpip

Summary

d TCP/IP is designed to use all types of networks

– Connection-oriented

– Connectionless

– Local Area Network (LAN)

– Wide Area Network (WAN)

– Point-to-point link

– Set of bridged networks

Internetworking With TCP/IP vol 1 -- Part 2 32 2005

Page 63: internetworking tcpip

Summary(continued)

d Each technology defines an addressing scheme

d TCP/IP must accommodate heterogeneous addressingschemes

Internetworking With TCP/IP vol 1 -- Part 2 33 2005

Page 64: internetworking tcpip

Questions?

Page 65: internetworking tcpip

PART III

INTERNETWORKING CONCEPTAND ARCHITECTURAL MODEL

Internetworking With TCP/IP vol 1 -- Part 3 1 2005

Page 66: internetworking tcpip

Accommodating Heterogeneity

d Approach 1

– Application gateways

– Gateway forwards data from one network to another

– Example: file transfer gateway

d Approach 2

– Network-level gateways

– Gateway forwards individual packets

d Discussion question: which is better?

Internetworking With TCP/IP vol 1 -- Part 3 2 2005

Page 67: internetworking tcpip

Desired Properties

d Universal service

d End-to-end connectivity

d Transparency

Internetworking With TCP/IP vol 1 -- Part 3 3 2005

Page 68: internetworking tcpip

Agreement Needed ToAchieve Desired Properties

d Data formats

d Procedures for exchanging information

d Identification

– Services

– Computers

– Applications

d Broad concepts: naming and addressing

Internetworking With TCP/IP vol 1 -- Part 3 4 2005

Page 69: internetworking tcpip

The TCP/IP Internet Concept

d Use available networks

d Interconnect physical networks

– Network of networks

– Revolutionary when proposed

d Devise abstractions that hide

– Underlying architecture

– Hardware addresses

– Routes

Internetworking With TCP/IP vol 1 -- Part 3 5 2005

Page 70: internetworking tcpip

Network Interconnection

d Uses active system

d Each network sees an additional computer attached

d Device is IP router (originally called IP gateway)

Internetworking With TCP/IP vol 1 -- Part 3 6 2005

Page 71: internetworking tcpip

Illustration OfNetwork Interconnection

Net 1 R Net 2

d Network technologies can differ

– LAN and WAN

– Connection-oriented and connectionless

Internetworking With TCP/IP vol 1 -- Part 3 7 2005

Page 72: internetworking tcpip

Building An Internet

d Use multiple IP routers

d Ensure that each network is reachable

d Do not need router between each pair of networks

Internetworking With TCP/IP vol 1 -- Part 3 8 2005

Page 73: internetworking tcpip

Example Of Multiple Networks

R2 R2Net 1 Net 2 Net 3

d Networks can be heterogeneous

d No direct connection from network 1 to network 3

Internetworking With TCP/IP vol 1 -- Part 3 9 2005

Page 74: internetworking tcpip

Physical Connectivity

In a TCP/IP internet, special computers called IP routers or IPgateways provide interconnections among physical networks.

Internetworking With TCP/IP vol 1 -- Part 3 10 2005

Page 75: internetworking tcpip

Packet Transmission Paradigm

d Source computer

– Generates a packet

– Sends across one network to a router

d Intermediate router

– Forwards packet to ‘‘next’’ router

d Final router

– Delivers packet to destination

Internetworking With TCP/IP vol 1 -- Part 3 11 2005

Page 76: internetworking tcpip

An Important PointAbout Forwarding

Routers use the destination network, not the destinationcomputer, when forwarding packets.

Internetworking With TCP/IP vol 1 -- Part 3 12 2005

Page 77: internetworking tcpip

Equal Treatment

The TCP/IP internet protocols treat all networks equally. ALocal Area Network such as an Ethernet, a Wide Area Networkused as a backbone, or a point-to-point link between twocomputers each count as one network.

Internetworking With TCP/IP vol 1 -- Part 3 13 2005

Page 78: internetworking tcpip

User’s View Of Internet

d Single large (global) network

d User’s computers all attach directly

d No other structure visible

Internetworking With TCP/IP vol 1 -- Part 3 14 2005

Page 79: internetworking tcpip

Illustration Of User’s View OfA TCP/IP Internet

user’s view

Internetworking With TCP/IP vol 1 -- Part 3 15 2005

Page 80: internetworking tcpip

Actual Internet Architecture

d Multiple physical networks interconnected

d Each host attaches to one network

d Single virtual network achieved through software thatimplements abstractions

Internetworking With TCP/IP vol 1 -- Part 3 16 2005

Page 81: internetworking tcpip

The Two Views OfA TCP/IP Internet

user’s view actual connections

Internetworking With TCP/IP vol 1 -- Part 3 17 2005

Page 82: internetworking tcpip

Architectural Terminology

d End-user system is called host computer

– Connects to physical network

– Possibly many hosts per network

– Possibly more than one network connection per host

d Dedicated systems called IP gateways or IP routersinterconnect networks

– Router connects two or more networks

Internetworking With TCP/IP vol 1 -- Part 3 18 2005

Page 83: internetworking tcpip

Many Unanswered Questions

d Addressing model and relationship to hardware addresses

d Format of packet as it travels through Internet

d How a host handles concurrent communication with severalother hosts

Internetworking With TCP/IP vol 1 -- Part 3 19 2005

Page 84: internetworking tcpip

Summary

d Internet is set of interconnected (possibly heterogeneous)networks

d Routers provide interconnection

d End-user systems are called host computers

d Internetworking introduces abstractions that hide details ofunderlying networks

Internetworking With TCP/IP vol 1 -- Part 3 20 2005

Page 85: internetworking tcpip

Questions?

Page 86: internetworking tcpip

PART IV

CLASSFUL INTERNET ADDRESSES

Internetworking With TCP/IP vol 1 -- Part 4 1 2005

Page 87: internetworking tcpip

Definitions

d Name

– Identifies what an entity is

– Often textual (e.g., ASCII)

d Address

– Identifies where an entity is located

– Often binary and usually compact

– Sometimes called locator

d Route

– Identifies how to get to the object

– May be distributed

Internetworking With TCP/IP vol 1 -- Part 4 2 2005

Page 88: internetworking tcpip

Internet Protocol Address(IP Address)

d Analogous to hardware address

d Unique value assigned as unicast address to each host onInternet

d Used by Internet applications

Internetworking With TCP/IP vol 1 -- Part 4 3 2005

Page 89: internetworking tcpip

IP Address Details

d 32-bit binary value

d Unique value assigned to each host in Internet

d Values chosen to make routing efficient

Internetworking With TCP/IP vol 1 -- Part 4 4 2005

Page 90: internetworking tcpip

IP Address Division

d Address divided into two parts

– Prefix (network ID) identifies network to which hostattaches

– Suffix (host ID) identifies host on that network

Internetworking With TCP/IP vol 1 -- Part 4 5 2005

Page 91: internetworking tcpip

Classful Addressing

d Original IP scheme

d Explains many design decisions

d New schemes are backward compatible

Internetworking With TCP/IP vol 1 -- Part 4 6 2005

Page 92: internetworking tcpip

Desirable Properties Of AnInternet Addressing Scheme

d Compact (as small as possible)

d Universal (big enough)

d Works with all network hardware

d Supports efficient decision making

– Test whether a destination can be reached directly

– Decide which router to use for indirect delivery

– Choose next router along a path to the destination

Internetworking With TCP/IP vol 1 -- Part 4 7 2005

Page 93: internetworking tcpip

Division Of Internet AddressInto Prefix And Suffix

d How should division be made?

– Large prefix, small suffix means many possiblenetworks, but each is limited in size

– Large suffix, small prefix means each network can belarge, but there can only be a few networks

d Original Internet address scheme designed to accommodateboth possibilities

– Known as classful addressing

Internetworking With TCP/IP vol 1 -- Part 4 8 2005

Page 94: internetworking tcpip

Original IPv4 Address Classes

0 netid hostid

1 0 netid hostid

1 1 0 netid hostid

1 1 1 0 IP multicast

1 1 1 1 0 reserved

Class A

Class B

Class C

Class D

Class E

Three Principle Classes

Other (seldom used) Classes

0 1 8 16 24 31

0 1 2 3 31

Internetworking With TCP/IP vol 1 -- Part 4 9 2005

Page 95: internetworking tcpip

Important Property

d Classful addresses are self-identifying

d Consequences

– Can determine boundary between prefix and suffix fromthe address itself

– No additional state needed to store boundary information

– Both hosts and routers benefit

Internetworking With TCP/IP vol 1 -- Part 4 10 2005

Page 96: internetworking tcpip

Endpoint Identification

Because IP addresses encode both a network and a host on thatnetwork, they do not specify an individual computer, but aconnection to a network.

Internetworking With TCP/IP vol 1 -- Part 4 11 2005

Page 97: internetworking tcpip

IP Address Conventions

d When used to refer to a network

– Host field contains all 0 bits

d Broadcast on the local wire

– Network and host fields both contain all 1 bits

d Directed broadcast: broadcast on specific (possibly remote)network

– Host field contains all 1 bits

– Nonstandard form: host field contains all 0 bits

Internetworking With TCP/IP vol 1 -- Part 4 12 2005

Page 98: internetworking tcpip

Assignment Of IP Addresses

d All hosts on same network assigned same address prefix

– Prefixes assigned by central authority

– Obtained from ISP

d Each host on a network has a unique suffix

– Assigned locally

– Local administrator must ensure uniqueness

Internetworking With TCP/IP vol 1 -- Part 4 13 2005

Page 99: internetworking tcpip

Advantages Of Classful Addressing

d Computationally efficient

– First bits specify size of prefix / suffix

d Allows mixtures of large and small networks

Internetworking With TCP/IP vol 1 -- Part 4 14 2005

Page 100: internetworking tcpip

Directed Broadcast

IP addresses can be used to specify a directed broadcast inwhich a packet is sent to all computers on a network; suchaddresses map to hardware broadcast, if available. Byconvention, a directed broadcast address has a valid netid andhas a hostid with all bits set to 1.

Internetworking With TCP/IP vol 1 -- Part 4 15 2005

Page 101: internetworking tcpip

Limited Broadcast

d All 1’s

d Broadcast limited to local network only (no forwarding)

d Useful for bootstrapping

Internetworking With TCP/IP vol 1 -- Part 4 16 2005

Page 102: internetworking tcpip

All Zeros IP Address

d Can only appear as source address

d Used during bootstrap before computer knows its address

d Means ‘‘this’’ computer

Internetworking With TCP/IP vol 1 -- Part 4 17 2005

Page 103: internetworking tcpip

Internet Multicast

d IP allows Internet multicast, but no Internet-wide multicastdelivery system currently in place

d Class D addresses reserved for multicast

d Each address corresponds to group of participatingcomputers

d IP multicast uses hardware multicast when available

d More later in the course

Internetworking With TCP/IP vol 1 -- Part 4 18 2005

Page 104: internetworking tcpip

Consequences Of IP Addressing

d If a host computer moves from one network to another, itsIP address must change

d For a multi-homed host (with two or more addresses), thepath taken by packets depends on the address used

Internetworking With TCP/IP vol 1 -- Part 4 19 2005

Page 105: internetworking tcpip

Multi-Homed Hosts And Reliability

NETWORK 1

NETWORK 2

R A B

I1 I2 I3

I4 I5

d Knowing that B is multi-homed increases reliability

d If interface I3 is down, host A can send to the interface I5

Internetworking With TCP/IP vol 1 -- Part 4 20 2005

Page 106: internetworking tcpip

Dotted Decimal Notation

d Syntactic form for expressing 32-bit address

d Used throughout the Internet and associated literature

d Represents each octet in decimal separated by periods (dots)

Internetworking With TCP/IP vol 1 -- Part 4 21 2005

Page 107: internetworking tcpip

Example Of Dotted DecimalNotation

d A 32-bit number in binary

10000000 00001010 00000010 00000011

d The same 32-bit number expressed in dotted decimalnotation

128 . 10 . 2 . 3

Internetworking With TCP/IP vol 1 -- Part 4 22 2005

Page 108: internetworking tcpip

Loopback Address

d Used for testing

d Refers to local computer (never sent to Internet)

d Address is 127.0.0.1

Internetworking With TCP/IP vol 1 -- Part 4 23 2005

Page 109: internetworking tcpip

Classful Address Ranges

Class Lowest Address Highest Address22222222222222222222222222222222222222222222

A 1.0.0.0 126.0.0.0B 128.1.0.0 191.255.0.0C 192.0.1.0 223.255.255.0D 224.0.0.0 239.255.255.255E 240.0.0.0 255.255.255.254

Internetworking With TCP/IP vol 1 -- Part 4 24 2005

Page 110: internetworking tcpip

Summary Of Address Conventions

all 0s

all 0s host

all 1s

net all 1s

127 anything (often 1)

This host 1

Host on this net 1

Limited broadcast (local net) 2

Directed broadcast for net 2

Loopback 3

1 Allowed only at system startup and isnever a valid destination address.

2 Never a valid source address.3 Should never appear on a network.

Notes:

Internetworking With TCP/IP vol 1 -- Part 4 25 2005

Page 111: internetworking tcpip

An Example Of IP Addresses

ISP9.0.0.0

ETHERNET128.10.0.0

WI-FINETWORK128.210.0.0

routers

Internetworking With TCP/IP vol 1 -- Part 4 26 2005

Page 112: internetworking tcpip

Example Host Addresses

ETHERNET 128.10.0.0

MERLIN(multi-homed

host)

GUENEVERE(Ethernet

host)

LANCELOT(Ethernet

host)

WI-FINETWORK128.210.0.0

ARTHUR(Wi-Fihost)

128.10.2.3 128.10.2.8 128.10.2.26

128.210.0.1

128.210.0.3

128.10.0.6128.210.50

128.10.2.70

TALIESYN(router)

GLATISANT(router)

To ISP

Internetworking With TCP/IP vol 1 -- Part 4 27 2005

Page 113: internetworking tcpip

Another Addressing Example

d Assume an organization has three networks

d Organization obtains three prefixes, one per network

d Host address must begin with network prefix

Internetworking With TCP/IP vol 1 -- Part 4 28 2005

Page 114: internetworking tcpip

Illustration Of IP Addressing

R1Router to Internet

Rest of the Internet

R2 R3

H1

128.10.0.0

192.5.48.0 128.211.0.0

128.211.0.9

Example host

Hosts and routersusing other addresses

Site with threenetworks

Internetworking With TCP/IP vol 1 -- Part 4 29 2005

Page 115: internetworking tcpip

Summary

d IP address

– 32 bits long

– Prefix identifies network

– Suffix identifies host

d Classful addressing uses first few bits of address todetermine boundary between prefix and suffix

Internetworking With TCP/IP vol 1 -- Part 4 30 2005

Page 116: internetworking tcpip

Summary(continued)

d Special forms of addresses handle

– Limited broadcast

– Directed broadcast

– Network identification

– This host

– Loopback

Internetworking With TCP/IP vol 1 -- Part 4 31 2005

Page 117: internetworking tcpip

Questions?

Page 118: internetworking tcpip

PART V

MAPPING INTERNET ADDRESSESTO PHYSICAL ADDRESSES

(ARP)

Internetworking With TCP/IP vol 1 -- Part 5 1 2005

Page 119: internetworking tcpip

Motivation

d Must use hardware (physical) addresses to communicateover network

d Applications only use Internet addresses

Internetworking With TCP/IP vol 1 -- Part 5 2 2005

Page 120: internetworking tcpip

Example

d Computers A and B on same network

d Application on A generates packet for application on B

d Protocol software on A must use B’s hardware addresswhen sending a packet

Internetworking With TCP/IP vol 1 -- Part 5 3 2005

Page 121: internetworking tcpip

Consequence

d Protocol software needs a mechanism that maps an IPaddress to equivalent hardware address

d Known as address resolution problem

Internetworking With TCP/IP vol 1 -- Part 5 4 2005

Page 122: internetworking tcpip

Address Resolution

d Performed at each step along path through Internet

d Two basic algorithms

– Direct mapping

– Dynamic binding

d Choice depends on type of hardware

Internetworking With TCP/IP vol 1 -- Part 5 5 2005

Page 123: internetworking tcpip

Direct Mapping

d Easy to understand

d Efficient

d Only works when hardware address is small

d Technique: assign computer an IP address that encodes thehardware address

Internetworking With TCP/IP vol 1 -- Part 5 6 2005

Page 124: internetworking tcpip

Example Of Direct Mapping

d Hardware: proNet ring network

d Hardware address: 8 bits

d Assume IP address 192.5.48.0 (24-bit prefix)

d Assign computer with hardware address K an IP address192.5.48.K

d Resolving an IP address means extracting the hardwareaddress from low-order 8 bits

Internetworking With TCP/IP vol 1 -- Part 5 7 2005

Page 125: internetworking tcpip

Dynamic Binding

d Needed when hardware addresses are large (e.g., Ethernet)

d Allows computer A to find computer B’s hardware address

– A starts with B’s IP address

– A knows B is on the local network

d Technique: broadcast query and obtain response

d Note: dynamic binding only used across one network at atime

Internetworking With TCP/IP vol 1 -- Part 5 8 2005

Page 126: internetworking tcpip

Internet Address Resolution Protocol (ARP)

d Standard for dynamic address resolution in the Internet

d Requires hardware broadcast

d Intended for LAN

d Important idea: ARP only used to map addresses within asingle physical network, never across multiple networks

Internetworking With TCP/IP vol 1 -- Part 5 9 2005

Page 127: internetworking tcpip

ARP

d Machine A broadcasts ARP request with B’s IP address

d All machines on local net receive broadcast

d Machine B replies with its physical address

d Machine A adds B’s address information to its table

d Machine A delivers packet directly to B

Internetworking With TCP/IP vol 1 -- Part 5 10 2005

Page 128: internetworking tcpip

Illustration Of ARPRequest And Reply Messages

X B YA

A broadcasts request for B

(across local net only)

A X YB

B replies to request

Internetworking With TCP/IP vol 1 -- Part 5 11 2005

Page 129: internetworking tcpip

ARP Packet Format WhenUsed With Ethernet

0 8 16 31

ETHERNET ADDRESS TYPE (1) IP ADDRESS TYPE (0800)

ETH ADDR LEN (6) IP ADDR LEN (4) OPERATION

SENDER’S ETH ADDR (first 4 octets)

SENDER’S ETH ADDR (last 2 octets) SENDER’S IP ADDR (first 2 octets)

SENDER’S IP ADDR (last 2 octets) TARGET’S ETH ADDR (first 2 octets)

TARGET’S ETH ADDR (last 4 octets)

TARGET’S IP ADDR (all 4 octets)

Internetworking With TCP/IP vol 1 -- Part 5 12 2005

Page 130: internetworking tcpip

Observations About Packet Format

d General: can be used with

– Arbitrary hardware address

– Arbitrary protocol address (not just IP)

d Variable length fields (depends on type of addresses)

d Length fields allow parsing of packet by computer that doesnot understand the two address types

Internetworking With TCP/IP vol 1 -- Part 5 13 2005

Page 131: internetworking tcpip

Retention Of Bindings

d Cannot afford to send ARP request for each packet

d Solution

– Maintain a table of bindings

d Effect

– Use ARP one time, place results in table, and then sendmany packets

Internetworking With TCP/IP vol 1 -- Part 5 14 2005

Page 132: internetworking tcpip

ARP Caching

d ARP table is a cache

d Entries time out and are removed

d Avoids stale bindings

d Typical timeout: 20 minutes

Internetworking With TCP/IP vol 1 -- Part 5 15 2005

Page 133: internetworking tcpip

Algorithm For ProcessingARP Requests

d Extract sender’s pair, (IA, EA) and update local ARP table ifit exists

d If this is a request and the target is ‘‘me’’

– Add sender’s pair to ARP table if not present

– Fill in target hardware address

– Exchange sender and target entries

– Set operation to reply

– Send reply back to requester

Internetworking With TCP/IP vol 1 -- Part 5 16 2005

Page 134: internetworking tcpip

Algorithm Features

d If A ARPs B, B keeps A’s information

– B will probably send a packet to A soon

d If A ARPs B, other machines do not keep A’s information

– Avoids clogging ARP caches needlessly

Internetworking With TCP/IP vol 1 -- Part 5 17 2005

Page 135: internetworking tcpip

Conceptual Purpose Of ARP

d Isolates hardware address at low level

d Allows application programs to use IP addresses

Internetworking With TCP/IP vol 1 -- Part 5 18 2005

Page 136: internetworking tcpip

ARP Encapsulation

d ARP message travels in data portion of network frame

d We say ARP message is encapsulated

Internetworking With TCP/IP vol 1 -- Part 5 19 2005

Page 137: internetworking tcpip

Illustration Of ARP Encapsulation

FRAMEHEADER

FRAME DATA AREA

ARP MESSAGE

Internetworking With TCP/IP vol 1 -- Part 5 20 2005

Page 138: internetworking tcpip

Ethernet Encapsulation

d ARP message placed in frame data area

d Data area padded with zeroes if ARP message is shorterthan minimum Ethernet frame

d Ethernet type 0x0806 used for ARP

Internetworking With TCP/IP vol 1 -- Part 5 21 2005

Page 139: internetworking tcpip

Reverse Address Resolution Protocol

d Maps Ethernet address to IP address

d Same packet format as ARP

d Intended for bootstrap

– Computer sends its Ethernet address

– RARP server responds by sending computer’s IP address

d Seldom used (replaced by DHCP)

Internetworking With TCP/IP vol 1 -- Part 5 22 2005

Page 140: internetworking tcpip

Summary

d Computer’s IP address independent of computer’s hardwareaddress

d Applications use IP addresses

d Hardware only understands hardware addresses

d Must map from IP address to hardware address fortransmission

d Two types

– Direct mapping

– Dynamic mapping

Internetworking With TCP/IP vol 1 -- Part 5 23 2005

Page 141: internetworking tcpip

Summary(continued)

d Address Resolution Protocol (ARP) used for dynamicaddress mapping

d Important for Ethernet

d Sender broadcasts ARP request, and target sends ARP reply

d ARP bindings are cached

d Reverse ARP was originally used for bootstrap

Internetworking With TCP/IP vol 1 -- Part 5 24 2005

Page 142: internetworking tcpip

Questions?

Page 143: internetworking tcpip

PART VI

INTERNET PROTOCOL:CONNECTIONLESS DATAGRAM

DELIVERY

Internetworking With TCP/IP vol 1 -- Part 6 1 2005

Page 144: internetworking tcpip

Internet Protocol

d One of two major protocols in TCP/IP suite

d Major goals

– Hide heterogeneity

– Provide the illusion of a single large network

– Virtualize access

Internetworking With TCP/IP vol 1 -- Part 6 2 2005

Page 145: internetworking tcpip

The Concept

IP allows a user to think of an internet as a single virtualnetwork that interconnects all hosts, and through whichcommunication is possible; its underlying architecture is bothhidden and irrelevant.

Internetworking With TCP/IP vol 1 -- Part 6 3 2005

Page 146: internetworking tcpip

Internet ServicesAnd Architecture

Of Protocol Software

APPLICATION SERVICES

RELIABLE TRANSPORT SERVICE

CONNECTIONLESS PACKET DELIVERY SERVICE

d Design has proved especially robust

Internetworking With TCP/IP vol 1 -- Part 6 4 2005

Page 147: internetworking tcpip

IP Characteristics

d Provides connectionless packet delivery service

d Defines three important items

– Internet addressing scheme

– Format of packets for the (virtual) Internet

– Packet forwarding

Internetworking With TCP/IP vol 1 -- Part 6 5 2005

Page 148: internetworking tcpip

Internet Packet

d Analogous to physical network packet

d Known as IP datagram

Internetworking With TCP/IP vol 1 -- Part 6 6 2005

Page 149: internetworking tcpip

IP Datagram Layout

DATAGRAM HEADER DATAGRAM DATA AREA

d Header contains

– Source Internet address

– Destination Internet address

– Datagram type field

d Payload contains data being carried

Internetworking With TCP/IP vol 1 -- Part 6 7 2005

Page 150: internetworking tcpip

Datagram Header Format

0 4 8 16 19 24 31

VERS HLEN TYPE OF SERVICE TOTAL LENGTH

IDENT FLAGS FRAGMENT OFFSET

TTL TYPE HEADER CHECKSUM

SOURCE IP ADDRESS

DESTINATION IP ADDRESS

IP OPTIONS (MAY BE OMITTED) PADDING

BEGINNING OF PAYLOAD (DATA)...

Internetworking With TCP/IP vol 1 -- Part 6 8 2005

Page 151: internetworking tcpip

Addresses In The Header

d SOURCE is the address of original source

d DESTINATION is the address of ultimate destination

Internetworking With TCP/IP vol 1 -- Part 6 9 2005

Page 152: internetworking tcpip

IP Versions

d Version field in header defines version of datagram

d Internet currently uses version 4 of IP, IPv4

d Preceding figure is the IPv4 datagram format

d IPv6 discussed later in the course

Internetworking With TCP/IP vol 1 -- Part 6 10 2005

Page 153: internetworking tcpip

Datagram Encapsulation

d Datagram encapsulated in network frame

d Network hardware treats datagram as data

d Frame type field identifies contents as datagram

– Set by sending computer

– Tested by receiving computer

Internetworking With TCP/IP vol 1 -- Part 6 11 2005

Page 154: internetworking tcpip

Datagram Encapsulation For Ethernet

IP DATAIP HEADER

FRAME DATAFRAME HEADER

d Ethernet header contains Ethernet hardware addresses

d Ethernet type field set to 0x0800

Internetworking With TCP/IP vol 1 -- Part 6 12 2005

Page 155: internetworking tcpip

Datagram Encapsulated In Ethernet Frame

02 07 01 00 27 ba 08 00 2b 0d 44 a7 08 00 45 00

00 54 82 68 00 00 f f 35 2101 80 0a 02 03 80 0a

02 08 08 00 73 0b d4 6d 00 00 04 3b 8c 28 28 20

0d 00 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15

16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25

26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35

36 37

d 20-octet IP header follows Ethernet header

d IP source: 128.10.2.3 (800a0203)

d IP destination: 128.10.2.8 (800a0208)

d IP type: 01 (ICMP)

Internetworking With TCP/IP vol 1 -- Part 6 13 2005

Page 156: internetworking tcpip

Standards For Encapsulation

d TCP/IP protocols define encapsulation for each possible typeof network hardware

– Ethernet

– Frame Relay

– Others

Internetworking With TCP/IP vol 1 -- Part 6 14 2005

Page 157: internetworking tcpip

Encapsulation Over Serial Networks

d Serial hardware transfers stream of octets

– Leased serial data line

– Dialup telephone connection

d Encapsulation of IP on serial network

– Implemented by software

– Both ends must agree

d Most common standards: Point to Point Protocol (PPP)

Internetworking With TCP/IP vol 1 -- Part 6 15 2005

Page 158: internetworking tcpip

Encapsulation For Avian Carriers (RFC 1149)

d Characteristics of avian carrier

– Low throughput

– High delay

– Low altitude

– Point-to-point communication

– Intrinsic collision avoidance

d Encapsulation

– Write in hexadecimal on scroll of paper

– Attach to bird’s leg with duct tape

d For an implementation see

http://www.blug.linux.no/rfc1149

Page 159: internetworking tcpip

A Potential Problem

d A datagram can contain up to 65535 total octets (includingheader)

d Network hardware limits maximum size of frame (e.g.,Ethernet limited to 1500 octets)

– Known as the network Maximum Transmission Unit(MTU)

d Question: how is encapsulation handled if datagram exceedsnetwork MTU?

Internetworking With TCP/IP vol 1 -- Part 6 16 2005

Page 160: internetworking tcpip

Possible Ways To AccommodateNetworks With Differing MTUs

d Force datagram to be less than smallest possible MTU

– Inefficient

– Cannot know minimum MTU

d Hide the network MTU and accommodate arbitrarydatagram size

Internetworking With TCP/IP vol 1 -- Part 6 17 2005

Page 161: internetworking tcpip

Accommodating Large Datagrams

d Cannot send large datagram in single frame

d Solution

– Divide datagram into pieces

– Send each piece in a frame

– Called datagram fragmentation

Internetworking With TCP/IP vol 1 -- Part 6 18 2005

Page 162: internetworking tcpip

Illustration Of When Fragmentation Needed

Net 2MTU=620

R1

HostA

Net 1

MTU=1500R2

HostB

Net 3

MTU=1500

d Hosts A and B send datagrams of up to 1500 octets

d Router R1 fragments large datagrams from Host A beforesending over Net 2

d Router R2 fragments large datagrams from Host B beforesending over Net 2

Internetworking With TCP/IP vol 1 -- Part 6 19 2005

Page 163: internetworking tcpip

Datagram Fragmentation

d Performed by routers

d Divides datagram into several, smaller datagrams calledfragments

d Fragment uses same header format as datagram

d Each fragment forwarded independently

Internetworking With TCP/IP vol 1 -- Part 6 20 2005

Page 164: internetworking tcpip

Illustration Of Fragmentation

Header

Original datagram

data1600 bytes

...........

data2600 bytes

...........

data3200 bytes

Header1 data1 fragment #1 (offset of 0)

Header2 data2 fragment #2 (offset of 600)

Header3 data3 fragment #3 (offset of 1200)

d Offset specifies where data belongs in original datagram

d Offset actually stored as multiples of 8 octets

d MORE FRAGMENTS bit turned off in header of fragment#3

Internetworking With TCP/IP vol 1 -- Part 6 21 2005

Page 165: internetworking tcpip

Fragmenting A Fragment

d Fragment can be further fragmented

d Occurs when fragment reaches an even-smaller MTU

d Discussion: which fields of the datagram header are used,and what is the algorithm?

Internetworking With TCP/IP vol 1 -- Part 6 22 2005

Page 166: internetworking tcpip

Reassembly

d Ultimate destination puts fragments back together

– Key concept!

– Needed in a connectionless Internet

d Known as reassembly

d No need to reassemble subfragments first

d Timer used to ensure all fragments arrive

– Timer started when first fragment arrives

– If timer expires, entire datagram discarded

Internetworking With TCP/IP vol 1 -- Part 6 23 2005

Page 167: internetworking tcpip

Time To Live

d TTL field of datagram header decremented at each hop (i.e.,each router)

d If TTL reaches zero, datagram discarded

d Prevents datagrams from looping indefinitely (in caseforwarding error introduces loop)

d IETF recommends initial value of 255 (max)

Internetworking With TCP/IP vol 1 -- Part 6 24 2005

Page 168: internetworking tcpip

Checksum Field In Datagram Header

d 16-bit 1’s complement checksum

d Over IP header only!

d Recomputed at each hop

Internetworking With TCP/IP vol 1 -- Part 6 25 2005

Page 169: internetworking tcpip

IP Options

d Seldom used

d Primarily for debugging

d Only some options copied into fragments

d Are variable length

d Note: padding needed because header length measured in32-bit multiples

d Option starts with option code octet

Internetworking With TCP/IP vol 1 -- Part 6 26 2005

Page 170: internetworking tcpip

Option Code Octet

0 1 2 3 4 5 6 7

COPY OPTION CLASS OPTION NUMBER

Option Class Meaning22222222222222222222222222222222222222222222

0 Datagram or network control1 Reserved for future use2 Debugging and measurement3 Reserved for future use

Internetworking With TCP/IP vol 1 -- Part 6 27 2005

Page 171: internetworking tcpip

IP Semantics

d IP uses best-effort delivery

– Makes an attempt to deliver

– Does not guarantee delivery

d In the Internet, routers become overrun or change routes,meaning that:

– Datagrams can be lost

– Datagrams can be duplicated

– Datagrams can arrive out of order or scrambled

d Motivation: allow IP to operate over the widest possiblevariety of physical networks

Internetworking With TCP/IP vol 1 -- Part 6 28 2005

Page 172: internetworking tcpip

Output FromPING Program

PING venera.isi.edu (128.9.0.32): 64 data bytes

at 1.0000 second intervals

72 bytes from 128.9.0.32: icmp_seq=0. time=170. ms

72 bytes from 128.9.0.32: icmp_seq=1. time=150. ms

72 bytes from 128.9.0.32: icmp_seq=1. time=160. ms

72 bytes from 128.9.0.32: icmp_seq=2. time=160. ms

72 bytes from 128.9.0.32: icmp_seq=3. time=160. ms

----venera.isi.edu PING Statistics----

4 packets transmitted, 5 packets received,

-25% packet loss

round-trip (ms) min/avg/max = 150/160/170

d Shows actual case of duplication

Internetworking With TCP/IP vol 1 -- Part 6 29 2005

Page 173: internetworking tcpip

Summary

d Internet Protocol provides basic connectionless deliveryservice for the Internet

d IP defines IP datagram to be the format of packets on theInternet

d Datagram header

– Has fixed fields

– Specifies source, destination, and type

– Allows options

d Datagram encapsulated in network frame for transmission

Internetworking With TCP/IP vol 1 -- Part 6 30 2005

Page 174: internetworking tcpip

Summary(continued)

d Fragmentation

– Needed when datagram larger than MTU

– Usually performed by routers

– Divides datagram into fragments

d Reassembly

– Performed by ultimate destination

– If some fragment(s) do not arrive, datagram discarded

d To accommodate all possible network hardware, IP does notrequire reliability (best-effort semantics)

Internetworking With TCP/IP vol 1 -- Part 6 31 2005

Page 175: internetworking tcpip

Questions?

Page 176: internetworking tcpip

PART VII

INTERNET PROTOCOL:FORWARDING IP DATAGRAMS

Internetworking With TCP/IP vol 1 -- Part 7 1 2005

Page 177: internetworking tcpip

Datagram Transmission

d Host delivers datagrams to directly connected machines

d Host sends datagrams that cannot be delivered directly torouter

d Routers forward datagrams to other routers

d Final router delivers datagram directly

Internetworking With TCP/IP vol 1 -- Part 7 2 2005

Page 178: internetworking tcpip

Question

Does a host need to make forwarding choices?

Internetworking With TCP/IP vol 1 -- Part 7 3 2005

Page 179: internetworking tcpip

Question

Does a host need to make forwarding choices?

Answer: YES!

Internetworking With TCP/IP vol 1 -- Part 7 3 2005

Page 180: internetworking tcpip

Example Host That Must ChooseHow To Forward Datagrams

HOST

R1 R2

path to some

destinations

path to other

destinations

d Note: host is singly homed!

Internetworking With TCP/IP vol 1 -- Part 7 4 2005

Page 181: internetworking tcpip

Two Broad Cases

d Direct delivery

– Ultimate destination can be reached over one network

– The ‘‘last hop’’ along a path

– Also occurs when two communicating hosts both attachto the same physical network

d Indirect delivery

– Requires intermediary (router)

Internetworking With TCP/IP vol 1 -- Part 7 5 2005

Page 182: internetworking tcpip

Important Design Decision

Transmission of an IP datagram between two machines on asingle physical network does not involve routers. The senderencapsulates the datagram in a physical frame, binds thedestination IP address to a physical hardware address, andsends the resulting frame directly to the destination.

Internetworking With TCP/IP vol 1 -- Part 7 6 2005

Page 183: internetworking tcpip

Testing Whether A DestinationLies On The Same Physical Network

As The Sender

Because the Internet addresses of all machines on a singlenetwork include a common network prefix and extracting thatprefix requires only a few machine instructions, testing whethera machine can be reached directly is extremely efficient.

Internetworking With TCP/IP vol 1 -- Part 7 7 2005

Page 184: internetworking tcpip

Datagram Forwarding

d General paradigm

– Source host sends to first router

– Each router passes datagram to next router

– Last router along path delivers datagram to destinationhost

d Only works if routers cooperate

Internetworking With TCP/IP vol 1 -- Part 7 8 2005

Page 185: internetworking tcpip

General Concept

Routers in a TCP/IP Internet form a cooperative,interconnected structure. Datagrams pass from router to routeruntil they reach a router that can deliver the datagram directly.

Internetworking With TCP/IP vol 1 -- Part 7 9 2005

Page 186: internetworking tcpip

Efficient Forwarding

d Decisions based on table lookup

d Routing tables keep only network portion of addresses (sizeproportional to number of networks, not number of hosts)

d Extremely efficient

– Lookup

– Route update

Internetworking With TCP/IP vol 1 -- Part 7 10 2005

Page 187: internetworking tcpip

Important Idea

d Table used to decide how to send datagram known asrouting table (also called a forwarding table)

d Routing table only stores address of next router along thepath

d Scheme is known as next-hop forwarding or next-hoprouting

Internetworking With TCP/IP vol 1 -- Part 7 11 2005

Page 188: internetworking tcpip

Terminology

d Originally

– Routing used to refer to passing datagram from router torouter

d More recently

– Purists decided to use forwarding to refer to the processof looking up a route and sending a datagram

d But...

– Table is usually called a routing table

Internetworking With TCP/IP vol 1 -- Part 7 12 2005

Page 189: internetworking tcpip

Conceptual Contents Of Routing TableFound In An IP Router

Network10.0.0.0

Network20.0.0.0

Network30.0.0.0

Network40.0.0.0Q R S

10.0.0.5 20.0.0.6

20.0.0.5

30.0.0.7

30.0.0.6 40.0.0.7

20.0.0.0 / 8 DELIVER DIRECT

30.0.0.0 / 8 DELIVER DIRECT

10.0.0.0 / 8 20.0.0.5

40.0.0.0 / 8 30.0.0.7

TO REACHNETWORK

ROUTE TOTHIS ADDRESS

An example Internet with IP addresses

The routing table for router R

Internetworking With TCP/IP vol 1 -- Part 7 13 2005

Page 190: internetworking tcpip

Special Cases

d Default route

d Host-specific route

Internetworking With TCP/IP vol 1 -- Part 7 14 2005

Page 191: internetworking tcpip

Default Route

d Special entry in IP routing table

d Matches ‘‘any’’ destination address

d Only one default permitted

d Only selected if no other match in table

Internetworking With TCP/IP vol 1 -- Part 7 15 2005

Page 192: internetworking tcpip

Host-Specific Route

d Entry in routing table

d Matches entire 32-bit value

d Can be used to send traffic for a specific host along aspecific path (i.e., can differ from the network route)

d More later in the course

Internetworking With TCP/IP vol 1 -- Part 7 16 2005

Page 193: internetworking tcpip

Level Of Forwarding Algorithm

FORWARDING

ALGORITHM

ROUTING

TABLE

DATAGRAM

TO BE FORWARDED

EXAMINATION OR

UPDATES OF ROUTES

DATAGRAM TO BE SENT

PLUS ADDRESS OF NEXT HOP

IP addresses used

Physical addresses used

d Routing table uses IP addresses, not physical addresses

Internetworking With TCP/IP vol 1 -- Part 7 17 2005

Page 194: internetworking tcpip

Summary

d IP uses routing table to forward datagrams

d Routing table

– Stores pairs of network prefix and next hop

– Can contain host-specific routes and a default route

Internetworking With TCP/IP vol 1 -- Part 7 18 2005

Page 195: internetworking tcpip

Questions?

Page 196: internetworking tcpip

PART VIII

ERROR AND CONTROLMESSAGES

(ICMP)

Internetworking With TCP/IP vol 1 -- Part 8 1 2005

Page 197: internetworking tcpip

Errors In Packet Switching Networks

d Causes include

– Temporary or permanent disconnection

– Hardware failures

– Router overrun

– Routing loops

d Need mechanisms to detect and correct

Internetworking With TCP/IP vol 1 -- Part 8 2 2005

Page 198: internetworking tcpip

Error Detection AndReporting Mechanisms

d IP header checksum to detect transmission errors

d Error reporting mechanism to distinguish between eventssuch as lost datagrams and incorrect addresses

d Higher level protocols (i.e., TCP) must handle all otherproblems

Internetworking With TCP/IP vol 1 -- Part 8 3 2005

Page 199: internetworking tcpip

Error Reporting Mechanism

d Named Internet Control Message Protocol (ICMP)

d Required and integral part of IP

d Used primarily by routers to report delivery or routingproblems to original source

d Also includes informational (nonerror) functionality

d Uses IP to carry control messages

d No error messages sent about error messages

Internetworking With TCP/IP vol 1 -- Part 8 4 2005

Page 200: internetworking tcpip

ICMP Purpose

The Internet Control Message Protocol allows a router to senderror or control messages to the source of a datagram, typicallya host. ICMP provides communication between the InternetProtocol software on one machine and the Internet Protocolsoftware on another.

Internetworking With TCP/IP vol 1 -- Part 8 5 2005

Page 201: internetworking tcpip

Error Reporting Vs. Error Correction

d ICMP does not

– Provide interaction between a router and the source oftrouble

– Maintain state information (each packet is handledindependently)

d Consequence

When a datagram causes an error, ICMP can only report theerror condition back to the original source of the datagram; thesource must relate the error to an individual applicationprogram or take other action to correct the problem.

Internetworking With TCP/IP vol 1 -- Part 8 6 2005

Page 202: internetworking tcpip

Important Restriction

d ICMP only reports problems to original source

d Discussion question: what major problem in the Internetcannot be handled with ICMP?

Internetworking With TCP/IP vol 1 -- Part 8 7 2005

Page 203: internetworking tcpip

ICMP Encapsulation

d ICMP message travels in IP datagram

d Entire ICMP message treated as data in the datagram

d Two levels of encapsulation result

Internetworking With TCP/IP vol 1 -- Part 8 8 2005

Page 204: internetworking tcpip

ICMP Message Encapsulation

ICMP MESSAGE

IP DATAIP HEADER

FRAME DATAFRAME HEADER

d ICMP message has header and data area

d Complete ICMP message is treated as data in IP datagram

d Complete IP datagram is treated as data in physical networkframe

Internetworking With TCP/IP vol 1 -- Part 8 9 2005

Page 205: internetworking tcpip

Example Encapsulation In Ethernet

02 07 01 00 27 ba 08 00 2b 0d 44 a7 08 00 45 00

00 54 82 68 00 00 f f 01 35 21 80 0a 02 03 80 0a

02 08 04 3b 8c 28 28 2000 73 0b d4 6d08 00 00

0d 00 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15

16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25

26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35

36 37

d ICMP header follows IP header, and contains eight bytes

d ICMP type field specifies echo request message (08)

d ICMP sequence number is zero

Internetworking With TCP/IP vol 1 -- Part 8 10 2005

Page 206: internetworking tcpip

ICMP Message Format

d Multiple message types

d Each message has its own format

d Messages

– Begin with 1-octet TYPE field that identifies which ofthe basic ICMP message types follows

– Some messages have a 1-octet CODE field that furtherclassifies the message

d Example

– TYPE specifies destination unreachable

– CODE specifies whether host or network wasunreachable

Internetworking With TCP/IP vol 1 -- Part 8 11 2005

Page 207: internetworking tcpip

ICMP Message Types

Type Field ICMP Message Type222222222222 22222222222222222222222222222222222

0 Echo Reply3 Destination Unreachable4 Source Quench5 Redirect (change a route)6 Alternate Host Address8 Echo Request9 Router Advertisement

10 Router Solicitation11 Time Exceeded for a Datagram12 Parameter Problem on a Datagram13 Timestamp Request14 Timestamp Reply15 Information Request16 Information Reply17 Address Mask Request18 Address Mask Reply

Internetworking With TCP/IP vol 1 -- Part 8 12 2005

Page 208: internetworking tcpip

ICMP Message Types(continued)

Type Field ICMP Message Type222222222222 22222222222222222222222222222

30 Traceroute31 Datagram Conversion Error32 Mobile Host Redirect33 IPv6 Where-Are-You34 IPv6 I-Am-Here35 Mobile Registration Request36 Mobile Registration Reply37 Domain Name Request38 Domain Name Reply39 SKIP40 Photuris

Internetworking With TCP/IP vol 1 -- Part 8 13 2005

Page 209: internetworking tcpip

Example ICMP Message(ICMP Echo Request)

0 8 16 31

TYPE (8 or 0) CODE (0) CHECKSUM

IDENTIFIER SEQUENCE NUMBER

OPTIONAL DATA

. . .

d Sent by ping program

d Used to test reachability

Internetworking With TCP/IP vol 1 -- Part 8 14 2005

Page 210: internetworking tcpip

Example ICMP Message(Destination Unreachable)

0 8 16 31

TYPE (3) CODE (0-12) CHECKSUM

UNUSED (MUST BE ZERO)

INTERNET HEADER + FIRST 64 BITS OF DATAGRAM

. . .

d Used to report that datagram could not be delivered

d Code specifies details

Internetworking With TCP/IP vol 1 -- Part 8 15 2005

Page 211: internetworking tcpip

Example ICMP Message(Redirect)

0 8 16 31

TYPE (5) CODE (0 to 3) CHECKSUM

ROUTER INTERNET ADDRESS

INTERNET HEADER + FIRST 64 BITS OF DATAGRAM

. . .

d Used to report incorrect route

Internetworking With TCP/IP vol 1 -- Part 8 16 2005

Page 212: internetworking tcpip

Situation Where An ICMP RedirectCannot Be Used

SR1

R2R3

R4

R5

D

d R5 cannot redirect R1 to use shorter path

Internetworking With TCP/IP vol 1 -- Part 8 17 2005

Page 213: internetworking tcpip

Example ICMP Message(Time Exceeded)

0 8 16 31

TYPE (11) CODE (0 or 1) CHECKSUM

UNUSED (MUST BE ZERO)

INTERNET HEADER + FIRST 64 BITS OF DATAGRAM

. . .

d At least one fragment failed to arrive, or

d TTL field in IP header reached zero

Internetworking With TCP/IP vol 1 -- Part 8 18 2005

Page 214: internetworking tcpip

ICMP Trick

d Include datagram that caused problem in the error message

– Efficient (sender must determine how to correctproblem)

– Eliminates need to construct detailed message

d Problem: entire datagram may be too large

d Solution: send IP header plus 64 bits of data area (sufficientin most cases)

Internetworking With TCP/IP vol 1 -- Part 8 19 2005

Page 215: internetworking tcpip

Summary

d ICMP

– Required part of IP

– Used to report errors to original source

– Reporting only: no interaction or error correction

d Several ICMP message types, each with its own format

d ICMP message begins with 1-octet TYPE field

d ICMP encapsulated in IP for delivery

Internetworking With TCP/IP vol 1 -- Part 8 20 2005

Page 216: internetworking tcpip

Questions?

Page 217: internetworking tcpip

PART IX

INTERNET PROTOCOL:CLASSLESS AND SUBNET

ADDRESS EXTENSIONS(CIDR)

Internetworking With TCP/IP vol 1 -- Part 9 1 2005

Page 218: internetworking tcpip

Recall

In the original IP addressing scheme, each physical network isassigned a unique network address; each host on a network hasthe network address as a prefix of the host’s individual address.

d Routers only examine prefix (small routing tables)

Internetworking With TCP/IP vol 1 -- Part 9 2 2005

Page 219: internetworking tcpip

An Observation

d Division into prefix and suffix means: site can assign anduse IP addresses in unusual ways provided

– All hosts and routers at the site honor the site’s scheme

– Other sites on the Internet can treat addresses as anetwork prefix and a host suffix

Internetworking With TCP/IP vol 1 -- Part 9 3 2005

Page 220: internetworking tcpip

Classful Addressing

d Three possible classes for networks

d Class C network limited to 254 hosts (cannot use all-1s orall-0s)

d Personal computers result in networks with many hosts

d Class B network allows many hosts, but insufficient class Bprefixes

Internetworking With TCP/IP vol 1 -- Part 9 4 2005

Page 221: internetworking tcpip

Question

d How can we minimize the number of assigned networkprefixes (especially class B) without abandoning the 32-bitaddressing scheme?

Internetworking With TCP/IP vol 1 -- Part 9 5 2005

Page 222: internetworking tcpip

Two Answers To The Minimization Question

d Proxy ARP

d Subnet addressing

Internetworking With TCP/IP vol 1 -- Part 9 6 2005

Page 223: internetworking tcpip

Proxy ARP

d Layer 2 solution

d Allow two physical networks to share a single IP prefix

d Arrange special system to answer ARP requests and forwarddatagrams between networks

Internetworking With TCP/IP vol 1 -- Part 9 7 2005

Page 224: internetworking tcpip

Illustration Of Proxy ARP

H1 H2 H3

RH4 H5

Main Network

Hidden Network

Router running proxy ARP

d Hosts think they are on same network

d Known informally as the ARP hack

Internetworking With TCP/IP vol 1 -- Part 9 8 2005

Page 225: internetworking tcpip

Assessment Of Proxy ARP

d Chief advantages

– Transparent to hosts

– No change in IP routing tables

d Chief disadvantages

– Does not generalize to complex topology

– Only works on networks that use ARP

– Most proxy ARP systems require manual configuration

Internetworking With TCP/IP vol 1 -- Part 9 9 2005

Page 226: internetworking tcpip

Subnet Addressing

d Not part of original TCP/IP address scheme

d Allows an organization to use a single network prefix formultiple physical networks

d Subdivides the host suffix into a pair of fields for physicalnetwork and host

d Interpreted only by routers and hosts at the site; treated likenormal address elsewhere

Internetworking With TCP/IP vol 1 -- Part 9 10 2005

Page 227: internetworking tcpip

Example Of Subnet Addressing

REST OF THEINTERNET R

H1 H2

H3 H4

Network 128.10.1.0

Network 128.10.2.0

128.10.1.1 128.10.1.2

128.10.2.1 128.10.2.2

all traffic to

128.10.0.0

d Both physical networks share prefix 128.10

d Router R uses third octet of address to choose physical net

Internetworking With TCP/IP vol 1 -- Part 9 11 2005

Page 228: internetworking tcpip

Interpretation Of Addresses

d Classful interpretation is two-level hierarchy

– Physical network identified by prefix

– Host on the net identified by suffix

d Subnetted interpretation is three-level hierarchy

– Site identified by network prefix

– Physical net at site identified by part of suffix

– Host on the net identified by remainder of suffix

Internetworking With TCP/IP vol 1 -- Part 9 12 2005

Page 229: internetworking tcpip

Example Of Address Interpretation(Subnetted Class B Address)

Internetpart

localpart

Internetpart

physicalnetwork host

...................

...................

...................

Note: in this case, 16-bit host portion is divided into two 8-bitfields

Internetworking With TCP/IP vol 1 -- Part 9 13 2005

Page 230: internetworking tcpip

Choice Of Subnet Size

d How should host portion of address be divided?

d Answer depends on topology at site and number of hosts pernetwork

Internetworking With TCP/IP vol 1 -- Part 9 14 2005

Page 231: internetworking tcpip

Example Of Site With Hierarchical Topology

R1

To rest of Internet

R2 R3

R4 R5

Network 1

Network 2 Network 3

Network 4 Network 5

Internetworking With TCP/IP vol 1 -- Part 9 15 2005

Page 232: internetworking tcpip

Illustration Of Subnet Addressing

R1Router at site

Rest of the Internet

R2 R3128.10.1.0

128.10.2.0 128.10.3.0

Site using third octet tosubnet address 128.10.0.0

Subnet address treated asnormal IP address

Subnet identified by using part of hostportion to identify physical net

Internetworking With TCP/IP vol 1 -- Part 9 16 2005

Page 233: internetworking tcpip

Address Mask

d Each physical network is assigned 32-bit address mask (alsocalled subnet mask)

d One bits in mask cover network prefix plus zero or morebits of suffix portion

d Logical and between mask and destination IP addressextracts the prefix and subnet portions

Internetworking With TCP/IP vol 1 -- Part 9 17 2005

Page 234: internetworking tcpip

Two Possible Mask Assignments

d Fixed-length subnet masks

d Variable-length subnet masks

Internetworking With TCP/IP vol 1 -- Part 9 18 2005

Page 235: internetworking tcpip

Fixed-length Subnet Masks

d Organization uses same mask on all networks

d Advantages

– Uniformity

– Ease of debugging / maintenance

d Disadvantages

– Number of nets fixed for entire organization

– Size of physical nets fixed for entire organization

Internetworking With TCP/IP vol 1 -- Part 9 19 2005

Page 236: internetworking tcpip

Possible Fixed-Length SubnetsFor Sixteen Bit Host Address

Bits in mask # subnets # hosts/subnet22222222222222222222222222222222222222222222222222222222222

16 1 6553418 2 1638219 6 819020 14 409421 30 204622 62 102223 126 51022222222222222222222222222222222222222222222222222222222222

24 254 25422222222222222222222222222222222222222222222222222222222222

25 510 12626 1022 6227 2046 3028 4094 1429 8190 630 16382 2

d All-0s and all-1s values must be omitted

d Organization chooses one line in table

Internetworking With TCP/IP vol 1 -- Part 9 20 2005

Page 237: internetworking tcpip

Variable-Length Subnet Masks (VLSM)

d Administrator chooses size for each physical network

d Mask assigned on per-network basis

d Advantages

– Flexibility to mix large and small nets

– More complete use of address space

d Disadvantages

– Difficult to assign / administer

– Potential address ambiguity

– More routes

Internetworking With TCP/IP vol 1 -- Part 9 21 2005

Page 238: internetworking tcpip

Use Of Address Space(Start With 16 Bits Of Host Suffix)

d One possible VLSM assignment (92.9% of addresses used)

– 11 networks of 2046 hosts each

– 24 networks of 254 hosts each

– 256 networks of 126 hosts each

d Another possible VLSM assignment (93.1% of addressesused)

– 9 networks of 2046 hosts each

– 2 networks of 1022 hosts each

– 40 networks of 510 hosts each

– 160 networks of 126 hosts eachInternetworking With TCP/IP vol 1 -- Part 9 22 2005

Page 239: internetworking tcpip

Subnet Details

d Two interesting facts

– Can assign all-0’s or all-1’s subnet

– Can assign noncontiguous subnet mask bits

d In practice

– Should avoid both

d Discussion question: why does the subnet standard allow theall-1’s and all-0’s subnet numbers?

Internetworking With TCP/IP vol 1 -- Part 9 23 2005

Page 240: internetworking tcpip

VLSM Example

d Use low-order sixteen bits of 128.10.0.0

d Create seven subnets

d Subnet 1

– Up to 254 hosts

– Subnet mask is 24 bits

d Subnets 2 through 7

– Up to 62 hosts each

– Subnet mask is 26 bits

Internetworking With TCP/IP vol 1 -- Part 9 24 2005

Page 241: internetworking tcpip

Example VLSM Prefixes

d Subnet 1 (up to 254 hosts)

mask: 11111111 11111111 11111111 00000000

prefix: 10000000 00001010 00000001 00000000

d Subnet 2 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000000 10000000

d Subnet 3 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000000 11000000

Internetworking With TCP/IP vol 1 -- Part 9 25 2005

Page 242: internetworking tcpip

Example VLSM Prefixes(continued)

d Subnet 4 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 00000000

d Subnet 5 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 01000000

d Subnet 6 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 10000000

Internetworking With TCP/IP vol 1 -- Part 9 26 2005

Page 243: internetworking tcpip

Example VLSM Prefixes(continued)

d Subnet 7 (up to 62 hosts)

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 11000000

Internetworking With TCP/IP vol 1 -- Part 9 27 2005

Page 244: internetworking tcpip

Address Ambiguity

d Address of host 63 on subnet 1 is

mask: 11111111 11111111 11111111 00000000

prefix: 10000000 00001010 00000001 00000000

host: 10000000 00001010 00000001 00111111

d Directed broadcast address on subnet 4 is

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 00000000

bcast: 10000000 00001010 00000001 00111111

Internetworking With TCP/IP vol 1 -- Part 9 28 2005

Page 245: internetworking tcpip

Address Ambiguity

d Address of host 63 on subnet 1 is

mask: 11111111 11111111 11111111 00000000

prefix: 10000000 00001010 00000001 00000000

host: 10000000 00001010 00000001 00111111

d Directed broadcast address on subnet 4 is

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 00000000

bcast: 10000000 00001010 00000001 00111111

d Same value!

Internetworking With TCP/IP vol 1 -- Part 9 28 2005

Page 246: internetworking tcpip

More Address Ambiguity

d Directed broadcast address on subnet 1 is

mask: 11111111 11111111 11111111 00000000

prefix: 10000000 00001010 00000001 00000000

broadcast: 10000000 00001010 00000001 11111111

d Directed broadcast address on subnet 7 is

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 11000000

broadcast:10000000 00001010 00000001 11111111

Internetworking With TCP/IP vol 1 -- Part 9 29 2005

Page 247: internetworking tcpip

More Address Ambiguity

d Directed broadcast address on subnet 1 is

mask: 11111111 11111111 11111111 00000000

prefix: 10000000 00001010 00000001 00000000

broadcast: 10000000 00001010 00000001 11111111

d Directed broadcast address on subnet 7 is

mask: 11111111 11111111 11111111 11000000

prefix: 10000000 00001010 00000001 11000000

broadcast:10000000 00001010 00000001 11111111

d Same value!

Internetworking With TCP/IP vol 1 -- Part 9 29 2005

Page 248: internetworking tcpip

Example Of Illegal Subnet Assignment

HR1 R2

Net 1 (not a subnet address)

Net 2 (subnet of address N) Net 3 (subnet of address N)

d Host cannot route among subnets

d Rule: subnets must be contiguous!

Internetworking With TCP/IP vol 1 -- Part 9 30 2005

Page 249: internetworking tcpip

Variety Of Routes

d Forwarding must accommodate

– Network-specific routes

– Subnet-specific routes

– Host-specific routes

– Default route

– Limited broadcast

– Directed broadcast to network

– Directed broadcast to specific subnet

d Single algorithm with address masks can accommodate allthe above

Internetworking With TCP/IP vol 1 -- Part 9 31 2005

Page 250: internetworking tcpip

Use Of Address Masks

d Each entry in routing table also has address mask

d All-1s mask used for host-specific routes

d Network mask used for network-specific routes

d Subnet mask used for subnet-specific routes

d All-0s mask used for default route

Internetworking With TCP/IP vol 1 -- Part 9 32 2005

Page 251: internetworking tcpip

Unified Forwarding Algorithm2222222222222222222222222222222222222222222222222222222222222222222

Algorithm:

Forward_IP_Datagram (datagram, routing_table)

Extract destination IP address, ID, from datagram;If prefix of ID matches address of any directly connected

network send datagram to destination over that network(This involves resolving ID to a physical address,encapsulating the datagram, and sending the frame.)

elsefor each entry in routing table do

Let N be the bitwise-and of ID and the subnet maskIf N equals the network address field of the entry then

forward the datagram to the specified next hop addressendforloop

If no matches were found, declare a forwarding error;

222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111

11111111111111111111111111

Internetworking With TCP/IP vol 1 -- Part 9 33 2005

Page 252: internetworking tcpip

Special Case: Unnumbered Serial Network

d Only two endpoints

d Not necessary to assign (waste) network prefix

d Trick: use remote IP address as next hop

Internetworking With TCP/IP vol 1 -- Part 9 34 2005

Page 253: internetworking tcpip

Example Unnumbered Serial Network

R1 R2leased serial line

128.10.0.0 128.211.0.0

128.10.2.250 128.211.0.100

1 2

128.10.0.0 DELIVER DIRECT 1

default 128.211.0.100 2

TO REACH HOSTSON NETWORK

ROUTE TOTHIS ADDRESS

USING THISINTERFACE

(a)

(b)

Internetworking With TCP/IP vol 1 -- Part 9 35 2005

Page 254: internetworking tcpip

Classless Inter-DomainRouting (CIDR)

d Problem

– Continued exponential Internet growth

– Subnetting insufficient

– Limited IP addresses (esp. Class B)

d Dire prediction made in 1993:

We will exhaust the address space ‘‘in a few years’’.

Note: address space is not near exhaustion

Internetworking With TCP/IP vol 1 -- Part 9 36 2005

Page 255: internetworking tcpip

CIDR Addressing

d Solution to problem

– Temporary fix until next generation of IP

– Backward compatible with classful addressing

– Extend variable-length subnet technology to prefixes

d CIDR was predicted to work ‘‘for a few years’’

– Extremely successful!

– Will work for at least 25 years!

Internetworking With TCP/IP vol 1 -- Part 9 37 2005

Page 256: internetworking tcpip

One Motivation For CIDR: Class C

d Fewer than seventeen thousand Class B numbers (total)

d More than two million Class C network numbers

d No one wants Class C (too small)

d CIDR allows

– Merging 256 Class C numbers into a single prefix that isequivalent to Class B

– Splitting a Class B along power of two boundaries

Internetworking With TCP/IP vol 1 -- Part 9 38 2005

Page 257: internetworking tcpip

CIDR Notation

d Addresses written NUMBER / m

– NUMBER is IP prefix

– m is ‘‘address mask’’ length

d Example

214.5.48.0/20

– Prefix occupies 20 bits

– Suffix occupies 12 bits

d Mask values must be converted to dotted decimal whenconfiguring a router (and binary internally)

Internetworking With TCP/IP vol 1 -- Part 9 39 2005

Page 258: internetworking tcpip

Route Proliferation

d If classful forwarding used, CIDR addresses result in moreroutes

d Example:

– Single CIDR prefix spans 256 Class C network numbers(supernetting)

– Classful routing table requires 256 separate entries

Internetworking With TCP/IP vol 1 -- Part 9 40 2005

Page 259: internetworking tcpip

Route Condensation

d Solution: change forwarding as well as addressing

d Store address mask with each route

d Send pair of (address, mask) whenever exchanging routinginformation

d Known as a CIDR block

Internetworking With TCP/IP vol 1 -- Part 9 41 2005

Page 260: internetworking tcpip

Example Of A CIDR Block

Dotted Decimal 32-bit Binary Equivalent222222222222222222222222222222222222222222222222222222222222

lowest 128.211.168.0 10000000 11010011 10101000 00000000highest 128.211.175.255 10000000 11010011 10101111 11111111

Internetworking With TCP/IP vol 1 -- Part 9 42 2005

Page 261: internetworking tcpip

Dotted Decimal Equivalents

CIDR Notation Dotted Decimal CIDR Notation Dotted Decimal222222222222222222222222222222222222222222222222222222222222222222

/1 128.0.0.0 /17 255.255.128.0/2 192.0.0.0 /18 255.255.192.0/3 224.0.0.0 /19 255.255.224.0/4 240.0.0.0 /20 255.255.240.0/5 248.0.0.0 /21 255.255.248.0/6 252.0.0.0 /22 255.255.252.0/7 254.0.0.0 /23 255.255.254.0/8 255.0.0.0 /24 255.255.255.0/9 255.128.0.0 /25 255.255.255.128

/10 255.192.0.0 /26 255.255.255.192/11 255.224.0.0 /27 255.255.255.224/12 255.240.0.0 /28 255.255.255.240/13 255.248.0.0 /29 255.255.255.248/14 255.252.0.0 /30 255.255.255.252/15 255.254.0.0 /31 255.255.255.254/16 255.255.0.0 /32 255.255.255.2551

111111111111111111111

Internetworking With TCP/IP vol 1 -- Part 9 43 2005

Page 262: internetworking tcpip

Example Of /30 CIDR Block

Dotted Decimal 32-bit Binary Equivalent222222222222222222222222222222222222222222222222222222222222

lowest 128.211.176.212 10000000 11010011 10110000 11010100highest 128.211.176.215 10000000 11010011 10110000 11010111

d Useful when customer of ISP has very small network

Internetworking With TCP/IP vol 1 -- Part 9 44 2005

Page 263: internetworking tcpip

Implementation Of CIDR Route Lookup

d Each entry in routing table has address plus mask

d Search is organized from most-specific to least-specific (i.e.,entry with longest mask is tested first)

d Known as longest-prefix lookup or longest-prefix search

Internetworking With TCP/IP vol 1 -- Part 9 45 2005

Page 264: internetworking tcpip

Implementing Longest-Prefix Matching

d Cannot easily use hashing

d Data structure of choice is binary trie

d Identifies unique prefix needed to match route

Internetworking With TCP/IP vol 1 -- Part 9 46 2005

Page 265: internetworking tcpip

Example Of Unique Prefixes

32-Bit Address Unique Prefix222222222222222222222222222222222222222222222222222222

00110101 00000000 00000000 00000000 0001000110 00000000 00000000 00000000 010001010110 00000000 00000000 00000000 010101100001 00000000 00000000 00000000 01110101010 11110000 00000000 00000000 101010110000 00000010 00000000 00000000 1011010111011 00001010 00000000 00000000 10111

Internetworking With TCP/IP vol 1 -- Part 9 47 2005

Page 266: internetworking tcpip

Example Binary Trie For The Seven Prefixes

0

0 1

0

0 1

1

1

0

1

0 1

0 1

d Path for 0101 is shown in red

Internetworking With TCP/IP vol 1 -- Part 9 48 2005

Page 267: internetworking tcpip

Modifications And Extensions

d Several variations of trie data structures exist

– PATRICIA trees

– Level-Compressed tries (LC-tries)

d Motivation

– Handle longest-prefix match

– Skip levels that do not distinguish among routes

Internetworking With TCP/IP vol 1 -- Part 9 49 2005

Page 268: internetworking tcpip

Nonroutable Addresses

d CIDR blocks reserved for use within a site

d Must never appear on the Internet

d ISPs do not maintain routes

d Also called private addresses

Prefix Lowest Address Highest Address2222222222222222222222222222222222222222222222222

10 / 8 10.0.0.0 10.255.255.255172.16 / 12 172.16.0.0 172.31.255.255192.168 / 16 192.168.0.0 192.168.255.255169.254 / 16 169.254.0.0 169.254.255.255

Internetworking With TCP/IP vol 1 -- Part 9 50 2005

Page 269: internetworking tcpip

Summary

d Original IP addressing scheme was classful

d Two extensions added

– Subnet addressing

– CIDR addressing

d Subnetting used only within a site

d CIDR used throughout the Internet

d Both use 32-bit address mask

– CIDR mask identifies division between network prefixand host suffix

– Subnet mask identifies boundary between subnet andindividual host

Internetworking With TCP/IP vol 1 -- Part 9 51 2005

Page 270: internetworking tcpip

Summary(continued)

d Single unified forwarding algorithm handles routes that are

– Network-specific

– Subnet-specific

– Host-specific

– Limited broadcast

– Directed broadcast to network

– Directed broadcast to subnet

– Default

d Longest-prefix match required

– Typical implementation: binary trie

Internetworking With TCP/IP vol 1 -- Part 9 52 2005

Page 271: internetworking tcpip

Questions?

Page 272: internetworking tcpip

PART X

PROTOCOL LAYERING

Internetworking With TCP/IP vol 1 -- Part 10 1 2005

Page 273: internetworking tcpip

Motivation For Layering

d Communication is difficult to understand

d Many subproblems

– Hardware failure

– Network congestion

– Packet delay or loss

– Data corruption

– Data duplication or inverted arrivals

Internetworking With TCP/IP vol 1 -- Part 10 2 2005

Page 274: internetworking tcpip

Solving The Problem

d Divide the problem into pieces

d Solve subproblems separately

d Combine into integrated whole

d Result is layered protocols

Internetworking With TCP/IP vol 1 -- Part 10 3 2005

Page 275: internetworking tcpip

Protocol Layering

d Separates protocol functionality

d Each layer solves one part of the communication problem

d Intended primarily for protocol designers

d Set of layers is called a protocol stack

Internetworking With TCP/IP vol 1 -- Part 10 4 2005

Page 276: internetworking tcpip

Concept Of Layering

Layer 1

Layer 2

. . .

Layer n

Sender

Layer 1

Layer 2

. . .

Layer n

Receiver

Network

Internetworking With TCP/IP vol 1 -- Part 10 5 2005

Page 277: internetworking tcpip

More Realistic Layering

NetworkInterface Layer

InternetProtocol Layer

High-LevelProtocol Layer

IP Module

Protocol 2Protocol 1 Protocol 3

Interface 2Interface 1 Interface 3

Conceptual Layers Software Organization

(a) (b)

Internetworking With TCP/IP vol 1 -- Part 10 6 2005

Page 278: internetworking tcpip

Layering In An Internet

Interface

IP Layer

Interface

IP Layer

Interface

IP Layer

Interface

IP Layer

other...

Sender

other...

Receiver

Net 1 Net 2 Net 3

Internetworking With TCP/IP vol 1 -- Part 10 7 2005

Page 279: internetworking tcpip

Examples Of Layering

d Two models exist

d ISO 7-layer reference model for Open SystemInterconnection (OSI)

– Predates TCP/IP

– Does not include an Internet layer

– Prescriptive (designed before protocols)

d Internet 5-layer reference model

– Designed for TCP/IP

– Descriptive (designed along with actual protocols)

Internetworking With TCP/IP vol 1 -- Part 10 8 2005

Page 280: internetworking tcpip

ISO 7-Layer Reference Model

Physical HardwareConnection1

Data Link(Hardware Interface)2

Network3

Transport4

Session5

Presentation6

Application7

FunctionalityLayer

Internetworking With TCP/IP vol 1 -- Part 10 9 2005

Page 281: internetworking tcpip

TCP/IP 5-Layer Reference Model

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ................................................................

Hardware

Network Interface

Internet

Transport

Application

Conceptual Layer Objects PassedBetween Layers

Network-Specific Frames

IP Datagrams

Transport Protocol Packets

Messages or Streams

d Only four layers above hardware

Internetworking With TCP/IP vol 1 -- Part 10 10 2005

Page 282: internetworking tcpip

TCP/IP Layer 1: Physical Hardware

d Defines electrical signals used in communication (e.g.,voltages on wires between two computers)

d Uninteresting except to electrical engineers

Internetworking With TCP/IP vol 1 -- Part 10 11 2005

Page 283: internetworking tcpip

TCP/IP Layer 2: Network Interface

d Defines communication between computer and networkhardware

d Isolates details of hardware (MAC) addressing

d Example protocol: ARP

d Code is usually in the operating system

Internetworking With TCP/IP vol 1 -- Part 10 12 2005

Page 284: internetworking tcpip

TCP/IP Layer 3: Internet

d Protocol is IP

d Provides machine to machine communication

d Defines best-effort, connectionless datagram delivery servicefor the Internet

d Code is usually in the operating system

Internetworking With TCP/IP vol 1 -- Part 10 13 2005

Page 285: internetworking tcpip

TCP/IP Layer 4: Transport

d Provides end-to-end connection from application program toapplication program

d Often handles reliability, flow control

d Protocols are TCP and UDP

d Code is usually in the operating system

Internetworking With TCP/IP vol 1 -- Part 10 14 2005

Page 286: internetworking tcpip

TCP/IP Layer 5: Application

d Implemented by application programs

d Many application-specific protocols in the Internet

d Built on top of transport layer

Internetworking With TCP/IP vol 1 -- Part 10 15 2005

Page 287: internetworking tcpip

Two Differences Between TCP/IPAnd Other Layered Protocols

d TCP/IP uses end-to-end reliability instead of link-levelreliability

d TCP/IP places the locus of intelligence and decision makingat the edge of the network instead of the core

Internetworking With TCP/IP vol 1 -- Part 10 16 2005

Page 288: internetworking tcpip

The Layering Principle

Software implementing layer n at the destination receivesexactly the message sent by software implementing layer n atthe source.

Internetworking With TCP/IP vol 1 -- Part 10 17 2005

Page 289: internetworking tcpip

Illustration Of Layering Principle

Application

Transport

Internet

NetworkInterface

NetworkInterface

Internet

Transport

Application

Physical Net

Host A Host B

identicalmessage

identicalpacket

identicaldatagram

identicalframe

Internetworking With TCP/IP vol 1 -- Part 10 18 2005

Page 290: internetworking tcpip

When A Datagram Traverses The Internet

d All layers involved at

– Original source

– Ultimate destination

d Only up through IP layer involved at

– Intermediate routers

Internetworking With TCP/IP vol 1 -- Part 10 19 2005

Page 291: internetworking tcpip

Illustration Of Layering In An Internet

Application

Transport

Internet

NetworkInterface

NetworkInterface

Internet

NetworkInterface

Internet

Transport

Application

Physical Net 1 Physical Net 2

Host A Host B

Router R

identicalmessage

identicalpacket

identicalframe

identicalframe

identicaldatagram

identicaldatagram

Internetworking With TCP/IP vol 1 -- Part 10 20 2005

Page 292: internetworking tcpip

A Key Definition

d A protocol is classified as end-to-end if the layeringprinciple applies from one end of the Internet to the other

d Examples

– IP is machine-to-machine because layering principleonly applies across one hop

– TCP is end-to-end because layering principle fromoriginal source to ultimate destination

Internetworking With TCP/IP vol 1 -- Part 10 21 2005

Page 293: internetworking tcpip

Practical Aspect Of Layering

d Multiple protocols at each layer

d One protocol used at each layer for given datagram

Internetworking With TCP/IP vol 1 -- Part 10 22 2005

Page 294: internetworking tcpip

Example Of Two ProtocolsAt Network Interface Layer:

SLIP And PPP

d Both used to send IP across

– Serial data circuit

– Dialup connection

d Each defines standards for

– Framing (encapsulation)

– Addressing

d Incompatible

Internetworking With TCP/IP vol 1 -- Part 10 23 2005

Page 295: internetworking tcpip

Notion Of Multiple Interfaces And Layering

NetworkInterface

Internet

Transport

Intranet

IP Module

Protocol 2Protocol 1 Protocol 3

Interface 2

Point-To-Point(Intranet)

Interface 1 Interface 3

Conceptual Layer Software Organization

(a) (b)

Internetworking With TCP/IP vol 1 -- Part 10 24 2005

Page 296: internetworking tcpip

Boundaries In The TCP/IP Layering Model

d High-level protocol address boundary

– Division between software that uses hardware addressesand software that uses IP addresses

d Operating system boundary

– Division between application program running outsidethe operating system and protocol software runninginside the operating system

Internetworking With TCP/IP vol 1 -- Part 10 25 2005

Page 297: internetworking tcpip

The Consequence Of An Address Boundary

Application programs as well as all protocol software from theInternet layer upward use only IP addresses; the networkinterface layer handles physical addresses.

Internetworking With TCP/IP vol 1 -- Part 10 26 2005

Page 298: internetworking tcpip

Illustration Of The Two Boundaries

NetworkInterface

Internet

Transport

Application

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .................................................................

Hardware

Conceptual Layer Boundary

Only IP addresses used

Physical addresses used

Software outside the operating system

Software inside the operating system

Internetworking With TCP/IP vol 1 -- Part 10 27 2005

Page 299: internetworking tcpip

Handling Multiple Protocols Per Layer

d Sender places field in header to say which protocol used ateach layer

d Receiver uses field to determine which protocol at next layerreceives the packet

d Known as multiplexing and demultiplexing

Internetworking With TCP/IP vol 1 -- Part 10 28 2005

Page 300: internetworking tcpip

Example Of Demultiplexing An Incoming Frame

Demultiplexing BasedOn Frame Type

ARP ModuleIP Module RARP Module

Frame Arrives

Internetworking With TCP/IP vol 1 -- Part 10 29 2005

Page 301: internetworking tcpip

Example Of Demultiplexing Performed By IP

ICMP Module UDP Module TCP Module

IP Module

Datagram Arrives

Internetworking With TCP/IP vol 1 -- Part 10 30 2005

Page 302: internetworking tcpip

Example Of Demultiplexing Performed By TCP

Application 1 Application 2 . . . Application n

TCP Module

Segment Arrives

d TCP is part of operating system

d Transfer to application program must cross operating systemboundary

Internetworking With TCP/IP vol 1 -- Part 10 31 2005

Page 303: internetworking tcpip

Discussion

d What are the key advantages and disadvantages ofmultiplexing / demultiplexing?

d Can you think of an alternative?

Internetworking With TCP/IP vol 1 -- Part 10 32 2005

Page 304: internetworking tcpip

Summary

d Layering

– Intended for designers

– Helps control complexity in protocol design

d TCP/IP uses 5-layer reference model

d Conceptually, a router only needs layers 2 and 3, and a hostneeds all layers

d IP is machine-to-machine protocol

d TCP is end-to-end protocol

d Demultiplexing used to handle multiple protocols at eachlayer

Internetworking With TCP/IP vol 1 -- Part 10 33 2005

Page 305: internetworking tcpip

Questions?

Page 306: internetworking tcpip

PART XI

USER DATAGRAM PROTOCOL(UDP)

Internetworking With TCP/IP vol 1 -- Part 11 1 2005

Page 307: internetworking tcpip

Identifying The Ultimate Destination

d IP address only specifies a computer

d Need a way to specify an application program (process) on acomputer

d Unfortunately

– Application programs can be created and destroyedrapidly

– Each operating system uses its own identification

Internetworking With TCP/IP vol 1 -- Part 11 2 2005

Page 308: internetworking tcpip

Specifying An Application Program

d TCP/IP introduces its own specification

d Abstract destination point known as protocol port number(positive integer)

d Each OS determines how to bind protocol port number tospecific application program

Internetworking With TCP/IP vol 1 -- Part 11 3 2005

Page 309: internetworking tcpip

User Datagram Protocol

d Transport-layer protocol (Layer 4)

d Connectionless service: provides application programs withability to send and receive messages

d Allows multiple, application programs on a single machineto communicate concurrently

d Same best-effort semantics as IP

– Message can be delayed, lost, or duplicated

– Messages can arrive out of order

d Application accepts full responsibility for errors

Internetworking With TCP/IP vol 1 -- Part 11 4 2005

Page 310: internetworking tcpip

The Added Benefit Of UDP

The User Datagram Protocol (UDP) provides an unreliableconnectionless delivery service using IP to transport messagesbetween machines. It uses IP to carry messages, but adds theability to distinguish among multiple destinations within a givenhost computer.

Internetworking With TCP/IP vol 1 -- Part 11 5 2005

Page 311: internetworking tcpip

UDP Message Format

0 16 31

UDP SOURCE PORT UDP DESTINATION PORT

UDP MESSAGE LENGTH UDP CHECKSUM

DATA

. . .

d If UDP CHECKSUM field contains zeroes, receiver does notverify the checksum

Internetworking With TCP/IP vol 1 -- Part 11 6 2005

Page 312: internetworking tcpip

Port Numbers In A UDP Message

d SOURCE PORT identifies application on original sourcecomputer

d DESTINATION PORT identifies application on ultimatedestination computer

d Note: IP addresses of source and destination do not appearexplicitly in header

Internetworking With TCP/IP vol 1 -- Part 11 7 2005

Page 313: internetworking tcpip

UDP Pseudo-Header

d Used when computing or verifying a checksum

d Temporarily prepended to UDP message

d Contains items from IP header

d Guarantees that message arrived at correct destination

d Note: pseudo header is not sent across Internet

Internetworking With TCP/IP vol 1 -- Part 11 8 2005

Page 314: internetworking tcpip

Contents Of UDP Pseudo-Header

0 8 16 31

SOURCE IP ADDRESS

DESTINATION IP ADDRESS

ZERO PROTO UDP LENGTH

d SOURCE ADDRESS and DESTINATION ADDRESSspecify IP address of sending and receiving computers

d PROTO contains the Type from the IP datagram header

Internetworking With TCP/IP vol 1 -- Part 11 9 2005

Page 315: internetworking tcpip

Position Of UDP In Protocol Stack

Network Interface

Internet (IP)

User Datagram (UDP)

Application

Conceptual Layering

d UDP lies between applications and IP

Internetworking With TCP/IP vol 1 -- Part 11 10 2005

Page 316: internetworking tcpip

Encapsulation

FRAMEHEADER FRAME DATA AREA

IPHEADER IP DATA AREA

UDPHEADER UDP DATA AREA

Internetworking With TCP/IP vol 1 -- Part 11 11 2005

Page 317: internetworking tcpip

Division Of Duties BetweenIP and UDP

The IP layer is responsible for transferring data between a pairof hosts on an internet, while the UDP layer is responsible fordifferentiating among multiple sources or destinations withinone host.

d IP header only identifies computer

d UDP header only identifies application programs

Internetworking With TCP/IP vol 1 -- Part 11 12 2005

Page 318: internetworking tcpip

Demultiplexing Based OnUDP Protocol Port Number

UDP: DemultiplexingBased On Port

Port 2Port 1 Port 3

IP Module

UDP Datagram arrives

Internetworking With TCP/IP vol 1 -- Part 11 13 2005

Page 319: internetworking tcpip

Assignment Of UDP Port Numbers

d Small numbers reserved for specific services

– Called well-known ports

– Same interpretation throughout the Internet

– Used by server software

d Large numbers not reserved

– Available to arbitrary application program

– Used by client software

d More later in the course

Internetworking With TCP/IP vol 1 -- Part 11 14 2005

Page 320: internetworking tcpip

Examples Of Assigned UDP Port Numbers

Decimal Keyword UNIX Keyword Description22222222222222222222222222222222222222222222222222222222222222222222222222222222220 - - Reserved7 ECHO echo Echo9 DISCARD discard Discard

11 USERS systat Active Users13 DAYTIME daytime Daytime15 - netstat Network Status Program17 QUOTE qotd Quote of the Day19 CHARGEN chargen Character Generator37 TIME time Time42 NAMESERVER name Host Name Server43 NICNAME whois Who Is53 DOMAIN nameserver Domain Name Server67 BOOTPS bootps BOOTP or DHCP Server68 BOOTPC bootpc BOOTP or DHCP Client69 TFTP tftp Trivial File Transfer88 KERBEROS kerberos Kerberos Security Service

111 SUNRPC sunrpc Sun Remote Procedure Call123 NTP ntp Network Time Protocol161 - snmp Simple Network Management Protocol162 - snmp-trap SNMP traps512 - biff UNIX comsat513 - who UNIX rwho Daemon514 - syslog System Log525 - timed Time Daemon

Internetworking With TCP/IP vol 1 -- Part 11 15 2005

Page 321: internetworking tcpip

Summary

d User Datagram Protocol (UDP) provides connectionless,best-effort message service

d UDP message encapsulated in IP datagram for delivery

d IP identifies destination computer; UDP identifiesapplication on the destination computer

d UDP uses abstraction known as protocol port numbers

Internetworking With TCP/IP vol 1 -- Part 11 16 2005

Page 322: internetworking tcpip

Questions?

Page 323: internetworking tcpip

PART XII

RELIABLE STREAM TRANSPORT SERVICE(TCP)

Internetworking With TCP/IP vol 1 -- Part 12 1 2005

Page 324: internetworking tcpip

Transmission Control Protocol(TCP)

d Major transport service in the TCP/IP suite

d Used for most Internet applications (esp. World Wide Web)

Internetworking With TCP/IP vol 1 -- Part 12 2 2005

Page 325: internetworking tcpip

TCP Characteristics

d Stream orientation

d Virtual circuit connection

d Buffered transfer

d Unstructured stream

d Full duplex connection

d Reliability

Internetworking With TCP/IP vol 1 -- Part 12 3 2005

Page 326: internetworking tcpip

Providing Reliability

d Traditional technique: Positive Acknowledgement withRetransmission (PAR)

– Receiver sends acknowledgement when data arrives

– Sender starts timer whenever transmitting

– Sender retransmits if timer expires beforeacknowledgement arrives

Internetworking With TCP/IP vol 1 -- Part 12 4 2005

Page 327: internetworking tcpip

Illustration Of Acknowledgements

Send Packet 1

Receive Packet 1Send ACK 1

Receive ACK 1Send Packet 2

Receive Packet 2Send ACK 2

Receive ACK 2

Events At Sender Site Network Messages Events At Receiver Site

d Time moves from top to bottom in the diagram

Internetworking With TCP/IP vol 1 -- Part 12 5 2005

Page 328: internetworking tcpip

Illustration Of Recovery After Packet Loss

Send Packet 1Start Timer

Packet should arriveACK should be sent

ACK would normallyarrive at this time

Timer Expires

Retransmit Packet 1Start Timer

Receive Packet 1Send ACK 1

Receive ACK 1Cancel Timer

Events At Sender Site Network Messages Events At Receiver Site

Packet lost

Internetworking With TCP/IP vol 1 -- Part 12 6 2005

Page 329: internetworking tcpip

The Problem With Simplistic PAR

A simple positive acknowledgement protocol wastes asubstantial amount of network bandwidth because it must delaysending a new packet until it receives an acknowledgement forthe previous packet.

d Problem is especially severe if network has long latency

Internetworking With TCP/IP vol 1 -- Part 12 7 2005

Page 330: internetworking tcpip

Solving The Problem

d Allow multiple packets to be outstanding at any time

d Still require acknowledgements and retransmission

d Known as sliding window

Internetworking With TCP/IP vol 1 -- Part 12 8 2005

Page 331: internetworking tcpip

Illustration Of Sliding Window

1 2 3 4 5 6 7 8 9 10 . . .

initial window

1 2 3 4 5 6 7 8 9 10 . . .

window slides

(a)

(b)

d Window size is fixed

d As acknowledgement arrives, window moves forward

Internetworking With TCP/IP vol 1 -- Part 12 9 2005

Page 332: internetworking tcpip

Why Sliding Window Works

Because a well-tuned sliding window protocol keeps thenetwork completely saturated with packets, it obtainssubstantially higher throughput than a simple positiveacknowledgement protocol.

Internetworking With TCP/IP vol 1 -- Part 12 10 2005

Page 333: internetworking tcpip

Illustration Of Sliding Window

Send Packet 1

Send Packet 2

Send Packet 3

Receive Packet 1Send ACK 1

Receive Packet 2Send ACK 2

Receive Packet 3Send ACK 3Receive ACK 1

Receive ACK 2

Receive ACK 3

Events At Sender Site Network Messages Events At Receiver Site

Internetworking With TCP/IP vol 1 -- Part 12 11 2005

Page 334: internetworking tcpip

Sliding Window Used By TCP

d Measured in byte positions

d Illustration

1 2 3 4 5 6 7 8 9 10 11 . . .

current window................

d Bytes through 2 are acknowledged

d Bytes 3 through 6 not yet acknowledged

d Bytes 7 though 9 waiting to be sent

d Bytes above 9 lie outside the window and cannot be sent

Internetworking With TCP/IP vol 1 -- Part 12 12 2005

Page 335: internetworking tcpip

Layering Of The Three Major Protocols

Network Interface

Internet (IP)

User Datagram (UDP)Reliable Stream (TCP)

Application

Conceptual Layering

Internetworking With TCP/IP vol 1 -- Part 12 13 2005

Page 336: internetworking tcpip

TCP Ports, Connections, And Endpoints

d Endpoint of communication is application program

d TCP uses protocol port number to identify application

d TCP connection between two endpoints identified by fouritems

– Sender’s IP address

– Sender’s protocol port number

– Receiver’s IP address

– Receiver’s protocol port number

Internetworking With TCP/IP vol 1 -- Part 12 14 2005

Page 337: internetworking tcpip

An Important Idea About Port Numbers

Because TCP identifies a connection by a pair of endpoints, agiven TCP port number can be shared by multiple connectionson the same machine.

Internetworking With TCP/IP vol 1 -- Part 12 15 2005

Page 338: internetworking tcpip

Passive And Active Opens

d Two sides of a connection

d One side waits for contact

– A server program

– Uses TCP’s passive open

d One side initiates contact

– A client program

– Uses TCP’s active open

Internetworking With TCP/IP vol 1 -- Part 12 16 2005

Page 339: internetworking tcpip

TCP Segment Format

0 4 10 16 24 31

SOURCE PORT DESTINATION PORT

SEQUENCE NUMBER

ACKNOWLEDGEMENT NUMBER

HLEN RESERVED CODE BITS WINDOW

CHECKSUM URGENT PTR

OPTIONS (MAY BE OMITTED) PADDING

BEGINNING OF PAYLOAD (DATA)

. . .

d Offset specifies header size (offset of data) in 32-bit words

Internetworking With TCP/IP vol 1 -- Part 12 17 2005

Page 340: internetworking tcpip

Code Bits In The TCP Segment Header

Bit (left to right) Meaning if bit set to 122222222222222222222222222222222222222222222222222222222222

URG Urgent pointer field is validACK Acknowledgement field is validPSH This segment requests a pushRST Reset the connectionSYN Synchronize sequence numbersFIN Sender has reached end of its byte stream1

1111111

Internetworking With TCP/IP vol 1 -- Part 12 18 2005

Page 341: internetworking tcpip

Flow Control And TCP Window

d Receiver controls flow by telling sender size of currentlyavailable buffer measured in bytes

d Called window advertisement

d Each segment, including data segments, specifies size ofwindow beyond acknowledged byte

d Window size may be zero (receiver cannot accept additionaldata at present)

d Receiver can send additional acknowledgement later whenbuffer space becomes available

Internetworking With TCP/IP vol 1 -- Part 12 19 2005

Page 342: internetworking tcpip

TCP Checksum Computation

d Covers entire segment (header plus data)

d Required (unlike UDP)

d Pseudo header included in computation as with UDP

Internetworking With TCP/IP vol 1 -- Part 12 20 2005

Page 343: internetworking tcpip

TCP Pseudo Header

0 8 16 31

SOURCE IP ADDRESS

DESTINATION IP ADDRESS

ZERO PROTOCOL TCP LENGTH

Internetworking With TCP/IP vol 1 -- Part 12 21 2005

Page 344: internetworking tcpip

TCP Retransmission

d Designed for Internet environment

– Delays on one connection vary over time

– Delays vary widely between connections

d Fixed value for timeout will fail

– Waiting too long introduces unnecessary delay

– Not waiting long enough wastes network bandwidthwith unnecessary retransmission

d Retransmission strategy must be adaptive

Internetworking With TCP/IP vol 1 -- Part 12 22 2005

Page 345: internetworking tcpip

Adaptive Retransmission

d TCP keeps estimate of round-trip time (RTT) on eachconnection

d Round-trip estimate derived from observed delay betweensending segment and receiving acknowledgement

d Timeout for retransmission based on current round-tripestimate

Internetworking With TCP/IP vol 1 -- Part 12 23 2005

Page 346: internetworking tcpip

Difficulties With AdaptiveRetransmission

d The problem is knowing when to retransmit

d Segments or ACKs can be lost or delayed, making round-trip estimation difficult or inaccurate

d Round-trip times vary over several orders of magnitudebetween different connections

d Traffic is bursty, so round-trip times fluctuate wildly on asingle connection

Internetworking With TCP/IP vol 1 -- Part 12 24 2005

Page 347: internetworking tcpip

Difficulties With AdaptiveRetransmission

(continued)

d Load imposed by a single connection can congest routers ornetworks

d Retransmission can cause congestion

d Because an internet contains diverse network hardwaretechnologies, there may be little or no control for intra-network congestion

Internetworking With TCP/IP vol 1 -- Part 12 25 2005

Page 348: internetworking tcpip

Solution: Smoothing

d Adaptive retransmission schemes keep a statisticallysmoothed round-trip estimate

d Smoothing keeps running average from fluctuating wildly,and keeps TCP from overreacting to change

d Difficulty: choice of smoothing scheme

Internetworking With TCP/IP vol 1 -- Part 12 26 2005

Page 349: internetworking tcpip

Original Smoothing Scheme

d Let RTT be current (old) average round-trip time

d Let NRT be a new sample

d Compute

RTT = α * RTT + β * NRT

where

α + β = 1

d Example: α = .8, β = .2

d Large α makes estimate less susceptible to a single longdelay (more stable)

d Large β makes estimate track changes in round-trip timequickly

Internetworking With TCP/IP vol 1 -- Part 12 27 2005

Page 350: internetworking tcpip

Problems With OriginalScheme

d Associating ACKs with transmissions

– TCP acknowledges receipt of data, not receipt oftransmission

– Assuming ACK corresponds to most recent transmissioncan cause instability in round-trip estimate (Cypresssyndrome)

– Assuming ACK corresponds to first transmission cancause unnecessarily long timeout

– Both assumptions lead to lower throughput

Internetworking With TCP/IP vol 1 -- Part 12 28 2005

Page 351: internetworking tcpip

Partridge / Karn Scheme†

d Solves the problem of associating ACKs with correcttransmission

d Specifies ignoring round-trip time samples that correspondto retransmissions

d Separates timeout from round-trip estimate for retransmittedpackets

†Also called Karn’s Algorithm

Internetworking With TCP/IP vol 1 -- Part 12 29 2005

Page 352: internetworking tcpip

Partridge / Karn Scheme(continued)

d Starts (as usual) with retransmission timer as a function ofround-trip estimate

d Doubles retransmission timer value for each retransmissionwithout changing round-trip estimate

d Resets retransmission timer to be function of round-tripestimate when ACK arrives for nonretransmitted segment

Internetworking With TCP/IP vol 1 -- Part 12 30 2005

Page 353: internetworking tcpip

Flow Control And Congestion

d Receiver advertises window that specifies how manyadditional bytes it can accept

d Window size of zero means sender must not send normaldata (ACKs and urgent data allowed)

d Receiver can never decrease window beyond previouslyadvertised point in sequence space

d Sender chooses effective window smaller than receiver’sadvertised window if congestion detected

Internetworking With TCP/IP vol 1 -- Part 12 31 2005

Page 354: internetworking tcpip

Jacobson / KarelsCongestion Control

d Assumes long delays (packet loss) due to congestion

d Uses successive retransmissions as measure of congestion

d Reduces effective window as retransmissions increase

d Effective window is minimum of receiver’s advertisementand computed quantity known as the congestion window

Internetworking With TCP/IP vol 1 -- Part 12 32 2005

Page 355: internetworking tcpip

Multiplicative Decrease

d In steady state (no congestion), the congestion window isequal to the receiver’s window

d When segment lost (retransmission timer expires), reducecongestion window by half

d Never reduce congestion window to less than one maximumsized segment

Internetworking With TCP/IP vol 1 -- Part 12 33 2005

Page 356: internetworking tcpip

Jacobson / Karels Slow Start

d Used when starting traffic or when recovering fromcongestion

d Self-clocking startup to increase transmission rate rapidly aslong as no packets are lost

d When starting traffic, initialize the congestion window to thesize of a single maximum sized segment

d Increase congestion window by size of one segment eachtime an ACK arrives without retransmission

Internetworking With TCP/IP vol 1 -- Part 12 34 2005

Page 357: internetworking tcpip

Jacobson / Karels Congestion Avoidance

d When congestion first occurs, record one-half of lastsuccessful congestion window (flightsize) in a thresholdvariable

d During recovery, use slow start until congestion windowreaches threshold

d Above threshold, slow down and increase congestionwindow by one segment per window (even if more than onesegment was successfully transmitted in that interval)

Internetworking With TCP/IP vol 1 -- Part 12 35 2005

Page 358: internetworking tcpip

Jacobson / Karels Congestion Avoidance(continued)

d Increment window size on each ACK instead of waiting forcomplete window

increase = segment / window

Let N be segments per window, or

N = congestion_window / max segment sizeso

increase = segment / N

= (MSS bytes / N)

= MSS / (congestion_window/MSS)or

increase = (MSS*MSS)/congestion_window

Internetworking With TCP/IP vol 1 -- Part 12 36 2005

Page 359: internetworking tcpip

Changes In Delay

d Original smoothing scheme tracks the mean but not changes

d To track changes, compute

DIFF = SAMPLE - RTT

RTT = RTT + δ * DIFF

DEV = DEV + δ (| DIFF | - DEV)

d DEV estimates mean deviation

d δ is fraction between 0 and 1 that weights new sample

d Retransmission timer is weighted average of RTT and DEV:

RTO = µ * RTT + φ* DEV

d Typically, µ = 1 and φ= 4

Internetworking With TCP/IP vol 1 -- Part 12 37 2005

Page 360: internetworking tcpip

Computing Estimated Deviation

d Extremely efficient (optimized) implementation possible

– Scale computation by 2n

– Use integer arithmetic

– Choose δ to be 1/2n

– Implement multiplication or division by powers of 2with shifts

– Research shows n = 3 works well

Internetworking With TCP/IP vol 1 -- Part 12 38 2005

Page 361: internetworking tcpip

TCP Round-Trip Estimation

100

80

60

40

20

200180160140120100

Datagram Number

80604020

...............

.....

...................

............

.........

................

............

......

.......

........................

..............

...........

....................

................

..............

Internetworking With TCP/IP vol 1 -- Part 12 39 2005

Page 362: internetworking tcpip

Measurement Of Internet Delays For 100Successive Packets At 1 Second Intervals

12 s

10 s

8 s

6 s

Time

4 s

2 s

1009080706050

Datagram Number403020101

x......................x. .x. .x. .x..........x....x......x. .x.........x. .x..

.....x. .x..

...x....x...x. .x..............x..

.x..

..

..

..

..

..........x...x.....x...x. .x. .x. .x..

.x.............x....x...x.............x...x. .x. .x. .x...........x. .x..

.x...........x...x.......x. .x. .x. .x. .x...x..

.....x...x.........x. .x. .x..

............x..

.x...x........x..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

.x. .x...x.....x.................x...x.....x......x.................................x..

.x.....x.......x..

...x. .x. .x..

.....x..

.x...x...x.....x....x......x. .x......x..

...x. .x........x.....x. .x.......x..

.x.......x..

.x..

..

..

..

..

..

..

..

..

..

.x. .x. .x......x. .x...x.........x.........................x......................x..

.x..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..x.......x. .x

Internetworking With TCP/IP vol 1 -- Part 12 40 2005

Page 363: internetworking tcpip

TCP Round-Trip Estimation ForSampled Internet Delays

12 s

10 s

8 s

6 s

Time

4 s

2 s

1009080706050

Datagram Number

403020101

x......................x. .x. .x. .x..........x....x......x. .x.........x. .x..

.....x. .x..

...x....x...x. .x..............x..

.x..

..

..

..

..

..........x...x.....x...x. .x. .x. .x..

.x.............x....x...x.............x...x. .x. .x. .x...........x. .x..

.x...........x...x.......x. .x. .x. .x. .x...x..

.....x...x.........x. .x. .x..

............x..

.x...x........x..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

.x. .x...x.....x.................x...x.....x......x.................................x..

.x.....x.......x..

...x. .x. .x..

.....x..

.x...x...x.....x....x......x. .x......x..

...x. .x........x.....x. .x.......x..

.x.......x..

.x..

..

..

..

..

..

..

..

..

..

.x. .x. .x......x. .x...x.........x.........................x......................x..

.x..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..

..x.......x. .x

Internetworking With TCP/IP vol 1 -- Part 12 41 2005

Page 364: internetworking tcpip

TCP Details

d Data flow may be shut down in one direction

d Connections started reliably, and terminated gracefully

d Connection established (and terminated) with a 3-wayhandshake

Internetworking With TCP/IP vol 1 -- Part 12 42 2005

Page 365: internetworking tcpip

3-Way HandshakeFor Connection Startup

Send SYN seq=x

Receive SYN segmentSend SYN seq=y, ACK x+1

Receive SYN + ACK segmentSend ACK y+1

Receive ACK segment

Events At Site 1 Network Messages Events At Site 2

Internetworking With TCP/IP vol 1 -- Part 12 43 2005

Page 366: internetworking tcpip

3-Way HandshakeFor Connection Shutdown

(application closes connection)Send FIN seq=x

Receive FIN segmentSend ACK x+1(inform application)

Receive ACK segment

(application closes connection)Send FIN seq=y, ACK x+1

Receive FIN + ACK segmentSend ACK y+1

Receive ACK segment

Events At Site 1 Network Messages Events At Site 2

Internetworking With TCP/IP vol 1 -- Part 12 44 2005

Page 367: internetworking tcpip

TCP Finite State Machine

CLOSED

LISTEN

SYNRECVD

SYNSENT

ESTAB-LISHED

FINWAIT-1

CLOSEWAIT

CLOSING

FINWAIT-2

TIMEWAIT

LASTACK

anything / reset

begin

active open / syn

closepassive open

send / syn

syn / syn + ack

reset

ack

close / fin

syn / syn + ack

syn + ack / ack

close / fin

fin / ack

fin / ack

ack / fin-ack / ack

fin / ack

ack /

close / fin

ack /

close /

timeout /reset

timeout after 2 segment lifetimes......

Internetworking With TCP/IP vol 1 -- Part 12 45 2005

Page 368: internetworking tcpip

TCP Urgent Data

d Segment with urgent bit set contains pointer to last octet ofurgent data

d Urgent data occupies part of normal sequence space

d Urgent data can be retransmitted

d Receiving TCP should deliver urgent data to application‘‘immediately’’ upon receipt

Internetworking With TCP/IP vol 1 -- Part 12 46 2005

Page 369: internetworking tcpip

TCP Urgent Data(continued)

d Two interpretations of standard

– Out-of-band data interpretation

– Data mark interpretation

Internetworking With TCP/IP vol 1 -- Part 12 47 2005

Page 370: internetworking tcpip

Data-Mark InterpretationOf Urgent Data

d Has become widely accepted

d Single data stream

d Urgent pointer marks end of urgent data

d TCP informs application that urgent data arrived

d Application receives all data in sequence

d TCP informs application when end of urgent data reached

Internetworking With TCP/IP vol 1 -- Part 12 48 2005

Page 371: internetworking tcpip

Data-Mark InterpretationOf Urgent Data

(continued)

d Application

– Reads all data from one stream

– Must recognize start of urgent data

– Must buffer normal data if needed later

d Urgent data marks read boundary

Internetworking With TCP/IP vol 1 -- Part 12 49 2005

Page 372: internetworking tcpip

Urgent DataDelivery

d Receiving application placed in urgent mode

d Receiving application leaves urgent mode after readingurgent data

d Receiving application acquires all available urgent datawhen in urgent mode

Internetworking With TCP/IP vol 1 -- Part 12 50 2005

Page 373: internetworking tcpip

Fast Retransmit

d Coarse-grained clock used to implement RTO

– Typically 300 to 500ms per tick

d Timer expires up to 1s after segment dropped

d Fast retransmission

– Sender uses three duplicate ACKs as trigger

– Sender retransmits ‘‘early’’

– Sender reduces congestion window to half

Internetworking With TCP/IP vol 1 -- Part 12 51 2005

Page 374: internetworking tcpip

Other TCP Details

d Silly Window Syndrome (SWS) avoidance

d Nagle algorithm

d Delayed ACKs

d For details, read the text

Internetworking With TCP/IP vol 1 -- Part 12 52 2005

Page 375: internetworking tcpip

Comparison Of UDP And TCP

Network Interface

Internet (IP)

Reliable Stream (TCP) User Datagram (UDP)

d TCP and UDP lie between applications and IP

d Otherwise, completely different

Internetworking With TCP/IP vol 1 -- Part 12 53 2005

Page 376: internetworking tcpip

Comparison Of UDP and TCP

UDP TCP

between apps. and IP between apps. and IPpackets called datagrams packets called segments

unreliable reliablechecksum optional checksum requiredconnectionless connection-orientedrecord boundaries stream interfaceintended for LAN useful over WAN or LANno flow control flow control1-to-1, 1-many, many-1 1-to-1allows unicast, multicast unicast only

or broadcast

Internetworking With TCP/IP vol 1 -- Part 12 54 2005

Page 377: internetworking tcpip

TCP Vs. UDP Traffic

Around 95% of all bytes and around 85-95% of all packets onthe Internet are transmitted using TCP.

– Eggert, et. al. CCR

Page 378: internetworking tcpip

Summary Of TCP

d Major transport service in the Internet

d Connection oriented

d Provides end-to-end reliability

d Uses adaptive retransmission

d Includes facilities for flow control and congestion avoidance

d Uses 3-way handshake for connection startup and shutdown

Internetworking With TCP/IP vol 1 -- Part 12 55 2005

Page 379: internetworking tcpip

Questions?

Page 380: internetworking tcpip

PART XIII

ROUTING: CORES, PEERS,AND ALGORITHMS

Internetworking With TCP/IP vol 1 -- Part 13 1 2005

Page 381: internetworking tcpip

Internet Routing(review)

d IP implements datagram forwarding

d Both hosts and routers

– Have an IP module

– Forward datagrams

d IP forwarding is table-driven

d Table known as routing table

Internetworking With TCP/IP vol 1 -- Part 13 2 2005

Page 382: internetworking tcpip

How / When Are IP RoutingTables Built?

d Depends on size / complexity of internet

d Static routing

– Fixes routes at boot time

– Useful only for simplest cases

d Dynamic routing

– Table initialized at boot time

– Values inserted / updated by protocols that propagateroute information

– Necessary in large internets

Internetworking With TCP/IP vol 1 -- Part 13 3 2005

Page 383: internetworking tcpip

Routing Tables

d Two sources of information

– Initialization (e.g., from disk)

– Update (e.g., from protocols)

d Hosts tend to freeze the routing table after initialization

d Routers use protocols to learn new information and updatetheir routing table dynamically

Internetworking With TCP/IP vol 1 -- Part 13 4 2005

Page 384: internetworking tcpip

Routing With Partial Information

A host can forward datagrams successfully even if it only haspartial routing information because it can rely on a router.

Internetworking With TCP/IP vol 1 -- Part 13 5 2005

Page 385: internetworking tcpip

Routing With Partial Information(continued)

The routing table in a given router contains partial informationabout possible destinations. Routing that uses partialinformation allows sites autonomy in making local routingchanges, but introduces the possibility of inconsistencies thatmay make some destinations unreachable from some sources.

Internetworking With TCP/IP vol 1 -- Part 13 6 2005

Page 386: internetworking tcpip

Original Internet

ARPANET BACKBONE

R2R1 Rn

Local Net 1 Local Net 2 Local Net n

CoreRouters. . .

d Backbone network plus routers each connecting a localnetwork

Internetworking With TCP/IP vol 1 -- Part 13 7 2005

Page 387: internetworking tcpip

Worst Case If All RoutersContain A Default Route

BACKBONE

R2R1 Rn. . .

Local Net 1 Local Net 2 Local Net n

...

d Datagram sent to nonexistent destination loops until TTLexpires

Internetworking With TCP/IP vol 1 -- Part 13 8 2005

Page 388: internetworking tcpip

Original Routing Architecture

d Small set of ‘‘core’’ routers with complete informationabout all destinations

d Other routers know local destinations and use the core ascentral router

Internetworking With TCP/IP vol 1 -- Part 13 9 2005

Page 389: internetworking tcpip

Illustration Of Default RoutesIn The Original Internet Core

CORESYSTEM

L1

L2

L3

L4

L5

L6

L7

Ln

...

Internetworking With TCP/IP vol 1 -- Part 13 10 2005

Page 390: internetworking tcpip

Disadvantage Of Original Core

d Central bottleneck for all traffic

d No shortcut routes possible

d Does not scale

Internetworking With TCP/IP vol 1 -- Part 13 11 2005

Page 391: internetworking tcpip

Beyond A Core Architecture

d Single core insufficient in world where multiple ISPs eachhave a wide-area backbone

d Two backbones first appeared when NSF and ARPA fundedseparate backbone networks

d Known as peer backbones

Internetworking With TCP/IP vol 1 -- Part 13 12 2005

Page 392: internetworking tcpip

Illustration Of Peer Backbones

ARPANET BACKBONE

NSFNET BACKBONE

R2R1 R3

HOST 1 HOST 2

HOST 3 HOST 4

Internetworking With TCP/IP vol 1 -- Part 13 13 2005

Page 393: internetworking tcpip

Partial Core

d Cannot have ‘‘partial core’’ scheme

d Proof:

PARTIALCORE #1

PARTIALCORE #2

default route to sitesbeyond core 1

default route to sitesbeyond core 2

default routesfrom sites

behind core 1

default routesfrom sites

behind core 2

d Datagram destined for nonexistent destination loops untilTTL expires

Internetworking With TCP/IP vol 1 -- Part 13 14 2005

Page 394: internetworking tcpip

When A Core Routing Architecture Works

A core routing architecture assumes a centralized set of routersserves as the repository of information about all possibledestinations in an internet. Core systems work best forinternets that have a single, centrally managed backbone.Expanding the topology to multiple backbones makes routingcomplex; attempting to partition the core architecture so thatall routers use default routes introduces potential routing loops.

Internetworking With TCP/IP vol 1 -- Part 13 15 2005

Page 395: internetworking tcpip

General Idea

d Have a set of core routers know routes to all locations

d Devise a mechanism that allows other routers to contact thecore to learn routes (spread necessary routing informationautomatically)

d Continually update routing information

Internetworking With TCP/IP vol 1 -- Part 13 16 2005

Page 396: internetworking tcpip

Automatic Route Propagation

d Two basic algorithms used by routing update protocols

– Distance-vector

– Link-state

d Many variations in implementation details

Internetworking With TCP/IP vol 1 -- Part 13 17 2005

Page 397: internetworking tcpip

Distance-Vector Algorithm

d Initialize routing table with one entry for each directly-connected network

d Periodically run a distance-vector update to exchangeinformation with routers that are reachable over directly-connected networks

Internetworking With TCP/IP vol 1 -- Part 13 18 2005

Page 398: internetworking tcpip

Dynamic Update With Distance-Vector

d One router sends list of its routes to another

d List contains pairs of destination network and distance

d Receiver replaces entries in its table by routes to the senderif routing through the sender is less expensive than thecurrent route

d Receiver propagates new routes next time it sends out anupdate

d Algorithm has well-known shortcomings (we will see anexample later)

Internetworking With TCP/IP vol 1 -- Part 13 19 2005

Page 399: internetworking tcpip

Example Of Distance-Vector Update

Destination Distance RouteNet 1Net 2Net 4Net 17Net 24Net 30Net 42

0085622

directdirect

Router LRouter MRouter JRouter QRouter J

Destination DistanceNet 1Net 4Net 17Net 21Net 24Net 30Net 42

23645

103

(a) (b)

d (a) is existing routing table

d (b) incoming update (marked items cause change)

Internetworking With TCP/IP vol 1 -- Part 13 20 2005

Page 400: internetworking tcpip

Link-State Algorithm

d Alternative to distance-vector

d Distributed computation

– Broadcast information

– Allow each router to compute shortest paths

d Avoids problem where one router can damage the entireinternet by passing incorrect information

d Also called Shortest Path First (SPF)

Internetworking With TCP/IP vol 1 -- Part 13 21 2005

Page 401: internetworking tcpip

Link-State Update

d Participating routers learn internet topology

d Think of routers as nodes in a graph, and networksconnecting them as edges or links

d Pairs of directly-connected routers periodically

– Test link between them

– Propagate (broadcast) status of link

d All routers

– Receive link status messages

– Recompute routes from their local copy of information

Internetworking With TCP/IP vol 1 -- Part 13 22 2005

Page 402: internetworking tcpip

Summary

d Routing tables can be

– Initialized at startup (host or router)

– Updated dynamically (router)

d Original Internet used core routing architecture

d Current Internet accommodates peer backbones

d Two important routing algorithms

– Distance-vector

– Link state

Internetworking With TCP/IP vol 1 -- Part 13 23 2005

Page 403: internetworking tcpip

Questions?

Page 404: internetworking tcpip

PART XIV

ROUTING: EXTERIOR GATEWAYPROTOCOLS AND AUTONOMOUS

SYSTEMS (BGP)

Internetworking With TCP/IP vol 1 -- Part 14 1 2005

Page 405: internetworking tcpip

General Principle

Although it is desirable for routers to exchange routinginformation, it is impractical for all routers in an arbitrarilylarge internet to participate in a single routing update protocol.

d Consequence: routers must be divided into groups

Internetworking With TCP/IP vol 1 -- Part 14 2 2005

Page 406: internetworking tcpip

A Practical Limit On Group Size

It is safe to allow up to a dozen routers to participate in asingle routing information protocol across a wide areanetwork; approximately five times as many can safelyparticipate across a set of local area networks.

Internetworking With TCP/IP vol 1 -- Part 14 3 2005

Page 407: internetworking tcpip

Router Outside A Group

d Does not participate directly in group’s routing informationpropagation algorithm

d Will not choose optimal routes if it uses a member of thegroup for general delivery

Internetworking With TCP/IP vol 1 -- Part 14 4 2005

Page 408: internetworking tcpip

The Extra HopProblem

BACKBONER1 R2

R3

Local Net 1 Local Net 2

non-participatingrouter

participatingrouter

participatingrouter

d Non-participating router picks one participating router to use(e.g., R2)

d Non-participating router routes all packets to R2 acrossbackbone

d Router R2 routes some packets back across backbone to R1

Internetworking With TCP/IP vol 1 -- Part 14 5 2005

Page 409: internetworking tcpip

Statement Of The Problem

Treating a group of routers that participate in a routing updateprotocol as a default delivery system can introduce an extrahop for datagram traffic; a mechanism is needed that allowsnonparticipating routers to learn routes from participatingrouters so they can choose optimal routes.

Internetworking With TCP/IP vol 1 -- Part 14 6 2005

Page 410: internetworking tcpip

Solving The ExtraHop Problem

d Not all routers can participate in a single routing exchangeprotocol (does not scale)

d Even nonparticipating routers should make routing decisions

d Need mechanism that allows nonparticipating routers toobtain correct routing information automatically (without theoverhead of participating fully in a routing exchangeprotocol)

Internetworking With TCP/IP vol 1 -- Part 14 7 2005

Page 411: internetworking tcpip

Hidden Networks

d Each site has complex topology

d Nonparticipating router (from another site) cannot attach toall networks

Internetworking With TCP/IP vol 1 -- Part 14 8 2005

Page 412: internetworking tcpip

Illustration Of Hidden Networks

INTERNET BACKBONE

R1

Local Net 1

R2 R3

Local Net 2 Local Net 3 R4 Local Net 4

ParticipatingRouter

d Propagation of route information is independent of datagramrouting

d Group must learn routes from nonparticipating routers

d Example: owner of networks 1 and 3 must tell group thatthere is a route to network 4

Internetworking With TCP/IP vol 1 -- Part 14 9 2005

Page 413: internetworking tcpip

A Requirement For Reverse Information Flow

Because an individual organization can have an arbitrarilycomplex set of networks interconnected by routers, no routerfrom another organization can attach directly to all networks.A mechanism is needed that allows nonparticipating routers toinform the other group about hidden networks.

Internetworking With TCP/IP vol 1 -- Part 14 10 2005

Page 414: internetworking tcpip

Autonomous System Concept(AS)

d Group of networks under one administrative authority

d Free to choose internal routing update mechanism

d Connects to one or more other autonomous systems

Internetworking With TCP/IP vol 1 -- Part 14 11 2005

Page 415: internetworking tcpip

Modern Internet Architecture

A large TCP/IP internet has additional structure toaccommodate administrative boundaries: each collection ofnetworks and routers managed by one administrative authorityis considered to be a single autonomous system that is free tochoose an internal routing architecture and protocols.

Internetworking With TCP/IP vol 1 -- Part 14 12 2005

Page 416: internetworking tcpip

EGPs: Exterior GatewayProtocols

d Originally a single protocol for communicating routesbetween two autonomous systems

d Now refers to any exterior routing protocol

d Solves two problems

– Allows router outside a group to advertise networkshidden in another autonomous system

– Allows router outside a group to learn destinations in thegroup

Internetworking With TCP/IP vol 1 -- Part 14 13 2005

Page 417: internetworking tcpip

Border Gateway Protocol

d The most popular (virtually the only) EGP in use in theInternet

d Current version is BGP-4

d Allows two autonomous systems to communicate routinginformation

d Supports CIDR (mask accompanies each route)

d Each AS designates a border router to speak on its behalf

d Two border routers become BGP peers

Internetworking With TCP/IP vol 1 -- Part 14 14 2005

Page 418: internetworking tcpip

Illustration Of An EGP(Typically BGP)

Network

Common

an EGP used

R1 R2

Internetworking With TCP/IP vol 1 -- Part 14 15 2005

Page 419: internetworking tcpip

Key Characteristics Of BGP

d Provides inter-autonomous system communication

d Propagates reachability information

d Follows next-hop paradigm

d Provides support for policies

d Sends path information

d Permits incremental updates

d Allows route aggregation

d Allows authentication

Internetworking With TCP/IP vol 1 -- Part 14 16 2005

Page 420: internetworking tcpip

Additional BGP Facts

d Uses reliable transport (i.e., TCP)

– Unusual: most routing update protocols useconnectionless transport (e.g., UDP)

d Sends keepalive messages so other end knows connection isvalid (even if no new routing information is needed)

Internetworking With TCP/IP vol 1 -- Part 14 17 2005

Page 421: internetworking tcpip

Four BGP Message Types

Type Code Message Type Description2222222222222222222222222222222222222222222222222222222222222222

1 OPEN Initialize communication2 UPDATE Advertise or withdraw routes3 NOTIFICATION Response to an incorrect message4 KEEPALIVE Actively test peer connectivity

Internetworking With TCP/IP vol 1 -- Part 14 18 2005

Page 422: internetworking tcpip

BGP Message Header

0 16 24 31

MARKER

LENGTH TYPE

d Each BGP message starts with this header

Internetworking With TCP/IP vol 1 -- Part 14 19 2005

Page 423: internetworking tcpip

BGP Open Message

0 8 16 31

VERSION

AUTONOMOUS SYSTEMS NUM

HOLD TIME

BGP IDENTIFIER

PARM. LEN

Optional Parameters (variable)

d Used to start a connection

d HOLD TIME specifies max time that can elapse betweenBGP messages

Internetworking With TCP/IP vol 1 -- Part 14 20 2005

Page 424: internetworking tcpip

BGP Update Message

0 16 31

WITHDRAWN LEN

Withdrawn Destinations (variable)

PATH LEN

Path Attributes (variable)

Destination Networks (variable)

d Sender can advertise new routes or withdraw old routes

Internetworking With TCP/IP vol 1 -- Part 14 21 2005

Page 425: internetworking tcpip

Compressed Address Entries

d Each route entry consists of address and mask

d Entry can be compressed to eliminate zero bytes

Internetworking With TCP/IP vol 1 -- Part 14 22 2005

Page 426: internetworking tcpip

Format Of BGP Address EntryThat Permits Compression

0 8 31

LEN

IP Address (1-4 octets)

d LEN field specifies size of address that follows

Internetworking With TCP/IP vol 1 -- Part 14 23 2005

Page 427: internetworking tcpip

Third-Party Routing Information

d Many routing protocols extract information from the localrouting table

d BGP must send information ‘‘from the receiver’sperspective’’

Internetworking With TCP/IP vol 1 -- Part 14 24 2005

Page 428: internetworking tcpip

Example Of Architecture In WhichBGP Must Consider Receiver’s Perspective

R1 R2

R3

R4

To peer in other Autonomous System

Runs BGP

Net 5

Net 1 Net 2

Net 3

Net 4

Internetworking With TCP/IP vol 1 -- Part 14 25 2005

Page 429: internetworking tcpip

Metric Interpretation

d Each AS can use its own routing protocol

d Metrics differ

– Hop count

– Delay

– Policy-based values

d EGP communicates between two separate autonomoussystems

Internetworking With TCP/IP vol 1 -- Part 14 26 2005

Page 430: internetworking tcpip

Key Restriction On An EGP

An exterior gateway protocol does not communicate or interpretdistance metrics, even if metrics are available.

d Interpretation: ‘‘my autonomous system provides a path tothis network’’

Internetworking With TCP/IP vol 1 -- Part 14 27 2005

Page 431: internetworking tcpip

The Point About EGPs

Because an Exterior Gateway Protocol like BGP onlypropagates reachability information, a receiver can implementpolicy constraints, but cannot choose a least cost route. Asender must only advertise paths that traffic should follow.

Internetworking With TCP/IP vol 1 -- Part 14 28 2005

Page 432: internetworking tcpip

Summary

d Internet is too large for all routers to participate in onerouting update protocol

d Group of networks and routers under one administrativeauthority is called Autonomous System (AS)

d Each AS chooses its own interior routing update protocol

d Exterior Gateway Protocol (EGP) is used to communicaterouting information between two autonomous systems

d Current exterior protocol is Border Gateway Protocolversion 4, BGP-4

d An EGP provides reachability information, but does notassociate metrics with each route

Internetworking With TCP/IP vol 1 -- Part 14 29 2005

Page 433: internetworking tcpip

Questions?

Page 434: internetworking tcpip

PART XV

ROUTING: INSIDE ANAUTONOMOUS SYSTEM

(RIP, OSPF, HELLO)

Internetworking With TCP/IP vol 1 -- Part 15 1 2005

Page 435: internetworking tcpip

Static Vs. Dynamic Interior Routes

d Static routes

– Initialized at startup

– Never change

– Typical for host

– Sometimes used for router

d Dynamic router

– Initialized at startup

– Updated by route propagation protocols

– Typical for router

– Sometimes used in host

Internetworking With TCP/IP vol 1 -- Part 15 2 2005

Page 436: internetworking tcpip

Illustration Of Topology In WhichStatic Routing Is Optimal

R2

R1

R4R3

Net 2

Net 3

Net 1

Net 4 Net 5

d Only one route exists for each destination

Internetworking With TCP/IP vol 1 -- Part 15 3 2005

Page 437: internetworking tcpip

Illustration Of Topology In WhichDynamic Routing Is Needed

R2

R1

R4R3

R5

Net 2

Net 3

Net 1

Net 4 Net 5

d Additional router introduces multiple paths

Internetworking With TCP/IP vol 1 -- Part 15 4 2005

Page 438: internetworking tcpip

Exchanging Routing InformationWithin An Autonomous System

d Mechanisms called interior gateway protocols, IGPs

d Choice of IGP is made by autonomous system

d Note: if AS connects to rest of the world, a router in the ASmust use an EGP to advertise network reachability to otherautonomous systems.

Internetworking With TCP/IP vol 1 -- Part 15 5 2005

Page 439: internetworking tcpip

Example Of Two Autonomous SystemsAnd the Routing Protocols Used

BGP used

R1 R2

IGP1

IGP1

IGP2

IGP2

Internetworking With TCP/IP vol 1 -- Part 15 6 2005

Page 440: internetworking tcpip

Example IGPs

d RIP

d HELLO

d OSPF

Internetworking With TCP/IP vol 1 -- Part 15 7 2005

Page 441: internetworking tcpip

Routing InformationProtocol (RIP)

d Implemented by UNIX program routed

d Uses hop count metric

d Distance-vector protocol

d Relies on broadcast

d Assumes low-delay local area network

d Uses split horizon and poison reverse techniques to solveinconsistencies

d Current standard is RIP2

Internetworking With TCP/IP vol 1 -- Part 15 8 2005

Page 442: internetworking tcpip

Two Forms Of RIP

d Active

– Form used by routers

– Broadcasts routing updates periodically

– Uses incoming messages to update routes

d Passive

– Form used by hosts

– Uses incoming messages to update routes

– Does not send updates

Internetworking With TCP/IP vol 1 -- Part 15 9 2005

Page 443: internetworking tcpip

Illustration Of HostsUsing Passive RIP

. . .

128.10.0.0

R1

To Some PartsOf Internet

128.10.0.200

R2

To Some PartsOf Internet

128.10.0.209

d Host routing table initialized to:222222222222222222222222222222222222222222

Destination Route222222222222222222222222222222222222222222

128.10.0.0 directdefault 128.10.0.2002222222222222222222222222222222222222222221

1111

11111

11111

d Host listens for RIP broadcast and uses data to update table

d Eliminates ICMP redirects

Internetworking With TCP/IP vol 1 -- Part 15 10 2005

Page 444: internetworking tcpip

RIP Operation

d Each router sends update every 30 seconds

d Update contains pairs of(destination address, distance)

d Distance of 16 is infinity (i.e., no route)

Internetworking With TCP/IP vol 1 -- Part 15 11 2005

Page 445: internetworking tcpip

Slow Convergence Problem(Count To Infinity)

NetworkN R1 R2 R3

Routers with routes to network N

Internetworking With TCP/IP vol 1 -- Part 15 12 2005

Page 446: internetworking tcpip

Slow Convergence Problem(Count To Infinity)

NetworkN R1 R2 R3

Routers with routes to network N

NetworkN R1 R2 R3

R1 erroneously routes to R2 after failure

Internetworking With TCP/IP vol 1 -- Part 15 12 2005

Page 447: internetworking tcpip

RIP1 Update Format0 8 16 31

COMMAND VERSION (1) RESERVED

FAMILY OF NET 1 NET 1 ADDR., OCTETS 1 - 2

NET 1 ADDRESS, OCTETS 3 - 6

NET 1 ADDRESS, OCTETS 7 - 10

NET 1 ADDRESS, OCTETS 11 - 14

DISTANCE TO NETWORK 1

FAMILY OF NET 2 NET 2 ADDR., OCTETS 1 - 2

NET 2 ADDRESS, OCTETS 3 - 6

NET 2 ADDRESS, OCTETS 7 - 10

NET 2 ADDRESS, OCTETS 11 - 14

DISTANCE TO NETWORK 2

. . .

d Uses FAMILY field to support multiple protocols

d IP address sent in octets 3 - 6 of address field

d Message travels in UDP datagram

Internetworking With TCP/IP vol 1 -- Part 15 13 2005

Page 448: internetworking tcpip

Changes To RIPIn Version 2

d Update includes subnet mask

d Authentication supported

d Explicit next-hop information

d Messages can be multicast (optional)

– IP multicast address is 224.0.0.9

Internetworking With TCP/IP vol 1 -- Part 15 14 2005

Page 449: internetworking tcpip

RIP2 Update Format0 8 16 31

COMMAND VERSION (1) UNUSED

FAMILY OF NET 1 ROUTE TAG FOR NET 1

NET 1 IP ADDRESS

NET 1 SUBNET MASK

NET 1 NEXT HOP ADDRESS

DISTANCE TO NETWORK 1

FAMILY OF NET 2 ROUTE TAG FOR NET 2

NET 2 IP ADDRESS

NET 2 SUBNET MASK

NET 2 NEXT HOP ADDRESS

DISTANCE TO NETWORK 2

. . .

d Packet format is backward compatible

d Infinity still limited to 16

d RIP2 can be broadcast

Internetworking With TCP/IP vol 1 -- Part 15 15 2005

Page 450: internetworking tcpip

Measures Of DistanceThat Have Been Used

d Hops

– Zero-origin

– One-origin (e.g., RIP)

d Delay

d Throughput

d Jitter

Internetworking With TCP/IP vol 1 -- Part 15 16 2005

Page 451: internetworking tcpip

HELLO: A Protocol ThatUsed Delay

d Developed by Dave Mills

d Measured delay in milliseconds

d Used by NSFNET fuzzballs

d Now historic

Internetworking With TCP/IP vol 1 -- Part 15 17 2005

Page 452: internetworking tcpip

How HELLO Worked

d Participants kept track of delay between pairs of routers

d HELLO propagated delay information across net

d Route chosen to minimize total delay

Internetworking With TCP/IP vol 1 -- Part 15 18 2005

Page 453: internetworking tcpip

Route Oscillation

d Effective delay depends on traffic (delay increases as trafficincreases)

d Using delay as metric means routing traffic where delay islow

d Increased traffic raises delay, which means route changes

d Routes tend to oscillate

Internetworking With TCP/IP vol 1 -- Part 15 19 2005

Page 454: internetworking tcpip

Why HELLO Worked

d HELLO used only on NSFNET backbone

d All paths had equal throughput

d Route changes damped to avoid oscillation

Internetworking With TCP/IP vol 1 -- Part 15 20 2005

Page 455: internetworking tcpip

Open Shortest Path First (OSPF)

d Developed by IETF in response to vendors’ proprietaryprotocols

d Uses SPF (link-state) algorithm

d More powerful than most predecessors

d Permits hierarchical topology

d More complex to install and manage

Internetworking With TCP/IP vol 1 -- Part 15 21 2005

Page 456: internetworking tcpip

OSPF Features

d Type of service routing

d Load balancing across multiple paths

d Networks partitioned into subsets called areas

d Message authentication

d Network-specific, subnet-specific, host-specific, and CIDRroutes

d Designated router optimization for shared networks

d Virtual network topology abstracts away details

d Can import external routing information

Internetworking With TCP/IP vol 1 -- Part 15 22 2005

Page 457: internetworking tcpip

OSPF Message Header

0 8 16 24 31

VERSION (1) TYPE MESSAGE LENGTH

SOURCE ROUTER IP ADDRESS

AREA ID

CHECKSUM AUTHENTICATION TYPE

AUTHENTICATION (octets 0-3)

AUTHENTICATION (octets 4-7)

d Each message starts with same header

Internetworking With TCP/IP vol 1 -- Part 15 23 2005

Page 458: internetworking tcpip

OSPF Message Types

Type Meaning222222222222222222222222222222222222222

1 Hello (used to test reachability)2 Database description (topology)3 Link status request4 Link status update5 Link status acknowledgement

Internetworking With TCP/IP vol 1 -- Part 15 24 2005

Page 459: internetworking tcpip

OSPF HELLO Message Format

0 8 16 24 31

OSPF HEADER WITH TYPE = 1

NETWORK MASK

DEAD TIMER HELLO INTER GWAY PRIO

DESIGNATED ROUTER

BACKUP DESIGNATED ROUTER

NEIGHBOR1 IP ADDRESS

NEIGHBOR2 IP ADDRESS

. . .

NEIGHBORn IP ADDRESS

d Used to test reachability

Internetworking With TCP/IP vol 1 -- Part 15 25 2005

Page 460: internetworking tcpip

OSPF Database Description Message Format

0 8 16 24 29 31

OSPF HEADER WITH TYPE = 2

MUST BE ZERO I M S

DATABASE SEQUENCE NUMBER

LINK TYPE

LINK ID

ADVERTISING ROUTER

LINK SEQUENCE NUMBER

LINK CHECKSUM LINK AGE

. . .

d Fields starting at LINK TYPE are repeated

Internetworking With TCP/IP vol 1 -- Part 15 26 2005

Page 461: internetworking tcpip

Values In The LINK Field

Link Type Meaning22222222222222222222222222222222222222222222222

1 Router link2 Network link3 Summary link (IP network)4 Summary link (link to border router)5 External link (link to another site)

Internetworking With TCP/IP vol 1 -- Part 15 27 2005

Page 462: internetworking tcpip

OSPF Link Status Request Message Format

0 16 31

OSPF HEADER WITH TYPE = 3

LINK TYPE

LINK ID

ADVERTISING ROUTER

. . .

Internetworking With TCP/IP vol 1 -- Part 15 28 2005

Page 463: internetworking tcpip

OSPF Link Status Update Message Format

0 16 31

OSPF HEADER WITH TYPE = 4

NUMBER OF LINK STATUS ADVERTISEMENTS

LINK STATUS ADVERTISEMENT1

. . .

LINK STATUS ADVERTISEMENTn

Internetworking With TCP/IP vol 1 -- Part 15 29 2005

Page 464: internetworking tcpip

Header Used In OSPF Link Status Advertisements

0 16 31

LINK AGE LINK TYPE

LINK ID

ADVERTISING ROUTER

LINK SEQUENCE NUMBER

LINK CHECKSUM LENGTH

d Four possible formats follow

– Links from a router to given area

– Links from a router to physical net

– Links from a router to physical nets of a subnetted IPnetwork

– Links from a router to nets at other sites

Internetworking With TCP/IP vol 1 -- Part 15 30 2005

Page 465: internetworking tcpip

Discussion Question

d What are the tradeoffs connected with the issue of routing inthe presence of partial information?

Internetworking With TCP/IP vol 1 -- Part 15 31 2005

Page 466: internetworking tcpip

Summary

d Interior Gateway Protocols (IGPs) used within an AS

d Popular IGPs include

– RIP (distance vector algorithm)

– OSPF (link-state algorithm)

Internetworking With TCP/IP vol 1 -- Part 15 32 2005

Page 467: internetworking tcpip

Questions?

Page 468: internetworking tcpip

PART XVI

INTERNET MULTICASTING

Internetworking With TCP/IP vol 1 -- Part 16 1 2005

Page 469: internetworking tcpip

Hardware Multicast

d Form of broadcast

d Only one copy of a packet traverses the net

d NIC initially configured to accept packets destined to

– Computer’s unicast address

– Hardware broadcast address

d User can dynamically add (and later remove)

– One or more multicast addresses

Internetworking With TCP/IP vol 1 -- Part 16 2 2005

Page 470: internetworking tcpip

A Note About Hardware Multicast

Although it may help to think of multicast addressing as ageneralization that subsumes unicast and broadcast addresses,the underlying forwarding and delivery mechanisms can makemulticast less efficient.

Internetworking With TCP/IP vol 1 -- Part 16 3 2005

Page 471: internetworking tcpip

Ethernet Multicast

d Determined by low-order bit of high-order byte

d Example in dotted decimal:

01.00.00.00.00.0016

d Remaining bits specify a multicast group

Internetworking With TCP/IP vol 1 -- Part 16 4 2005

Page 472: internetworking tcpip

IP Multicast

d Group address: each multicast group assigned a unique classD address

d Up to 228 simultaneous multicast groups

d Dynamic group membership: host can join or leave at anytime

d Uses hardware multicast where available

d Best-effort delivery semantics (same as IP)

d Arbitrary sender (does not need to be a group member)

Internetworking With TCP/IP vol 1 -- Part 16 5 2005

Page 473: internetworking tcpip

Facilities Needed For Internet Multicast

d Multicast addressing scheme

d Effective notification and delivery mechanism

d Efficient Internet forwarding facility

Internetworking With TCP/IP vol 1 -- Part 16 6 2005

Page 474: internetworking tcpip

IP Multicast Addressing

d Class D addresses reserved for multicast

d General form:

0 1 2 3 4 31

1 1 1 0 Group Identification

d Two types

– Well-known (address reserved for specific protocol)

– Transient (allocated as needed)

Internetworking With TCP/IP vol 1 -- Part 16 7 2005

Page 475: internetworking tcpip

Multicast Addresses

d Address range

224.0.0.0 through 239.255.255.255

d Notes

– 224.0.0.0 is reserved (never used)

– 224.0.0.1 is ‘‘all systems’’

– 224.0.0.3 is ‘‘all routers’’

– Address up through 224.0.0.255 used for multicastrouting protocols

Internetworking With TCP/IP vol 1 -- Part 16 8 2005

Page 476: internetworking tcpip

Example Multicast Address Assignments

Address Meaning2222222222222222222222222222222222222222222

224.0.0.0 Base Address (Reserved)224.0.0.1 All Systems on this Subnet224.0.0.2 All Routers on this Subnet224.0.0.3 Unassigned224.0.0.4 DVMRP Routers224.0.0.5 OSPFIGP All Routers224.0.0.6 OSPFIGP Designated Routers224.0.0.7 ST Routers224.0.0.8 ST Hosts224.0.0.9 RIP2 Routers224.0.0.10 IGRP Routers224.0.0.11 Mobile-Agents224.0.0.12 DHCP Server / Relay Agent224.0.0.13 All PIM Routers224.0.0.14 RSVP-Encapsulation224.0.0.15 All-CBT-Routers224.0.0.16 Designated-Sbm224.0.0.17 All-Sbms224.0.0.18 VRRP

Internetworking With TCP/IP vol 1 -- Part 16 9 2005

Page 477: internetworking tcpip

Example Multicast Address Assignments(continued)

Address Meaning2222222222222222222222222222222222222222222222222222222

224.0.0.19through

224.0.0.255Other Link Local Addresses

224.0.1.0through Globally Scoped Addresses

238.255.255.255

239.0.0.0through

239.255.255.255Scope restricted to one organization

Internetworking With TCP/IP vol 1 -- Part 16 10 2005

Page 478: internetworking tcpip

Mapping An IP Multicast AddressTo An Ethernet Multicast Address

d Place low-order 23 bits of IP multicast address in low-order23 bits of the special Ethernet address:

01.00.5E.00.00.0016

d Example IP multicast address 224.0.0.2 becomes Ethernetmulticast address

01.00.5E.00.00.0216

Internetworking With TCP/IP vol 1 -- Part 16 11 2005

Page 479: internetworking tcpip

Transmission Of Multicast Datagrams

d Host does not install route to multicast router

d Host uses hardware multicast to transmit multicastdatagrams

d If multicast router is present on net

– Multicast router receives datagram

– Multicast router uses destination address to determinerouting

Internetworking With TCP/IP vol 1 -- Part 16 12 2005

Page 480: internetworking tcpip

Multicast Scope

d Refers to range of members in a group

d Defined by set of networks over which multicast datagramstravel to reach group

d Two techniques control scope

– IP’s TTL field (TTL of 1 means local net only)

– Administrative scoping

Internetworking With TCP/IP vol 1 -- Part 16 13 2005

Page 481: internetworking tcpip

Host Participation In IP Multicast

d Host can participate in one of three ways:

Level Meaning22222222222222222222222222222222222222222222222222222

0 Host can neither send nor receive IP multicast1 Host can send but not receive IP multicast2 Host can both send and receive IP multicast

d Note: even level 2 requires additions to host software

Internetworking With TCP/IP vol 1 -- Part 16 14 2005

Page 482: internetworking tcpip

Host Details For Level 2 Participation

d Host uses Internet Group Management Protocol (IGMP) toannounce participation in multicast

d If multiple applications on a host join the same multicastgroup, each receives a copy of messages sent to the group

d Group membership is associated with a specific network:

A host joins a specific IP multicast group on a specific network.

Internetworking With TCP/IP vol 1 -- Part 16 15 2005

Page 483: internetworking tcpip

IGMP

d Allows host to register participation in a group

d Two conceptual phases

– When it joins a group, host sends message declaringmembership

– Multicast router periodically polls a host to determine ifany host on the network is still a member of a group

Internetworking With TCP/IP vol 1 -- Part 16 16 2005

Page 484: internetworking tcpip

IGMP Implementation

d All communication between host and multicast router useshardware multicast

d Single query message probes for membership in all activegroups

d Default polling rate is every 125 seconds

d If multiple multicast routers attach to a shared network, oneis elected to poll

d Host waits random time before responding to poll (to avoidsimultaneous responses)

d Host listens to other responses, and suppresses unnecessaryduplicate responses

Internetworking With TCP/IP vol 1 -- Part 16 17 2005

Page 485: internetworking tcpip

IGMP State Transitions

d Host uses FSM to determine actions:

NON-MEMBER MEMBERDELAYING

MEMBER

join group / start timer

leave group / cancel timer

reference count becomes zero / leave group

timer expires / send response

query arrives / start timer

another host responds / cancel timer

d Separate state kept for each multicast group

Internetworking With TCP/IP vol 1 -- Part 16 18 2005

Page 486: internetworking tcpip

IGMP Message Format

0 8 16 31

TYPE RESP TIME CHECKSUM

GROUP ADDRESS (ZERO IN QUERY)

d Message TYPE field is one of:

Type Group Address Meaning2222222222222222222222222222222222222222222222222222222222

0x11 unused (zero) General membership query0x11 used Specific group membership query0x16 used Membership report0x17 used Leave group

0x12 used Membership report (version 1)

Internetworking With TCP/IP vol 1 -- Part 16 19 2005

Page 487: internetworking tcpip

Multicast Forwarding Example

network 1

network 2

network 3R

A

EDCB

F G

d Hosts marked with dot participate in one group

d Hosts marked with X participate in another group

d Forwarding depends on group membership

Internetworking With TCP/IP vol 1 -- Part 16 20 2005

Page 488: internetworking tcpip

The Complexity Of Multicast Routing

Unlike unicast routing in which routes change only when thetopology changes or equipment fails, multicast routes canchange simply because an application program joins or leavesa multicast group.

Internetworking With TCP/IP vol 1 -- Part 16 21 2005

Page 489: internetworking tcpip

Multicast Forwarding Complication

Multicast forwarding requires a router to examine more thanthe destination address.

d In most cases, forwarding depends on the source address aswell as the destination address

Internetworking With TCP/IP vol 1 -- Part 16 22 2005

Page 490: internetworking tcpip

Final Item That Complicates IP Multicast

A multicast datagram may originate on a computer that is notpart of the multicast group, and may be forwarded acrossnetworks that do not have any group members attached.

Internetworking With TCP/IP vol 1 -- Part 16 23 2005

Page 491: internetworking tcpip

Multicast Routing Paradigms

d Two basic approaches

d Flood-and-prune

– Send a copy to all networks

– Only stop forwarding when it is known that noparticipant lies beyond a given point

d Multicast trees

– Routers interact to form a ‘‘tree’’ that reaches allnetworks of a given group

– Copy traverses branches of the tree

Internetworking With TCP/IP vol 1 -- Part 16 24 2005

Page 492: internetworking tcpip

Reverse Path Forwarding

d Early flood-and-prune approach

d Actual algorithm is Truncated Reverse Path Forwarding(TRPF)

Internetworking With TCP/IP vol 1 -- Part 16 25 2005

Page 493: internetworking tcpip

Example Topology In WhichTRPF Delivers Multiple Copies

network 1

network 2 network 3

network 4

R1 R2

R3 R4

A

B

Internetworking With TCP/IP vol 1 -- Part 16 26 2005

Page 494: internetworking tcpip

Multicast Trees

A multicast forwarding tree is defined as a set of paths throughmulticast routers from a source to all members of a multicastgroup. For a given multicast group, each possible source ofdatagrams can determine a different forwarding tree.

Internetworking With TCP/IP vol 1 -- Part 16 27 2005

Page 495: internetworking tcpip

Examples Of Multicast Routing Protocols

d Reverse Path Multicasting (RPM)

d Distance-Vector Multicast Routing Protocol (DVMRP)

d Core-Based Trees (CBT)

d Protocol Independent Multicast - Dense Mode (PIM-DM)

d Protocol Independent Multicast - Sparse Mode (PIM-SM)

Internetworking With TCP/IP vol 1 -- Part 16 28 2005

Page 496: internetworking tcpip

Reverse Path Multicasting (RPM)

d Early form

d Routers flood datagrams initially

d Flooding pruned as group membership information learned

Internetworking With TCP/IP vol 1 -- Part 16 29 2005

Page 497: internetworking tcpip

Distance-Vector Multicast Routing Protocol(DVMRP)

d Early protocol

d Defines extension of IGMP that routers use to exchangemulticast routing information

d Implemented by Unix mrouted program

– Configures tables in kernel

– Supports tunneling

– Used in Internet’s Multicast backBONE (MBONE)

Internetworking With TCP/IP vol 1 -- Part 16 30 2005

Page 498: internetworking tcpip

Topology In Which Tunneling Needed

INTERNET(with no support

for multicast)R1 R2

net 1 net 2

Internetworking With TCP/IP vol 1 -- Part 16 31 2005

Page 499: internetworking tcpip

Encapsulation Used With Tunneling

DATAGRAMHEADER UNICAST DATAGRAM DATA AREA

DATAGRAMHEADER MULTICAST DATAGRAM DATA AREA

d IP travels in IP

Internetworking With TCP/IP vol 1 -- Part 16 32 2005

Page 500: internetworking tcpip

Core-Based Trees (CBT)

d Proposed protocol

d Better for sparse network

d Does not forward to a net until host on the net joins a group

d Request to join a group sent to ‘‘core’’ of network

d Multiple cores used for large Internet

Internetworking With TCP/IP vol 1 -- Part 16 33 2005

Page 501: internetworking tcpip

Division Of Internet

Because CBT uses a demand-driven paradigm, it divides theinternet into regions and designates a core router for eachregion; other routers in the region dynamically build aforwarding tree by sending join requests to the core.

Internetworking With TCP/IP vol 1 -- Part 16 34 2005

Page 502: internetworking tcpip

Protocol Independent Multicast - Dense Mode(PIM-DM)

d Allows router to build multicast forwarding table frominformation in conventional routing table

d Term ‘‘dense’’ refers to density of group members

d Best for high density areas

d Uses flood-and-prune approach

Internetworking With TCP/IP vol 1 -- Part 16 35 2005

Page 503: internetworking tcpip

Protocol Independent Multicast - Sparse Mode(PIM-SM)

d Allows router to build multicast forwarding table frominformation in conventional routing table

d Term ‘‘sparse’’ refers to relative density of group members

d Best for situations with ‘‘islands’’ of participating hostsseparated by networks with no participants

d Uses tree-based approach

Internetworking With TCP/IP vol 1 -- Part 16 36 2005

Page 504: internetworking tcpip

Question For Discussion

d How can we provide reliable multicast?

Internetworking With TCP/IP vol 1 -- Part 16 37 2005

Page 505: internetworking tcpip

Summary

d IP multicasting uses hardware multicast for delivery

d Host uses Internet Group Management Protocol (IGMP) tocommunicate group membership to local multicast router

d Two forms of multicast routing used

– Flood-and-prune

– Tree-based

Internetworking With TCP/IP vol 1 -- Part 16 38 2005

Page 506: internetworking tcpip

Summary(continued)

d Many multicast routing protocols have been proposed

– TRPF

– DVMRP

– CBT

– PIM-DM

– PIM-SM

Internetworking With TCP/IP vol 1 -- Part 16 39 2005

Page 507: internetworking tcpip

Questions?

Page 508: internetworking tcpip

PART XVII

IP Switching And MPLS

Internetworking With TCP/IP vol 1 -- Part 17 1 2005

Page 509: internetworking tcpip

Switching Technology

d Designed as a higher-speed alternative to packet forwarding

d Uses array lookup instead of destination address lookup

d Often associated with Asynchronous Transfer Mode (ATM)

Internetworking With TCP/IP vol 1 -- Part 17 2 2005

Page 510: internetworking tcpip

Switching Concept

S1

S2

S3

0

1

0

0

actionlabel

(a)

(b)

0

1

2

3

send out interface 1

send out interface 1

send out interface 0

send out interface 1...

d Part (b) shows table for switch S1

d Identifier in packet known as label

d All labels except 2 go out interface 1Internetworking With TCP/IP vol 1 -- Part 17 3 2005

Page 511: internetworking tcpip

Extending Switching To A Large Network

S0 S1

S2

S3

0

10

0

0actionlabel

0

1

2

3

label → 1; send out 0

label → 0; send out 0

label → 3; send out 0

label → 2; send out 0

actionlabel

0

1

2

3

label → 2; send out 1

label → 4; send out 1

label → 1; send out 0

label → 3; send out 1

d Label replacement known as label swapping

d A path through the network corresponds to a sequence oflabels

Internetworking With TCP/IP vol 1 -- Part 17 4 2005

Page 512: internetworking tcpip

An Important Note

Switching uses a connection-oriented approach. To avoid theneed for global agreement on the use of labels, the technologyallows a manager to define a path of switches without requiringthat the same label be used across the entire path.

Internetworking With TCP/IP vol 1 -- Part 17 5 2005

Page 513: internetworking tcpip

Potential Advantages Of SwitchingFor IP Forwarding

d Faster forwarding

d Aggregated route information

d Ability to manage aggregate flows

Internetworking With TCP/IP vol 1 -- Part 17 6 2005

Page 514: internetworking tcpip

IP Switching

d Pioneered by Ipsilon Corporation

d Originally used ATM hardware

d Variants by others known as

– Layer 3 switching

– Tag switching

– Label switching

d Ideas eventually consolidated into Multi-Protocol LabelSwitching (MPLS)

Internetworking With TCP/IP vol 1 -- Part 17 7 2005

Page 515: internetworking tcpip

MPLS Operation

d Internet divided into

– Standard routers

– MPLS core

d Datagram encapsulated when entering the MPLS core andde-encapsulated when leaving

d Within the core, MPLS labels are used to forward packets

Internetworking With TCP/IP vol 1 -- Part 17 8 2005

Page 516: internetworking tcpip

Processing An Incoming Datagram

d Datagram classified

– Multiple headers examined

– Example: classification can depend on TCP portnumbers as well as IP addresses

d Classification used to assign a label

d Note: each label corresponds to ‘‘flow’’ that may includemay TCP sessions

Internetworking With TCP/IP vol 1 -- Part 17 9 2005

Page 517: internetworking tcpip

Hierarchical MPLS

d Multi-level hierarchy is possible

d Example: corporation with three campuses and multiplebuildings on each campus

– Conventional forwarding within a building

– One level of MPLS for buildings within a campus

– Additional level of MPLS between campuses

d To accommodate hierarchy, MPLS uses stack of labels

Internetworking With TCP/IP vol 1 -- Part 17 10 2005

Page 518: internetworking tcpip

MPLS Label Processing

d Only top label is used to forward

d When entering new level of hierarchy, push addtional labelon stack

d When leaving a level of the hierarchy, pop the top labelfrom the stack

Internetworking With TCP/IP vol 1 -- Part 17 11 2005

Page 519: internetworking tcpip

MPLS Encapsulation

FRAMEHEADER FRAME DATA AREA

DATAGRAMHEADER DATAGRAM DATA AREA

MPLS header

d MPLS can run over conventional networks

d Shim header contains labels

Internetworking With TCP/IP vol 1 -- Part 17 12 2005

Page 520: internetworking tcpip

Fields In An MPLS Shim Header

0 20 22 24 31

LABEL EXP S TTL

d Shim header

– Prepended to IP datagram

– Only used while datagram in MPLS core

d MPLS switches use LABEL in shim when forwardingpacket

Internetworking With TCP/IP vol 1 -- Part 17 13 2005

Page 521: internetworking tcpip

Label Switching Router (LSR)

d Device that connects between conventional Internet andMPLS core

d Handles classification

d Uses data structure known as Next Hop Label ForwardingTable (NHLFT) to choose an action

Internetworking With TCP/IP vol 1 -- Part 17 14 2005

Page 522: internetworking tcpip

Next Hop Label Forwarding Entry

d Found in NHLFT

d Specifies

– Next hop information (e.g., the outgoing interface)

– Operation to be performed

– Encapsulation to use (optional)

– How to encode the label (optional)

– Other information needed to handle the packet (optional)

Internetworking With TCP/IP vol 1 -- Part 17 15 2005

Page 523: internetworking tcpip

Possible Operations

d Replace label at top of stack

d Pop label at top of stack

d Replace label at top of stack, and then push one or morenew labels onto stack

Internetworking With TCP/IP vol 1 -- Part 17 16 2005

Page 524: internetworking tcpip

Control Processing And Label Distribution

d Needed to establish Label Switched Path (LSP)

– Coordinate labels along the path

– Configure next-hop forwarding in switches

d Performed by Label Distribution mechanism

d Series of labels selected automatically

Internetworking With TCP/IP vol 1 -- Part 17 17 2005

Page 525: internetworking tcpip

Protocols For MPLS Control

d Two primary protocols proposed

– Label Distribution Protocol (MPLS-LDP)

– Constraint-Based Routing LDP (CR-LDP)

d Other proposals to extend routing protocols

– OSPF

– BGP

Internetworking With TCP/IP vol 1 -- Part 17 18 2005

Page 526: internetworking tcpip

Notes About Fragmentation

d Outgoing

– MPLS prepends shim header to each datagram

– If datagram fills network MTU, fragmentation will berequired

d Incoming

– Classification requires knowledge of headers (e.g., TCPport numbers)

– Only first fragment contains needed information

– LSR must collect fragments and reassemble beforeclassification

Internetworking With TCP/IP vol 1 -- Part 17 19 2005

Page 527: internetworking tcpip

Mesh Topology

d Used in many MPLS cores

d LSP established between each pair of LSRs

d Parallel LSPs can be used for levels of service

d Example

– One LSP reserved for VOIP traffic

– Another LSP used for all other traffic

Internetworking With TCP/IP vol 1 -- Part 17 20 2005

Page 528: internetworking tcpip

Service Differentiation

Because MPLS classification can use arbitrary fields in adatagram, including the IP source address, the service adatagram receives can depend on the customer sending thedatagram as well as the type of data being carried.

Internetworking With TCP/IP vol 1 -- Part 17 21 2005

Page 529: internetworking tcpip

Questions?

Page 530: internetworking tcpip

PART XVIII

MOBILE IP

Internetworking With TCP/IP vol 1 -- Part 18 1 2005

Page 531: internetworking tcpip

Mobility And IP Addressing

d Recall: prefix of IP address identifies network to which hostis attached

d Consequence: when moving to a new network either

– Host must change its IP address

– All routers install host-specific routes

Internetworking With TCP/IP vol 1 -- Part 18 2 2005

Page 532: internetworking tcpip

Mobile IP

d Technology to support mobility

– Allows host to retain original IP address

– Does not require routers to install host-specific routes

Internetworking With TCP/IP vol 1 -- Part 18 3 2005

Page 533: internetworking tcpip

Characteristics Of Mobile IP

d Transparent to applications and transport protocols

d Interoperates with standard IPv4

d Scales to large Internet

d Secure

d Macro mobility (intended for working away from homerather than moving at high speed)

Internetworking With TCP/IP vol 1 -- Part 18 4 2005

Page 534: internetworking tcpip

General Approach

d Host visiting a foreign network obtains second IP addressthat is local to the site

d Host informs router on home network

d Router at home uses second address to forward datagramsfor the host to the foreign network

– Datagrams sent in a tunnel

– Uses IP-in-IP encapsulation

Internetworking With TCP/IP vol 1 -- Part 18 5 2005

Page 535: internetworking tcpip

Two Broad Approaches

d Foreign network runs system known as foreign agent

– Visiting host registers with foreign agent

– Foreign agent assigns host a temporary address

– Foreign agent registers host with home agent

d Foreign network does not run a foreign agent

– Host uses DHCP to obtain temporary address

– Host registers directly with home agent

Internetworking With TCP/IP vol 1 -- Part 18 6 2005

Page 536: internetworking tcpip

Foreign Agent Advertisement Extension

d Sent by router that runs foreign agent

d Added to ICMP router advertisement

d Format:

0 8 16 24 31

TYPE (16) LENGTH SEQUENCE NUM

LIFETIME CODE RESERVED

CARE-OF ADDRESSES

Internetworking With TCP/IP vol 1 -- Part 18 7 2005

Page 537: internetworking tcpip

CODE Field In Advertisement Message

Bit Meaning22222222222222222222222222222222222222222222222222222222222222

0 Registration with an agent is required; co-locatedcare-of addressing is not permitted

1 The agent is busy and is not accepting registrations2 Agent functions as a home agent3 Agent functions as a foreign agent4 Agent uses minimal encapsulation5 Agent uses GRE-style encapsulation6 Agent supports header compression when communicating

with mobile7 Unused (must be zero)

Internetworking With TCP/IP vol 1 -- Part 18 8 2005

Page 538: internetworking tcpip

Host Registration Request

0 8 16 31

TYPE (1 or 3) FLAGS LIFETIME

HOME ADDRESS

HOME AGENT

CARE-OF ADDRESS

IDENTIFICATION

EXTENSIONS . . .

Internetworking With TCP/IP vol 1 -- Part 18 9 2005

Page 539: internetworking tcpip

FLAGS Field In Host Registration Request

Bit Meaning22222222222222222222222222222222222222222222222222222222

0 This is a simultaneous (additional) addressrather than a replacement.

1 Mobile requests home agent to tunnel a copy ofeach broadcast datagram

2 Mobile is using a co-located care-of address andwill decapsulate datagrams itself

3 Mobile requests agent to use minimal encapsulation4 Mobile requests agent to use GRE encapsulation5 Mobile requests header compression

6-7 Reserved (must be zero)

Internetworking With TCP/IP vol 1 -- Part 18 10 2005

Page 540: internetworking tcpip

Consequence Of Mobile IP

Because a mobile uses its home address as a source addresswhen communicating with an arbitrary destination, each replyis forwarded to the mobile’s home network, where an agentintercepts the datagram, encapsulates it in another datagram,and forwards it either directly to the mobile or to the foreignagent the mobile is using.

Internetworking With TCP/IP vol 1 -- Part 18 11 2005

Page 541: internetworking tcpip

Illustration Of The Two-Crossing Problem

R1 R4

INTERNETR2 R3

M

D

Home Site Foreign Site

mobile

destination

mobile’s original home

foreign agenthome agent

Internetworking With TCP/IP vol 1 -- Part 18 12 2005

Page 542: internetworking tcpip

A Severe Problem

Mobile IP introduces a routing inefficiency known as the two-crossing problem that occurs when a mobile visits a foreignnetwork far from its home and then communicates with acomputer near the foreign site. Each datagram sent to themobile travels across the Internet to the mobile’s home agentwhich then forwards the datagram back to the foreign site.Eliminating the problem requires propagating host-specificroutes; the problem remains for any destination that does notreceive the host-specific route.

Internetworking With TCP/IP vol 1 -- Part 18 13 2005

Page 543: internetworking tcpip

Summary

d Mobile IP allows a host to visit a foreign site withoutchanging its IP address

d A visiting host obtains a second, temporary address which isused for communication while at the site

d The chief advantage of mobile IP arises from transparencyto applications

d The chief disadvantage of mobile IP arises from inefficientrouting known as a two-crossing problem

Internetworking With TCP/IP vol 1 -- Part 18 14 2005

Page 544: internetworking tcpip

Questions?

Page 545: internetworking tcpip

PART XIX

PRIVATE NETWORK INTERCONNECTION(NAT AND VPN)

Internetworking With TCP/IP vol 1 -- Part 19 1 2005

Page 546: internetworking tcpip

Definitions

d An internet is private to one group (sometimes calledisolated) if none of the facilities or traffic is accessible toother groups

– Typical implementation involves using leased lines tointerconnect routers at various sites of the group

d The global Internet is public because facilities are sharedamong all subscribers

Internetworking With TCP/IP vol 1 -- Part 19 2 2005

Page 547: internetworking tcpip

Hybrid Architecture

d Permits some traffic to go over private connections

d Allows contact with global Internet

Internetworking With TCP/IP vol 1 -- Part 19 3 2005

Page 548: internetworking tcpip

Example Of Hybrid Architecture

INTERNET

R1

R2

R3

R4

leased circuit

128.10.1.0

128.10.2.0

192.5.48.0

128.210.0.0

Site 1 Site 2

Internetworking With TCP/IP vol 1 -- Part 19 4 2005

Page 549: internetworking tcpip

The Cost Of Private And Public Networks

d Private network extremely expensive

d Public Internet access inexpensive

d Goal: combine safety of private network with low cost ofglobal Internet

Internetworking With TCP/IP vol 1 -- Part 19 5 2005

Page 550: internetworking tcpip

Question

How can an organization that uses the global Internet toconnect its sites keep its data private?

d Answer: Virtual Private Network (VPN)

Internetworking With TCP/IP vol 1 -- Part 19 6 2005

Page 551: internetworking tcpip

Virtual Private Network

d Connect all sites to global Internet

d Protect data as it passes from one site to another

– Encryption

– IP-in-IP tunneling

Internetworking With TCP/IP vol 1 -- Part 19 7 2005

Page 552: internetworking tcpip

Illustration Of EncapsulationUsed With VPN

DATAGRAMHEADER OUTER DATAGRAM DATA AREA

ENCRYPTED INNER DATAGRAM

Internetworking With TCP/IP vol 1 -- Part 19 8 2005

Page 553: internetworking tcpip

The Point

A Virtual Private Network sends data across the Internet, butencrypts intersite transmissions to guarantee privacy.

Internetworking With TCP/IP vol 1 -- Part 19 9 2005

Page 554: internetworking tcpip

Example Of VPN Addressing And Routing

INTERNET

R1

R2

R3

R4

128.10.1.0

128.10.2.0

192.5.48.0

128.210.0.0

Site 1 Site 2

Routing table in R1

destination next hop

128.10.1.0 direct

128.10.2.0 R2

192.5.48.0 tunnel to R3

128.210.0.0 tunnel to R3

default ISP’s router

Internetworking With TCP/IP vol 1 -- Part 19 10 2005

Page 555: internetworking tcpip

Example VPN With Private Addresses

INTERNETSite 1

using subnet10.1.0.0

Site 2using subnet

10.2.0.0R1 R2

valid IP address

10.1 address

valid IP address

10.2 address

d Advantage: only one globally valid IP address needed persite

Internetworking With TCP/IP vol 1 -- Part 19 11 2005

Page 556: internetworking tcpip

General Access With Private Addresses

d Question: how can a site provide multiple computers at thesite access to Internet services without assigning eachcomputer a globally-valid IP address?

d Two answers

– Application gateway (one needed for each service)

– Network Address Translation (NAT)

Internetworking With TCP/IP vol 1 -- Part 19 12 2005

Page 557: internetworking tcpip

Network Address Translation (NAT)

d Extension to IP addressing

d IP-level access to the Internet through a single IP address

d Transparent to both ends

d Implementation

– Typically software

– Usually installed in IP router

– Special-purpose hardware for highest speed

Internetworking With TCP/IP vol 1 -- Part 19 13 2005

Page 558: internetworking tcpip

Network Address Translation (NAT)(continued)

d Pioneered in Unix program slirp

d Also known as

– Masquerade (Linux)

– Internet Connection Sharing (Microsoft)

d Inexpensive implementations available for home use

Internetworking With TCP/IP vol 1 -- Part 19 14 2005

Page 559: internetworking tcpip

NAT Details

d Organization

– Obtains one globally valid address per Internetconnection

– Assigns nonroutable addresses internally (net 10)

– Runs NAT software in router connecting to Internet

d NAT

– Replaces source address in outgoing datagram

– Replaces destination address in incoming datagram

– Also handles higher layer protocols (e.g., pseudo headerfor TCP or UDP)

Internetworking With TCP/IP vol 1 -- Part 19 15 2005

Page 560: internetworking tcpip

NAT Translation Table

d NAT uses translation table

d Entry in table specifies local (private) endpoint and globaldestination.

d Typical paradigm

– Entry in table created as side-effect of datagram leavingsite

– Entry in table used to reverse address mapping forincoming datagram

Internetworking With TCP/IP vol 1 -- Part 19 16 2005

Page 561: internetworking tcpip

Example NAT Translation Table

Private Private External External NAT ProtocolAddress Port Address Port Port Used222222222222222222222222222222222222222222222222222222222222222222

10.0.0.5 21023 128.10.19.20 80 14003 tcp10.0.0.1 386 128.10.19.20 80 14010 tcp10.0.2.6 26600 207.200.75.200 21 14012 tcp10.0.0.3 1274 128.210.1.5 80 14007 tcp

d Variant of NAT that uses protocol port numbers is known asNetwork Address and Port Translation (NAPT)

Internetworking With TCP/IP vol 1 -- Part 19 17 2005

Page 562: internetworking tcpip

Use Of NAT By An ISP

INTERNET

ISP using NAT

hosts usingdialup access

Internetworking With TCP/IP vol 1 -- Part 19 18 2005

Page 563: internetworking tcpip

Higher Layer Protocols And NAT

d NAT must

– Change IP headers

– Possibly change TCP or UDP source ports

– Recompute TCP or UDP checksums

– Translate ICMP messages

– Translate port numbers in an FTP session

Internetworking With TCP/IP vol 1 -- Part 19 19 2005

Page 564: internetworking tcpip

Applications And NAT

NAT affects ICMP, TCP, UDP, and other higher-layerprotocols; except for a few standard applications like FTP, anapplication protocol that passes IP addresses or protocol portnumbers as data will not operate correctly across NAT.

Internetworking With TCP/IP vol 1 -- Part 19 20 2005

Page 565: internetworking tcpip

Summary

d Virtual Private Networks (VPNs) combine the advantages oflow cost Internet connections with the safety of privatenetworks

d VPNs use encryption and tunneling

d Network Address Translation allows a site to multiplexcommunication with multiple computers through a single,globally valid IP address.

d NAT uses a table to translate addresses in outgoing andincoming datagrams

Internetworking With TCP/IP vol 1 -- Part 19 21 2005

Page 566: internetworking tcpip

Questions?

Page 567: internetworking tcpip

PART XX

CLIENT-SERVER MODELOF INTERACTION

Internetworking With TCP/IP vol 1 -- Part 20 1 2005

Page 568: internetworking tcpip

Client-Server Paradigm

d Conceptual basis for virtually all distributed applications

d One program initiates interaction to which another programresponds

d Note: ‘‘peer-to-peer’’ applications use client-serverparadigm internally

Internetworking With TCP/IP vol 1 -- Part 20 2 2005

Page 569: internetworking tcpip

Definitions

d Client

– Any application program

– Contacts a server

– Forms and sends a request

– Awaits a response

d Server

– Usually a specialized program that offers a service

– Awaits a request

– Computes an answer

– Issues a response

Internetworking With TCP/IP vol 1 -- Part 20 3 2005

Page 570: internetworking tcpip

Server Persistence

A server starts execution before interaction begins and (usually)continues to accept requests and send responses without everterminating. A client is any program that makes a request andawaits a response; it (usually) terminates after using a server afinite number of times.

Internetworking With TCP/IP vol 1 -- Part 20 4 2005

Page 571: internetworking tcpip

Illustration Of TheClient-Server Paradigm

client

..

..

..

server

..

..

..request sent towell-known port

Client sends request

Internetworking With TCP/IP vol 1 -- Part 20 5 2005

Page 572: internetworking tcpip

Illustration Of TheClient-Server Paradigm

client

..

..

..

server

..

..

..request sent towell-known port

client

..

..

..

server

..

..

..response sent toclient’s port

Client sends request

Server sends response

Internetworking With TCP/IP vol 1 -- Part 20 5 2005

Page 573: internetworking tcpip

Use Of Protocol Ports

A server waits for requests at a well-known port that has beenreserved for the service it offers. A client allocates anarbitrary, unused, nonreserved port for its communication.

Internetworking With TCP/IP vol 1 -- Part 20 6 2005

Page 574: internetworking tcpip

Client Side

d Any application program can become a client

d Must know how to reach the server

– Server’s Internet address

– Server’s protocol port number

d Usually easy to build

Internetworking With TCP/IP vol 1 -- Part 20 7 2005

Page 575: internetworking tcpip

Server Side

d Finds client’s location from incoming request

d Can be implemented with application program or inoperating system

d Starts execution before requests arrive

d Must ensure client is authorized

d Must uphold protection rules

d Must handle multiple, concurrent requests

d Usually complex to design and build

Internetworking With TCP/IP vol 1 -- Part 20 8 2005

Page 576: internetworking tcpip

Concurrent Server Algorithm

d Open well-known port

d Wait for next client request

d Create a new socket for the client

d Create thread / process to handle request

d Continue with wait step

Internetworking With TCP/IP vol 1 -- Part 20 9 2005

Page 577: internetworking tcpip

Complexity Of Servers

Servers are usually more difficult to build than clients because,although they can be implemented with application programs,servers must enforce all the access and protection policies ofthe computer system on which they run and must protectthemselves against all possible errors.

Internetworking With TCP/IP vol 1 -- Part 20 10 2005

Page 578: internetworking tcpip

Summary

d Client-server model is basis for distributed applications

d Server is specialized, complex program (process) that offersa service

d Arbitrary application can become a client by contacting aserver and sending a request

d Most servers are concurrent

Internetworking With TCP/IP vol 1 -- Part 20 11 2005

Page 579: internetworking tcpip

Questions?

Page 580: internetworking tcpip

PART XXI

THE SOCKET INTERFACE

Internetworking With TCP/IP vol 1 -- Part 21 1 2005

Page 581: internetworking tcpip

Using Protocols

d Protocol software usually embedded in OS

d Applications run outside OS

d Need an Application Program Interface (API) to allowapplication to access protocols

Internetworking With TCP/IP vol 1 -- Part 21 2 2005

Page 582: internetworking tcpip

API

d TCP/IP standards

– Describe general functionality needed

– Do not give details such as function names andarguments

d Each OS free to define its own API

d In practice: socket interface has become de facto standardAPI

Internetworking With TCP/IP vol 1 -- Part 21 3 2005

Page 583: internetworking tcpip

Socket API

d Defined by U.C. Berkeley as part of BSD Unix

d Adopted (with minor changes) by Microsoft as WindowsSockets

Internetworking With TCP/IP vol 1 -- Part 21 4 2005

Page 584: internetworking tcpip

Characteristics Of Socket API

d Follows Unix’s open-read-write-close paradigm

d Uses Unix’s descriptor abstraction

– First, create a socket and receive an integer descriptor

– Second, call a set of functions that specify all the detailsfor the socket (descriptor is argument to each function)

d Once socket has been established, use read and write orequivalent functions to transfer data

d When finished, close the socket

Internetworking With TCP/IP vol 1 -- Part 21 5 2005

Page 585: internetworking tcpip

Creating A Socket

result = socket(pf, type, protocol)

d Argument specifies protocol family as TCP/IP

Internetworking With TCP/IP vol 1 -- Part 21 6 2005

Page 586: internetworking tcpip

Terminating A Socket

close(socket)

d Closing a socket permanently terminates the interaction

Internetworking With TCP/IP vol 1 -- Part 21 7 2005

Page 587: internetworking tcpip

Specifying A Local Address For The Socket

bind(socket, localaddr, addrlen)

Internetworking With TCP/IP vol 1 -- Part 21 8 2005

Page 588: internetworking tcpip

Format Of A Sockaddr Structure(Generic)

0 16 31

ADDRESS FAMILY ADDRESS OCTETS 0-1

ADDRESS OCTETS 2-5

ADDRESS OCTETS 6-9

ADDRESS OCTETS 10-13

Internetworking With TCP/IP vol 1 -- Part 21 9 2005

Page 589: internetworking tcpip

Format Of A Sockaddr StructureWhen Used With TCP/IP

0 16 31

ADDRESS FAMILY (2) PROTOCOL PORT

IP ADDRESS

Internetworking With TCP/IP vol 1 -- Part 21 10 2005

Page 590: internetworking tcpip

Connecting A Socket ToA Destination Address

connect(socket, destaddr, addrlen)

d Can be used with UDP socket to specify remote endpointaddress

Internetworking With TCP/IP vol 1 -- Part 21 11 2005

Page 591: internetworking tcpip

Sending Data Through A Socket

send(socket, message, length, flags)

d Note

– Function write can also be used

– Alternatives exist for connectionless transport (UDP)

Internetworking With TCP/IP vol 1 -- Part 21 12 2005

Page 592: internetworking tcpip

Receiving Data Through A Socket

recv(socket, buffer, length, flags)

d Note

– Function read can also be used

– Alternatives exist for connectionless transport (UDP)

Internetworking With TCP/IP vol 1 -- Part 21 13 2005

Page 593: internetworking tcpip

Obtaining Remote And LocalSocket Addresses

getpeername(socket, destaddr, addrlen)and

getsockname(socket, localaddr, addrlen)

Internetworking With TCP/IP vol 1 -- Part 21 14 2005

Page 594: internetworking tcpip

Set Maximum Queue Length (Server)

listen(socket, qlength)

d Maximum queue length can be quite small

Internetworking With TCP/IP vol 1 -- Part 21 15 2005

Page 595: internetworking tcpip

Accepting New Connections (Server)

newsock = accept(socket, addr, addrlen)

d Note:

– Original socket remains available for acceptingconnections

– New socket corresponds to one connection

– Permits server to handle requests concurrently

Internetworking With TCP/IP vol 1 -- Part 21 16 2005

Page 596: internetworking tcpip

Handling Multiple Services With One Server

d Server

– Creates socket for each service

– Calls select function to wait for any request

– Select specifies which service was contacted

d Form of select

nready = select(ndesc, indesc, outdesc, excdesc, timeout)

Internetworking With TCP/IP vol 1 -- Part 21 17 2005

Page 597: internetworking tcpip

Socket Functions Used For DNS

d Mapping a host name to an IP address

gethostname(name, length)

d Obtaining the local domain

getdomainname(name, length)

Internetworking With TCP/IP vol 1 -- Part 21 18 2005

Page 598: internetworking tcpip

Illustration Of A Socket Library

System Calls InComputer’s Operating System

Application Program Code

Library Routines Used

application program bound with library routines it calls

Internetworking With TCP/IP vol 1 -- Part 21 19 2005

Page 599: internetworking tcpip

Byte Order Conversion Routines

d Convert between network byte order and local host byteorder

d If local host uses big-endian, routines have no effect

localshort = ntohs(netshort)locallong = ntohl(netlong)netshort = htons(localshort)netlong = htonl(locallong)

Internetworking With TCP/IP vol 1 -- Part 21 20 2005

Page 600: internetworking tcpip

IP Address ManipulationRoutines

d Convert from dotted decimal (ASCII string) to 32-bit binaryvalue

d Example:

address = inet_addr(string)

Internetworking With TCP/IP vol 1 -- Part 21 21 2005

Page 601: internetworking tcpip

Other Socket Routines

d Many other functions exist

d Examples: obtain information about

– Protocols

– Hosts

– Domain name

Internetworking With TCP/IP vol 1 -- Part 21 22 2005

Page 602: internetworking tcpip

Example Client Program

/* whoisclient.c - main */

#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>

/*----------------------------------------------------------------------* Program: whoisclient** Purpose: UNIX application program that becomes a client for the* Internet "whois" service.** Use: whois hostname username** Author: Barry Shein, Boston University** Date: Long ago in a universe far, far away**----------------------------------------------------------------------*/

Internetworking With TCP/IP vol 1 -- Part 21 23 2005

Page 603: internetworking tcpip

Example Client Program (Part 2)

main(argc, argv)int argc; /* standard UNIX argument declarations */char *argv[];{int s; /* socket descriptor */int len; /* length of received data */struct sockaddr_in sa; /* Internet socket addr. structure */struct hostent *hp; /* result of host name lookup */struct servent *sp; /* result of service lookup */char buf[BUFSIZ+1]; /* buffer to read whois information */char *myname; /* pointer to name of this program */char *host; /* pointer to remote host name */char *user; /* pointer to remote user name */

myname = argv[0];

Internetworking With TCP/IP vol 1 -- Part 21 24 2005

Page 604: internetworking tcpip

Example Client (Part 3)

/** Check that there are two command line arguments*/if(argc != 3) {

fprintf(stderr, "Usage: %s host username\n", myname);exit(1);

}host = argv[1];user = argv[2];/** Look up the specified hostname*/if((hp = gethostbyname(host)) == NULL) {

fprintf(stderr,"%s: %s: no such host?\n", myname, host);exit(1);

}/** Put host’s address and address type into socket structure*/bcopy((char *)hp->h_addr, (char *)&sa.sin_addr, hp->h_length);sa.sin_family = hp->h_addrtype;

Internetworking With TCP/IP vol 1 -- Part 21 25 2005

Page 605: internetworking tcpip

Example Client (Part 4)

/** Look up the socket number for the WHOIS service*/if((sp = getservbyname("whois","tcp")) == NULL) {

fprintf(stderr,"%s: No whois service on this host\n", myname);exit(1);

}/** Put the whois socket number into the socket structure.*/sa.sin_port = sp->s_port;/** Allocate an open socket*/if((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {

perror("socket");exit(1);

}

Internetworking With TCP/IP vol 1 -- Part 21 26 2005

Page 606: internetworking tcpip

Example Client (Part 5)

/** Connect to the remote server*/if(connect(s, &sa, sizeof sa) < 0) {

perror("connect");exit(1);

}/** Send the request*/if(write(s, user, strlen(user)) != strlen(user)) {

fprintf(stderr, "%s: write error\n", myname);exit(1);

}/** Read the reply and put to user’s output*/while( (len = read(s, buf, BUFSIZ)) > 0)

write(1, buf, len);close(s);exit(0);

}

Internetworking With TCP/IP vol 1 -- Part 21 27 2005

Page 607: internetworking tcpip

Example Server Program

/* whoisserver.c - main */

#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <netdb.h>#include <pwd.h>

/*----------------------------------------------------------------------* Program: whoisserver** Purpose: UNIX application program that acts as a server for* the "whois" service on the local machine. It listens* on well-known WHOIS port (43) and answers queries from* clients. This program requires super-user privilege to* run.** Use: whois hostname username*

Internetworking With TCP/IP vol 1 -- Part 21 28 2005

Page 608: internetworking tcpip

Example Server (Part 2)

* Author: Barry Shein, Boston University** Date: Long ago in a universe far, far away**----------------------------------------------------------------------*/

#define BACKLOG 5 /* # of requests we’re willing to queue */#define MAXHOSTNAME 32 /* maximum host name length we tolerate */

main(argc, argv)int argc; /* standard UNIX argument declarations */char *argv[];{int s, t; /* socket descriptors */int i; /* general purpose integer */struct sockaddr_in sa, isa; /* Internet socket address structure */struct hostent *hp; /* result of host name lookup */char *myname; /* pointer to name of this program */struct servent *sp; /* result of service lookup */char localhost[MAXHOSTNAME+1];/* local host name as character string */

Internetworking With TCP/IP vol 1 -- Part 21 29 2005

Page 609: internetworking tcpip

Example Server (Part 3)

myname = argv[0];/** Look up the WHOIS service entry*/if((sp = getservbyname("whois","tcp")) == NULL) {

fprintf(stderr, "%s: No whois service on this host\n", myname);exit(1);

}/** Get our own host information*/gethostname(localhost, MAXHOSTNAME);if((hp = gethostbyname(localhost)) == NULL) {

fprintf(stderr, "%s: cannot get local host info?\n", myname);exit(1);

}

Internetworking With TCP/IP vol 1 -- Part 21 30 2005

Page 610: internetworking tcpip

Example Server (Part 4)

/** Put the WHOIS socket number and our address info* into the socket structure*/sa.sin_port = sp->s_port;bcopy((char *)hp->h_addr, (char *)&sa.sin_addr, hp->h_length);sa.sin_family = hp->h_addrtype;/** Allocate an open socket for incoming connections*/if((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {

perror("socket");exit(1);

}/** Bind the socket to the service port* so we hear incoming connections*/if(bind(s, &sa, sizeof sa) < 0) {

perror("bind");exit(1);

}

Internetworking With TCP/IP vol 1 -- Part 21 31 2005

Page 611: internetworking tcpip

Example Server (Part 5)

/** Set maximum connections we will fall behind*/listen(s, BACKLOG);/** Go into an infinite loop waiting for new connections*/while(1) {

i = sizeof isa;/** We hang in accept() while waiting for new customers*/if((t = accept(s, &isa, &i)) < 0) {perror("accept");exit(1);

}whois(t); /* perform the actual WHOIS service */close(t);

}}

Internetworking With TCP/IP vol 1 -- Part 21 32 2005

Page 612: internetworking tcpip

Example Server (Part 6)

/** Get the WHOIS request from remote host and format a reply.*/whois(sock)int sock;{struct passwd *p;char buf[BUFSIZ+1];int i;

/** Get one line request*/if( (i = read(sock, buf, BUFSIZ)) <= 0)

return;buf[i] = ’\0’; /* Null terminate */

Internetworking With TCP/IP vol 1 -- Part 21 33 2005

Page 613: internetworking tcpip

Example Server (Part 7)

/** Look up the requested user and format reply*/if((p = getpwnam(buf)) == NULL)

strcpy(buf,"User not found\n");else

sprintf(buf, "%s: %s\n", p->pw_name, p->pw_gecos);/** Return reply*/write(sock, buf, strlen(buf));return;

}

Internetworking With TCP/IP vol 1 -- Part 21 34 2005

Page 614: internetworking tcpip

Summary

d Socket API

– Invented for BSD Unix

– Not official part of TCP/IP

– De facto standard in the industry

– Used with TCP or UDP

– Large set of functions

d General paradigm: create socket and then use a set offunctions to specify details

Internetworking With TCP/IP vol 1 -- Part 21 35 2005

Page 615: internetworking tcpip

Questions?

Page 616: internetworking tcpip

PART XXII

BOOTSTRAP AND AUTOCONFIGURATION(DHCP)

Internetworking With TCP/IP vol 1 -- Part 22 1 2005

Page 617: internetworking tcpip

System Startup

d To keep protocol software general

– IP stack designed with many parameters

– Values filled in when system starts

d Two possible sources of information

– Local storage device (e.g., disk)

– Server on the network

Internetworking With TCP/IP vol 1 -- Part 22 2 2005

Page 618: internetworking tcpip

Bootstrapping

d BOOTstrap Protocol (BOOTP)

– Early alternative to RARP

– Provided more than just an IP address

– Obtained configuration parameters from a server

– Used UDP

d Dynamic Host Configuration Protocol (DHCP)

– Replaces and extends BOOTP

– Provides dynamic address assignment

Internetworking With TCP/IP vol 1 -- Part 22 3 2005

Page 619: internetworking tcpip

Apparent Contradiction

d DHCP used to obtain parameters for an IP stack

d DHCP uses IP and UDP to obtain the parameters

d Stack must be initialized before being initialized

Internetworking With TCP/IP vol 1 -- Part 22 4 2005

Page 620: internetworking tcpip

Solving The Apparent Contradiction

d DHCP runs as application

d Only needs basic facilities

d In particular:

An application program can use the limited broadcast IPaddress to force IP to broadcast a datagram on the localnetwork before IP has discovered the IP address of the localnetwork or the machine’s IP address.

d Note: server cannot use ARP when replying to clientbecause client does not know its own IP address

Internetworking With TCP/IP vol 1 -- Part 22 5 2005

Page 621: internetworking tcpip

DHCP Retransmission

d Client handles retransmission

d Initial timeout selected at random

d Timeout for successive retransmissions doubled

Internetworking With TCP/IP vol 1 -- Part 22 6 2005

Page 622: internetworking tcpip

Two-Step Bootstrap

d DHCP provides information, not data

d Client receives

– Name of file that contains boot image

– Address of server

d Client must use another means to obtain the image to run(typically TFTP)

Internetworking With TCP/IP vol 1 -- Part 22 7 2005

Page 623: internetworking tcpip

Dynamic Address Assignment

d Needed by ISPs

– Client obtains an IP address and uses temporarily

– When client finishes, address is available for anotherclient

d Also used on many corporate networks

Internetworking With TCP/IP vol 1 -- Part 22 8 2005

Page 624: internetworking tcpip

DHCP Address Assignment

d Backward compatible with BOOTP

d Can assign addresses in three ways

– Manual (manager specifies binding as in BOOTP)

– Automatic (address assigned by server, and machineretains same address)

– Dynamic (address assigned by server, but machine mayobtain new address for successive request)

d Manager chooses type of assignment for each address

Internetworking With TCP/IP vol 1 -- Part 22 9 2005

Page 625: internetworking tcpip

DHCP Support For Autoconfiguration

Because it allows a host to obtain all the parameters needed forcommunication without manual intervention, DHCP permitsautoconfiguration. Autoconfiguration is, of course, subject toadministrative constraints.

Internetworking With TCP/IP vol 1 -- Part 22 10 2005

Page 626: internetworking tcpip

Dynamic Address Assignment

d Client is granted a lease on an address

d Server specifies length of lease

d At end of lease, client must renew lease or stop usingaddress

d Actions controlled by finite state machine

Internetworking With TCP/IP vol 1 -- Part 22 11 2005

Page 627: internetworking tcpip

Server Contact

To use DHCP, a host becomes a client by broadcasting amessage to all servers on the local network. The host thencollects offers from servers, selects one of the offers, andverifies acceptance with the server.

Internetworking With TCP/IP vol 1 -- Part 22 12 2005

Page 628: internetworking tcpip

DHCP Finite State Machine

REBIND

INITIALIZE

BOUND

RENEW

SELECT

REQUEST

/ DHCPDISCOVER

Select Offer /DHCPREQUEST

DHCPOFFER

DHCPACK

DHCPACK

DHCPACK

DHCPNACKDHCPNACKor

Lease Expires

Lease Reaches50% Expiration /DHCPREQUEST

Lease Reaches87.5% Expiration /DHCPREQUEST

Host Boots

Cancel Lease / DHCPRELEASE

Internetworking With TCP/IP vol 1 -- Part 22 13 2005

Page 629: internetworking tcpip

DHCP Message Format

0 8 16 24 31

OP HTYPE HLEN HOPS

TRANSACTION ID

SECONDS FLAGS

CLIENT IP ADDRESS

YOUR IP ADDRESS

SERVER IP ADDRESS

ROUTER IP ADDRESS

CLIENT HARDWARE ADDRESS (16 OCTETS)...

SERVER HOST NAME (64 OCTETS)...

BOOT FILE NAME (128 OCTETS)...

OPTIONS (VARIABLE)...

Internetworking With TCP/IP vol 1 -- Part 22 14 2005

Page 630: internetworking tcpip

Message Type Field

0 8 16 23

CODE (53) LENGTH (1) TYPE (1 - 7)

TYPE FIELD Corresponding DHCP Message Type22222222222222222222222222222222222222222222222222

1 DHCPDISCOVER2 DHCPOFFER3 DHCPREQUEST4 DHCPDECLINE5 DHCPACK6 DHCPNACK7 DHCPRELEASE8 DHCPINFORM

Internetworking With TCP/IP vol 1 -- Part 22 15 2005

Page 631: internetworking tcpip

Questions For Discussion

d Explain the relationship between DHCP and DNS

d What basic facility is needed? Why?

Internetworking With TCP/IP vol 1 -- Part 22 16 2005

Page 632: internetworking tcpip

Summary

d Two protocols available for bootstrapping

– BOOTP (static binding of IP address to computer)

– DHCP (extension of BOOTP that adds dynamic bindingof IP addresses)

d DHCP

– Server grants lease for an address

– Lease specifies length of time

– Host must renew lease or stop using address when leaseexpires

– Actions controlled by finite state machine

Internetworking With TCP/IP vol 1 -- Part 22 17 2005

Page 633: internetworking tcpip

Questions?

Page 634: internetworking tcpip

PART XXIII

DOMAIN NAME SYSTEM(DNS)

Internetworking With TCP/IP vol 1 -- Part 23 1 2005

Page 635: internetworking tcpip

Names For Computers

d Humans prefer pronounceable names rather than numericaddresses

d Two possibilities

– Flat namespace

– Hierarchical namespace

Internetworking With TCP/IP vol 1 -- Part 23 2 2005

Page 636: internetworking tcpip

Naming Hierarchy

d Two possibilities

– According to network topology

– By organizational structure (independent of physicalnetworks)

d Internet uses the latter

Internetworking With TCP/IP vol 1 -- Part 23 3 2005

Page 637: internetworking tcpip

Internet Hierarchy

In a TCP/IP internet, hierarchical machine names are assignedaccording to the structure of organizations that obtain authorityfor parts of the namespace, not necessarily according to thestructure of the physical network interconnections.

Internetworking With TCP/IP vol 1 -- Part 23 4 2005

Page 638: internetworking tcpip

Internet Domain Names

d Flexible hierarchy

– Universal naming scheme (same everywhere)

– Each organization determines internal naming structure

d Mechanism known as Domain Name System (DNS)

d Name assigned to a computer known as domain name

Internetworking With TCP/IP vol 1 -- Part 23 5 2005

Page 639: internetworking tcpip

Domain Name Syntax

d Set of labels separated by delimiter character (period)

d Example

cs . purdue . edu

d Three labels: cs, purdue, and edu

d String purdue . edu is also a domain

d Top-level domain is edu

Internetworking With TCP/IP vol 1 -- Part 23 6 2005

Page 640: internetworking tcpip

Original Top-Level Domains

Domain Name Assigned To2222222222222222222222222222222222222222222222222222222

com Commercial organizationsedu Educational institutions (4-year)gov Government institutionsmil Military groupsnet Major network support centersorg Organizations other than those abovearpa Temporary ARPANET domain (obsolete)int International organizationscountry code Each country (geographic scheme)

d Meaning assigned to each

d Three domains considered generic.com.net.org

Internetworking With TCP/IP vol 1 -- Part 23 7 2005

Page 641: internetworking tcpip

New Top-Level Domains

Domain Name Assigned To2222222222222222222222222222222222222222222222222222222222222222

aero Air-Transport Industrybiz Businessescoop Non-Profit Cooperativesinfo Unrestrictedmuseum Museumsname Individualspro Professionals (accountants, lawyers, physicians)

d Proponents argued (incorrectly) that DNS would collapsewithout additional TLDs

d New TLDs created legal nightmare

Internetworking With TCP/IP vol 1 -- Part 23 8 2005

Page 642: internetworking tcpip

Illustration Of Part Of The DNS Tree

com edu gov us

dec purdue nsf va

cc cs ecn reston

cnri

. . .

unnamed root

Internetworking With TCP/IP vol 1 -- Part 23 9 2005

Page 643: internetworking tcpip

Authority For Names

d Authority delegated down the tree

d Example

– Purdue University registers under top level domain .eduand receives authority for domain purdue . edu

– Computer Science Department at Purdue registers withthe Purdue authority, and becomes the authority forcs . purdue . edu

– Owner of a lab in the CS Department registers with thedepartmental authority, and becomes the authority forxinu . cs . purdue . edu

Internetworking With TCP/IP vol 1 -- Part 23 10 2005

Page 644: internetworking tcpip

DNS Database

d Record has (name, class)

d Class specifies type of object (e.g., computer, emailexchanger)

d Consequence:

A given name may map to more than one item in the domainsystem. The client specifies the type of object desired whenresolving a name, and the server returns objects of that type.

Internetworking With TCP/IP vol 1 -- Part 23 11 2005

Page 645: internetworking tcpip

Mapping Domain Names To Addresses

d DNS uses a set of on-line servers

d Servers arranged in tree

d Given server can handle entire subtree

– Example: ISP manages domain names for its clients(including corporations)

Internetworking With TCP/IP vol 1 -- Part 23 12 2005

Page 646: internetworking tcpip

Terminology

d DNS server known as name server

d DNS client software known as resolver

Internetworking With TCP/IP vol 1 -- Part 23 13 2005

Page 647: internetworking tcpip

Illustration Of Topology AmongDNS Servers

server for.com

server for.edu

server for.gov

server for.us

RootServer

server fordec.com

server forpurdue.edu

server fornsf.gov

server forva.us

. . .

Internetworking With TCP/IP vol 1 -- Part 23 14 2005

Page 648: internetworking tcpip

In Practice

d Single server can handle multiple levels of the naming tree

d Example: root server handles all top-level domains

Internetworking With TCP/IP vol 1 -- Part 23 15 2005

Page 649: internetworking tcpip

Domain Name Resolution

d Conceptually, must search from root of tree downward

d In practice

– Every name server knows location of a root server

– Only contacts root if no subdomain known

– Lookup always starts with local server first (host canlearn address of DNS server from DHCP)

Internetworking With TCP/IP vol 1 -- Part 23 16 2005

Page 650: internetworking tcpip

Efficient Translation

d Facts

– Most lookups refer to local names

– Name-to-address bindings change infrequently

– User is likely to repeat same lookup

d To increase efficiency

– Initial contact begins with local name server

– Every server caches answers (owner specifies cachetimeout)

Internetworking With TCP/IP vol 1 -- Part 23 17 2005

Page 651: internetworking tcpip

Domain Server Message Format

0 16 31

IDENTIFICATION PARAMETER

NUMBER OF QUESTIONS NUMBER OF ANSWERS

NUMBER OF AUTHORITY NUMBER OF ADDITIONAL

QUESTION SECTION. . .

ANSWER SECTION. . .

AUTHORITY SECTION. . .

ADDITIONAL INFORMATION SECTION. . .

Internetworking With TCP/IP vol 1 -- Part 23 18 2005

Page 652: internetworking tcpip

Parameter BitsBit of PARAMETER field Meaning222222222222222222222222222222222222222222222222222222222222222222

0 Operation:0 Query1 Response

1-4 Query Type:0 Standard1 Inverse2 Server status request3 Completion (now obsolete)4 Notify5 Update

5 Set if answer authoritative6 Set if message truncated7 Set if recursion desired8 Set if recursion available9 Set if data is authenticated

10 Set if checking is disabled11 Reserved

12-15 Response Type:0 No error1 Format error in query2 Server failure3 Name does not exist5 Refused6 Name exists when it should not7 RR set exists8 RR set that should exist does not9 Server not authoritative for the zone10 Name not contained in zone11

1111111111111111111111111111

Internetworking With TCP/IP vol 1 -- Part 23 19 2005

Page 653: internetworking tcpip

Format Of Question Section

0 16 31

QUERY DOMAIN NAME. . .

QUERY TYPE QUERY CLASS

Internetworking With TCP/IP vol 1 -- Part 23 20 2005

Page 654: internetworking tcpip

Format Of Resource Records

0 16 31

RESOURCE DOMAIN NAME. . .

TYPE CLASS

TIME TO LIVE

RESOURCE DATA LENGTH

RESOURCE DATA. . .

Internetworking With TCP/IP vol 1 -- Part 23 21 2005

Page 655: internetworking tcpip

Abbreviation Of Domain Names

d DNS only recognizes full domain names

d Client software allows abbreviation

Internetworking With TCP/IP vol 1 -- Part 23 22 2005

Page 656: internetworking tcpip

Example Of Domain Name Abbreviation

d Client configured with suffix list

– . cs . purdue . edu

– . cc . purdue . edu

– . purdue . edu

– null

d User enters abbreviation xinu

d Client tries the following in order

– xinu. cs . purdue . edu

– xinu. cc . purdue . edu

– xinu. purdue . edu

– xinu

Internetworking With TCP/IP vol 1 -- Part 23 23 2005

Page 657: internetworking tcpip

The Point About Abbreviation

The Domain Name System only maps full domain names intoaddresses; abbreviations are not part of the Domain NameSystem itself, but are introduced by client software to makelocal names convenient for users.

Internetworking With TCP/IP vol 1 -- Part 23 24 2005

Page 658: internetworking tcpip

Inverse Query

d Map in reverse direction

d Excessive overhead

d May not have unique answer

d Not used in practice

Internetworking With TCP/IP vol 1 -- Part 23 25 2005

Page 659: internetworking tcpip

Pointer Query

d Special case of inverse mapping

d Convert IP address to domain name

d Trick: write IP address as a string and look up as a name

Internetworking With TCP/IP vol 1 -- Part 23 26 2005

Page 660: internetworking tcpip

Example Of Pointer Query

d Start with dotted decimal address such as

aaa . bbb . ccc . ddd

d Rearrange dotted decimal representation as a string:

ddd . ccc . bbb . aaa . in-addr . arpa

d Look up using a pointer query type

Internetworking With TCP/IP vol 1 -- Part 23 27 2005

Page 661: internetworking tcpip

Object Types That DNS Supports

Type Meaning Contents222222222222222222222222222222222222222222222222222222222222222222222

A Host Address 32-bit IP addressCNAME Canonical Name Canonical domain name for an aliasHINFO CPU & OS Name of CPU and operating systemMINFO Mailbox info Information about a mailbox or mail listMX Mail Exchanger 16-bit preference and name of host that

acts as mail exchanger for the domainNS Name Server Name of authoritative server for domainPTR Pointer Domain name (like a symbolic link)SOA Start of Authority Multiple fields that specify which

parts of the naming hierarchya server implements

TXT Arbitrary text Uninterpreted string of ASCII textAAAA Host Address 128-bit IPv6 address

Internetworking With TCP/IP vol 1 -- Part 23 28 2005

Page 662: internetworking tcpip

Summary

d Domain Name System provides mapping frompronounceable names to IP addresses

d Domain names are hierarchical; top-level domains aredictated by a central authority

d Organizations can choose how to structure their domainnames

d DNS uses on-line servers to answer queries

d Lookup begins with local server, which caches entries

Internetworking With TCP/IP vol 1 -- Part 23 29 2005

Page 663: internetworking tcpip

Questions?

Page 664: internetworking tcpip

PART XXIV

APPLICATIONS:REMOTE LOGIN

(TELNET AND RLOGIN)

Internetworking With TCP/IP vol 1 -- Part 24 1 2005

Page 665: internetworking tcpip

Remote Interaction

d Devised when computers used (ASCII) terminals

d Terminal abstraction extended to remote access over anetwork

Internetworking With TCP/IP vol 1 -- Part 24 2 2005

Page 666: internetworking tcpip

Client-Server Interaction

d Client

– Invoked by user

– Forms connection to remote server

– Passes keystrokes from user’s keyboard to server anddisplays output from server on user’s screen

d Server

– Accepts connection over the network

– Passes incoming characters to OS as if they were typedon a local keyboard

– Sends output over connection to client

Internetworking With TCP/IP vol 1 -- Part 24 3 2005

Page 667: internetworking tcpip

TELNET

d Standard protocol for remote terminal access

d Three basic services

– Defines network virtual terminal that provides standardinterface

– Mechanism that allows client and server to negotiateoptions (e.g., character set)

– Symmetric treatment that allows either end of theconnection to be a program instead of a physicalkeyboard and display

Internetworking With TCP/IP vol 1 -- Part 24 4 2005

Page 668: internetworking tcpip

Illustration Of TELNET

Internet

operatingsystem

telnetclient

operatingsystem

telnetserver appl.

user’sscreen &keyboard

client readsfrom keyboard

client sendsto server

server receivesfrom client

server sends topseudo terminal

the inputreaches anapplicationthrough the

pseudo terminal

Internetworking With TCP/IP vol 1 -- Part 24 5 2005

Page 669: internetworking tcpip

Accommodating Heterogeneity

d Network Virtual Terminal (NVT) describes system-independent encoding

d TELNET client and server map NVT into local computer’srepresentation

Internetworking With TCP/IP vol 1 -- Part 24 6 2005

Page 670: internetworking tcpip

Illustration Of How NVTAccommodates Heterogeneity

Client

user’skeyboard& display Server Server’s

SystemTCP connection across internet

Client System format used NVT format used Server System format used

Internetworking With TCP/IP vol 1 -- Part 24 7 2005

Page 671: internetworking tcpip

Definition Of TELNET NVT

ASCII DecimalControl Code Value Assigned Meaning222222222222222222222222222222222222222222222222222222222222222222222222222222222222

NUL 0 No operation (has no effect on output)BEL 7 Sound audible/visible signal (no motion)BS 8 Move left one character positionHT 9 Move right to the next horizontal tab stopLF 10 Move down (vertically) to the next lineVT 11 Move down to the next vertical tab stopFF 12 Move to the top of the next pageCR 13 Move to the left margin on the current line

other control – No operation (has no effect on output)

Internetworking With TCP/IP vol 1 -- Part 24 8 2005

Page 672: internetworking tcpip

TELNET NVT Control Functions

Signal Meaning222222222222222222222222222222222222222222222222222222222

IP Interrupt Process (terminate running program)AO Abort Output (discard any buffered output)AYT Are You There (test if server is responding)EC Erase Character (delete the previous character)EL Erase Line (delete the entire current line)SYNCH Synchronize (clear data path until TCP urgent

data point, but do interpret commands)BRK Break (break key or attention signal)

Internetworking With TCP/IP vol 1 -- Part 24 9 2005

Page 673: internetworking tcpip

TELNET Commands

DecimalCommand Encoding Meaning222222222222222222222222222222222222222222222222222222222222222222222222222222222222

IAC 255 Interpret next octet as command (when the IACoctet appears as data, the sender doubles itand sends the 2-octet sequence IAC-IAC)

DON’T 254 Denial of request to perform specified optionDO 253 Approval to allow specified optionWON’T 252 Refusal to perform specified optionWILL 251 Agreement to perform specified optionSB 250 Start of option subnegotiationGA 249 The ‘‘go ahead’’ signalEL 248 The ‘‘erase line’’ signalEC 247 The ‘‘erase character’’ signalAYT 246 The ‘‘are you there’’ signalAO 245 The ‘‘abort output’’ signalIP 244 The ‘‘interrupt process’’ signalBRK 243 The ‘‘break’’ signalDMARK 242 The data stream portion of a SYNCH (always

accompanied by TCP Urgent notification)NOP 241 No operationSE 240 End of option subnegotiationEOR 239 End of record

Internetworking With TCP/IP vol 1 -- Part 24 10 2005

Page 674: internetworking tcpip

TELNET Control Sequences And TCP

TELNET cannot rely on the conventional data stream alone tocarry control sequences between client and server because amisbehaving application that needs to be controlled mightinadvertently block the data stream.

d Solution: use TCP’s urgent data to send control sequences

Internetworking With TCP/IP vol 1 -- Part 24 11 2005

Page 675: internetworking tcpip

TELNET Option Negotiation

TELNET uses a symmetric option negotiation mechanism toallow clients and servers to reconfigure the parameterscontrolling their interaction. Because all TELNET softwareunderstands a basic NVT protocol, clients and servers caninteroperate even if one understands options another does not.

Internetworking With TCP/IP vol 1 -- Part 24 12 2005

Page 676: internetworking tcpip

Remote Login (rlogin)

d Invented for BSD Unix

d Includes facilities specifically for Unix

d Allows manager to configure a set of computers so that iftwo or more computers have same login id, X, the logins areowned by the same individual

d Permits other forms of authentication

Internetworking With TCP/IP vol 1 -- Part 24 13 2005

Page 677: internetworking tcpip

Remote Shell (rsh)

d Similar to rlogin

d Also part of BSD Unix

d Allows remote execution of a single command

Internetworking With TCP/IP vol 1 -- Part 24 14 2005

Page 678: internetworking tcpip

Secure Remote Login (ssh)

d Alternative to TELNET/rlogin

d Transport layer protocol with service authentication

d User authentication protocol

d Connection protocol

– Multiplexes multiple transfers

– Uses encryption for privacy

Internetworking With TCP/IP vol 1 -- Part 24 15 2005

Page 679: internetworking tcpip

Port Forwarding

d Novel aspect of ssh

d Similar to NAT

d Permits incoming TCP connection to be forwarded acrosssecure tunnel

Internetworking With TCP/IP vol 1 -- Part 24 16 2005

Page 680: internetworking tcpip

Remote Desktop

d Intended for systems that have a GUI interface

d Allows a remote user to see screen of remote system anduse mouse as well as keyboard

d Examples include

– Virtual Network Computing (VNC)

– Remote Desktop Protocol (RDP)

Internetworking With TCP/IP vol 1 -- Part 24 17 2005

Page 681: internetworking tcpip

Summary

d Remote interaction allows client software to connect localkeyboard and screen to remote system

d Standard protocol is TELNET

d Alternatives include rlogin, rsh, and ssh

d Remote desktop extends remote access to handle GUIinteface

Internetworking With TCP/IP vol 1 -- Part 24 18 2005

Page 682: internetworking tcpip

Questions?

Page 683: internetworking tcpip

PART XXV

APPLICATIONS:FILE TRANSFER AND ACCESS

(FTP, TFTP, NFS)

Internetworking With TCP/IP vol 1 -- Part 25 1 2005

Page 684: internetworking tcpip

On-Line File Sharing

d Always a popular application

d Two basic paradigms

– Whole-file copying

– Piecewise file access

d Piecewise access mechanism

– Opaque: application uses special facilities to accessremote file

– Transparent: application uses same facilities to accesslocal and remote files

Internetworking With TCP/IP vol 1 -- Part 25 2 2005

Page 685: internetworking tcpip

File Transfer

d Whole file copying

d Client

– Contacts server

– Specifies file

– Specifies transfer direction

– Server

– Maintains set of files on local disk

– Waits for contact

– Honors request from client

Internetworking With TCP/IP vol 1 -- Part 25 3 2005

Page 686: internetworking tcpip

File Transfer Protocol (FTP)

d Major TCP/IP protocol for whole-file copying

d Uses TCP for transport

d Features

– Interactive access

– Format specification (ASCII or EBCDIC)

– Authentication control (login and password)

Internetworking With TCP/IP vol 1 -- Part 25 4 2005

Page 687: internetworking tcpip

FTP Process Model

TCP/IPinternet

operatingsystem

datatransfer

controlprocess

operatingsystem

controlprocess

datatransfer

server systemclient system

client dataconnection

client controlconnection

server controlconnection

server dataconnection

d Separate processes handle

– Interaction with user

– Individual transfer requests

Internetworking With TCP/IP vol 1 -- Part 25 5 2005

Page 688: internetworking tcpip

FTP’s Use of TCP Connections

Data transfer connections and the data transfer processes thatuse them can be created dynamically when needed, but thecontrol connection persists throughout a session. Once thecontrol connection disappears, the session is terminated and thesoftware at both ends terminates all data transfer processes.

Internetworking With TCP/IP vol 1 -- Part 25 6 2005

Page 689: internetworking tcpip

Control Connection Vs. Data Connection

d For data transfer, client side becomes server and server sidebecomes client

d Client

– Creates process to handle data transfer

– Allocates port and sends number to server over controlconnection

– Process waits for contact

d Server

– Receives request

– Creates process to handle data transfer

– Process contacts client-side

Internetworking With TCP/IP vol 1 -- Part 25 7 2005

Page 690: internetworking tcpip

Question For Discussion

d What special relationship is required between FTP andNAT?

Internetworking With TCP/IP vol 1 -- Part 25 8 2005

Page 691: internetworking tcpip

Interactive Use Of FTP

d Initially a command-line interface

– User invokes client and specifies remote server

– User logs in and enters password

– User issues series of requests

– User closes connection

d Currently

– Most FTP initiated through browser

– User enters URL or clicks on link

– Browser uses FTP to contact remote server and obtainlist of files

– User selects file for download

Internetworking With TCP/IP vol 1 -- Part 25 9 2005

Page 692: internetworking tcpip

Anonymous FTP

d Login anonymous

d Password guest

d Used for ‘‘open’’ FTP site (where all files are publiclyavailable

d Typically used by browsers

Internetworking With TCP/IP vol 1 -- Part 25 10 2005

Page 693: internetworking tcpip

Secure File Transfer Protocols

d Secure Sockets Layer FTP (SSL-FTP)

– Uses secure sockets layer technology

– All transfers are confidential

d Secure File Transfer Program (sftp)

– Almost nothing in common with FTP

– Uses ssh tunnel

d Secure Copy (scp)

– Derivative of Unix remote copy (rcp)

– Uses ssh tunnel

Internetworking With TCP/IP vol 1 -- Part 25 11 2005

Page 694: internetworking tcpip

Trivial File Transfer Protocol (TFTP)

d Alternative to FTP

d Whole-file copying

d Not as much functionality as FTP

d Code is much smaller

d Intended for use on Local Area Network

d Runs over UDP

d Diskless machine can use to obtain image at bootstrap

Internetworking With TCP/IP vol 1 -- Part 25 12 2005

Page 695: internetworking tcpip

TFTP Packet Types

READ REQ. (1) FILENAME 0 MODE 0

2-octet opcode n octets 1 octet n octets 1 octet

WRITE REQ. (2) FILENAME 0 MODE 0

2-octet opcode n octets 1 octet n octets 1 octet

DATA (3) BLOCK # DATA OCTETS...

2-octet opcode 2 octets up to 512 octets

ACK (4) BLOCK #

2-octet opcode 2 octets

ERROR (5) ERROR CODE ERROR MESSAGE 0

2-octet opcode 2 octets n octets 1 octet

Internetworking With TCP/IP vol 1 -- Part 25 13 2005

Page 696: internetworking tcpip

TFTP Retransmission

d Symmetric (both sides implement timeout andretransmission)

d Data block is request for ACK

d ACK is request for next data block

Internetworking With TCP/IP vol 1 -- Part 25 14 2005

Page 697: internetworking tcpip

Sorcerer’s Apprentice Bug

d Consequence of symmetric retransmission

d Duplicate packet is perceived as second request, whichgenerates another transmission

d Duplicate response triggers duplicate packets from the otherend

d Cycle continues

Internetworking With TCP/IP vol 1 -- Part 25 15 2005

Page 698: internetworking tcpip

Network File System (NFS)

d Protocol for file access, not copying

d Developed by Sun Microsystems, now part of TCP/IPstandards

d Transparent (application cannot tell that file is remote)

Internetworking With TCP/IP vol 1 -- Part 25 16 2005

Page 699: internetworking tcpip

NFS Implementation

application

localfile

system

localdisk

NFSclient

network connectionto NFS server

local / remote decision

Internetworking With TCP/IP vol 1 -- Part 25 17 2005

Page 700: internetworking tcpip

Remote Procedure Call (RPC)

d Also developed by Sun Microsystems, now part of TCP/IPstandards

d Used in implementation of NFS

d Relies on eXternal Data Representation (XDR) standard forconversion of data items between heterogeneous computers

Internetworking With TCP/IP vol 1 -- Part 25 18 2005

Page 701: internetworking tcpip

Summary

d Two paradigms for remote file sharing

– Whole file copying

– Piecewise file access

d File Transfer Protocol (FTP)

– Standard protocol for file copying

– Separate TCP connection for each data transfer

– Client and server roles reversed for data connection

d Examples of secure alternatives to FTP

– SSL-FTP, sftp, and scp

Internetworking With TCP/IP vol 1 -- Part 25 19 2005

Page 702: internetworking tcpip

Summary(continued)

d Trivial File Transfer Protocol (TFTP)

– Alternative to FTP that uses UDP

– Symmetric retransmission scheme

– Packet duplication can result in Sorcerer’s Apprenticeproblem

d Network File System (NFS)

– Standard protocol for piecewise file access

– Uses RPC and XDR

Internetworking With TCP/IP vol 1 -- Part 25 20 2005

Page 703: internetworking tcpip

Questions?

Page 704: internetworking tcpip

PART XXVI

APPLICATIONS:ELECTRONIC MAIL

(SMTP, POP, IMAP, MIME)

Internetworking With TCP/IP vol 1 -- Part 26 1 2005

Page 705: internetworking tcpip

Electronic Mail

d Among most widely used Internet services

d Two major components

– User interface

– Mail transfer software

d Paradigm: transfer is separate background activity

Internetworking With TCP/IP vol 1 -- Part 26 2 2005

Page 706: internetworking tcpip

Illustration Of Email System Components

userinter-face

. . . . . . . . . . . .

............

outgoingmail spool

area

mailboxesfor

incomingmail

client(background

transfer)

server(to accept

mail)

TCP connection

for outgoing mail

TCP connection

for incoming mail

user sends mail

user reads mail

Internetworking With TCP/IP vol 1 -- Part 26 3 2005

Page 707: internetworking tcpip

Mailbox Names And Aliases

d Email destination identified by pair

( mailbox, computer )

d Aliases permitted (user enters alias that is expanded)

Internetworking With TCP/IP vol 1 -- Part 26 4 2005

Page 708: internetworking tcpip

Forwarding

d Powerful idea

d Email arriving on a computer can be forwarded to anultimate destination

Internetworking With TCP/IP vol 1 -- Part 26 5 2005

Page 709: internetworking tcpip

Illustration Of Aliases And Forwarding

userinter-face

. . . . . . . . . . . .

............

aliasexpansion

andforwarding

aliasdatabase

outgoingmail spool

area

mailboxesfor

incomingmail

server(to accept

mail)

client(background

transfer)

user sends mail

user reads mail

Internetworking With TCP/IP vol 1 -- Part 26 6 2005

Page 710: internetworking tcpip

TCP/IP Standards For Email

d Syntax for email addresses

d Format of email message

d Protocols for email transfer and mailbox access

Internetworking With TCP/IP vol 1 -- Part 26 7 2005

Page 711: internetworking tcpip

Email Address Syntax

d Mailbox identified by string

mailbox@computer

d String computer is domain name of computer on which amailbox resides

d String mailbox is unique mailbox name on the destinationcomputer

Internetworking With TCP/IP vol 1 -- Part 26 8 2005

Page 712: internetworking tcpip

Format Of Email Message

d Message consists of

– Header

– Blank line

– Body of message

d Headers have form

keyword : information

d Standard given in RFC 2822

Internetworking With TCP/IP vol 1 -- Part 26 9 2005

Page 713: internetworking tcpip

Protocol For Email Transfer

d Specifies interaction between transfer components

– Transfer client

– Transfer server

d Standard protocol is Simple Mail Transfer Protocol (SMTP)

Internetworking With TCP/IP vol 1 -- Part 26 10 2005

Page 714: internetworking tcpip

SMTP

d Application-level protocol

d Uses TCP

d Commands and responses encoded in ASCII

Internetworking With TCP/IP vol 1 -- Part 26 11 2005

Page 715: internetworking tcpip

Example Of SMTP

S: 220 Beta.GOV Simple Mail Transfer Service ReadyC: HELO Alpha.EDUS: 250 Beta.GOV

C: MAIL FROM:<[email protected]>S: 250 OK

C: RCPT TO:<[email protected]>S: 250 OK

C: RCPT TO:<[email protected]>S: 550 No such user here

C: RCPT TO:<[email protected]>S: 250 OK

C: DATAS: 354 Start mail input; end with <CR><LF>.<CR><LF>C: ...sends body of mail message...C: ...continues for as many lines as message containsC: <CR><LF>.<CR><LF>S: 250 OK

C: QUITS: 221 Beta.GOV Service closing transmission channel

Internetworking With TCP/IP vol 1 -- Part 26 12 2005

Page 716: internetworking tcpip

Protocol For Mailbox Access

d Used when user’s mailbox resides on remote computer

d Especially helpful when user’s local computer is not alwayson-line

d Two protocols exist

– Post Office Protocol version 3 (POP3)

– Internet Message Access Protocol (IMAP)

d Each provides same basic functionality

– User authentication

– Mailbox access commands

Internetworking With TCP/IP vol 1 -- Part 26 13 2005

Page 717: internetworking tcpip

Multipurpose Internet Mail Extensions(MIME)

d Permits nontextual data to be sent in email

– Graphics image

– Voice or video clip

d Sender

– Encodes binary item into printable characters

– Places in email message for transfer

d Receiver

– Receives email message containing encoded item

– Decodes message to extract original binary value

Internetworking With TCP/IP vol 1 -- Part 26 14 2005

Page 718: internetworking tcpip

MIME Header

d Header in email message describes encoding used

d Example

From: [email protected]: [email protected]: 1.0Content-Type: image/jpegContent-Transfer-Encoding: base64

...data for the image...

Internetworking With TCP/IP vol 1 -- Part 26 15 2005

Page 719: internetworking tcpip

Seven Basic MIME Types

Content Type Used When Data In the Message Is22222222222222222222222222222222222222222222222222222222222222222222

text Textual (e.g. a document).image A still photograph or computer-generated imageaudio A sound recordingvideo A video recording that includes motionapplication Raw data for a programmultipart Multiple messages that each have a separate content

type and encodingmessage An entire e-mail message (e.g., a memo that has been

forwarded) or an external reference to amessage (e.g., an FTP server and file name)

Internetworking With TCP/IP vol 1 -- Part 26 16 2005

Page 720: internetworking tcpip

Example Of Mixed / Multipart Message

From: [email protected]: [email protected]: 1.0Content-Type: Multipart/Mixed; Boundary=StartOfNextPart

--StartOfNextPartContent-Type: text/plainContent-Transfer-Encoding: 7bitJohn,

Here is the photo of our research lab I promisedto send you. You can see the equipment you donated.

Thanks again, Bill

--StartOfNextPartContent-Type: image/jpegContent-Transfer-Encoding: base64

...data for the image...

Internetworking With TCP/IP vol 1 -- Part 26 17 2005

Page 721: internetworking tcpip

Summary

d Email operates at application layer

d Conceptual separation between

– User interface

– Mail transfer components

d Simple Mail Transfer Protocol (SMTP)

– Standard for transfer

– Uses ASCII encoding

d Post Office Protocol (POP) And Internet Mail AccessProtocol (IMAP) allow access of remote mailbox.

d Multipurpose Internet Mail Extensions (MIME) permitstransfer of nontextual information (e.g., images)

Internetworking With TCP/IP vol 1 -- Part 26 18 2005

Page 722: internetworking tcpip

Questions?

Page 723: internetworking tcpip

PART XXVII

APPLICATIONS:WORLD WIDE WEB

(HTTP)

Internetworking With TCP/IP vol 1 -- Part 27 1 2005

Page 724: internetworking tcpip

World Wide Web

d Distributed hypermedia paradigm

d Major service on the Internet

d Use surpassed file transfer in 1995

Internetworking With TCP/IP vol 1 -- Part 27 2 2005

Page 725: internetworking tcpip

Web Page Identifier

d Known as Uniform Resource Locator (URL)

d Encodes

– Access protocol to use

– Domain name of server

– Protocol port number (optional)

– Path through server’s file system (optional)

– Parameters (optional)

– Query (optional)

d Format

http: // hostname [: port] / path [; parameters] [? query]

Internetworking With TCP/IP vol 1 -- Part 27 3 2005

Page 726: internetworking tcpip

Web Standards

d Separate standards for

– Representation

– Transfer

Internetworking With TCP/IP vol 1 -- Part 27 4 2005

Page 727: internetworking tcpip

Representation

d HyperText Markup Language (HTML)

d Document contains text plus embedded links

d HTML gives guidelines for display, not details

d Consequence: two browsers may choose to display samedocument differently

Internetworking With TCP/IP vol 1 -- Part 27 5 2005

Page 728: internetworking tcpip

Transfer

d Used between browser and web server

d Protocol is HyperText Transfer Protocol (HTTP)

d Runs over TCP

Internetworking With TCP/IP vol 1 -- Part 27 6 2005

Page 729: internetworking tcpip

HTTP Characteristics

d Application level

d Request / response paradigm

d Stateless

d Permits bi-directional transfer

d Offers capability negotiation

d Support for caching

d Support for intermediaries

Internetworking With TCP/IP vol 1 -- Part 27 7 2005

Page 730: internetworking tcpip

HTTP Operation

d Browser sends requests to which server replies

d Typical request: GET used to fetch document

d Example

GET http://www.cs.purdue.edu/people/comer/ HTTP/1.1

d Relative URL also permitted

GET /people/comer/ HTTP/1.1

Internetworking With TCP/IP vol 1 -- Part 27 8 2005

Page 731: internetworking tcpip

Error Messages

d HTTP includes set of error responses

d Server can format error as HTML message for user or useinternal form and allow browser to format message

Internetworking With TCP/IP vol 1 -- Part 27 9 2005

Page 732: internetworking tcpip

Persistent Connections

d HTTP version 1.0 uses one TCP connection per transfer

– Browser forms TCP connection to server

– Browser sends GET request

– Server returns header describing item

– Server returns item

– Server closes connection

d HTTP version 1.1 permits connection to persist acrossmultiple requests

Internetworking With TCP/IP vol 1 -- Part 27 10 2005

Page 733: internetworking tcpip

HTTP Headers

HTTP uses MIME-like headers to carry meta information. Bothbrowsers and servers send headers that allow them to negotiateagreement on the document representation and encoding to beused.

Internetworking With TCP/IP vol 1 -- Part 27 11 2005

Page 734: internetworking tcpip

Handing Persistence

To allow a TCP connection to persist through multiple requestsand responses, HTTP sends a length before each response. If itdoes not know the length, a server informs the client, sends theresponse, and then closes the connection.

Internetworking With TCP/IP vol 1 -- Part 27 12 2005

Page 735: internetworking tcpip

Headers And Length Encoding

d HTTP headers use same syntax as email headers

– Lines of text followed by blank line

– Lines of text have form keyword:information

d For persistent connection header specifies length (in octets)of data item that follows

Internetworking With TCP/IP vol 1 -- Part 27 13 2005

Page 736: internetworking tcpip

Items That Can Appear In An HTTP Header

Header Meaning222222222222222222222222222222222222222222222222

Content-Length Size of item in octetsContent-Type Type of itemContent-Encoding Encoding used for itemContent-Language Language(s) used in item

Internetworking With TCP/IP vol 1 -- Part 27 14 2005

Page 737: internetworking tcpip

Example Of Header

Content-Length: 34Content-Language: englishContent-Encoding: ascii

<HTML> A trivial example. </HTML>

d Note: if length is not known in advance, server can informbrowser that connection will close following transfer

Connection: close

Internetworking With TCP/IP vol 1 -- Part 27 15 2005

Page 738: internetworking tcpip

Negotiation

d Either server or browser can initiate

d Items sent in headers

d Can specify representations that are acceptable withpreference value assigned to each

d Example

Accept: text/html, text/plain; q=0.5, text/x-dvi; q=0.8

Internetworking With TCP/IP vol 1 -- Part 27 16 2005

Page 739: internetworking tcpip

Items For Negotiation

Accept-Encoding:Accept-Charset:Accept-Language:

Internetworking With TCP/IP vol 1 -- Part 27 17 2005

Page 740: internetworking tcpip

Conditional Request

d Allows browser to check cached copy for freshness

d Eliminates useless latency

d Sends If-Modified-Since in header of GET request

d Example

If-Modified-Since: Wed, 31 Dec 2003 05:00:01 GMT

Internetworking With TCP/IP vol 1 -- Part 27 18 2005

Page 741: internetworking tcpip

Proxy Servers

d Browser can be configured to contact proxy

d Permits caching for entire organization

d Server can specify maximum number of proxies along path(including none)

Internetworking With TCP/IP vol 1 -- Part 27 19 2005

Page 742: internetworking tcpip

Caching Of Web Pages

d Caching essential to efficiency

d Server specifies

– Whether page can be cached

– Maximum time page can be kept

d Intermediate caches and browser cache web pages

d Browser can specify maximum age of page (forcesintermediate caches to revalidate)

Internetworking With TCP/IP vol 1 -- Part 27 20 2005

Page 743: internetworking tcpip

Summary

d Web is major application in the Internet

d Standard for representation is HTML

d Standard for transfer is HTTP

– Request-response protocol

– Header precedes item

– Version 1.1 permits persistent connections

– Server specifies length of time item can be cached

– Browser can issue conditional request to validate cacheditem

Internetworking With TCP/IP vol 1 -- Part 27 21 2005

Page 744: internetworking tcpip

Questions?

Page 745: internetworking tcpip

PART XXVIII

APPLICATIONS:VOICE AND VIDEO OVER IP

(VOIP, RTP, RSVP)

Internetworking With TCP/IP vol 1 -- Part 28 1 2005

Page 746: internetworking tcpip

TCP/IP Protocols

d Designed for data

d Can also handle voice and video

d Industry excited about Voice Over IP (VOIP)

Internetworking With TCP/IP vol 1 -- Part 28 2 2005

Page 747: internetworking tcpip

Representation

d Voice and video must be converted between analog anddigital forms

d Typical device is codec (coder / decoder)

d Example encoding used by phone system is Pulse CodeModulation (PCM)

– Note: 128 second audio clip encoded in PCM requiresone megabyte of memory

d Codec for voice, known as vocodec, attempts to recognizespeech rather than just waveforms

Internetworking With TCP/IP vol 1 -- Part 28 3 2005

Page 748: internetworking tcpip

Playback

d Internet introduces burstiness

d Jitter buffer used to smooth bursts

d Protocol support needed

Internetworking With TCP/IP vol 1 -- Part 28 4 2005

Page 749: internetworking tcpip

Requirements For Real-Time

Because an IP Internet is not isochronous, additional protocolsupport is required when sending digitized real-time data. Inaddition to basic sequence information that allows detection ofduplicate or reordered packets, each packet must carry aseparate timestamp that tells the receiver the exact time atwhich the data in the packet should be played.

Internetworking With TCP/IP vol 1 -- Part 28 5 2005

Page 750: internetworking tcpip

Illustration Of Jitter Buffer

K

items extractedat a fixed rate

items inserted ata variable rate

d Data arrives in bursts

d Data leaves at steady rate

Internetworking With TCP/IP vol 1 -- Part 28 6 2005

Page 751: internetworking tcpip

Real-Time Transport Protocol (RTP)

d Internet standard

d Provides playback timestamp along with data

d Allows receiver to playback items in sequence

Internetworking With TCP/IP vol 1 -- Part 28 7 2005

Page 752: internetworking tcpip

RTP Message Format

d Each message begins with same header

0 1 3 8 16 31

VER P X CC M PTYPE SEQUENCE NUM

TIMESTAMP

SYNCHRONIZATION SOURCE IDENTIFIER

CONTRIBUTING SOURCE ID

. . .

Internetworking With TCP/IP vol 1 -- Part 28 8 2005

Page 753: internetworking tcpip

Terminology And Layering

d Name implies that RTP is a transport-layer protocol

d In fact

– RTP is an application protocol

– RTP runs over UDP

Internetworking With TCP/IP vol 1 -- Part 28 9 2005

Page 754: internetworking tcpip

Mixing

d RTP can coordinate multiple data streams

d Intended for combined audio and video

d Up to 15 sources

d Header specifies mixing

Internetworking With TCP/IP vol 1 -- Part 28 10 2005

Page 755: internetworking tcpip

RTP Control Protocol (RTCP)

d Required part of RTP

d Allows sender and receiver to exchange information aboutsessions that are in progress

d Separate data stream

d Uses protocol port number one greater than port number ofdata stream

Internetworking With TCP/IP vol 1 -- Part 28 11 2005

Page 756: internetworking tcpip

RTCP Message Types

Type Meaning222222222222222222222222222222222222

200 Sender report201 Receiver report202 Source description message203 Bye message204 Application specific message

Internetworking With TCP/IP vol 1 -- Part 28 12 2005

Page 757: internetworking tcpip

RTCP Interaction

d Receivers generate receiver report messages

d Inform sender about reception and loss

d Senders generate sender report

d Provide absolute timestamp and relate real time to relativeplayback timestamp

Internetworking With TCP/IP vol 1 -- Part 28 13 2005

Page 758: internetworking tcpip

VOIP

d RTP used for encoding and transfer

d Also need signaling protocol for

– Dialing

– Answering a call

– Call forwarding

d Gateway used to connect IP telephone network to PublicSwitched Telephone Network (PSTN)

d PSTN uses SS7 for signaling

Internetworking With TCP/IP vol 1 -- Part 28 14 2005

Page 759: internetworking tcpip

Standards For IP Telephony

d H.323

d SIP

Internetworking With TCP/IP vol 1 -- Part 28 15 2005

Page 760: internetworking tcpip

H.323

d ITU standard

d Set of many protocols

d Major protocols specified by H.323 include

Protocol Purpose2222222222222222222222222222222222222222222222222222222

H.225.0 Signaling used to establish a callH.245 Control and feedback during the callRTP Real-time data transfer (sequence and timing)T.120 Exchange of data associated with a call

Internetworking With TCP/IP vol 1 -- Part 28 16 2005

Page 761: internetworking tcpip

How H.323 Protocols Fit Together

IP

UDP TCP

RTP

RTCP H.225Registr.

H.225Signaling

H.245Control

T.120Data

audio / video applications signaling and control

audiocodec

videocodec

dataapplications

Internetworking With TCP/IP vol 1 -- Part 28 17 2005

Page 762: internetworking tcpip

Session Initiation Protocol (SIP)

d IETF standard

d Alternative to H.323

– Less functionality

– Much smaller

d Permits SIP telephone to make call

d Does not require RTP for encoding

Internetworking With TCP/IP vol 1 -- Part 28 18 2005

Page 763: internetworking tcpip

Session Description Protocol (SDP)

d Companion to SIP

d Specifies details such as

– Media encoding

– Protocol port numbers

– Multicast addresses

Internetworking With TCP/IP vol 1 -- Part 28 19 2005

Page 764: internetworking tcpip

Quality Of Service (QoS)

d Statistical guarantee of performance

d Requires changes to underlying Internet infrastructure

d Proponents claim it is needed for telephony

d Others claim only larger bandwidth will solve the problem

Internetworking With TCP/IP vol 1 -- Part 28 20 2005

Page 765: internetworking tcpip

Resource ReSerVation Protocol (RSVP)

d IETF response to ATM

d End-to-end QoS guarantees

d Abstraction is unidirectional flow

d Initiated by endpoint

Internetworking With TCP/IP vol 1 -- Part 28 21 2005

Page 766: internetworking tcpip

RSVP Requests

An endpoint uses RSVP to request a simplex flow through an IPinternet with specified QoS bounds. If routers along the pathagree to honor the request, they approve it; otherwise, theydeny it. If an application needs QoS in two directions, eachendpoint must use RSVP to request a separate flow.

Internetworking With TCP/IP vol 1 -- Part 28 22 2005

Page 767: internetworking tcpip

Note About RSVP

d RSVP defines

– Messages endpoint sends to router to request QoS

– Messages routers send to other routers

– Replies

d RSVP does not specify how enforcement done

d Separate protocol needed

Internetworking With TCP/IP vol 1 -- Part 28 23 2005

Page 768: internetworking tcpip

Common Open Policy Services (COPS)

d Proposed enforcement protocol for RSVP

d Known as traffic policing

d Uses policy server

d Checks data sent on flow to ensure the flow does not exceedpreestablished bounds

Internetworking With TCP/IP vol 1 -- Part 28 24 2005

Page 769: internetworking tcpip

Summary

d Codec translates between analog and digital forms

d RTP used to transfer real-time data

d RTP adds timestamp that sender uses to determine playbacktime

d RTCP is companion protocol for RTP that senders andreceivers use to control and coordinate data transfer

d Voice Over IP uses

– RTP for digitized voice transfer

– SIP or H.323 for signaling

d RSVP and COPS provide quality of service guarantees

Internetworking With TCP/IP vol 1 -- Part 28 25 2005

Page 770: internetworking tcpip

Questions?

Page 771: internetworking tcpip

PART XXIX

APPLICATIONS:INTERNET MANAGEMENT

(SNMP)

Internetworking With TCP/IP vol 1 -- Part 29 1 2005

Page 772: internetworking tcpip

Management Protocols

d Early network systems used two approaches

– Separate, parallel management network

– Link-level management commands

d TCP/IP pioneered running management protocols at theapplication layer

– Motivation: provide internet-wide capability instead ofsingle network capability

Internetworking With TCP/IP vol 1 -- Part 29 2 2005

Page 773: internetworking tcpip

The Point About Internet Management

In a TCP/IP internet, a manager needs to examine and controlrouters and other network devices. Because such devices attachto arbitrary networks, protocols for internet managementoperate at the application level and communicate using TCP/IPtransport-level protocols.

Internetworking With TCP/IP vol 1 -- Part 29 3 2005

Page 774: internetworking tcpip

Architectural Model

MA

MA

MA

MAMA

MC

MA

MA

Devices being managed

Manager’s Host

Router being managed

Other devices

Internetworking With TCP/IP vol 1 -- Part 29 4 2005

Page 775: internetworking tcpip

Terminology

d Agent

– Runs on arbitrary system (e.g., a router)

– Responds to manager’s requests

d Management software

– Runs on manager’s workstation

– Sends requests to agents as directed by the manager

Internetworking With TCP/IP vol 1 -- Part 29 5 2005

Page 776: internetworking tcpip

TCP/IP Network Management Protocols

d Management Information Base (MIB)

d Structure Of Management Information (SMI)

d Simple Network Management Protocol (SNMP)

Internetworking With TCP/IP vol 1 -- Part 29 6 2005

Page 777: internetworking tcpip

Management Information Base (MIB)

d All management commands are encoded as fetch or storeoperations on ‘‘variables’’

d Example: to reboot, store a zero in a variable thatcorresponds to the time until reboot.

d A MIB is a set of variables and the semantics of fetch andstore on each

Internetworking With TCP/IP vol 1 -- Part 29 7 2005

Page 778: internetworking tcpip

MIB Categories

MIB category Includes Information About2222222222222222222222222222222222222222222222222222222222

system The host or router operating systeminterfaces Individual network interfaces

at Address translation (e.g., ARP mappings)ip Internet Protocol software

icmp Internet Control Message Protocol softwaretcp Transmission Control Protocol softwareudp User Datagram Protocol softwareospf Open Shortest Path First softwarebgp Border Gateway Protocol software

rmon Remote network monitoringrip-2 Routing Information Protocol softwaredns Domain Name System software

Internetworking With TCP/IP vol 1 -- Part 29 8 2005

Page 779: internetworking tcpip

Examples of MIB Variables

MIB Variable Category Meaning2222222222222222222222222222222222222222222222222222222222222222222222222

sysUpTime system Time since last rebootifNumber interfaces Number of network interfacesifMtu interfaces MTU for a particular interfaceipDefaultTTL ip Value IP uses in time-to-live fieldipInReceives ip Number of datagrams receivedipForwDatagrams ip Number of datagrams forwardedipOutNoRoutes ip Number of routing failuresipReasmOKs ip Number of datagrams reassembledipFragOKs ip Number of datagrams fragmentedipRoutingTable ip IP Routing tableicmpInEchos icmp Number of ICMP Echo Requests receivedtcpRtoMin tcp Minimum retransmission time TCP allowstcpMaxConn tcp Maximum TCP connections allowedtcpInSegs tcp Number of segments TCP has receivedudpInDatagrams udp Number of UDP datagrams received

Internetworking With TCP/IP vol 1 -- Part 29 9 2005

Page 780: internetworking tcpip

Structure of Management Information (SMI)

d Set of rules for defining MIB variable names

d Includes basic definitions such as

– Address (4-octet value)

– Counter (integer from 0 to 232 - 1)

d Specifies using Abstract Syntax Notation 1 (ASN.1)

Internetworking With TCP/IP vol 1 -- Part 29 10 2005

Page 781: internetworking tcpip

ASN.1

d ISO standard

d Specifies

– Syntax for names (user-readable format)

– Binary encoding (format used in a message)

d Absolute, global, hierarchical namespace

Internetworking With TCP/IP vol 1 -- Part 29 11 2005

Page 782: internetworking tcpip

Position of MIB In The ASN.1 Hierarchy

unnamed

itu2

iso1

joint-iso-itu

3

org3

dod6

internet1

mgmt2

directory1

experi-mental

3private

4

mib1

Internetworking With TCP/IP vol 1 -- Part 29 12 2005

Page 783: internetworking tcpip

Syntactic Form

d Variable name written as sequence of labels with dot (periodas delimiter)

d Numeric encoding used in messages

d Example: prefix for mgmt node is

1 . 3 . 6 . 1 . 2 . 1

Internetworking With TCP/IP vol 1 -- Part 29 13 2005

Page 784: internetworking tcpip

ASN.1 Hierarchy For TCP/IP

internet1

..

.

mgmt2

mib1

directory1

experi-mental

3private

4

system1

inter-faces

2

addr.trans.

3ip4

icmp5

tcp6

udp7

label from the root tothis point is 1 . 3 . 6

Internetworking With TCP/IP vol 1 -- Part 29 14 2005

Page 785: internetworking tcpip

Example MIB Variables

d Prefix for variable ipInReceives is

iso . org . dod . internet . mgmt . mib . ip . ipInReceives

d Numeric value is

1 . 3 . 6 . 1 . 2 . 1 . 4 . 3

Internetworking With TCP/IP vol 1 -- Part 29 15 2005

Page 786: internetworking tcpip

MIB Tables

d Correspond to data structures programmers think of asarrays or structs

d ASN.1 definition uses keyword SEQUENCE

d Array index is appended to MIB variable name

Internetworking With TCP/IP vol 1 -- Part 29 16 2005

Page 787: internetworking tcpip

Example Of SEQUENCE Definition

IpAddrEntry ::= SEQUENCE {ipAdEntAddr

IpAddress,ipAdEntIfIndex

INTEGER,ipAdEntNetMask

IpAddress,ipAdEntBcastAddr

IpAddress,ipAdEntReasmMaxSize

INTEGER (0..65535)}

Internetworking With TCP/IP vol 1 -- Part 29 17 2005

Page 788: internetworking tcpip

Simple Network Management Protocol (SNMP)

d Specifies communication between manager’s workstationand managed entity

d Uses fetch-store paradigm

Internetworking With TCP/IP vol 1 -- Part 29 18 2005

Page 789: internetworking tcpip

Operations That SNMP Supports

Command Meaning222222222222222222222222222222222222222222222222222222222222222

get-request Fetch a value from a specific variableget-next-request Fetch a value without knowing its exact nameget-bulk-request Fetch a large volume of data (e.g., a table)response A response to any of the above requestsset-request Store a value in a specific variableinform-request Reference to third-part data (e.g., for a proxy)snmpv2-trap Reply triggered by an eventreport Undefined at present

Internetworking With TCP/IP vol 1 -- Part 29 19 2005

Page 790: internetworking tcpip

SNMP Message Format

d Defined using ASN.1 notation

d Similar to BNF grammar

Internetworking With TCP/IP vol 1 -- Part 29 20 2005

Page 791: internetworking tcpip

Example ASN.1 Definition

SNMPv3Message ::=SEQUENCE {

msgVersion INTEGER (0..2147483647),-- note: version number 3 is used for SNMPv3

msgGlobalData HeaderData,msgSecurityParameters OCTET STRING,msgData ScopedPduData

}

Internetworking With TCP/IP vol 1 -- Part 29 21 2005

Page 792: internetworking tcpip

Definition Of HeaderData Area In SNMP Message

HeaderData ::= SEQUENCE {msgID INTEGER (0..2147483647),

-- used to match responses with requestsmsgMaxSize INTEGER (484..2147483647),

-- maximum size reply the sender can acceptmsgFlags OCTET STRING (SIZE(1)),

-- Individual flag bits specify message characteristics-- bit 7 authorization used-- bit 6 privacy used-- bit 5 reportability (i.e., a response needed)

msgSecurityModel INTEGER (1..2147483647)-- determines exact format of security parameters that follow

}

Internetworking With TCP/IP vol 1 -- Part 29 22 2005

Page 793: internetworking tcpip

Discriminated Union

d ASN.1 uses CHOICE keyword for a discriminated union

d Example

ScopedPduData ::= CHOICE {plaintext ScopedPDU,encryptedPDU OCTET STRING -- encrypted ScopedPDU value

}

Internetworking With TCP/IP vol 1 -- Part 29 23 2005

Page 794: internetworking tcpip

Summary

d TCP/IP management protocols reside at application layer

d Management Information Base (MIB) specifies set ofvariables that can be accessed

d Structure Of Management Information (SMI) specifies rulesfor naming MIB variables

d Simple Network Management Protocol (SNMP) specifiesformat of messages that pass between a manager’sworkstation and managed entity

d Variables named using ASN.1 (absolute, global,hierarchical)

d Message format defined with ASN.1 (similar to BNFgrammar)

Internetworking With TCP/IP vol 1 -- Part 29 24 2005

Page 795: internetworking tcpip

Questions?

Page 796: internetworking tcpip

PART XXX

INTERNET SECURITYAND FIREWALL DESIGN

(IPsec, SSL)

Internetworking With TCP/IP vol 1 -- Part 30 1 2005

Page 797: internetworking tcpip

Network Security

d Refers in broad sense to confidence that information andservices available on a network cannot be accessed byunauthorized users

d Implies

– Safety

– Freedom from unauthorized access or use

– Freedom from snooping or wiretapping

– Freedom from disruption of service

– Assurance that outsiders cannot change data

d Also called information security

Internetworking With TCP/IP vol 1 -- Part 30 2 2005

Page 798: internetworking tcpip

A Crucial Point

Just as no physical property is absolutely secure against crime,no network is completely secure.

Internetworking With TCP/IP vol 1 -- Part 30 3 2005

Page 799: internetworking tcpip

Aspects Of Protection

d Data integrity

d Data availability

d Privacy or confidentiality

d Authorization

d Authentication

d Replay avoidance

Internetworking With TCP/IP vol 1 -- Part 30 4 2005

Page 800: internetworking tcpip

Information Policy

d Defines what is allowed

d Special note:

Humans are usually the most susceptible point in any securityscheme. A worker who is malicious, careless, or unaware of anorganization’s information policy can compromise the bestsecurity.

Internetworking With TCP/IP vol 1 -- Part 30 5 2005

Page 801: internetworking tcpip

Internet Security

d Especially difficult

d Data travels across many networks owned by many groupsfrom source to destination

d Computers in the middle can change data

Internetworking With TCP/IP vol 1 -- Part 30 6 2005

Page 802: internetworking tcpip

A Point About Authentication

An authorization scheme that uses a remote machine’s IPaddress to authenticate its identity does not suffice in anunsecure internet. An imposter who gains control of anintermediate router can obtain access by impersonating anauthorized client.

Internetworking With TCP/IP vol 1 -- Part 30 7 2005

Page 803: internetworking tcpip

Two Basic Techniques For Internet Security

d Encryption

d Perimeter Security

Internetworking With TCP/IP vol 1 -- Part 30 8 2005

Page 804: internetworking tcpip

IP Security Protocol (IPsec)

d Devised by IETF

d Actually a set of protocols

d Name IPsec applies collectively

d Works with IPv4 or IPv6

d Gives framework, but does not specify exactly whichencryption or authentication algorithms to use

d Choice between authentication and encryption

Internetworking With TCP/IP vol 1 -- Part 30 9 2005

Page 805: internetworking tcpip

IPsec Authentication Header (AH)

d Not an IP option

d Added after IP header

d Follows IPv6 format (more on IPv6 later in the course)

Internetworking With TCP/IP vol 1 -- Part 30 10 2005

Page 806: internetworking tcpip

Illustration of Authentication Header Insertion

IPv4HEADER

TCPHEADER

TCPDATA

IPv4HEADER

AUTHENTICATIONHEADER

TCPHEADER

TCPDATA

(a)

(b)

d (a) shows datagram and (b) shows same datagram afterheader has been inserted

Internetworking With TCP/IP vol 1 -- Part 30 11 2005

Page 807: internetworking tcpip

Type Information

d IPv4 PROTOCOL field is modified so the type is IPsec

d Authentication header contains NEXT HEADER field thatspecifies original type

Internetworking With TCP/IP vol 1 -- Part 30 12 2005

Page 808: internetworking tcpip

Illustration Of Type InformationWith Authentication

0 8 16 31

NEXT HEADER PAYLOAD LEN RESERVED

SECURITY PARAMETERS INDEX

SEQUENCE NUMBER

AUTHENTICATION DATA (VARIABLE). . .

Internetworking With TCP/IP vol 1 -- Part 30 13 2005

Page 809: internetworking tcpip

Security Association

d Not all information related to security can fit in header

d Sender and receiver communicate, agree on securityparameters, assign small index to each parameter, and thenuse index values in headers

Internetworking With TCP/IP vol 1 -- Part 30 14 2005

Page 810: internetworking tcpip

IPsec Encapsulating Security Payload (ESP)

d Used to encrypt packet contents

d More complex than authentication header

Internetworking With TCP/IP vol 1 -- Part 30 15 2005

Page 811: internetworking tcpip

Illustration Of ESP

IPv4HEADER

TCPHEADER

TCPDATA

IPv4HEADER

ESPHEADER

TCPHEADER

TCPDATA

ESPTRAILER

ESPAUTH

(a)

(b)

encryptedauthenticated

Internetworking With TCP/IP vol 1 -- Part 30 16 2005

Page 812: internetworking tcpip

ESP Header

0 16 31

SECURITY PARAMETERS INDEX

SEQUENCE NUMBER

d Eight octets

d Precedes payload

Internetworking With TCP/IP vol 1 -- Part 30 17 2005

Page 813: internetworking tcpip

ESP Trailer

0 16 24 31

0 - 255 OCTETS OF PADDING PAD LENGTH NEXT HEADER

ESP AUTHENTICATION DATA (VARIABLE). . .

d Authentication data variable size

d Padding optional

Internetworking With TCP/IP vol 1 -- Part 30 18 2005

Page 814: internetworking tcpip

Mutable Header Fields

d Some IP header fields change (e.g., TTL)

d IPsec designed to ensure end-to-end integrity

d One possibility: IPsec tunneling

– Place IPsec datagram inside normal datagram

– Often used in VPNs

Internetworking With TCP/IP vol 1 -- Part 30 19 2005

Page 815: internetworking tcpip

Illustration Of IPsec Tunneling

OUTER IPHEADER

AUTHENTICATIONHEADER

INNER IP DATAGRAM(INCLUDING IP HEADER)

OUTER IPHEADER

ESPHEADER

INNER IP DATAGRAM(INCLUDING IP HEADER)

ESPTRAILER

ESPAUTH

encryptedauthenticated

(a)

(b)

d (a) when used with authentication

d (b) when used with encapsulated security payload

Internetworking With TCP/IP vol 1 -- Part 30 20 2005

Page 816: internetworking tcpip

Mandatory Security Algorithms For IPsec

Authentication22222222222222222222222222222222222222

HMAC with MD5 RFC 2403HMAC with SHA-1 RFC 2404

Encapsulating Security Payload22222222222222222222222222222222222222

DES in CBC mode RFC 2405HMAC with MD5 RFC 2403HMAC with SHA-1 RFC 2404Null AuthenticationNull Encryption

Internetworking With TCP/IP vol 1 -- Part 30 21 2005

Page 817: internetworking tcpip

Secure Sockets Layer (SS)

d Created by Netscape, Inc.

d Widely used

d Not formally adopted by IETF

d Same API as sockets

d Provides authentication and encryption

d De facto standard for web browsers

Internetworking With TCP/IP vol 1 -- Part 30 22 2005

Page 818: internetworking tcpip

Transport Layer Security (TLS)

d Created by IETF

d So closely related to SSL that the same protocol port is used

d Most implementations of SSL also support TLS

Internetworking With TCP/IP vol 1 -- Part 30 23 2005

Page 819: internetworking tcpip

Perimeter Security

d Form of access control

d Mechanism is Internet firewall

d Firewall placed at each connection between site and rest ofInternet

d All firewalls use coordinated policy

d Blocks unwanted packets

Internetworking With TCP/IP vol 1 -- Part 30 24 2005

Page 820: internetworking tcpip

Firewall Implementation

d Basic technique is packet filter

d Typically runs in a router

d Manager specifies restrictions on incoming packets

d Filter drops packets that are not allowed

Internetworking With TCP/IP vol 1 -- Part 30 25 2005

Page 821: internetworking tcpip

Illustration Of Packet Filter

R 12 INSIDEOUTSIDE

ARRIVES ON IP IP SOURCE DEST.INTERFACE SOURCE DEST. PROTOCOL PORT PORT222222222222222222222222222222222222222222222222222222222222222222222222222

2 * * TCP * 212 * * TCP * 231 128.5.0.0 / 16 * TCP * 252 * * UDP * 432 * * UDP * 692 * * TCP * 79

Internetworking With TCP/IP vol 1 -- Part 30 26 2005

Page 822: internetworking tcpip

Effective Filtering

To be effective, a firewall that uses datagram filtering shouldrestrict access to all IP sources, IP destinations, protocols, andprotocol ports except those computers, networks, and servicesthe organization explicitly decides to make available externally.A packet filter that allows a manager to specify whichdatagrams to admit instead of which datagrams to block canmake such restrictions easy to specify.

Internetworking With TCP/IP vol 1 -- Part 30 27 2005

Page 823: internetworking tcpip

Consequences Of A Restrictive Filter

If an organization’s firewall restricts incoming datagramsexcept for ports that correspond to services the organizationmakes available externally, an arbitrary application inside theorganization cannot become a client of a server outside theorganization.

Internetworking With TCP/IP vol 1 -- Part 30 28 2005

Page 824: internetworking tcpip

Proxy Access

d Allows specific clients to access specific services

d Handles problems like virus detection on incoming files

d Uses bastion host

Internetworking With TCP/IP vol 1 -- Part 30 29 2005

Page 825: internetworking tcpip

Illustration Of Proxy Access

GLOBALINTERNET(OUTSIDE)

INTRANET(INSIDE)

bastion host

manually enabledbypass

d Two firewall filters restrict

– Incoming packets from Internet to proxy

– Outgoing packets from site to proxy

Internetworking With TCP/IP vol 1 -- Part 30 30 2005

Page 826: internetworking tcpip

Stateful Firewalls

d Allow clients inside an organization to contact servers in theInternet

d Firewall

– Watches outgoing packets

– Records source and destination information

– Uses recorded information when admitting packets

d Communication still subject to policies

Internetworking With TCP/IP vol 1 -- Part 30 31 2005

Page 827: internetworking tcpip

Managing Firewall State

d Connection tracking

– Uses FIN to remove state for TCP connection

– Does not work well with UDP

d Soft state

– Timer set when entry created

– Idle entry removed after timeout

Internetworking With TCP/IP vol 1 -- Part 30 32 2005

Page 828: internetworking tcpip

Content Protection With Proxies

d Firewall only operates at packet level

d Mechanism known as application proxy protects againstincoming

– Viruses

– Other illicit content

d Proxy can examine entire content (e.g., mail message)

Internetworking With TCP/IP vol 1 -- Part 30 33 2005

Page 829: internetworking tcpip

Summary

d Two basic techniques used for Internet security

– Encryption

– Perimeter security

d IETF has defined IPsec as a framework for security

d IPsec offers choice of

– Authentication header (AH)

– Encapsulated Security Payload (ESP)

Internetworking With TCP/IP vol 1 -- Part 30 34 2005

Page 830: internetworking tcpip

Summary(continued)

d Firewall is mechanism used for perimeter security

d Packet filter specified by manager

d Firewall rejects packets except those explicitly allowed

d Stateful firewall allows clients in organization to initiatecommunication

d Application proxy can be used to check content

Internetworking With TCP/IP vol 1 -- Part 30 35 2005

Page 831: internetworking tcpip

Questions?

Page 832: internetworking tcpip

PART XXXI

THE FUTURE OF TCP/IP(IPv6)

Internetworking With TCP/IP vol 1 -- Part 31 1 2005

Page 833: internetworking tcpip

Current Version

d TCP/IP has worked well for over 25 years

d Design is flexible and powerful

d Has adapted to

– New computer and communication technologies

– New applications

– Increases in size and load

Internetworking With TCP/IP vol 1 -- Part 31 2 2005

Page 834: internetworking tcpip

Most Significant Technical Problem

d Address space limitation

d IPv4 address space may be exhausted by the year 2020

Internetworking With TCP/IP vol 1 -- Part 31 3 2005

Page 835: internetworking tcpip

History Of The New Version

d Developed by IETF

d Started in early 1990s

d Input from many groups, including: computermanufacturers, hardware and software vendors, users,managers, programmers, telephone companies, and the cabletelevision industry

Internetworking With TCP/IP vol 1 -- Part 31 4 2005

Page 836: internetworking tcpip

History Of The New Version(continued)

d Three main proposals

d Eventually new version emerged

d Assigned version number 6, and known as IPv6

d RFC in 1994

d Defined over 10 years ago!

Internetworking With TCP/IP vol 1 -- Part 31 5 2005

Page 837: internetworking tcpip

Major Changes From IPv4

d Larger addresses

d Extended address hierarchy

d Variable header format

d Facilities for many options

d Provision for protocol extension

d Support for autoconfiguration and renumbering

d Support for resource allocation

Internetworking With TCP/IP vol 1 -- Part 31 6 2005

Page 838: internetworking tcpip

IPv6 Address Size

d 128 bits per address

d Absurd increase in capacity

d IPv6 has 1024 addresses per square meter of the Earth’ssurface!

Internetworking With TCP/IP vol 1 -- Part 31 7 2005

Page 839: internetworking tcpip

General Form Of IPv6 Datagram

DATA . . .Base

HeaderExtensionHeader 1

. . .ExtensionHeader N

optional

d Base header required

d Extension headers optional

Internetworking With TCP/IP vol 1 -- Part 31 8 2005

Page 840: internetworking tcpip

IPv6 Base Header Format

0 4 12 16 24 31

VERS TRAFFIC CLASS FLOW LABEL

PAYLOAD LENGTH NEXT HEADER HOP LIMIT

SOURCE ADDRESS

DESTINATION ADDRESS

d Alignment is on 64-bit multiples

d Fragmentation in extension header

d Flow label intended for resource reservation

Internetworking With TCP/IP vol 1 -- Part 31 9 2005

Page 841: internetworking tcpip

Size Of Base Header

Each IPv6 datagram begins with a 40-octet base header thatincludes fields for the source and destination addresses, themaximum hop limit, the traffic class, the flow label, and thetype of the next header. Thus, an IPv6 datagram must containat least 40 octets in addition to the data.

Internetworking With TCP/IP vol 1 -- Part 31 10 2005

Page 842: internetworking tcpip

IPv6 Extension Headers

d Sender chooses zero or more extension headers

d Only those facilities that are needed should be included

Internetworking With TCP/IP vol 1 -- Part 31 11 2005

Page 843: internetworking tcpip

Parsing An IPv6 Datagram

Base Header

NEXT=TCPTCP Segment

Base Header

NEXT=ROUTE

Route Header

NEXT=TCPTCP Segment

Base Header

NEXT=ROUTE

Route Header

NEXT=AUTH

Auth Header

NEXT=TCPTCP Segment

(a)

(b)

(c)

d Each header includes NEXT HEADER field

d NEXT HEADER operates like type field

Internetworking With TCP/IP vol 1 -- Part 31 12 2005

Page 844: internetworking tcpip

IPv6 Fragmentation And Reassembly

d Like IPv4

– Ultimate destination reassembles

d Unlike IPv4

– Routers avoid fragmentation

– Original source must fragment

Internetworking With TCP/IP vol 1 -- Part 31 13 2005

Page 845: internetworking tcpip

How Can Original Source Fragment?

d Option 1: choose minimum guaranteed MTU of 1280

d Option 2: use path MTU discovery

Internetworking With TCP/IP vol 1 -- Part 31 14 2005

Page 846: internetworking tcpip

Path MTU Discovery

d Guessing game

d Source sends datagram without fragmenting

d If router cannot forward, router sends back ICMP errormessage

d Source tries smaller MTU

Internetworking With TCP/IP vol 1 -- Part 31 15 2005

Page 847: internetworking tcpip

Fragmentation Details

0 8 16 29 31

NEXT HEADER RESERVED FRAG. OFFSET RS M

DATAGRAM IDENTIFICATION

d Fragmentation information carried in extension header

Internetworking With TCP/IP vol 1 -- Part 31 16 2005

Page 848: internetworking tcpip

Discussion Questions

d Is fragmentation desirable?

d What are the consequences of the IPv6 design?

Internetworking With TCP/IP vol 1 -- Part 31 17 2005

Page 849: internetworking tcpip

IPv6 Colon Hexadecimal Notation

d Replaces dotted decimal

d Example: dotted decimal value

104.230.140.100.255.255.255.255.0.0.17.128.150.10.255.255

d Becomes

68E6:8C64:FFFF:FFFF:0:1180:96A:FFFF

Internetworking With TCP/IP vol 1 -- Part 31 18 2005

Page 850: internetworking tcpip

Zero Compression

d Successive zeroes are indicated by a pair of colons

d Example

FF05:0:0:0:0:0:0:B3

d Becomes

FF05::B3

Internetworking With TCP/IP vol 1 -- Part 31 19 2005

Page 851: internetworking tcpip

IPv6 Destination Addresses

d Three types

– Unicast (single host receives copy)

– Multicast (set of hosts each receive a copy)

– Anycast (set of hosts, one of which receives a copy)

d Note: no broadcast (but special multicast addresses (e.g.,‘‘all hosts on local wire’’)

Internetworking With TCP/IP vol 1 -- Part 31 20 2005

Page 852: internetworking tcpip

Proposed IPv6 Address Space

Binary Prefix Type Of Address Part Of Address Space222222222222222222222222222222222222222222222222222222222222222222222222222222222222

0000 0000 Reserved (IPv4 compatibility) 1/2560000 0001 Unassigned 1/256

0000 001 NSAP Addresses 1/128

0000 01 Unassigned 1/640000 1 Unassigned 1/320001 Unassigned 1/16

001 Global Unicast 1/8010 Unassigned 1/8011 Unassigned 1/8100 Unassigned 1/8101 Unassigned 1/8110 Unassigned 1/8

1110 Unassigned 1/161111 0 Unassigned 1/321111 10 Unassigned 1/641111 110 Unassigned 1/1281111 1110 0 Unassigned 1/512

1111 1110 10 Link-Local Unicast Addresses 1/10241111 1110 11 IANA - Reserved 1/10241111 1111 Multicast Addresses 1/256

Internetworking With TCP/IP vol 1 -- Part 31 21 2005

Page 853: internetworking tcpip

Backward Compatibility

d Subset of IPv6 addresses encode IPv4 addresses

d Dotted hex notation can end with 4 octets in dotted decimal

80 zero bits 16 bits 32 bits

0000 . . . . . . . . . . . . . . . . . . 0000 0000 IPv4 Address

0000 . . . . . . . . . . . . . . . . . . 0000 FFFF IPv4 Address

Internetworking With TCP/IP vol 1 -- Part 31 22 2005

Page 854: internetworking tcpip

Myths About IPv6According To Geoff Huston

d IPv6 is

– More secure

– Required for mobility

– Better for wireless networks

d IPv6 offers better QoS

d Only IPv6 supports auto-configuration

d IPv6 solves route scaling

Internetworking With TCP/IP vol 1 -- Part 31 23 2005

Page 855: internetworking tcpip

Myths About IPv6According To Geoff Huston

(continued)

d IPv6 provides better support for

– Rapid prefix renumbering

– Multihomed sites

d IPv4 has run out of addresses

Source: G. Huston, ‘‘The Mythology Of IP Version 6,’’ The InternetProtocol Journal vol. 6:2 (June, 2003)

Internetworking With TCP/IP vol 1 -- Part 31 23 2005

Page 856: internetworking tcpip

Summary

d IETF has defined next version of IP to be IPv6

d Addresses are 128 bits long

d Datagram starts with base header followed by zero or moreextension headers

d Sender performs fragmentation

d Many myths abound about the advantages of IPv6

d No strong technical motivation for change

Internetworking With TCP/IP vol 1 -- Part 31 23 2005

Page 857: internetworking tcpip

Questions?

Page 858: internetworking tcpip

STOP