lecture 5, 20-755: the internet, summer 1999 1 20-755: the internet lecture 5: internetworking ii...

43
Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department of Electrical and Computer Engineering Carnegie Mellon University Institute for eCommerce, Summer 1999

Post on 20-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 1

20-755: The InternetLecture 5: Internetworking II

David O’Hallaron

School of Computer Science and

Department of Electrical and Computer Engineering

Carnegie Mellon University

Institute for eCommerce, Summer 1999

Page 2: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 2

Today’s lecture

• IP: Internetworking with routers (50 min)

• Break (10 min)

• UDP, TCP (35 min)

Page 3: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 3

Typical computer system

Local/IO BusLocal/IO Bus

MemoryMemory Networkadapter

Networkadapter

IDE diskcontroller

IDE diskcontroller

Videoadapter

Videoadapter

DisplayDisplay NetworkNetwork

ProcessorProcessor Interruptcontroller

Interruptcontroller

SCSIcontroller

SCSIcontroller

SCSI busSCSI bus

Serial port controller

Serial port controller

Parallel portcontroller

Parallel portcontroller

Keyboardcontroller

Keyboardcontroller

KeyboardKeyboard MouseMouse PrinterPrinterModemModem

disk

disk cdrom

Page 4: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 4

IP: Internetworking with routers

The “Hourglass Model”, Dave Clark, MIT

IP

Many different kinds of applications

andhigher-levelprotocols

Many differentkinds

of networks

• IP is the most successful protocol ever developed

• Keys to success:– simple enough to implement on top of

any physical network

» two tin cans and a string.

– rich enough to serve as the base for implementations of more complicated protocols and applications.

» The IP designers never dreamed of something like the Web.

– “rough consensus and working code”

» solid implementable specs.

Page 5: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 5

Internet protocol stack

Reliable byte streamdelivery(process-process)

Unreliablebest effort datagramdelivery(host-host)

Unreliablebest effortdatagramdelivery(process-process)

User application program (FTP, Telnet, WWW, email)User application program (FTP, Telnet, WWW, email)

User datagram protocol(UDP)

User datagram protocol(UDP)

Transmission control protocol (TCP)

Transmission control protocol (TCP)

Internet Protocol (IP)Internet Protocol (IP)

Network interface (ethernet)Network interface (ethernet)

hardwarehardware Physical connection

Berkeley sockets interface

Page 6: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 6

IP service model

• IP service model:– Delivery model: IP provides best-effort delivery of datagram

(connectionless) packets between two hosts.

» IP tries but doesn’t guarantee that packets will arrive (best effort)

» packets can be lost or duplicated (unreliable)

» ordering of datagrams not guaranteed (connectionless)

– Naming scheme: IP provides a unique address (name) for each host in the Internet.

• Why would such a limited delivery model be useful?

– simple, so it runs on any kind of network

– provides a basis for building more sophisticated and user-friendly protocols like TCP and UDP

Page 7: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 7

IP datagram delivery: Example internet

R1R2

H1 H2 H3

Network 3 (FDDI)

H4 H5 H6

H7 H8R3Network 2(Ethernet) Network 4

(Point-to-point)

Network 1 (Ethernet)

Page 8: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 8

IP layering

IP

TCP

ETH

IP

ETH FDDI

IP

FDDI P2P

IP

P2P ETH

IP

TCP

ETH

Protocol layers used to connect host H1 to host H8 in example internet.

H1 R1 R2 R3 H8

Page 9: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 9

Encapsulating IP datagrams in Ethernet

Ethernet frameheader

Ethernet frameheader

IP datagramheader

IP datagramheader IP datagram dataIP datagram data

IP datagramheader

IP datagramheader IP datagram dataIP datagram data

IP datagram

Ethernet frame

The same idea is used for other types of physical networks

Page 10: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 10

Ver Hlen

IP packet format

VER IP versionHL Header length (in 32-bit words)TOS Type of service (unused)Length Datagram length (max 64K B) ID Unique datagram identifierFlags xxM (more fragmented packets)Offset Fragment offsetTTL Time to LiveProtocol Higher level protocol (e.g., TCP)

TOS Length

Datagram ID Flags

TTL Protocol Checksum

Source IP address

Destination IP address

Options (variable)

Offset

Data

0 4 8 16 19 31

Page 11: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 11

Fragmentation and reassembly

• Different networks types have different maximum transfer units (MTU).

• A problem can occur if packet is routed onto network with a smaller MTU.

– e.g. FDDI (4,500B) onto Ethernet (1,500B)

• Solution: break packet into smaller fragments.– each fragment has identifier and sequence number

• Destination reassembles packet before handing it up in the stack.

– alternative would be to reassemble when entering network with larger MTU

• Sender can disable fragmentation using flag.

