You are on page 1of 26

Indian Institute of Technology Kharagpur

TCP/IP – Part II
Prof Indranil Sengupta
Computer Science and Engineering
Indian Institute of Technology
Kharagpur

• Lecture 4: TCP/IP – Part II


¾ On completion, the student will be
able to:
1. Explain the differences between
transparent and non-transparent
fragmentation in IP packets.
2. Identify the IP header fields used in
fragmentation and reassembly.
3. Illustrate how a data packet gets
fragmented in the IP protocol with an
example.
4. Interpret the various IP address classes,
and their capacities.

1
Introduction

• Most of the fields in the header of an


IP datagram have been explained.
• We now discuss the fields used for
fragmentation and reassembly of
packets.
¾If the packet size exceeds a certain
maximum value, it is split into two or
more fragment packets.
¾The fragments are reassembled at some
later stage.

Fragmentation

• Why needed?
¾The IP layer injects a packet into the
datalink layer, and hopes for the best.
ƒ Not responsible for the reliable transport of
these packets.
¾Each layer imposes some maximum
size of packets, due to various reasons.
ƒ Called Maximum Transfer Unit (MTU).
¾Suppose a large packet travels through
a network whose MTU is too small.
ƒ Fragmentation is required.

2
Fragmentation (contd.)

• What to do then?
¾The different networks are connected
among themselves through routers.
¾Allow the routers to break the packets
into fragments, if necessary.
¾Each fragment is transmitted as a
separate IP packet.
¾The fragments need to be reassembled
back.

Fragmentation (contd.)

• When is reassembly of fragments


carried out?
¾Two alternatives:
ƒ Transparent fragmentation
ƒ Non-transparent fragmentation

3
Interconnection of Networks

N2
R
R
R
H
N1 R N4
R
H

R R
N3

Transparent Fragmentation

• Fragmentation is made transparent


to subsequent networks, through
which the packet pass.
• Basic concept:
¾An oversized packet reaches a router.
¾Router breaks it up into fragments.
¾All fragments sent to the same exit
router (say, RE).
¾RE reassembles the fragments before
forwarding to the next network.

4
Transparent Fragmentation (contd.)

• Why called transparent?


¾Subsequent networks are not even
aware that fragmentation had occurred.
• A packet may get fragmented several
times on its way to the final
destination.

Transparent Fragmentation (contd.)

N2
R
R
R
H
N1 R N4
R
H

R
Packet R
N3

5
Transparent Fragmentation (contd.)

• Drawbacks:
¾All packets must be routed via the same
exit router.
¾Exit router must know when all the pieces
have been received.
ƒ Either a “count” field or “end-of-packet”
field must be stored in each packet.
¾Lot of overhead.
ƒ A large packet may be fragmented and
reassembled repeatedly.

Non-transparent Fragmentation

• Fragmentation is not transparent to


subsequent networks.
• Basic concept:
¾Packet fragments are not reassembled
at any intermediate router.
¾Each fragment is treated as an
independent packet by the routers.
¾The fragments are reassembled at the
final destination host.

6
Non-transparent Frag. (contd.)

N2
R 213 1
R 1 2 3 2
R 3
P1 H 4
N1 R N4 5
R
H P2 P1 P2 4
P 5
Packet R 4 5 R
N3

Non-transparent Frag. (contd.)

• Advantage:
¾Multiple exit routers may be used.
¾Higher throughput.
• Drawback:
¾When a large packet is fragmented,
overhead increases.
¾Each fragment must have a header
(minimum 20 bytes).
• IP protocol uses non-transparent
fragmentation.

7
IP Datagram
0 4 8 15 16 31
VER HLEN Service type Total Length

-------HEADER--------
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum
Source IP Address
Destination IP Address

Options

DATA

What does IP do?

• To allow fragment reassembly at the


final destination, IP uses the
following fields in the header:
¾Identification (16 bits)
ƒ A datagram id set by the source.
¾Fragment offset (13 bits)
ƒ Indicates where in the original
datagram this fragment belongs to.
ƒ Specified in multiple of 8 bytes.

8
What does IP do? (contd.)

