SlideShare a Scribd company logo
1 of 72
Lecture 1 1
Lecture 1: TCP/IP
TCP/IP
Layer Structure
IP
TCP
UDP
Lecture 1 2
Introduction
To achieve the global connectivity, ideally we
have a virtual global network to which every
machine can connect to.
However, in the real world, we do not have such
global network.
Many different networks with different technologies
and protocols are existed all over the world.
We called they are heterogeneous networks.
Lecture 1 3
Introduction
Alternative approach
We establish physical links and routers to connect
them together;
we apply the same higher level communication
protocol for each machine such that receivers can
understand the content of packets sent from senders.
Solution: TCP/IP
Lecture 1 4
TCP/IP Model
TCP/IP = Transmission
Control Protocol/Internet
Protocol.
Developed in 1970s by
the US Department of
Defense.
Application
Transport (TCP)
Internet (IP)
Link
Physical
Lecture 1 5
TCP/IP Model
Physical (Chapter 4)
Link (Chapter 5)
Internet (IP = Internet Protocol)
specify the format of the packets sent across the
Internet and the mechanisms used to forward packets
from a station through one or more routers to the
destination station.
Lecture 1 6
TCP/IP Model
Transport (TCP = Transmission Control
Protocol)
specify an end-to-end protocol for the reliable transfer
of data between two programs.
Application
specify how one application uses an Internet.
Lecture 1 7
TCP/IP Model
TH
IH
HH
Data
TCP Data
IP Data
H-to-N Data HT
Source
machine
Application
Transport (TCP)
Internet (IP)
Host-to-Network
Destination
machine
Application
Transport (TCP)
Internet (IP)
Host-to-Network
Lecture 1 8
IP
Internet Protocol
Main characteristics
Hierarchical addressing: IP address are 32 bits in
length and are used in the source and destination
address fields of the IP datagram.
Connectionless routing: each data packet is an
individual datagram to do the routing.
Lecture 1 9
IP Address
Dotted Decimal Notation
It is difficult for human being to read 32-bit IP
addresses in technical documents or through
application programs.
Thus IP addresses are written as four decimal
integers separated by decimal points, where each
integer gives the value of one octet of the IP address
(1 octet = 8 bits).
Lecture 1 10
IP Address
Example 1
10000000 00001010 00000010 00011110
is written as 128.10.2.30
Example 2
149.8.12.40 is written as
10010101 00001000 00001100 00101000
Lecture 1 11
Two components: network id. and host id.
Network id.: identifies the network;
Host id.: identifies the station (or host computer) on
that network (as identified by the network id.).
IP Address
IP address
Network id. Host id.
Lecture 1 12
IP Address
Trade off between the size of the network id.
field and that of the host id. field.
Larger network id. ⇒ larger possible number of
networks (in the Internet) with each network having
smaller number of hosts.
Larger host id. ⇒ larger number of hosts in a
network but the possible number of networks is
smaller.
To accommodate networks of different sizes, we
classified networks into 5 categories: A, B, C, D and
E.
Lecture 1 13
IP Address
0 Network Host
10 Network Host
110 Network Host
1110 Multicast address
11110 Reserved for future use
Class
A
B
C
D
E
32 bits
Lecture 1 14
IP Address
Class A
126 networks (7-bit network id. − 2 special cases);
All 0s (0.0.0.0): allow only at system startup and never be a
valid destination address. Once a machine learns its correct
IP address, all 0s will not be used.
All 1s (127.xx.yy.zz): reserved for loop back test (testing the
TCP/IP on a local machine, send a packet from its output
port and receive it from its own input port).
16.8 million hosts (24-bit host id. − 2 special cases);
All 0s (xx.0.0.0): network.
All 1s (xx.255.255.255): broadcast within the network.
Lecture 1 15
IP Address
Class B
16,382 networks (14-bit network id. − 2);
65534 hosts (16-bit host id. − 2);
Class C
2 million networks (21-bit network id. − 2);
254 hosts (8-bit host id. − 2);
Class D
28 bits to specify a multicast group;
can be used only as destination address;
Lecture 1 16
IP Header
Version IHL Type of service Total length
Identification
D
F
M
F Fragment offset
Time to live Protocol Header checksum
Source address
Destination address
Options (0 or more words)
32 bits
Lecture 1 17
IP Header
Total length: the total length of the datagram
(including header);
Datagram = IP-PDU, packet routed in IP layer;
Maximum: 65,535 bytes (1 byte = 8 bits);
How to handle a message if its size is larger than the
maximum packet size of a physical network?
Solution: fragmentation and reassembling.
Lecture 1 18
IP Header: Fragmentation
Fragmentation of IP datagram is allowed
because
This feature facilitates building an Internet with
components networks accommodating different
maximum packet sizes.
IP datagram
Datagram
header
Datagram
Data Area
Frame
Header
Frame Data Area
Physical
Network frame
Lecture 1 19
IP Header: Fragmentation
When an IP datagram is encapsulated by a physical
network frame (e.g. Ethernet frame), since the size of
a frame is limited (e.g. for fairness), the size of an IP
datagram is also limited. Thus we need to apply
fragmentation for the transmitted message longer
than the limited size.
Packet too long may suffer long transmission delay
and even cause network congestion. Thus short
packet is preferred.
Lecture 1 20
IP Header: Fragmentation
When the size of a datagram is larger than the
maximum one, a router breaks the datagram up
into a number of small fragments.
The destination host's IP layer can then
reassemble the fragments back to the complete
datagram before passing it up to upper layer
protocol (say TCP) entity.
Lecture 1 21
IP Header: Fragmentation
Identifier: When a large datagram needs to be
fragmented, all its fragments carry the same
value in the identifier field.
The destination host can determine which datagram
the current fragment belongs to and reassemble the
original datagram.
DF: when it sets to 1, it tells the Internet (router)
not to fragment the datagram.
Lecture 1 22
IP Header: Fragmentation
MF: when it sets to 1, it stands for 'more
fragment'.
All fragments of a datagram except the last one have
this bit set.
Fragment offset: it tells where in the containing
datagram this fragment belongs.
To reassemble, the destination host must obtain all
fragments starting with the fragment that has offset 0
through the fragment with the highest offset.
Lecture 1 23
IP Header
Time to live: it specifies how long, in seconds,
the datagram is allowed to remain in the internet
system.
Protocol: it tells the network access layer in the
destination host, which upper protocol process
to give the datagram to.
Usually it will be TCP or UDP.
Lecture 1 24
IP Header
Header checksum: a checksum verifying the
header only;
Source address;
Destination address;
Options
Lecture 1 25
IP Routing
hosts
messag
e
NetA
NetC
NetB
NetD
R(AC)
H1
H2
H4
H3
R(ABD)
Lecture 1 26
IP Routing
Consider H1 would like to send a packet to H3.
H1 is the end station of the network NetA, and H2, H3
and H4 are the end stations of the network NetD.
H1 communicates with other stations by using the
native protocol of the network NetA (say PrA, e.g.
Ethernet).
Similarly, H2, H3 and H4 communicate with each
other with the native protocol of NetD (say PrD, e.g.
Token Ring).
Lecture 1 27
IP Routing
It is possible that PrA, PrB , PrC and PrD are not the
same.
H1 does so by using IP protocol which H1, R(ABD)
and H3 all understand and agree upon.
H1 puts H3's IP address in the destination address
and its own IP address in the source address.
H1 also puts the destination address of R(ABD) in the
destination address field of the header of PrA-PDU.
Lecture 1 28
IP Routing
When the PrA-PDU is routed by NetA to the
destination R(ABD), R(ABD) will extract the IP
datagram from the PrA-PDU and look at the
destination address and decide that the destination is
on H3.
So R(ABD) sends the IP datagram to station H3, this
time embedding the datagram in a PrD-PDU.
When H3 receives the PrD-PDU, it will extract the IP
datagram and obtain the data.
Lecture 1 29
IP Routing
ET = Ethernet Tail
TT = Token Ring Tail
Px(y) = Physical address of y in x
H1
App.
TCP
IP
H-to-N
H3
Datagram
IP Header
Data
S=H1
D=H3
...
IP
H-to-N
App.
TCP
IP
H-to-N
Router
R(ABD)
D=PrA(R(ABD))
…
ET
Ethernet Header
D=PrD(H3)
…
TTDatagram
Token Ring Header
Network NetA Network NetD
Datagram
Lecture 1 30
IP Routing
How does the router make a suitable decision to
route the packet to H3? Solution: Routing table.
A network on the Internet is usually designated
by the network prefix of its IP address followed
by appending 0's to the suffix.
Example: the network 144.214 in the next slide is
usually designated 144.214.0.0.
Lecture 1 31
IP Routing
A router is connected to more than one network.
Hence it has multiple IP addresses.
Example: the router below has two IP addresses:
144.214.0.15 and 144.120.12.9.
router
144.214.0.0
144.120.0.0
144.214.0.15
144.120.12.9
Lecture 1 32
IP Routing
R1 R2
R3
NetA
NetB NetC NetD
NetE
Routing table at R2
Destination Next hop
NetA R1
NetB R1
NetC direct deliver
NetD direct deliver
NetE R3
Lecture 1 33
IP Routing
In practice, the networks are identified by its IP
address.
The router uses a network-id mask (also called
a subnet mask) to extract the network id from a
(destination station) IP address and search the
routing table for a match.
Lecture 1 34
IP Routing
R1 R2
R3
20.0.0.0
40.0.0.0 128.1.0.0 192.4.10.0
144.214.0.0
40.0.0.7 128.1.0.8 144.214.0.5128.1.0.9
192.4.10.9
20.0.0.7
192.4.10.8
Lecture 1 35
IP Routing
Routing table at R2 would look like
Destination Mask Next hop
20.0.0.0 255.0.0.0 128.1.0.8
40.0.0.0 255.0.0.0 128.1.0.8
128.1.0.0 255.255.0.0 direct deliver
192.4.10.0 255.255.255.0 direct deliver
144.214.0.0 255.255.0.0 192.4.10.8
Lecture 1 36
IP Routing
Example
Datagram P arrive at R2 with destination address
144.214.10.18.
For each entry in the routing table, the corresponding
mask is “anded” with the destination address and the
result (144.214.0.0) is compared to the destination
(network) field.
If a match is found, it will be sent to the address at
the next hop field (192.4.10.8).
Lecture 1 37
Companion IP Protocols
The core IP protocol is for the sending of
datagrams between stations across the Internet.
There are a number of companion protocols to
handle other functions.
Two important protocols will be described: ICMP
(Internet Control Message Protocol) and ARP
(Address Resolution Protocol).
Lecture 1 38
ICMP
It is used to communicate control messages
between host and router, among routers and
between hosts.
ICMP messages are embedded in the data field
of a datagram and the protocol type is set to 1.
IP header IP data field
IP datagramICMP message
Protocol = 1
Lecture 1 39
ICMP
Most ICMP messages are for signaling error or
unusual situations.
Messages between routers and hosts:
'can't reach destination'
'Time-to-live expired'
'illegal parameter'
'slow down - congestion'
'there is a better route to send data', …, etc.
Lecture 1 40
ICMP
Messages between hosts:
'can't read application'
'reassembly time expired'
'strange parameter'
'slow down - congestion'
'echo request'
'echo reply', …, etc.
Lecture 1 41
ARP
When an IP datagram arrives at a destination
router, the router will send the datagram to the
destination host over the destination network.
Since the format of the physical network
address (e.g. Ethernet address) is different from
that of the IP address, usually the router has a
table to map the destination IP address to its
corresponding physical network address.
Lecture 1 42
ARP
The router then sends the datagram to the
destination by encapsulating the datagram in
the corresponding physical network address.
However, if the router does not know it, how
does the router send the datagram?
The router may not know the mapping if the
configuration of the physical network is changed, or
the station is just joined the network.
Solution: ARP
Lecture 1 43
ARP
R
144.214.0.0
144.120.0.0
144.214.01.5
144.120.12.9
Datagram with
destination address Ap
Lecture 1 44
ARP
An IP datagram with destination address Ap (e.g.
144.120.60.8) arrives at the (destination) router
R.
The router wants to know the Ethernet address
of the station with IP address Ap. R broadcasts a
request: “Who owns IP address Ap?” on the
destination LAN (e.g. 144.120.0.0).
Lecture 1 45
ARP
Only the destination with the IP address Ap will
response, giving its physical network address to
R (e.g. Ethernet address E).
Then R updates its table and send the datagram
to the destination.
Note that a source station can use ARP to find
the local network address of the router if
necessary.
Lecture 1 46
TCP
Transmission Control Protocol
Functions:
To provide a point-to-point reliable connection
oriented service for upper (application) layer entities.
To provide for multiplexing of multiple transport
connections over a single network.
Lecture 1 47
TCP Segment
TCP PDUs are called segments.
Fixed size header (20 bytes);
The data field can be up to 216
− 40 bytes (TCP
and IP headers), i.e. 65,495 bytes.
Lecture 1 48
TCP Segment
Data (optional)
Destination port
Acknowledgement number
Options (0 or more 32-bit words)
Source port
Sequence number
TCP
header
length
F
I
N
R
S
T
P
S
H
A
C
K
U
R
G
S
Y
N
Window size
Urgent pointerChecksum
32 bits
Lecture 1 49
TCP Segment
Source port and destination port: TCP port
numbers that identify the application programs
at the ends of the connection.
A port number plus an IP address form an unique
transport service access point (TSAP).
Sequence number (SEQ): identify the position in
the sender’s byte stream of the data in the
segment.
Lecture 1 50
TCP Segment
Acknowledgement number (ACKN): identifies
the number of the octet that the source expects
to receive next.
TCP header length: TCP segment’s header (in
units of 32-bit words);
Lecture 1 51
TCP Segment
URG
When it sets to 1, the urgent pointer is in use.
The pointer is used to specify the position in the
segment where urgent data ends.
This is used to draw attention of the receiver.
ACK
When it sets to 1, the field of the acknowledgement
number (ACKN) is valid.
Lecture 1 52
TCP Segment
PSH
When it sets to 1, it indicates to the receiver that it
should deliver the data (and any already buffered) to
the application program.
Otherwise, the receiver may buffer (and only deliver
when buffer is full) for efficiency.
RST
When it sets to 1, reset the connection.
Lecture 1 53
TCP Segment
SYN
Used for connection set-up;
SYN = 1, ACK = 0 ⇒ connection set-up request;
SYN = 1, ACK = 1 ⇒ connection set-up accept;
FIN
Used for connection release;
When it sets to 1, the sender has reached end of its
byte stream.
Lecture 1 54
TCP Services
Connection set-up
three-way handshake
Sender
Events
Receiver
Events
Network
Message
s
SYN(SEQ = x)
SYN(SEQ = y, ACKN = x + 1)
SYN(SEQ = x + 1, ACKN = y + 1)
Lecture 1 55
TCP Services
The advantage of three-way handshake is that it still
works even the TCP segment containing the
connection-accept segment is lost.
Note that a new set of starting sequence numbers is
used on connection set-up. This is to avoid any
segment from a previous connection session
between the same processes from confusing the
current connection.
Lecture 1 56
TCP Services
Connection release
FIN
FIN
ACK
Sender
Events
Receiver
Events
Network
Message
s
Lecture 1 57
TCP Services
Data transfer
Damaged and lost segments are handled by a
positive acknowledgement time-out retransmission
mechanism.
Duplicated and out of order segments are detected
by use of the sequence number field.
Lecture 1 58
TCP Services
Flow control
It is affected by a window mechanism.
The send window size can be dynamically changed
by the receiver (based on its buffer condition).
Window advertisement (the window size field in the
TCP header) specifies how many octets (1 octet = 8
bits) of data that the receiver is prepared to accept.
Example : maximum segment size of the sender is
1000 octets and maximum window advertisement is
2000 octets.
Lecture 1 59
TCP Services
advertise window = 2500
send data octets 1 - 1000
send data octets 1001 - 2000
send data octets 2001 - 2500
ack up to 1000, window = 1500
ack up to 2000, window = 500
ack up to 2500, window = 0
Sender
Events
Receiver
Events
Network
Message
s
receive ack for 1000
receive ack for 2000
receive ack for 2500 application reads 2000 octets
ack up to 2500, window = 2000
ack up to 3500, window = 1000
ack up to 4500, window = 0
application reads 1000 octets
ack up to 4500, window = 1000
send data octets 2501 - 3500
send data octets 3501 - 4500
receive ack for 4500
receive ack for 3500
receive ack for 4500
Lecture 1 60
TCP Services
Congestion control: slow-start algorithm
TCP (sender) maintains two windows, a send window
Ws which is set by receiver’s window advertisement,
and a congestion window Wc.
The sender uses the smaller of the two for actual
transmission.
A threshold, T, is an integer such that the congestion
window will increase exponentially before reaching
the threshold.
Usually T will be initially set to 64k bytes.
Lecture 1 61
TCP Services
Procedure:
1. Wc = 1.
2. When (i) a window is sent, (ii) there is no time-out, and
(iii) Wc is smaller than the threshold,
Wc = min(2 × Wc, threshold)
(growth rate is exponential).
3. When (i) a window is sent, (ii) there is no time-out, and
(iii) Wc is not smaller than the threshold,
Wc = Wc + 1 (growth rate is linear).
4. When a time-out occurs, T = Wc / 2 and Wc = 1.
Lecture 1 62
TCP Services
Slow-Start
0
10
20
30
40
50
60
70
80
0 5 10 15 20
Transmission numbers
Congestionwindow(kbytes)
Timeout
Threshold
New
Threshold
Lecture 1 63
TCP Services
Trans. No. Wc (kbytes) Trans. No. Wc (kbytes)
0 1 13 1
1 2 14 2
2 4 15 4
3 8 16 8
4 16 17 16
5 32 18 32
6 64 19 35
7 65 20 36
8 66 21 37
9 67 22 38
10 68 23 39
11 69 24 40
12
(Timeout)
70
Lecture 1 64
TCP Multiplexing
A host use an unique IP address to
communicate through the Internet.
Within that machine, there may be multiple
application programs requiring remote
communication services.
The TCP layer implements multiple transport
connections over a single network interface.
Lecture 1 65
TCP Multiplexing
Host A Host B
Internet
TCP
IP
X Y
TCP
IP
M N
144.214.12.38
205.10.11.09
144.214.12.38:23144.214.12.38:290 205.10.11.09:2529
205.10.11.09:1326
Lecture 1 66
UDP
User Data Protocol
Connectionless transport protocol
suitable for applications requiring short
communication exchanges;
packet is up to 64 kbytes.
32 bits
Destination portSource port
ChecksumDatagram length
User data
Lecture 1 67
Tutorial 1
1. When an IP datagram is to be routed through a network
whose maximum packet size is smaller than that of the
datagram, it is fragmented into smaller datagrams.
Where do you think is better to reassemble the
datagram? At the next router or at the destination host
(IP layer)? Explain.
Lecture 1 68
Tutorial 1
2. Most IP datagram reassembly algorithms have a timer to
avoid having a lost fragment tie up reassembly buffers
forever. Suppose a datagram is fragmented into 4
fragments. The first 3 fragments arrive, but the last one
is delayed. Eventually the timer goes off and the three
fragments in the receiver’s memory are discarded. A
little later, the last fragment stumbles in. What should be
done with it?
Lecture 1 69
Tutorial 1
3. How many responses a router expects to get when it
broadcasts an ARP request? Why?
4. You have just explained the ARP protocol to a friend.
When you are all done, he says: “I have got it. ARP
provides a service to the network layer, so it is part of
the data link layer.” What do you say to him?
Lecture 1 70
Tutorial 1
5. Write out the following IP address in dotted decimal
format:
10010000 11001000 00100101 01000001
6. Is the IP address space efficiently utilized? Explain.
Suppose that instead of using 16 bits for the network
part of a class B address, 20 bits has been used. How
many class B networks would there have been?
Lecture 1 71
Tutorial 1
7. What is the size of the port number space for TCP?
What is the maximum size of a TCP segment? Under
what condition is this maximum size achievable?
8. Consider a TCP connection over the Internet. When a
time-out occurs on the sending of a segment, which is
by far most likely the cause: (i) congestion, (ii) error:
damaged or lost IP datagram (which encapsulates the
TCP segment). Explain.
Lecture 1 72
Tutorial 1
9. Consider the slow start flow control algorithm used in
TCP. Suppose the maximum segment size is 1 Kbytes.
Suppose the congestion window Wc just before a time-
out was 32 Kbytes. What are the congestion window
sizes for the first 8 transmissions after the time-out?
Assume that there are no time-outs during these 8
transmissions.