Page 12: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 12

Fragmentation example

IP

TCP

ETH

IP

ETH FDDI

IP

FDDI P2P

IP

P2P ETH

IP

TCP

ETH

H1 R1 R2 R3 H8

ETH IP 1400 FDDI IP 1400 P2P IP 512

P2P IP 512

P2P IP 376

ETH IP 512

ETH IP 512

ETH IP 376

MTU=1500 MTU=4500 MTU=532 MTU=1500

Page 13: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 13

Fragmentation example (cont)

start of header

ident=x m=1 offset=0

rest of header

512 data bytes

start of header

ident=x m=1 offset=512

rest of header

512 data bytes

start of header

ident=x m=0 offset=1024

rest of header

376 data bytes

First packet

Second packet

Third packet

Page 14: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 14

Internet addresses

• Each host h has a physical address P(h) and a unique IP address I(h).

• IP addresses contain a network part and a host part:

0 1 2 8 16 24

network(7) host (24)0

31

network (14) host (16)1 0

network (21) host (8)1 1 0

Class A (128 nets, 16 M hosts/net)

Class B (16 K nets, 65 K hosts/net)

Class C (2 M nets, 256 hosts/net)

3 classes of addresses:

Page 15: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 15

Example Internet addresses

0 1 2 3 4 8 16 24

network host0

31

network host1 0

network host1 1 0

Class A

Class B

Class C

Host IP Number Class Network

cs.cmu.edu 128.2.222.173 B 0x0002

cmu.edu 128.2.35.186 B 0x0000

cs.stanford.edu 171.64.64.64 B 0x2640

att.com 192.128.133.151 C 0x008085

Page 16: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 16

IP Datagram Forwarding

• Forwarding: the process of copying an input packet from an input port to an output port.

• Routing: the process of building the tables on each router that allow the correct output port to be determined (beyond our scope)

• Key points– Every IP datagram contains the IP address of the

destination.

– Network part of IP address uniquely identifies a single physical network.

– All hosts and routers with same network field in address are on the same physical network.

– Every physical network on the Internet has a router connected to at least one other physical network.

Page 17: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 17

IP Forwarding Algorithm

if (NetworkNum(S) == NetworkNum(D)) { deliver packet directly to D /* IP->physical mapping via ARP */else deliver packet to default router

NextHop = lookup(NetworkNum(D));if (NextHop is an interface) deliver packet directly to D using interface NextHop else if (NextHop != <undefined>) deliver packet to NextHop (a router) else deliver packet to default router

Forwarding table consists of (NetworkNum,NextHop) pairs

Algorithm for host S sending to host D:

Algorithm for router receiving packet for host D

Page 18: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 18

IP Forwarding example

R1 R2

H1 H2 H3

Network 3 (FDDI)

H4 H5 H6

H7 H8R3Network 2(Ethernet) Network 4

(Point-to-point)

Network 1 (Ethernet)

NetworkNum NextHop1 R32 R13 Interface 14 Interface 0

Router R2 forwardingtable

Page 19: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 19

ARP: Address resolution protocol

• Initially: – Hosts S and D on the same network with IP

addresses I(S) and I(D) and physical addresses P(S) and P(D).

• Problem: – Given I(D), host S wants to discover P(D).

• Solution: – Host S broadcasts triple (I(S), P(S), I(D),???)

on network.

– Host D (and only host D) responds with tuple (I(S), P(S), I(D), P(D))

– Both sender and receiver maintain a software cache of IP to physical mappings.

– Time out old entries

SS DD

(I(S), P(S), I(D), ???)

SS DD

(I(S), P(S), I(D), P(D))

Page 20: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 20

Subnetting

• Problem: IP addressing scheme makes inefficient use of addresses

• Partial solution: subnetting– physical network part of address identifies a “virtual” physical

network to the external world.

– use some of the high order “host” bits to identify local physical networks within the “virtual” physical network.

Class B address

Subnet mask (255.255.255.0)

Subnet number

&

=00000000111111111111111111111111

network number host number

xxxxxxxx xxxxxxxx xxxxxxxx 00000000

- All hosts on same physical network have same subnet number.- There is exactly one subnet mask per subnet.- All hosts on subnet configured with this mask (ifconfig)

Page 21: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 21

IP forwarding with subnetting

D1 = SubnetMask & destination IP addressif (D1 == MySubnetNum) deliver datagram directly to destinationelse deliver datagram to default router

Algorithm on a host:

for each forwarding table entry <SubnetNum,SubnetMask,NextHop> D1 = SubnetMask & destination IP address if (D1 == SubnetNum) if (NextHop is an interface) deliver datagram directly to destination else deliver datagram to NextHop (a router)

Algorithm on a router:

Page 22: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 22

Subnetting example

H1128.96.34.15

R1

128.96.34.1

128.96.34.130

R2

128.96.34.129

128.96.33.1

H3

128.96.33.14

H2

128.96.34.139

subnet mask: 255.255.255.128subnet number: 128.96.34.0

subnet mask: 255.255.255.128subnet number: 128.96.34.128

subnet mask: 255.255.255.0subnet number: 128.96.33.0

SubnetNum SubnetMask NextHop128.96.34.0 255.255.255.128interface 0128.96.34.128 255.255.255.128interface 1129.96.33.0 255.255.255.0 R2

forwardingtable for R1

Page 23: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 23

IPv6

• Also called Next Generation IP and IPng

• Extends address space from 32 bits to 128 bits

• Hierarchical address space:

010 registryID providerID SubscriberID SubnetID InterfaceID3

• neat feature– embedded InterfaceID allows host to assign itself an IP address!

48

Page 24: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 24

IPv6 packet format

Ver IP version (6)Pri/Flowlabel Quality of Service)PayloadLen packet len (max 64KB)NextHdr optional/encapsulated