¾Flags (3 bits)
ƒ Two flags are defined:
D bit :: don’t fragment; prevents
fragmentation from taking
place.
M bit :: more fragment; specifies if
this fragment is the last one
in the original packet or not.

Example :: IP Fragmentation

N1 N2
1000
bytes
data MTU = MTU =
620 bytes 400 bytes

9
Example (contd.)

ID=5,FO=0,M=0 20 1000
By N1

ID=5,FO=0,M=1 ID=5,FO=75,M=0
20 600 20 400

By N2
ID=5,FO=47,M=1 ID=5,FO=75,M=1
20 376 20 224 20 376 20 24
ID=5,FO=0,M=1 ID=5,FO=122,M=0

1020 bytes sent and 1080 bytes received

Basic IP Addressing

• Each host connected to the Internet is


identified by a unique IP address.
• An IP address is a 32-bit quantity.
¾Expressed as a dotted-decimal notation
W.X.Y.Z, where dots are used to separate
each of the four octets of the address.
¾Consists of two logical parts:
ƒ A network number
ƒ A host number
¾This partition defines the IP address classes.

10
Dotted Decimal Notation

IP address: 01000010 10001000 00110000 01111110

01000010 10001000 00110000 01111110


(66) (134) (48) (126)

Dotted Decimal Notation: 66.134.48.126

Hierarchical Addressing

• A computer on the Internet is


addressed using a two-tuple:
¾The network number
ƒ Assigned and managed by central
authority.
¾The host number
ƒ Assigned and managed by local
network administrator.
• When routing a packet to the
destination network, only the
network number is looked at.

11
IP Address Classes

• There are five defined IP address classes.


¾Class A UNICAST
¾Class B UNICAST
¾Class C UNICAST
¾Class D MULTICAST
¾Class E RESERVED
• Identified by the first few bits in the IP
address.
• There also exists some special-purpose IP
addresses.

IP Address Classes (contd.)

• The class-based addressing is also


known as the classful model.
¾Different network classes represent
different network-to-hosts ratio.
¾Lend themselves to different network
configurations.

12
Class A Address

0 Network Host Host Host

• Network bits : 7
¾Number of networks = 27 – 1 = 127
• Host bits: 24
¾Number of hosts = 224 – 2 = 16,777,214
• Address range:
¾0.0.0.0 to 127.255.255.255

Class B Address

10 Network Network Host Host

• Network bits : 14
¾Number of networks = 214 – 1 = 16,383
• Host bits: 16
¾Number of hosts = 216 – 2 = 65,534
• Address range:
¾128.0.0.0 to 191.255.255.255

13
Class C Address

110 Network Network Network Host

• Network bits : 21
¾Number of networks = 221 – 1 = 2,097,151
• Host bits: 8
¾Number of hosts = 28 – 2 = 254
• Address range:
¾192.0.0.0 to 223.255.255.255

Class D Address

1110 Multicast Address

• Address range:
¾224.0.0.0 to 239.255.255.255

14
Address Distribution

A 2 billion

B 1 billion

C 500 million

Special-purpose IP Addresses

• Reserved for private use


¾10.x.x.x (Class A)
¾172.16.x.x – 172.31.x.x (Class B)
¾192.168.x.x (Class C)
• Loopback/local address
¾127.0.0.0 – 127.255.255.255
• Default network
¾0.0.0.0
• Limited broadcast
¾255.255.255.255

15
Some Conventions

• Within a particular network (Class A,


B or C), the first and last addresses
serve special functions.
¾The first address represents the
network number.
ƒ For example, 118.0.0.0
¾The last address represents the
directed broadcast address of the
network.
ƒ For example, 118.255.255.255

16
SOLUTIONS TO QUIZ
QUESTIONS ON
LECTURE 3

Quiz Solutions on Lecture 3

1. How many bits are there in the IP


address?

32 bits

2. How many bits are there in the Ethernet


address?

48 bits

17
Quiz Solutions on Lecture 3

3. What does the Ethernet address signify?

It signifies the 48-bit physical address


of the interface port.

4. What does the IP address signify?

It signifies the 32-bit Internet address


of a machine.