More Related Content

What's hot (20)

Internet protocol
Internet protocolInternet protocol
Internet protocol
 
WIRELESS NETWORK
WIRELESS NETWORKWIRELESS NETWORK
WIRELESS NETWORK
 
4 ipv6
4 ipv64 ipv6
4 ipv6
 
IPv4 to IPv6
IPv4 to IPv6IPv4 to IPv6
IPv4 to IPv6
 
I.p. protocol
I.p. protocolI.p. protocol
I.p. protocol
 
Network layer logical addressing
Network layer logical addressingNetwork layer logical addressing
Network layer logical addressing
 
Chapter 3. sensors in the network domain
Chapter 3. sensors in the network domainChapter 3. sensors in the network domain
Chapter 3. sensors in the network domain
 
Ip protocol
Ip protocolIp protocol
Ip protocol
 
10 coms 525 tcpip - internet protocol - ip
10   coms 525 tcpip -  internet protocol - ip10   coms 525 tcpip -  internet protocol - ip
10 coms 525 tcpip - internet protocol - ip
 
Ipspk1
Ipspk1Ipspk1
Ipspk1
 
network fundamental
network fundamentalnetwork fundamental
network fundamental
 
Network layer
Network layerNetwork layer
Network layer
 
IPv6: Internet Protocol version 6
IPv6: Internet Protocol version 6IPv6: Internet Protocol version 6
IPv6: Internet Protocol version 6
 
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENTTCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
TCP/IP 3RD SEM.2012 AUG.ASSIGNMENT
 