header typeHopLimit same as TTL in IPv4Source Address 128-bit source addrDest Address 128-bit dest addr

Ver Pri FlowLabel

PayloadLen NextHdr

Source Address

HopLimit

Next header/data

4 8 16 24 31

Destination AddressOptional header examples:

fragmentation (44)authentication (51)TCP (6)

Page 25: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 25

Converting from IPv4 to IPv6

• Not possible to have a “flag day”

• Must upgrade incrementally– dual stack operation

» IPv6 nodes run both IPv4 and IPv6 protocol stacks

– IP tunneling

» IP packet sent as payload of another IP packet

» networking community’s version of indirection!

IPv4 networkIPv6

routerIPv6

routerIPV6

IPV6 IPV4 IPV6 IPV4

IPV6

Page 26: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 26

Break time!

Page 27: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 27

Today’s lecture

• IP: Internetworking with routers (50 min)

• Break (10 min)

• UDP, TCP (35 min)

Page 28: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 28

UDP: User datagram protocol

Reliable byte streamdelivery(process-process)

Unreliablebest effort datagramdelivery(host-host)

Unreliablebest effortdatagramdelivery(process-process)

User application program (FTP, Telnet, WWW, email)User application program (FTP, Telnet, WWW, email)

User datagram protocol(UDP)

User datagram protocol(UDP)

Transmission control protocol (TCP)

Transmission control protocol (TCP)

Internet Protocol (IP)Internet Protocol (IP)

Network interface (ethernet)Network interface (ethernet)

hardwarehardware Physical connection

Berkeley sockets interface

Page 29: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 29

UDP: User datagram protocol

• Extends IP to provide process-to-process (end-to-end) datagram delivery

• Mechanism for demultiplexing IP packets

• Based on port abstraction

• Process identified by <host, port> pair.

SrcPort DstPort

CheckSum Length

Data

Page 30: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 30

TCP: Transmission Control Protocol

Reliable byte streamdelivery(process-process)

Unreliablebest effort datagramdelivery(host-host)

Unreliablebest effortdatagramdelivery(process-process)

User application program (FTP, Telnet, WWW, email)User application program (FTP, Telnet, WWW, email)

User datagram protocol(UDP)

User datagram protocol(UDP)

Transmission control protocol (TCP)

Transmission control protocol (TCP)

Internet Protocol (IP)Internet Protocol (IP)

Network interface (ethernet)Network interface (ethernet)

hardwarehardware Physical connection

Berkeley sockets interface

Page 31: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 31

TCP: Transmission control protocol

• Uses IP to provide reliable process-to-process byte stream delivery.

– stream orientation

» sender transfers ordered stream of bytes; receiver gets identical stream

– virtual circuit connection

» stream transfer analogous to placing phone call

» sender initiates connection which must be accepted by receiver.

– buffered data transfer

» protocol software free to use arbitrary size transfer units

– unstructured streams

» stream is a sequence of bytes, just like Unix files

– full duplex

» concurrent transfers in both directions along a connection

Page 32: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 32

TCP functions

• Connections

• Sequence numbers

• Sliding window protocol

• Reliability and congestion control.

Source PortSource Port Dest. PortDest. Port

Sequence NumberSequence Number

AcknowledgmentAcknowledgment

Hlen/FlagsHlen/Flags WindowWindow

D. ChecksumD. Checksum Urgent PointerUrgent Pointer

Options..Options..

Page 33: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 33

Connections

• Connection is a fundamental TCP communication abstraction.

– data sent along a connection arrives in order

– implies allocation of resources (buffers) on hosts

• The endpoint of a connection is a pair of integers:– (IP address, port)

• A connection is defined by a pair of endpoints:– ((128.2.254.139, 1184), (128.10.2.3, 53))

