Beruflich Dokumente
Kultur Dokumente
1
Orientation
IP (Internet Protocol) is a Network Layer Protocol.
2
Internet Protocol
IP as a Routed Protocol
IP is a connectionless,
unreliable, best-effort
delivery protocol.
IP accepts whatever data
is passed down to it from
the upper layers and
forwards the data in the
form of IP Packets.
All the nodes are
identified using an IP
address.
Packets are delivered
from the source to the
destination using IP
address
Internet Protocol
Packet Propagation
IP: The waist of the
hourglass
IP is the waist of the
hourglass of the Applications
Internet protocol
HTTP FTP SMTP
architecture
TCP UDP
Multiple higher-layer
IP
protocols
Multiple lower-layer
Data link layer
protocols protocols
Physical layer
Only one protocol at the protocols
network layer.
5
Application protocol
IP is the highest layer protocol which
is implemented at both routers and
hosts
6
IP Service
Delivery service of IP is minimal
Consequences:
Higher layer protocols have to deal with losses or with duplicate
packets
Packets may be delivered out-of-sequence
9
IP Service
IP supports the following services:
one-to-one (unicast)
one-to-all (broadcast)
one-to-several (multicast)
unicast
broadcast multicast
10
DATAGRAM
A packet in the IP layer is called a datagram,
a variable-length packet
Consisting of two parts: header and data.
The header is 20 to 60 bytes in length and
contains information essential to routing and
delivery.
11
IP datagram
12
IP Datagram Format
bit # 0 7 8 15 16 23 24 31
header
version DS ECN total length (in bytes)
length
D M
Identification 0 Fragment offset
F F
time-to-live (TTL) protocol header checksum
source IP address
destination IP address
options (0 to 40 bytes)
payload
4 bytes
Big Endian
Little Endian Stores the high-order byte at
Stores the low-order byte at the lowest address, and the
the lowest address and the low-order byte at the highest
highest order byte in the address.
highest address. Base Address+0 Byte3
Base Address+0 Byte0 Base Address+1 Byte2
Base Address+1 Byte1 Base Address+2 Byte1
Base Address+2 Byte2 Base Address+3 Byte0
Base Address+3 Byte3
Motorola processors use big endian.
Intel processors use this order
15
Fields of the IP Header
Version (4 bits): current version is 4, next version
will be 6.
-This field specifies the version of IP used for
transferring data. The size of the Version field is 4
bits. Both the sender and the receiver must use
the same version of IP to ensure proper
interpretation of the fields in the datagram.
Header length (4 bits): length of IP header, in
multiples of 4 bytes.
-You must multiply the value in this field by
four to get the length of the IP header. For
example, if the value in this field is 3, the length
of the header is 3*4, which is 12 bytes.
TOTAL LENGTH: Total Length field specifies the
total length of the datagram. The size of the field
is 16 bits. The Total Length
16 field can be calculated
DS/ECN field (1 byte)
This field was previously called as Type-of-
Service (TOS) field. The role of this field
has been re-defined, but is backwards
compatible to TOS interpretation
Differentiated Service (DS) (6 bits):
Used to specify service level (currently
not supported in the Internet)
Explicit Congestion Notification (ECN) (2
bits):
New feedback mechanism used by TCP
Fields of the IP Header
Identification (16 bits): Unique
identification of a datagram from a host.
Incremented whenever a datagram is
transmitted
Flags (3 bits):
First bit always set to 0
DF bit (Do not fragment)
MF bit (More fragments)
Will be explained later Fragmentation
18
Fields of the IP Header
Time To Live (TTL) (1 byte):
Specifies longest paths before datagram is
dropped
Role of TTL field: Ensure that packet is
eventually dropped when a routing loop occurs
Used as follows:
Sender sets the value (e.g., 64)
Each router decrements the value by 1
When the value reaches 0, the datagram is
dropped
19
Fields of the IP Header
Protocol (1 byte):
Specifies the higher-layer protocol.
Used for demultiplexing to higher layers.
20
Value Protocol
(Decim
al)
23
Maximum Transmission Unit
Maximum size of IP datagram is 65535, but the data link layer
protocol generally imposes a limit that is much smaller.
Example:
Ethernet frames have a maximum payload of 1500 bytes
IP datagrams encapsulated in Ethernet frame cannot be
longer than 1500 bytes
24
MTU
The amount of data that can be
transmitted in a single frame is
calledMaximum Transfer Unit(MTU)
and varies with the network
technology that is used.
MTU size is measured in bytes.
For example, the MTU for Ethernet is
1,500 bytes, whereas it is 4,352 bytes
for FDDI.
IP Fragmentation
What if the size of an IP datagram exceeds the MTU?
IP datagram is fragmented into smaller units.
What if the route contains networks with different MTUs?
Ethernet
FDDI
Ring
Host A Router Host B
MTUs: FDDI: 4352 Ethernet: 1500
Fragmentation:
IP router splits the datagram into several datagram
Fragments are reassembled at receiver
26
IP Fragmentation
If a datagram can be accommodated in a
frame, data transmission becomes very
simple
However, if the size of the datagram is more
than the value that can be accommodated
in the frame, the datagram must be divided
into logical groups called fragments.
If a datagram cannot be accommodated in a
single frame, it is divided or fragmented and sent
in multiple frames. The process of dividing a
datagram into multiple groups called
fragments is called fragmentation.
Where is Fragmentation
done?
Fragmentation can be done at the sender or
at intermediate routers
The same datagram can be fragmented
several times.
Reassembly of original datagram is only
done at destination hosts !!
Router
28
Whats involved in
Fragmentation?
The following fields in the IP header are involved:
31
Determining the length of
fragments
To determine the size of the fragments we recall that,
since there are only 13 bits available for the fragment
offset, the offset is given as a multiple of eight bytes.
As a result, the first and second fragment have a size
of 996 bytes (and not 1000 bytes).
This number is chosen since 976 is the largest
number smaller than 100020= 980 that is divisible
by eight.
The payload for the first and second fragments is 976
bytes long, with bytes 0 through 975 of the original
IP payload in the first fragment, and bytes 976
through 1951 in the second fragment.
The payload of the third fragment has the remaining
428 (448-20) bytes, from byte 1952 through 2379.
With these considerations, we can determine the
values of the fragment offset, which are 0, 976 / 8 =
122, and 1952 / 8 = 244, 32 respectively, for the first,
Why the fragment offset should be in
integral of 8 bytes?
-Maximum IP packet size, in bytes, fits in
16 bits (so it's 2^16), and the maximum
fragment offset is 13 bits (so it's 2^13,
so it's 2^16/2^13, which is 2^(16-13), or
2^3, or 8.
The More Fragments field is set to 1 for
all fragments but the last, to let the
recipient know when it has received all
the fragments.
ARP and RARP
Internet Control
Message Protocol
WhyICMP
What it Does
I
C
M
P
ICMPEncapsulation
ICMP
TYPESOFMESSAGES
MESSAGEFORMAT
ERRORREPORTINGMSG
QUERYMSG
ICMPPACKAGE
ICMP
TYPESOFMESSAGES
ICMP MESSAGE TYPES
The error-reporting messages
report problems that a router or a host (destination)
may encounter when it processes an IP packet.
The query messages,
which occur in pairs, help a host or a network
manager get specific information from a router or
another host.
For example,
1) Nodes can discover their neighbours.
2)Hosts can discover and learn about routers on
their network, and
3) Routers can help a node redirect its messages.
Error-reporting message
Types
Category Type Message
Error 3 Destination
Reporting Unreachable
Messages
4 Source Quench
11 Time Exceed
12 Parameter Problem
5 Redirection
Query 8/0 Echo Req / Rep
Messages
13 / 14 Timestamp Req /
Rep
ICMP
MESSAGEFORMAT
ERRORREPORTINGMSG
QUERYMSG
GeneralformatofICMPmessages
ICMP
MESSAGEFORMAT
ERRORREPORTINGMSG
QUERYMSG
Error Reporting Messages
ICMP always reports error messages to the original
source
The ping program to test the server fhda.edu. The result is shown
below
$ ping fhda.edu
PING fhda.edu (153.18.8.1) 56 (84) bytes of data.
64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=0 ttl=62 time=1.91 ms
64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=1 ttl=62 time=2.04 ms
64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=2 ttl=62 time=1.90 ms
64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=3 ttl=62 time=1.97 ms
64 bytes from tiptoe.fhda.edu (153.18.8.1): icmp_seq=4 ttl=62 time=1.93 ms
PING
source host. It is 16 bits long, which means that the port number can range from
0 to
65,535. If the source host is the client (a client sending a request), the port number, in
most cases, is an ephemeral port number requested by the process and chosen by the
UDP software running on the source host. If the source host is the server (a server
sending a response), the port number, in most cases, is a well-known port number.
Destination port number. This is the port number used by the process running
on
the destination host. It is also 16 bits long. If the destination host is the server (a
client sending a request), the port number, in most cases, is a well-known port
number. If the destination host is the client (a server sending a response), the port
number, in most cases, is an ephemeral port number. In this case, the server copies
the header.
in an IP datagram.
Checksum. This field is used to detect errors over the entire user
109
CHECKSUM
UDP checksum calculation is different from the one for IP and ICMP. Here
the checksum includes three sections: a pseudoheader, the UDP header,
and the data coming from the application layer.
1. Connectionless Service
2. Flow and Error Control
3. Encapsulation and Decapsulation
4. Queues in UDP
Format
Encapsulation
139
Sequence number
The sequence number for each segment is the number of
the first byte of data carried in that segment.
When a segment carries a combination of data and
control information (piggybacking), it uses a sequence
number.
If a segment does not carry user data, it does not logically
define a sequence number.
However, some segments, when carrying only control
information, need a sequence number to allow an
acknowledgment from the receiver.
These segments are used for connection establishment,
termination, or abortion.
The receive window closes (moves its left wall to the right) when
more bytes arrive from the sender.
It opens (moves its right wall to the right) when more bytes are
pulled by the process.
We assume that it does not shrink (the right wall does not
move to the left).
160
The opening, closing, and shrinking of the send window is
controlled by the receiver.
The send window closes (moves its left wall to the right) when a
new acknowledgement allows it to do so.
The send window opens (its right wall moves to the right) when
the receive window size (rwnd) advertised by the receiver allows
it to do so.
The limitation does not allow the right wall of the send
window to move to the left.
What is the value of the receiver window (rwnd) for host A if the
receiver, host B, has a buffer size of 5,000 bytes and 1,000 bytes
of received and unprocessed data?
Solution
The value of rwnd = 5,000 1,000 = 4,000. Host B can receive
only 4,000 bytes of data before overflowing its buffer. Host B
advertises this value in its next segment to A.
What is the size of the window for host A if the value of rwnd is
3,000 bytes and the value of cwnd is 3,500 bytes?
Solution
The size of the window is the smaller of rwnd and cwnd, which is
3,000 bytes.
In this case, the sender does not actually shrink the size of the
window, but stops sending data until a new advertisement has
arrived.
the sender can always send a segment with 1 byte of data. This is
called probing and is used to prevent a deadlock.
Example:
If TCP sends segments containing only 1 byte of data, it means that
a 41-byte datagram (20 bytes of TCP header and 20 bytes of IP
header) transfers only 1 byte of user data.
Here the overhead is 41/1, which indicates that we are using the
capacity of the network very inefficiently.
The inefficiency is even worse after accounting for the data link
layer and physical layer overhead.
171
The solution is to prevent the sending TCP from sending the
data byte by byte.
How long should the sending TCP wait? If it waits too long,
it may delay the process.
simple
After the sending TCP has sent the data in the window, it
stops.
This kills the syndrome. 179
Delayed acknowledgment also has another advantage:
In modern implementations, a
retransmission occurs if the
retransmission timer expires or three
duplicate ACK segments have arrived.
TCP uses congestion window and congestion policy that avoid congestion
and detect and alleviate congestion.
Congestion window:
In flow control the sender window size depends on the size of receiver
buffer(rwnd).
Congestion also depends on the network ,if network is slow compared to
the packets created by the sender,it must tell the sender to slow down or else
it will not be delivered.(cwnd)
Actual window size=min(rwnd,cwnd)
It is a method of congestion control by providing shape to data flow before entering the packet into
the network.
At connection set-up time, the sender and carrier negotiate a traffic pattern (shape)
210
Leaky Bucket Algorithm
The Leaky Bucket Algorithm used to control rate in a
network.
In this algorithm the input rate can vary but the output
rate remains constant.
(a) A leaky bucket with water. (b) a leaky bucket with packets.
212
Leaky Bucket Algorithm
Algorithm
213
Example
Let n = 1000
Packet =. 200 700 500 450 400 200
This procedure is repeated until all the packets is sent to the network.
214
Token Bucket Algorithm
5-34
Algorithm
Step - 2 : The bucket can hold at most b-tokens. If a token arrive when
bucket is full it is discarded.
Step - 3 : When a packet of m bytes arrived m tokens are removed from the
bucket and the packet is sent to the network.
Step 4 : If less than n tokens are available no tokens are removed from the
buckets and the packet is considered to be non conformant.
217
DIFFERENCE BETWEEN LEAKY BUCKET AND TOKEN BUCKET ALGORITHM
218