IPv6 header
IPv6 headerIPv6 header
IPv6 header
 
Final networks lab manual
Final networks lab manualFinal networks lab manual
Final networks lab manual
 
logical addressing
logical addressinglogical addressing
logical addressing
 
Mobile IP
Mobile IPMobile IP
Mobile IP
 
IPv6 - The Next next generation protocol
IPv6 - The Next next generation protocolIPv6 - The Next next generation protocol
IPv6 - The Next next generation protocol
 
Comparison between ipv4 and ipv6
Comparison between ipv4 and ipv6Comparison between ipv4 and ipv6
Comparison between ipv4 and ipv6
 

Similar to Lecture1, TCP/IP

TCP/IP Protocol Architeture
TCP/IP Protocol ArchitetureTCP/IP Protocol Architeture
TCP/IP Protocol ArchitetureManoj Kumar
 
CCNA Interview.pdf
CCNA Interview.pdfCCNA Interview.pdf
CCNA Interview.pdfhoang971
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modifiedrajesh531
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) pptDulith Kasun
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 
07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.pptssuserf7cd2b
 
Networks A2
Networks  A2Networks  A2
Networks A2aeneas
 
Computer network (12)
Computer network (12)Computer network (12)
Computer network (12)NYversity
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)Jeff Green
 
