Chapter 3 TCP and IP
2
Introduction
Transmission Control Protocol (TCP)
User Datagram Protocol (UDP)
Internet Protocol (IP)
IPv6
Chapter 3 TCP and IP
3
TCP
RFC 793, RFC 1122
Outgoing data is logically a stream of
octets from user
Stream broken into blocks of data, or
segments
TCP accumulates octets from user until
segment is large enough, or data marked
with PUSH flag
User can mark data as URGENT
Chapter 3 TCP and IP
4
Similarly, incoming data is a stream of
octets presented to user
Data marked with PUSH flag triggers
delivery of data to user, otherwise TCP
decides when to deliver data
Data marked with URGENT flag causes
user to be signaled
Chapter 3 TCP and IP
5
Checksum Field
Applied to data segment and part of the
header (Pseudo header). The pseudo
header includes the source and destination
IP addresses, protocol and segment length
fields from the IP header. TCP protects
itself from mis-delivery by IP.
Protects against bit errors in user data and
addressing information
Filled in at source
Checked at destination
Chapter 3 TCP and IP
6
Options
Maximumsegmentsize–definedinRFC793–
itspecifiesthemaximumsegmentsizeinoctets
thatwillbeacceptedinthisconnection.16-bit
andcanonlybeusedintheinitialconnection
requestsegments.
Windowscalefactor–ThevalueofFin2
F
,
wherethevalueofthewindowfieldis
multiplied.MaxvalueofFis14andthisoption
isonlyusedintheinitialconnectionrequest
segments.
Timestamp
Chapter 3 TCP and IP
7
Figure 2.1
Some of the Fields
Sequence Number (32 bits) –sequence number of the first data
octet in this segment except when SYN flag is set. If set this
field is ISN + 1 –ISN and the first data octet.
Data offset (4 bits) –number of 32-bit words in the header.
Window (16 bit) –Flow control credit allocation, in octets.
Contains the number of data octets beginning with the one
indicated in the ACK field that the sender is willing to accept.
Flags (6 bits) –URG, ACK, PSH, RST, SYN and FIN.
Urgent Pointer (16 bits) –points to the last octet in a sequence
of urgent data. This allows the receiver to know how much
urgent data is coming.
Chapter 3 TCP and IP
8
Chapter 3 TCP and IP
9
UDP
RFC 768
Connectionless, unreliable
Less overhead
Simply adds port addressing to IP
Checksum is optional
Chapter 3 TCP and IP
10
Appropriate Uses of UDP
Inward data collection –as in sensor ntks
Outward data dissemination –broadcast
message to users.
Request-response –when applications
control the transaction service.
Real-time applications –in voice and
telemetry.
Chapter 3 TCP and IP
11
IP
RFC 791
Field highlights:
–Type of service, defined in RFC 1349, see
Figure 3.1 –provides guidance to end-system
IP modules and to routers along the
datagram’s path.
–More bit
–Don’t fragment bit
–Time to live (similar to a hop count)
Chapter 3 TCP and IP
12
Figure 2.2
Chapter 3 TCP and IP
13
Figure 3.1
Chapter 3 TCP and IP
14
Fragmentation and Reassembly
Onlytwoofthe3bitsintheflagfieldarecurrentlydefined.
Themorebitandthedon’tfragmentbit.
Networksmayhavedifferentmaximumpacketsize
Routermayneedtofragmentdatagramsbeforesendingtonext
network
Fragmentsmayneedfurtherfragmentinginlaternetworks
InIP,Reassemblyisdoneonlyatfinaldestinationsince
fragmentsmaytakedifferentroutes.
–Whatisthedisadvantageofthisscheme(pktscanonlygetsmalleras
datamovesthroughtheinternet).
–Whatdisadvantagesresultifintermediateroutersdothereassembly?
(largebuffersarerequiredatroutersandallfragmentsmustpass
throughthesamerouter)
Fragmentation and Reassembly
TheIPfragmentationtechniqueusesthefollowinginformationfromtheIP
header:
–Identification(ID),DataLength(differencebetweentotallengthandInternetheader
length),Fragmentoffset,MoreFlag
ThesourceendsystemcreatesadatagramwithaDataLengthequaltothe
entirelengthofthedatafield,withOffset=0,andaMoreFlagsetto0
(False)
Tofragmentalongdatagram,anIPmoduleinarouterperformsthe
followingtasks:
–Createtwonewdatagramsandcopytheheaderfieldsoftheincomingdatagramintoboth.
–Dividetheincominguserdatafieldintotwoapproximatelyequalportionsalonga64-bit
boundary,placingoneportionineachnewdatagram.Thefirstportionmustbeamultiple
of64bits.
–SettheDataLengthofthefirstnewdatagramtothelengthoftheinserteddata,andset
MoreFlagto1(true).TheOffsetfieldisunchanged.
–SettheDataLengthofthesecondnewdatagramtothelengthoftheinserteddata,and
addthelengthofthefirstdataportiondividedby8totheOffsetfield.TheMoreFlag
remainsthesame(inthiscasefalseiffragmentedtotwo).
Chapter 3 TCP and IP
15
Chapter 3 TCP and IP
16
Figure 3.2
Chapter 3 TCP and IP
17
Type of Service TOS Subfield
Set by source system –provides guidance
on selection of the next path for this
segment.
Routers may ignore TOS
Router may respond to requested TOS
value through:
–Route selection –IPv4 focuses here
–Subnetwork service
–Queuing discipline
TOS
When TOS routing is implemented, RFC 1812 specifies the ff rules for
forwarding a datagram with a nonzero TOS.
–The router determines all available routes to the destination; if there
are none, the datagram is discarded.
–If one or more routes have the same TOS as the requested TOS, then
the router chooses the route with the best metric based on its routing
algorithms.
–Otherwise, if one or more routes with a TOS=0 (normal service), then
the best of these routes is chosen.
–Otherwise, the router discards the datagram.
Under this set of rules, a router might discard a datagram even though a
route is available, because there is no route with either the same TOS or
normal service.
In practice, routing algorithms always support a TOS=0 route for any
reachable destination.
Chapter 3 TCP and IP
18
Chapter 3 TCP and IP
19
Table 3.1
Chapter 3 TCP and IP
20
Type of Service Precedence
Subfield
Indicates degree of urgency or priority to be
associated with a datagram.
Provides guidance about the relative allocation of
router resources for this datagram.
Like TOS subfield, may be ignored and there are
3 approaches to responding
Intended to affect queuing discipline at router
–Queue service
–Congestion control
Chapter 3 TCP and IP
21
IPv4 Options
Security
Source routing
Route recording
timestamping
Chapter 3 TCP and IP
22
IPv6
IPng turned to IPv6 standard in 1996.
Increase IP address from 32 bits to 128
Accommodate higher network speeds, mix
of data streams (graphics, video, audio)
Fixed size 40-octet header, followed by
optional extension headers
Longer header but fewer fields (8 vs 12),
so routers should have less processing
Chapter 3 TCP and IP
23
IPv6 Header
Version
Traffic class –to support various forms of differentiated
services.
Flow label –a flow is a sequence of pks sent from a
particular src to a particular dst for which the src desires
special handling by the intervening routers.
Payload length
Next header
Hop limit
Source address
Destination address
Chapter 3 TCP and IP
24
IPv6 Addresses
128 bits
Longer addresses can have structure that
assists routing
3 types:
–Unicast
–Anycast
–multicast
Chapter 3 TCP and IP
25
Figure 3.3
Chapter 3 TCP and IP
26
Optional Extension Headers
Hop-by-hop options
Routing –provides extended routing, like
src routing in IPv4.
Fragment
Authentication
Encapsulating security payload
Destination options