Quiz Solutions on Lecture 3

5. What does the port number signify?

It identifies an application/server
running on the designated machine. It
is an 8-bit number.

18
Quiz Solutions on Lecture 3

6. What does the various layers in the


simplified TCP/IP protocol stack
correspond to with respect to the OSI
seven-layer model?

Datalink Æ Datalink, Physical


IP Æ Network
TCP /UDP Æ Transport
Application Æ Session, Presentation,
Application

Quiz Solutions on Lecture 3

7. Why is the transport layer called end-to-


end or host-to-host layer?

Because it is at this layer two


programs running on the two end
hosts directly communicate with each
other over a “virtual” channel.

19
Quiz Solutions on Lecture 3

8. IP is unreliable, and TCP uses IP. How


does TCP provide reliable service to the
application layer?

TCP provides explicit error control. It


checks to find out if all parts of a
message has been transmitted
successfully. If not, it arranges for a
retransmission.

Quiz Solutions on Lecture 3

9. List two common applications that


use UDP.

TFTP and DNS

10. Why is the IP protocol considered


unreliable?

This is because in the IP protocol


a) a packet may be lost
b) duplicate packets may be generated
c) packets may arrive out of order.

20
Quiz Solutions on Lecture 3

11. What does TCP do if the message to be


sent is larger that what a single
datagram can handle?

It breaks the message into two or


more datagrams.

Quiz Solutions on Lecture 3

12. If a 1000 byte data message is sent using


TFTP, what will be the size in bytes of
the corresponding Ethernet packet?

1050 bytes. This includes 50


bytes of header.

13. What are the minimum and maximum


header size of an IP packet?

20 bytes, 60 bytes

21
Quiz Solutions on Lecture 3

14. What is the purpose of the “Time to live”


field in the IP header?

It contains a counter that is


decremented at each hop. The
packet is discarded when counter
value reaches zero. Prevents a
packet from falling into a routing
loop.

Quiz Solutions on Lecture 3

15. If the IP header is 192 bytes long, what


will be the value of the “HLEN” field?

6, because 6x32=192.

16. What is the maximum size of data that


can be accommodated in an IP
datagram?

65536 – 160 = 65376 bytes

22
QUIZ QUESTIONS ON
LECTURE 4

Quiz Questions on Lecture 4

1. An IP packet arrives at a router with the


first eight bits as 01000011. The router
discards the packet. Why?
2. An IP packet arrives at a router with the
first eight bits as 01001000. How many
bytes of options are there in the packet?
3. In an IP packet, the value of HLEN is 5,
and the value of the total length field is
1000. How many bytes of data the packet
is carrying?

23
Quiz Questions on Lecture 4
4. A packet has arrived at the destination
with the M bit as zero. What can you say
about the packet?
5. A packet has arrived at the destination
with the M bit as one. What can you say
about the packet?
6. A packet has arrived at the destination
with the M bit as one, and also the
fragment offset field as zero. What can
you say about the packet?
7. A packet has arrived at the destination
with the fragment offset field as 500.
What can you say about the packet?

Quiz Questions on Lecture 4

8. A packet has arrived at the destination with


the HLEN value as 5, the fragment offset
field as 150, and the total length field as
2000. What can you say about the packet?
9. In an IP network, does the intermediate
routers need to worry about fragmentation
and reassembly?
10. Can an IP fragment contain any number of
data bytes less than the maximum possible
value?

24
Quiz Questions on Lecture 4

9. Change the following IP address from


binary notation to dotted decimal
notation.
11000100 10001111 00110000 10000001
10. Find the error if any in the following IP
address:
144.15.256.7
11. Find the class of the following IP address:
227.15.75.111

Quiz Questions on Lecture 4


12. Given the network address 135.75.0.0,
find the class, the network id, and the
range of the addresses.
13. Given the network address 216.12.20.0,
find the class, the network id, and the
range of the addresses.
14. What do the following IP address signify:
144.16.255.255
15. An IP packet with 2500 bytes of data
(plus header) passes through an IP
network with MTU=500. How many
additional bytes will be delivered at the
destination?

25
Indian Institute of Technology Kharagpur

26

You might also like