Socket Programming TCP:IP PPT.pdf
Socket Programming TCP:IP PPT.pdfSocket Programming TCP:IP PPT.pdf
Socket Programming TCP:IP PPT.pdfPraveenKumar187040
 
Unit 4 tansport layer in the internat
Unit 4 tansport layer in the internatUnit 4 tansport layer in the internat
Unit 4 tansport layer in the internatKritika Purohit
 

Similar to Lecture1, TCP/IP (20)

TCP/IP Protocol Architeture
TCP/IP Protocol ArchitetureTCP/IP Protocol Architeture
TCP/IP Protocol Architeture
 
More on Tcp/Ip
More on Tcp/IpMore on Tcp/Ip
More on Tcp/Ip
 
CCNA Interview.pdf
CCNA Interview.pdfCCNA Interview.pdf
CCNA Interview.pdf
 
Exploration network chapter_5_modified
Exploration network chapter_5_modifiedExploration network chapter_5_modified
Exploration network chapter_5_modified
 
Internet Protocol
Internet ProtocolInternet Protocol
Internet Protocol
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) ppt
 
Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt07 - TCP_IP and the DoD Model.ppt
07 - TCP_IP and the DoD Model.ppt
 
Networks A2
Networks  A2Networks  A2
Networks A2
 
Hardware9
Hardware9Hardware9
Hardware9
 