connection(128.2.254.139, 1184) (128.10.2.3, 53)

Page 34: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 34

Sequence space

• Each stream split into a sequence of segments which are encapsulated in IP datagrams.

• Each byte in the byte stream is numbered.– 32 bit value

– wraps around

– initial values selected at runtime

• Each segment has a sequence number.– indicates the sequence number of its first byte

– Detects lost, duplicate or out of order segments

Page 35: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 35

TCP flow control mechanism:sliding window

• The purpose of flow control is to keep senders from flooding receivers with packets and filling up their memories.

• Often confused with congestion control, which tries to keep the senders from flooding the network with packets.

Page 36: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 36

Sliding window protocol (sender)

• Sender maintains a “window” of unacknowledged bytes that it is allowed to send, and a pointer to the last byte it sent:

current window

Bytes through 2 have been sent and acknowledged (and thus can be discarded)Bytes 3 -- 6 have been sent but not acknowledged (and thus must be buffered)Bytes 7 -- 9 have been not been sent but will be sent without delay.Bytes 10 and higher cannot be sent until the right edge of window moves.

byte stream1 2 3 4 5 6 7 8 9 10 11 ...

left rightcurr

Page 37: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 37

Sliding window protocol (receiver)

• Receiver acknowledges receipt of a segment with two pieces of information:

– ACK: the sequence number of the next byte in the contiguous stream it has already received

– WIN: amount of available buffer space.

• ACK indicates that data was received correctly.– sender can increment left edge of window

– sender can delete data to the left of the window.

• WIN indicates that more buffer space was freed up.– sender can increment the right edge of its window

– sender can transmit more data.

Page 38: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 38

Sliding window protocol (example)Sender Receiver

Application does 2K write

Application does 3K write

Senderis blocked

Sender may send up to 2K

2K, SEQ = 0

ACK=2K, WIN = 2K

Receiver’s buffer

empty

0 4K

2K

2K, SEQ =2K

4KACK=4K, WIN = 0

Application reads 2KACK=4K, WIN = 2K

2K

1K, SEQ =4K

2K1K

Page 39: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 39

Opening and closing connections

Host 1 Host 2

Application does a connect to a socket on Host 2

SYN, SEQ = J, WIN = 4K

ACK =J +1, SYN, SEQ = K, WIN = 4K

ACK = K+1,

J is the initial sequence number for messages from Host 1 to Host 2.K is the initial sequence number for messages from Host 2 to Host 1.SYN is the “synchronize” flag

The three way handshake

Application does a close on a connection

FIN, SEQ = M

FIN, SEQ = N

ACK = M+1

ACK = N+1

Host 2 replies with its own close.FIN is the “finish” flag

Page 40: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 40

Reliability and congestion control• Reliability:

– sender

» saves segments inside its window

» uses timeouts and sequence numbers in ACKS to detect lost segments.

» retransmit segments it thinks are lost

– receiver

» uses sequence numbers to assemble segments in order

» also to detect duplicate segments (how might this happen?)

• Congestion control– sender maintains separate separate congestion window

– uses smaller of the two windows

– uses “slow start” algorithm to adaptively set congestion window size.

Page 41: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 41

End-to-end data issues

• Presentation formatting– must account for different data formats on different

machines

» different byte orders

» different word sizes

• Compression– data can be compressed/decompressed on the endpoints

to save network bandwidth (beyond our scope)

• Encryption– sensitive data can be encrypted/unencrypted on the

endpoints.

• Authentication– Receivers may want to verify that messages really do

come from the sender.

Page 42: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 42

Key themes in IP internetworking

• Protocol layering– Way to structure complex system

– Handle different concerns at different layers

• Must cope with heterogeneous networks

• Must cope with huge scale

• Must cope with imperfect environment– Packets get corrupted and lost

• No one has complete routing table– Too many hosts

– Hosts continually being added and removed

– In the future, they will start moving around (mobile computing)

Page 43: Lecture 5, 20-755: The Internet, Summer 1999 1 20-755: The Internet Lecture 5: Internetworking II David O’Hallaron School of Computer Science and Department

Lecture 5, 20-755: The Internet, Summer 1999 43

Next time: Programming the global IP Internet

Reliable byte streamdelivery(process-process)

Unreliablebest effort datagramdelivery(host-host)

Unreliablebest effortdatagramdelivery(process-process)

User application program (FTP, Telnet, WWW, email)User application program (FTP, Telnet, WWW, email)

User datagram protocol(UDP)

User datagram protocol(UDP)

Transmission control protocol (TCP)

Transmission control protocol (TCP)

Internet Protocol (IP)Internet Protocol (IP)

Network interface (ethernet)Network interface (ethernet)

hardwarehardware Physical connection

Berkeley sockets interface