Computer network (12)
Computer network (12)Computer network (12)
Computer network (12)
 
16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)16.) layer 3 (basic tcp ip routing)
16.) layer 3 (basic tcp ip routing)
 
TCP Vs UDP
TCP Vs UDP TCP Vs UDP
TCP Vs UDP
 
class30.ppt
class30.pptclass30.ppt
class30.ppt
 
Internet protocols
Internet protocolsInternet protocols
Internet protocols
 
IP Utilites
IP UtilitesIP Utilites
IP Utilites
 
Socket Programming TCP:IP PPT.pdf
Socket Programming TCP:IP PPT.pdfSocket Programming TCP:IP PPT.pdf
Socket Programming TCP:IP PPT.pdf
 
Unit 4 tansport layer in the internat
Unit 4 tansport layer in the internatUnit 4 tansport layer in the internat
Unit 4 tansport layer in the internat
 

Recently uploaded

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Recently uploaded (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Lecture1, TCP/IP

  • 1. Lecture 1 1 Lecture 1: TCP/IP TCP/IP Layer Structure IP TCP UDP
  • 2. Lecture 1 2 Introduction To achieve the global connectivity, ideally we have a virtual global network to which every machine can connect to. However, in the real world, we do not have such global network. Many different networks with different technologies and protocols are existed all over the world. We called they are heterogeneous networks.
  • 3. Lecture 1 3 Introduction Alternative approach We establish physical links and routers to connect them together; we apply the same higher level communication protocol for each machine such that receivers can understand the content of packets sent from senders. Solution: TCP/IP
  • 4. Lecture 1 4 TCP/IP Model TCP/IP = Transmission Control Protocol/Internet Protocol. Developed in 1970s by the US Department of Defense. Application Transport (TCP) Internet (IP) Link Physical
  • 5. Lecture 1 5 TCP/IP Model Physical (Chapter 4) Link (Chapter 5) Internet (IP = Internet Protocol) specify the format of the packets sent across the Internet and the mechanisms used to forward packets from a station through one or more routers to the destination station.
  • 6. Lecture 1 6 TCP/IP Model Transport (TCP = Transmission Control Protocol) specify an end-to-end protocol for the reliable transfer of data between two programs. Application specify how one application uses an Internet.
  • 7. Lecture 1 7 TCP/IP Model TH IH HH Data TCP Data IP Data H-to-N Data HT Source machine Application Transport (TCP) Internet (IP) Host-to-Network Destination machine Application Transport (TCP) Internet (IP) Host-to-Network
  • 8. Lecture 1 8 IP Internet Protocol Main characteristics Hierarchical addressing: IP address are 32 bits in length and are used in the source and destination address fields of the IP datagram. Connectionless routing: each data packet is an individual datagram to do the routing.
  • 9. Lecture 1 9 IP Address Dotted Decimal Notation It is difficult for human being to read 32-bit IP addresses in technical documents or through application programs. Thus IP addresses are written as four decimal integers separated by decimal points, where each integer gives the value of one octet of the IP address (1 octet = 8 bits).
  • 10. Lecture 1 10 IP Address Example 1 10000000 00001010 00000010 00011110 is written as 128.10.2.30 Example 2 149.8.12.40 is written as 10010101 00001000 00001100 00101000
  • 11. Lecture 1 11 Two components: network id. and host id. Network id.: identifies the network; Host id.: identifies the station (or host computer) on that network (as identified by the network id.). IP Address IP address Network id. Host id.
  • 12. Lecture 1 12 IP Address Trade off between the size of the network id. field and that of the host id. field. Larger network id. ⇒ larger possible number of networks (in the Internet) with each network having smaller number of hosts. Larger host id. ⇒ larger number of hosts in a network but the possible number of networks is smaller. To accommodate networks of different sizes, we classified networks into 5 categories: A, B, C, D and E.
  • 13. Lecture 1 13 IP Address 0 Network Host 10 Network Host 110 Network Host 1110 Multicast address 11110 Reserved for future use Class A B C D E 32 bits
  • 14. Lecture 1 14 IP Address Class A 126 networks (7-bit network id. − 2 special cases); All 0s (0.0.0.0): allow only at system startup and never be a valid destination address. Once a machine learns its correct IP address, all 0s will not be used. All 1s (127.xx.yy.zz): reserved for loop back test (testing the TCP/IP on a local machine, send a packet from its output port and receive it from its own input port). 16.8 million hosts (24-bit host id. − 2 special cases); All 0s (xx.0.0.0): network. All 1s (xx.255.255.255): broadcast within the network.
  • 15. Lecture 1 15 IP Address Class B 16,382 networks (14-bit network id. − 2); 65534 hosts (16-bit host id. − 2); Class C 2 million networks (21-bit network id. − 2); 254 hosts (8-bit host id. − 2); Class D 28 bits to specify a multicast group; can be used only as destination address;
  • 16. Lecture 1 16 IP Header Version IHL Type of service Total length Identification D F M F Fragment offset Time to live Protocol Header checksum Source address Destination address Options (0 or more words) 32 bits
  • 17. Lecture 1 17 IP Header Total length: the total length of the datagram (including header); Datagram = IP-PDU, packet routed in IP layer; Maximum: 65,535 bytes (1 byte = 8 bits); How to handle a message if its size is larger than the maximum packet size of a physical network? Solution: fragmentation and reassembling.
  • 18. Lecture 1 18 IP Header: Fragmentation Fragmentation of IP datagram is allowed because This feature facilitates building an Internet with components networks accommodating different maximum packet sizes. IP datagram Datagram header Datagram Data Area Frame Header Frame Data Area Physical Network frame
  • 19. Lecture 1 19 IP Header: Fragmentation When an IP datagram is encapsulated by a physical network frame (e.g. Ethernet frame), since the size of a frame is limited (e.g. for fairness), the size of an IP datagram is also limited. Thus we need to apply fragmentation for the transmitted message longer than the limited size. Packet too long may suffer long transmission delay and even cause network congestion. Thus short packet is preferred.
  • 20. Lecture 1 20 IP Header: Fragmentation When the size of a datagram is larger than the maximum one, a router breaks the datagram up into a number of small fragments. The destination host's IP layer can then reassemble the fragments back to the complete datagram before passing it up to upper layer protocol (say TCP) entity.
  • 21. Lecture 1 21 IP Header: Fragmentation Identifier: When a large datagram needs to be fragmented, all its fragments carry the same value in the identifier field. The destination host can determine which datagram the current fragment belongs to and reassemble the original datagram. DF: when it sets to 1, it tells the Internet (router) not to fragment the datagram.
  • 22. Lecture 1 22 IP Header: Fragmentation MF: when it sets to 1, it stands for 'more fragment'. All fragments of a datagram except the last one have this bit set. Fragment offset: it tells where in the containing datagram this fragment belongs. To reassemble, the destination host must obtain all fragments starting with the fragment that has offset 0 through the fragment with the highest offset.
  • 23. Lecture 1 23 IP Header Time to live: it specifies how long, in seconds, the datagram is allowed to remain in the internet system. Protocol: it tells the network access layer in the destination host, which upper protocol process to give the datagram to. Usually it will be TCP or UDP.
  • 24. Lecture 1 24 IP Header Header checksum: a checksum verifying the header only; Source address; Destination address; Options
  • 25. Lecture 1 25 IP Routing hosts messag e NetA NetC NetB NetD R(AC) H1 H2 H4 H3 R(ABD)
  • 26. Lecture 1 26 IP Routing Consider H1 would like to send a packet to H3. H1 is the end station of the network NetA, and H2, H3 and H4 are the end stations of the network NetD. H1 communicates with other stations by using the native protocol of the network NetA (say PrA, e.g. Ethernet). Similarly, H2, H3 and H4 communicate with each other with the native protocol of NetD (say PrD, e.g. Token Ring).
  • 27. Lecture 1 27 IP Routing It is possible that PrA, PrB , PrC and PrD are not the same. H1 does so by using IP protocol which H1, R(ABD) and H3 all understand and agree upon. H1 puts H3's IP address in the destination address and its own IP address in the source address. H1 also puts the destination address of R(ABD) in the destination address field of the header of PrA-PDU.
  • 28. Lecture 1 28 IP Routing When the PrA-PDU is routed by NetA to the destination R(ABD), R(ABD) will extract the IP datagram from the PrA-PDU and look at the destination address and decide that the destination is on H3. So R(ABD) sends the IP datagram to station H3, this time embedding the datagram in a PrD-PDU. When H3 receives the PrD-PDU, it will extract the IP datagram and obtain the data.
  • 29. Lecture 1 29 IP Routing ET = Ethernet Tail TT = Token Ring Tail Px(y) = Physical address of y in x H1 App. TCP IP H-to-N H3 Datagram IP Header Data S=H1 D=H3 ... IP H-to-N App. TCP IP H-to-N Router R(ABD) D=PrA(R(ABD)) … ET Ethernet Header D=PrD(H3) … TTDatagram Token Ring Header Network NetA Network NetD Datagram
  • 30. Lecture 1 30 IP Routing How does the router make a suitable decision to route the packet to H3? Solution: Routing table. A network on the Internet is usually designated by the network prefix of its IP address followed by appending 0's to the suffix. Example: the network 144.214 in the next slide is usually designated 144.214.0.0.
  • 31. Lecture 1 31 IP Routing A router is connected to more than one network. Hence it has multiple IP addresses. Example: the router below has two IP addresses: 144.214.0.15 and 144.120.12.9. router 144.214.0.0 144.120.0.0 144.214.0.15 144.120.12.9
  • 32. Lecture 1 32 IP Routing R1 R2 R3 NetA NetB NetC NetD NetE Routing table at R2 Destination Next hop NetA R1 NetB R1 NetC direct deliver NetD direct deliver NetE R3
  • 33. Lecture 1 33 IP Routing In practice, the networks are identified by its IP address. The router uses a network-id mask (also called a subnet mask) to extract the network id from a (destination station) IP address and search the routing table for a match.
  • 34. Lecture 1 34 IP Routing R1 R2 R3 20.0.0.0 40.0.0.0 128.1.0.0 192.4.10.0 144.214.0.0 40.0.0.7 128.1.0.8 144.214.0.5128.1.0.9 192.4.10.9 20.0.0.7 192.4.10.8
  • 35. Lecture 1 35 IP Routing Routing table at R2 would look like Destination Mask Next hop 20.0.0.0 255.0.0.0 128.1.0.8 40.0.0.0 255.0.0.0 128.1.0.8 128.1.0.0 255.255.0.0 direct deliver 192.4.10.0 255.255.255.0 direct deliver 144.214.0.0 255.255.0.0 192.4.10.8
  • 36. Lecture 1 36 IP Routing Example Datagram P arrive at R2 with destination address 144.214.10.18. For each entry in the routing table, the corresponding mask is “anded” with the destination address and the result (144.214.0.0) is compared to the destination (network) field. If a match is found, it will be sent to the address at the next hop field (192.4.10.8).
  • 37. Lecture 1 37 Companion IP Protocols The core IP protocol is for the sending of datagrams between stations across the Internet. There are a number of companion protocols to handle other functions. Two important protocols will be described: ICMP (Internet Control Message Protocol) and ARP (Address Resolution Protocol).
  • 38. Lecture 1 38 ICMP It is used to communicate control messages between host and router, among routers and between hosts. ICMP messages are embedded in the data field of a datagram and the protocol type is set to 1. IP header IP data field IP datagramICMP message Protocol = 1
  • 39. Lecture 1 39 ICMP Most ICMP messages are for signaling error or unusual situations. Messages between routers and hosts: 'can't reach destination' 'Time-to-live expired' 'illegal parameter' 'slow down - congestion' 'there is a better route to send data', …, etc.
  • 40. Lecture 1 40 ICMP Messages between hosts: 'can't read application' 'reassembly time expired' 'strange parameter' 'slow down - congestion' 'echo request' 'echo reply', …, etc.
  • 41. Lecture 1 41 ARP When an IP datagram arrives at a destination router, the router will send the datagram to the destination host over the destination network. Since the format of the physical network address (e.g. Ethernet address) is different from that of the IP address, usually the router has a table to map the destination IP address to its corresponding physical network address.
  • 42. Lecture 1 42 ARP The router then sends the datagram to the destination by encapsulating the datagram in the corresponding physical network address. However, if the router does not know it, how does the router send the datagram? The router may not know the mapping if the configuration of the physical network is changed, or the station is just joined the network. Solution: ARP
  • 44. Lecture 1 44 ARP An IP datagram with destination address Ap (e.g. 144.120.60.8) arrives at the (destination) router R. The router wants to know the Ethernet address of the station with IP address Ap. R broadcasts a request: “Who owns IP address Ap?” on the destination LAN (e.g. 144.120.0.0).
  • 45. Lecture 1 45 ARP Only the destination with the IP address Ap will response, giving its physical network address to R (e.g. Ethernet address E). Then R updates its table and send the datagram to the destination. Note that a source station can use ARP to find the local network address of the router if necessary.
  • 46. Lecture 1 46 TCP Transmission Control Protocol Functions: To provide a point-to-point reliable connection oriented service for upper (application) layer entities. To provide for multiplexing of multiple transport connections over a single network.
  • 47. Lecture 1 47 TCP Segment TCP PDUs are called segments. Fixed size header (20 bytes); The data field can be up to 216 − 40 bytes (TCP and IP headers), i.e. 65,495 bytes.
  • 48. Lecture 1 48 TCP Segment Data (optional) Destination port Acknowledgement number Options (0 or more 32-bit words) Source port Sequence number TCP header length F I N R S T P S H A C K U R G S Y N Window size Urgent pointerChecksum 32 bits
  • 49. Lecture 1 49 TCP Segment Source port and destination port: TCP port numbers that identify the application programs at the ends of the connection. A port number plus an IP address form an unique transport service access point (TSAP). Sequence number (SEQ): identify the position in the sender’s byte stream of the data in the segment.
  • 50. Lecture 1 50 TCP Segment Acknowledgement number (ACKN): identifies the number of the octet that the source expects to receive next. TCP header length: TCP segment’s header (in units of 32-bit words);
  • 51. Lecture 1 51 TCP Segment URG When it sets to 1, the urgent pointer is in use. The pointer is used to specify the position in the segment where urgent data ends. This is used to draw attention of the receiver. ACK When it sets to 1, the field of the acknowledgement number (ACKN) is valid.
  • 52. Lecture 1 52 TCP Segment PSH When it sets to 1, it indicates to the receiver that it should deliver the data (and any already buffered) to the application program. Otherwise, the receiver may buffer (and only deliver when buffer is full) for efficiency. RST When it sets to 1, reset the connection.
  • 53. Lecture 1 53 TCP Segment SYN Used for connection set-up; SYN = 1, ACK = 0 ⇒ connection set-up request; SYN = 1, ACK = 1 ⇒ connection set-up accept; FIN Used for connection release; When it sets to 1, the sender has reached end of its byte stream.
  • 54. Lecture 1 54 TCP Services Connection set-up three-way handshake Sender Events Receiver Events Network Message s SYN(SEQ = x) SYN(SEQ = y, ACKN = x + 1) SYN(SEQ = x + 1, ACKN = y + 1)
  • 55. Lecture 1 55 TCP Services The advantage of three-way handshake is that it still works even the TCP segment containing the connection-accept segment is lost. Note that a new set of starting sequence numbers is used on connection set-up. This is to avoid any segment from a previous connection session between the same processes from confusing the current connection.
  • 56. Lecture 1 56 TCP Services Connection release FIN FIN ACK Sender Events Receiver Events Network Message s
  • 57. Lecture 1 57 TCP Services Data transfer Damaged and lost segments are handled by a positive acknowledgement time-out retransmission mechanism. Duplicated and out of order segments are detected by use of the sequence number field.
  • 58. Lecture 1 58 TCP Services Flow control It is affected by a window mechanism. The send window size can be dynamically changed by the receiver (based on its buffer condition). Window advertisement (the window size field in the TCP header) specifies how many octets (1 octet = 8 bits) of data that the receiver is prepared to accept. Example : maximum segment size of the sender is 1000 octets and maximum window advertisement is 2000 octets.
  • 59. Lecture 1 59 TCP Services advertise window = 2500 send data octets 1 - 1000 send data octets 1001 - 2000 send data octets 2001 - 2500 ack up to 1000, window = 1500 ack up to 2000, window = 500 ack up to 2500, window = 0 Sender Events Receiver Events Network Message s receive ack for 1000 receive ack for 2000 receive ack for 2500 application reads 2000 octets ack up to 2500, window = 2000 ack up to 3500, window = 1000 ack up to 4500, window = 0 application reads 1000 octets ack up to 4500, window = 1000 send data octets 2501 - 3500 send data octets 3501 - 4500 receive ack for 4500 receive ack for 3500 receive ack for 4500
  • 60. Lecture 1 60 TCP Services Congestion control: slow-start algorithm TCP (sender) maintains two windows, a send window Ws which is set by receiver’s window advertisement, and a congestion window Wc. The sender uses the smaller of the two for actual transmission. A threshold, T, is an integer such that the congestion window will increase exponentially before reaching the threshold. Usually T will be initially set to 64k bytes.
  • 61. Lecture 1 61 TCP Services Procedure: 1. Wc = 1. 2. When (i) a window is sent, (ii) there is no time-out, and (iii) Wc is smaller than the threshold, Wc = min(2 × Wc, threshold) (growth rate is exponential). 3. When (i) a window is sent, (ii) there is no time-out, and (iii) Wc is not smaller than the threshold, Wc = Wc + 1 (growth rate is linear). 4. When a time-out occurs, T = Wc / 2 and Wc = 1.
  • 62. Lecture 1 62 TCP Services Slow-Start 0 10 20 30 40 50 60 70 80 0 5 10 15 20 Transmission numbers Congestionwindow(kbytes) Timeout Threshold New Threshold
  • 63. Lecture 1 63 TCP Services Trans. No. Wc (kbytes) Trans. No. Wc (kbytes) 0 1 13 1 1 2 14 2 2 4 15 4 3 8 16 8 4 16 17 16 5 32 18 32 6 64 19 35 7 65 20 36 8 66 21 37 9 67 22 38 10 68 23 39 11 69 24 40 12 (Timeout) 70
  • 64. Lecture 1 64 TCP Multiplexing A host use an unique IP address to communicate through the Internet. Within that machine, there may be multiple application programs requiring remote communication services. The TCP layer implements multiple transport connections over a single network interface.
  • 65. Lecture 1 65 TCP Multiplexing Host A Host B Internet TCP IP X Y TCP IP M N 144.214.12.38 205.10.11.09 144.214.12.38:23144.214.12.38:290 205.10.11.09:2529 205.10.11.09:1326
  • 66. Lecture 1 66 UDP User Data Protocol Connectionless transport protocol suitable for applications requiring short communication exchanges; packet is up to 64 kbytes. 32 bits Destination portSource port ChecksumDatagram length User data
  • 67. Lecture 1 67 Tutorial 1 1. When an IP datagram is to be routed through a network whose maximum packet size is smaller than that of the datagram, it is fragmented into smaller datagrams. Where do you think is better to reassemble the datagram? At the next router or at the destination host (IP layer)? Explain.
  • 68. Lecture 1 68 Tutorial 1 2. Most IP datagram reassembly algorithms have a timer to avoid having a lost fragment tie up reassembly buffers forever. Suppose a datagram is fragmented into 4 fragments. The first 3 fragments arrive, but the last one is delayed. Eventually the timer goes off and the three fragments in the receiver’s memory are discarded. A little later, the last fragment stumbles in. What should be done with it?
  • 69. Lecture 1 69 Tutorial 1 3. How many responses a router expects to get when it broadcasts an ARP request? Why? 4. You have just explained the ARP protocol to a friend. When you are all done, he says: “I have got it. ARP provides a service to the network layer, so it is part of the data link layer.” What do you say to him?
  • 70. Lecture 1 70 Tutorial 1 5. Write out the following IP address in dotted decimal format: 10010000 11001000 00100101 01000001 6. Is the IP address space efficiently utilized? Explain. Suppose that instead of using 16 bits for the network part of a class B address, 20 bits has been used. How many class B networks would there have been?
  • 71. Lecture 1 71 Tutorial 1 7. What is the size of the port number space for TCP? What is the maximum size of a TCP segment? Under what condition is this maximum size achievable? 8. Consider a TCP connection over the Internet. When a time-out occurs on the sending of a segment, which is by far most likely the cause: (i) congestion, (ii) error: damaged or lost IP datagram (which encapsulates the TCP segment). Explain.
  • 72. Lecture 1 72 Tutorial 1 9. Consider the slow start flow control algorithm used in TCP. Suppose the maximum segment size is 1 Kbytes. Suppose the congestion window Wc just before a time- out was 32 Kbytes. What are the congestion window sizes for the first 8 transmissions after the time-out? Assume that there are no time-outs during these 8 transmissions.