SlideShare ist ein Scribd-Unternehmen logo
1 von 188
Downloaden Sie, um offline zu lesen
COMPUTER NETWORKS
Ajit K Nayak, Ph.D.
Department of Computer Science & Information Technology,
ITER, SOA University.
Lecture Notes
Module III
Computer Networking / Module III/ AKN / 2
Out Line of Module III
 Network Layer, Network Layer Protocols
 Transport Layer, Congestion control &
Quality of service
 Application Layer protocols
Readings: “Data Communications and Networking” Third
Edition, Behrouz A Forcuzan, Chapter 19 - Chapter 23
Computer Networking / Module III/ AKN / 3
Network Layer
Lecture I
• Host-to-Host Delivery
• Addressing
• Routing
•Network Layer Protocols
• IPV4
• ARP
• ICMP
Computer Networking / Module III/ AKN / 4
Network Layer
Protocol used is IP for Network Layer
Responsibility of this layer to deliver the
datagram to the correct destination host. i.e. host-to-
host delivery
Computer Networking / Module III/ AKN / 5
Classful IP Addresses
 Each host on a TCP/IP internet is assigned a unique
32-bit unicast Internet address that is used in all
communication with that host.
 Each unicast IP address is a pair(netid, hostid), where
netid identifies a network and hostid identifies a host
on that network
 The total address space is 232=4,294,967,296. But all
addresses are not usable
 It is represented in dotted decimal notation
128.11.3.31
1000000 00001011 00000011 00011111
Computer Networking / Module III/ AKN / 6
Type of communication
 Unicast: one-to-one communication. i.e. One
source sends to exactly one destination host
 Multicast: one-to-a group. i.e. one sources
sends to a predefined group of destination
hosts simultaneously
 Broadcast: one-to-all. i.e. one source sends to
all other hosts available in that network.
Broadcast in Internet is not allowed.
 Others: anycast, geocast, etc. read yourself!
Computer Networking / Module III/ AKN / 7
Classes of IP addresses
 Class A 0.0.0.0 – 127.255.255.255
 Class B 128.0.0.0 – 191.255.255.255
 Class C 192.0.0.0 – 223.255.255.255
 Class D 224.0.0.0 – 239.255.255.255
 Class E 240.0.0.0 – 255.255.255.255
0 netid hostid
1 0 netid hostid
1 1 0 netid hostid
1 1 1 0 multicast address
1 1 1 1 reserved for future use
Computer Networking / Module III/ AKN / 8
IP Addresses
 Class A
 First octet defines the netid and first bit is fixed
 Max. no of network possible: 27-2=126
 All zero and all one values can not be used
 24 bits are used for hostid
 Max no of hosts 224-2=16,777,214 per network can
be connected to a class A network
 Class B
 First two octet define the netid and two left bits are
fixed : 214-2=16,382 networks and
 216-2=65,534 hosts/network
Computer Networking / Module III/ AKN / 9
IP Addresses
 Class C: First three octet defines netid and three bits
fixed
 221-2=2,097,151 networks
 28-2=254 hosts/network
 Class D: No net and host ids
 First four bits are fixed, remaining 24 bits define multicast
addresses?
 Class E: No use
Computer Networking / Module III/ AKN / 10
Special Addresses
 Network Addresses
 Addresses having all zero hostids are used to
identify a network and is not assigned to any host
Specific All 0s
. . .
123.0.0.0
123.50.16.90 123.65.7.34 123.90.123.4
Class A
Computer Networking / Module III/ AKN / 11
Network Address
Find Network addresses of the following IP addresses
24.32.3.29
190.234.211.21
200.23.31.6
Computer Networking / Module III/ AKN / 12
Special Addresses contd.
 Direct Broadcast Addresses
 Used by a router to broadcast a message to all
hosts of a network
 It can only be used as a destination address by
specifying hostid as all 1s
Specific All 1s
. . .
221.45.71.0
221.45.71.20 221.45.71.64 221.45.71.99
Class C network
R
221.45.71.255
Computer Networking / Module III/ AKN / 13
Special Addresses contd.
 Limited Broadcast Addresses
 Used by a host to send a message to every other host in
that network
 It can only be used as a destination address by specifying
netid and hostid as all 1s
 Router blocks the packet and discards it.
All 1s All 1s
. . .
221.45.71.0
221.45.71.20 221.45.71.64 221.45.71.99
Class C network
R
Blocked here
Computer Networking / Module III/ AKN / 14
Special Addresses contd.
 This Host Addresses
 Used by a DHCP client at bootstrap as a source address to
get a valid IP address from the DHCP server
 It is specified by all 0s. The destination is a limited broadcast
address
 It is always a Class A address regardless of the network
All 0s All 0s
. . .
221.45.71.0
?.?.?.? 221.45.71.64 221.45.71.99
Class C network
B
Bootstrap server
221.45.71.1
Computer Networking / Module III/ AKN / 15
Special Addresses contd.
 Loop Back Addresses
 Used by a host to communicate with itself without
a special network interface
 This is the address with first byte as 127 and the
packet never goes out of the machine
127 Any
HostP1 P2
127.0.0.1
Computer Networking / Module III/ AKN / 16
Private Network Addresses
 These IPs should not be used in internet but one
can use for hosts that do not require direct access
to the Internet
 These addresses are filtered by Internet routers and
therefore do not have to be globally unique
 10.0.0.0 – 10.255.255.255
 172.16.0.0 – 172.31.255.255
 192.168.0.0 – 192.168.255.255
 Automatic Private IP Addressing
 Used by windows machine, if there is no DHCP available
 169.254.0.0 – 169.254.255.255
 Rfcs: 1466, 1918, 1597, 3927 etc.
Computer Networking / Module III/ AKN / 17
Masking
 To reach at a host we have two level of hierarchy
1. Reach at destination network 2. Reach at host
 Masking is a process that extracts the address of
physical network from an IP address
 Mask is an IP having netid all ones and hostid all zeros
141.14.2.21 255.255.0.0 141.14.0.0
 A bit wise and operation is performed
10001101 00001110 00000010 00010101
11111111 11111111 00000000 00000000
141 14 0 0
Mask
Computer Networking / Module III/ AKN / 18
Problems with classful
 There are three main problems with “classful” addressing,
1. Lack of Internal Address Flexibility: Big organizations are
assigned large, “monolithic” blocks of addresses that don't
match well the structure of their underlying internal networks.
2. Inefficient Use of Address Space: The existence of only three
block sizes (classes A, B and C) leads to waste of limited IP
address space.
3. Proliferation of Router Table Entries: As the Internet grows,
more and more entries are required for routers to handle the
routing of IP datagrams, which causes performance problems
for routers. Attempting to reduce inefficient address space
allocation leads to even more router table entries.
Computer Networking / Module III/ AKN / 19
Subnetting
 This technique helps to divide one physical network
into some smaller subnets (i.e.to create hierarchies)
 Advantage:
 Increasing popularity of LAN may exhaust the netids
 When many hosts connected to a single network the
messages are overcrowded due to the broadcast nature of
LANs
 The scheme allows multiple physical networks to
share a same prefix (1980s)
 A second extension is also available to divide suffix
and prefix at an arbitrary point called classless
addressing and supernetting (1990s)
Computer Networking / Module III/ AKN / 20
Subnetting an Example
141.14.0.0
. . .
141.14.0.0
.2.20 .7.96 .22.90
R
141.14.0.0
141.14.0.0
R
.2
.7
.22
Without subnet
With subnet
.2.20
.7.96
.22.90
141.14.2.0
141.14.22.0
141.14.7.0
Computer Networking / Module III/ AKN / 21
Subnetting
 Rest of the Internet still fills as if one
network. i.e packet destinated at 141.14.2.21
still reach at router R and it is aware of three
subnets.
 Last two octets define two things
1. subnetid 2. hostid
 Delivery of packets now involve three steps
1. Delivery to the network
2. Delivery to the subnet
3. Delivery to the host
Computer Networking / Module III/ AKN / 22
Example 1
Q. Design 8 subnets from 211.77.20.0
Ans. Taking 3 bits for subnet in last byte, remaining 5 bits are
used for hostid
Computer Networking / Module III/ AKN / 23
Example 1 contd.
 According to classic IP routing rules, it was not possible to use the
subnets with all zero or all one values. i.e. subnet #0 and subnet #7
 However, most modern machines have no troubles using uppermost or
lowermost subnets
Computer Networking / Module III/ AKN / 24
Example 2
 The network address is x.y.z.0, subnet mask is
255.255.255.248 then design the subnets
 From mask it is clear that first five bits of last byte is
used as subnetid and last three bits are used as
hostids
 i.e. 25=32 subnets and 23-2=6 hosts/subnets
 Subnet #0: x.y.z.0, x.y.z.1, . . ., x.y.z.6, x.y.z.7
 Subnet #1: x.y.z.9, x.y.z.10, . . ., x.y.z.14, x.y.z.15
 Subnet #2: x.y.z.16, x.y.z.17, . . ., x.y.z.22, x.y.z.23
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 Subnet #29: x.y.z.232, x.y.z.233, . . ., x.y.z.238, x.y.z.239
 Subnet #30: x.y.z.240, x.y.z.241, . . ., x.y.z.246, x.y.z.247
 Subnet #31: x.y.z.248, x.y.z.249, . . ., x.y.z.254, x.y.z.255
 First column is used as subnet id, last column is used as
broadcast address.
Computer Networking / Module III/ AKN / 25
IP addresses are used not only to
uniquely identify IP addresses
but also to facilitate the routing
of IP datagrams over networks
Computer Networking / Module III/ AKN / 26
Problems with IP Addressing
 If a host computer moves from one network to another, its IP
address must change (manually)
 Because routing uses the network portion of the IP address, the
path taken by packets traveling to a host with multiple IP address
depends on the address used.
 Addressing Authorities
 IANA: Internet Assigned Number Authority upto 1998
 ICANN: Internet Corporation for Assigned Names and Numbers
R A B
Network 1
Network 2
I2
I2 I3
I5I4
If link I3 fails than A cannot send to B
Computer Networking / Module III/ AKN / 27
Dynamic Address configuration
 Each computer that is connected to Internet must have
following information
 Its IP address
 Subnet mask
 Router/gateway‟s IP address
 Name server‟s IP address
 These information are maintained in operating system and
stored in disk
 These information may be acquired by assigning static values
or can also be obtained dynamically when needed
 DHCP is designed to assign these information dynamically (on
demand)
 It is a client/server program, when client sends a request to
server, server selects an IP address from the pool of unused IP
address for a negotiable period of time (lease time)
Computer Networking / Module III/ AKN / 28
Dynamic Host Configuration Protocol
TRANSITION STATES
 All the DHCP servers
replies with a
DHCPOFFER message,
which contains IP
address, lease time etc.
 client chooses on of the
offers. Client now sends a
DHCPREQUEST message
 Requesting state
Remains in this state till it gets the DHCPACK, which creates a binding of
physical and logical address
 Initializing state
 Client broadcasts a
DHCPDISCOVER message
 Selecting state
Computer Networking / Module III/ AKN / 29
DHCP contd.
 Bound state
 After using 50% of the time, client requests for renewal by
sending another DHCPREQUEST, or client can cancel the
lease and go back to the initializing state
 Renewing state
 If it receives the DHCPACK then the timer is reset or client
goes again for rebinding. If not received till 87.5% of lease
time then goes to rebinding state
 Rebinding state
 It remains in this state till it receives a DHCPNAK or lease
expires, client goes to initializing state for a fresh process or
goes to bound state if DHCPACK is received
Computer Networking / Module III/ AKN / 30
Network Address Translation
 Home users and small business can be connected to Internet
via an ADSL or cable modem and every body needs one or
more IP addresses
 Due to shortage of IP addresses, the demand may be full filled
by using the private network address through Network address
translation method (NAT)
 NAT enables a user to have large set of addresses (private)
internally and one or a small set of addresses externally
(global)
Address translation
Computer Networking / Module III/ AKN / 31
NAT contd.
 Address translation
 All out going packets go through
the NAT router, which replaces
destination address in the packet
with global NAT address.
 Similarly all incoming packets
also pass through the NAT
router, which replaces the
destination address with
appropriate private address
using Translation table
Private
Address
Private
Port
External
Address
External
Port
Transport
Protocol
172.18.3.1 1400 25.8.3.2 80 TCP
172.18.3.2 1401 25.8.3.2 80 TCP
... ... ... ... ...
Computer Networking / Module III/ AKN / 32
Routing techniques
 Usually routing uses an Internet routing table on each
machine that stores information about possible
destinations and how to reach them
 Next Hop Routing
network
10.0.0.0
network
20.0.0.0
network
30.0.0.0
network
40.0.0.0
Q R
SDest Next hop
10.0.0.0 20.0.0.5
20.0.0.0 Direct
30.0.0.0 Direct
40.0.0.0 30.0.0.7
10.0.0.5
20.0.0.5
20.0.0.6
30.0.0.6
30.0.0.7
40.0.0.7
Computer Networking / Module III/ AKN / 33
Network-Specific Routing
 Instead of one entry for each destination host,
we maintain one entry for total network
Computer Networking / Module III/ AKN / 34
Host-Specific Routing
 Host-specific routes
 Although all routing is based on networks and not on specific
hosts, most software allows per-host routes as a special case.
 This is helpful for administration purposes like testing,
controlling access and debugging etc.
Net1
Net2 Net3
R
P
Q
A
B
Destination Next hop
B R
Net2 Q
Net3 R
Table for host A
Computer Networking / Module III/ AKN / 35
Default Routing
 Default Routes
 In this type of routing , it looks in the routing table for the
destination network. If no route appears in the table, the
routing routines send the datagram to a default router
 It is useful when the network has a small set of local
addresses and only one connection to the rest of internet
Rest of
Internet
network
10.0.0.0
network
20.0.0.0
Q
S
Destination Next hop
20.0.0.0 Q
Default S
• Routing table
for a host on
network 10.0.0.0
Computer Networking / Module III/ AKN / 36
Static versus Dynamic Routing Tables
 Routing tables may be constructed statically or
dynamically. The success of routing depends on the
consistency of routing table information
 Static Routing table
 Information entered manually, can be used for small intranet
that does not change very often. It is not a good choice in
Internet where information changes very often
 Dynamic Routing table
 Updated periodically using the dynamic routing protocols like
RIP, OSPF, or BGP etc.
 Dynamic routing is preferred over static routing as the
updation of routing table is done dynamically thus providing
a consistent routing mechanism.
Computer Networking / Module III/ AKN / 37
Hierarchical Routing
 It is not possible to keep information about each host and or
each network in the routing table of each Internet router
 To solve this problem we maintain hierarchical routing.
According to this technique the we maintain partial information
in routers
 e.g. if the block assigned to one ISP is a.b.c.d/n and it may
create many subnets of e.f.g.h/m for each of its customers, the
rest of the Internet does not have to be aware of this division.
i.e. all customer of that ISP are defined as a.b.c.d/n to the rest
of Internet
 There is only one entry needed for this ISP
 The router inside ISP recognizes the sub-blocks and routes the
packets to the destination
 To reduce the size of table further the hierarchical routing may
be included. i.e. The routers of ISPs outside Europe will have
only one entry for packets to Europe in their routing tables.
Computer Networking / Module III/ AKN / 38
Internet Protocol (IPV4:RFC-791)
 Connection less delivery system
 Internet service consists of an unreliable, best-effort,
connection less packet delivery system.
 Unreliable because delivery is not guaranteed.
 i.e.The packet may be lost, duplicated, delayed or delivered
out of order but the service will not detect such conditions,
nor will it inform the sender or receiver.
 A sequence of sent from one computer to another may
travel over different paths, or some may be lost while others
are delivered.
 It is best-effort delivery because the internet software
makes an earnest attempt to delivery packets
 i.e. the internet does not discard packets always.
Unreliability arises only when resources are exhausted or
underlying networks fail.
Computer Networking / Module III/ AKN / 39
Internet Protocol (contd.)
 The Internet protocol defines unreliable, connection less
delivery mechanism ( IP )
 It defines the basic unit of data transfer used throughout the
internet by specifying the exact format of data
 It performs routing function, choosing the path over which
the data will be sent
 It also includes a set of rules that embody the idea of
unreliable packet delivery.
 i.e. It tells how to process the packets, how and when error
message should be generated, and the conditions under
which the packets can be discarded.
Computer Networking / Module III/ AKN / 40
Internet Protocol Datagram Format
Ver Total length
Fragment offsetIdentification
Source IP
Destination IP
IP Options if any
Data
. . .
Service TypeHLen
Flag
TTL Protocol Header checksum
Padding
0 4 8 16 19 24 31
Computer Networking / Module III/ AKN / 41
IP Header
 Ver: version of IP (4 or 6)
 HLen: total length of datagram header (20-60 bytes)
 Type of Service: how the datagram should be handled
by the router
 Precedence: (3 bits) defines priorities in cases like congestion
 TOS bits: low delay, high throughput, high reliability, less cost.
A hint to router as a decision making factor for routing
algorithms. Internet does not guarantee to provide any
particular type of service
 IETF redefined the meaning
 If last three bits are zero than first three bits define
precedence (backward compatibility)i.e. xxx000
Precedence D T R C
0 4 7
CODEPOINT unused
0 6 7
Computer Networking / Module III/ AKN / 42
IP Header (contd.)
 The 64 code point values maps to an underlying
service definition and is divided into three groups
Pool Codepoint Assigned by
1 xxxxx0 Standards Organization(IETF)
2 xxxx11 Local or Experimental
3 xxxx01 Local or experimental for now
 If the standards bodies exhaust all values in pool 1,
they may also choose to assign values in pool 3
 Total Length: defines total length of the datagram in
bytes.
 i.e. 216-1=65,535 bytes max. including header
Computer Networking / Module III/ AKN / 43
IP Header (contd.)
 Fragmentation
 Each datagram is encapsulated in a datalink frame
before transmission.
 It has to travel through different networks and the
frame size differs for different networks and is
defined by MTU of that network
 Identification: IP software keeps a global counter
and increments each time a new datagram created.
 if the datagram is fragmented then the identification
is copied to each fragment of same datagram
 Flags:
 3 bit field, D:do not fragment M: more fragment
U D M
Computer Networking / Module III/ AKN / 44
IP Header (contd.)
 D=1: datagram must not be fragmented
 D=0: datagram can be fragmented
 M=1: It is not the last fragment
 M=0: It is the last or only fragment
 Fragmentation offset: It shows the relative position of the
fragment, w.r.t. whole datagram
0 3999
0 1399
1400 2799
2800 3999
Offset measured in bytes
0/8 = 0
1400/8 = 175
2800/8 = 350
Computer Networking / Module III/ AKN / 45
IP Header (contd.)
 Time to Live:It specifies how long in seconds, the
datagram is allowed to remain in the internet system
 When a datagram arrives at a router, it records the
time and before sending forward it decrements the
time to live field.
 When it becomes zero, the datagram is discarded and
an error message is sent to the source
 But to estimate exact time is difficult because routers
do not usually know the transit time for physical
networks.
 Thus in practice the time to live acts as a hop limit
rather than an estimate of delay. Each router only
decrements the value by one till it becomes zero.
Computer Networking / Module III/ AKN / 46
IP Header (contd.)
 Protocol: It defines the higher level protocol
that uses the IP layer service
 ICMP- 1, IGMP-2, TCP-6, UDP-17 etc.
 Header Checksum: Ensures the integrity of
header values
 Divide the packet in to k section of 16 bits each
 All sections are added using ones complement
method
 The final result is complemented to make checksum
 Follow the same method at receiver. If the result is
zero accept else discard the datagram
Computer Networking / Module III/ AKN / 47
IP Header Options
 IP header is made of two parts: the fixed part and the
variable part. Fixed part is 20 byte long; the variable
part comprises the option which can be a max. of 40
bytes.
 These are included primarily for network testing and
debugging
 Format
 Code:
 It contains copy(1), class(2), and number(5)
 Copy = 1: options should be copied to all fragment
 Copy = 0: options must be only copied to first fragment
Code(8) Length(8) Data (variable length)
Copy Class Number
Computer Networking / Module III/ AKN / 48
Options field of IP Datagram
 Class
 00 : used for datagram control, 01: reserved
 10: Debugging and management, 11: reserved
 Number
 Defines the type of options
 Length
 It defines the total length of the option including the code
field and the length field itself
 Data
 Contains the data that specific options require
Computer Networking / Module III/ AKN / 49
Types of Options
 0 : End of option, used if options do not end at end of header
 1: no operation, used to align octets
 7: Record Route, It is used to record the routers that handles the
datagrams. It can list up to nine router addresses?
 The source creates empty fields for the IP addresses in the data field of
the option
Options
Data
0
7-byte opt
8-byte opt
1
Code Length Pointer
First IP Address (empty)
Second IP Address (empty)
Third IP Address (empty)
Computer Networking / Module III/ AKN / 50
Types of Options
 Whenever a router handles the datagram, it compares
the pointer and length field. If the pointer field is
greater than length field, the list is full.
 Else router inserts its IP address at the position
specified by pointer and increments the pointer by
four.
 This option requires that two machines must
cooperate. i.e. source must enable record route and
destination must agree to process the resultant list.
 9: Strict source route, used by the source to
predetermine a route for the datagram as it travels
through internet
 i.e. a source may choose a safer route to the destination
Computer Networking / Module III/ AKN / 51
Types of Options
 If a datagram specifies a strict source route, all of the
routers defined in the option must be visited in order
by the datagram.
 If a datagram reaches at a router not in the list then it
is discarded and error message is sent to the source.
 If a datagram reaches at the destination and some
entries were not visited, it will also be discarded and
error message is issued.
 i.e. The path between two successive addresses in the
list must consists of a single physical network
 It is only useful when the network topology is known
Computer Networking / Module III/ AKN / 52
Types of Options
 3: Loose source route, It is similar to strict source but allows
multiple network hops between successive address in the list
 Both source route options requires routers along the path to
overwrite the list with their local network address.
 4: Timestamp, is used to record the time of datagram
processing by the router.
Code Length Pointer
First IP Address
First Timestamp
. . .
OFlow Flags
Computer Networking / Module III/ AKN / 53
Types of Options
 Length and pointer fields are used to specify the
length of the space reserved for the option and the
location of the next unused slot.
 Oflow(4) contains an integer count of routers that
couldnot supply timestamp because the option was
too small
 Flag(4), controls the exact format of the option and
tells how routers should supply timestamps.
 0: Record timestamps only, omit IP addresses
 1: Precede each timestamp by an IP address
 3: IP addresses are specified by sender; a router only
records a timestamp if the next IP address in the list
matches the router‟s IP address
Computer Networking / Module III/ AKN / 54
Routing IP Datagrams
 Routing is the process of choosing a path over which
to send packets, and router refers to a computer
making the choice
 The goal of IP is to provide a virtual network that
encompasses multiple physical network and offers a
connection less datagram delivery service
 Routing is divided into two forms
1. Direct delivery: Transmission of a datagram from one
computer across a single physical network directly to another
2. Indirect delivery: Transmission of datagram to a
destination not attached directly to the senders network, thus
forcing the sender to pass the datagram to a router for delivery
Computer Networking / Module III/ AKN / 55
Datagram delivery over a single Network
 In this case the final destination of the datagram is a
host connected to the same physical network
R
• The sender extracts the network address of destination IP and
compares it to the network portion of its own IP .
• If a match is found then the delivery is direct and it does not
involve routers
• Now the destination IP address is used to find its physical
address for actual datalink layer delivery?
• Extraction of network address
takes a few machine instructions
making the process extremely
efficient
Computer Networking / Module III/ AKN / 56
Indirect Delivery
 It is more difficult because the sender must identify a
router to which the datagram can be sent
R
R
• The datagram goes from router to
router until it reaches the destination
network
• At the destination network it
performs direct delivery to reach
at the host
• How can a host know which router to use for a given
destination?
• How can a router know where to send datagrams?
Computer Networking / Module III/ AKN / 57
Mapping Internet Address to Physical Address
 Delivery of a packet requires two levels of addressing.
 Hosts and routers are recognized at the network
level by their logical addresses, which is universal and
implemented in software
 But at physical level devices are recognized by their
physical addresses
 Therefore, the packet to be sent from A to B should
be mapped to the physical address of B
 Address mapping must be performed at each step
along a path from original source to ultimate
destination
i.e 1. Last hop addressing 2. Intermediate addressing
Computer Networking / Module III/ AKN / 58
Mapping Internet Address Physical Address
 Last hop addressing
 Packet‟s internet address is mapped to the final
destinations physical address
 Intermediate addressing
 At any point along the path packet is mapped to
intermediate routers physical address (as destination)
 Address resolution problem
 The problem of mapping logical to physical address is
called the ‘address resolution problem’.
 There are two technologies followed by TCP/IP to resolve
the problem.
1. Resolution through direct mapping
2. Resolution through Dynamic binding
Computer Networking / Module III/ AKN / 59
Mapping Internet Address Physical Address
 Resolution through Direct Mapping
 In proNET token ring network, the administrator chooses
small integers for physical addresses while installing an
interface.
 Now to have a efficient address resolution one can find a
function PA = f (IA) to calculate the numbers.
 i.e. if f is simple then the mapping will be simple
 Another way is to keep a table containing address pairs
(logical, physical) and a hash function may be used to
search that table
 Another advantage in this method is, if one interface of a
computer is changed then also the same physical address
can be used for the new interface
 Also new computers can be added to the network without
changing the existing assignments.
Computer Networking / Module III/ AKN / 60
Mapping Internet Address Physical Address
 Resolution through dynamic binding
 In Ethernet technology the 48 bit physical address is
assigned when manufactured
 Thus the physical address of a computer changes each time
an interface is changed.
 Because the physical address is 48 bit long and not assigned
by the user thus it is impossible to devise a function for
mapping as in previous case
 To avoid maintaining a mapping table (not possible !) the
designers developed a protocol to bind addresses
dynamically known as „Address Resolution Protocol‟
 ARP provides a mechanism that is both reasonably efficient
and easy to maintain
Computer Networking / Module III/ AKN / 61
Resolution through dynamic Binding
 Idea
 Sender broadcasts a special
packet that asks the
destination about its
physical address
 Destination recognizes the
packet and sends a reply
containing its physical
address
 Now the sender uses
physical address to send
packets directly to
destination
A B C D
A B C D
A B C D
Computer Networking / Module III/ AKN / 62
ARP Packet Format (RFC-826)
 H/W Type: 16 bit field defines type of LAN e.g. Ethernet=1
 Protocol Type: 16 bit field defining IP version e.g.
IPV4=0080016
 Hlen: 8 bit, length of hardware address e.g. Ethernet = 6
 Plen : 16 bit, length of logical address
 Operation : 8 bit, request=1, reply 2
Hardware Type Protocol Type
OperationH/W length Protocol length
Sender Hardware Address
Sender Protocol Address
Target Hardware Address
Target Protocol Address
Computer Networking / Module III/ AKN / 63
Address Resolution Protocol
 Encapsulation
 ARP packet is encapsulated directly in to a
datalink frame
 Refinements
 If the target machine is down or too busy to
accept the request? i.e sender may not receive a
reply (1) or it is delayed(2)
 Retransmit the request for (1) or it restores the
original outgoing packet till it resolves the address
SFD Dest Add Source Add Type Data CRC
ARP Packet
Computer Networking / Module III/ AKN / 64
ARP Implementation
 ARP Cache
 After receiving an ARP reply, it saves the IP address and
corresponding hardware address in its cache for successive
lookups
 But problem occurs if receiver crashes in between and
source gets no information but keep on sending
 To resolve above problem a timer is used, when it expires
the information in the cache is erased and normal procedure
starts again
 Another refinement possible is, senders IP-Physical address
binding can also be updated in receivers cache before
processing the ARP request
Computer Networking / Module III/ AKN / 65
Four cases using ARP
Computer Networking / Module III/ AKN / 66
Limitations with IP
 A datagram travels from router to router till it reaches
one that can deliver directly to its final destination
 If a router cannot route a datagram?
 If the router detects an unusual condition that affects
its ability to forward the datagram?
 In an connectionless system, each router operates
autonomously, i.e without coordination of sender.
and
 IP fails to deliver the datagram if
 The destination is temporarily or permanently disconnected
 The TTL expires
 The intermediate routers become so congested that they
cannot process the incoming traffic
Computer Networking / Module III/ AKN / 67
The Internet Control Message Protocol
 To allow routers in an internet to report errors or provide
information about unexpected circumstances, one mechanism
is attached with IP is called
“The Internet Control Message Protocol”, ICMP
 ICMP allows routers to send error or control messages to other
router or hosts; It provides communication between the IP
software on one machine and the IP software on another
 i.e. The ultimate destination of an ICMP message is not an
application program or user on destination but the IP software
of that machine
 ICMP is not restricted only to routers but is allowed to be used
by any arbitrary machine to get some information.
 ICMP messages travel across internet in the data portion of IP
datagrams
Computer Networking / Module III/ AKN / 68
Error Reporting / Error Correction
 When a datagram causes an error, ICMP can only report
the error condition back to the original source of the
datagram.
 The source must take some action to correct the error
 It cannot be used to inform intermediate routers about
the problem
 An Example
 If a datagram follows a path R1, R2, . . ., Rk and Rk has the
incorrect information and mistakenly routes the datagram to
Re
 Now Re cannot use ICMP to report the error back to Rk but it
can send a report back to the original source
 And the original source has no control over the misbehaving
router. In fact it is not possible for the source to know which
router (Rk) causes the problem
Computer Networking / Module III/ AKN / 69
ICMP Message
 Message Delivery
 It requires two levels of encapsulation
Header ICMP Data
Header Datagram Data
Header Frame Data
– Even though ICMP messages are encapsulated and sent
using IP datagrams, it is not considered a higher level
protocol, but a required part of IP
– It is Because, it needs to travel across several physical
networks to reach their final destination
Computer Networking / Module III/ AKN / 70
ICMP Message Format
 Type : identifies the message type
 Code : provides further information about the
message type
 Checksum : error detection
 ICMP messages that report errors always include the
header and first 64 bit data bits of the datagram
causing the problem
Type (8 bit) Code (8 bit) Checksum (16 bit)
Rest of Header
Data . . .
(Variable size)
Computer Networking / Module III/ AKN / 71
ICMP Message Format (contd.)
 The total table is available in page 133 of D.E. Comer
Type Message
0 Echo Reply
3 Destination unreachable
4 Source Quench
5 Redirect (change route)
8 Echo Request
9 Router Advertisement
10 Router solicitation
11 Time Exceeded for a datagram
12 Parameter problem on a datagram
Ping: One of the most
frequently used
debugging tool that
invokes ICMP echo
request and echo reply
messages
- Any machine that
receives an echo request
formulates an echo reply
and return it to the
original sender
Computer Networking / Module III/ AKN / 72
Echo Request and Reply Message
 Optional Data is a variable length field that
contains data to be returned to sender
 Identifier and Sequence number are used by
the sender to match replies to request.
 The Type field specifies whether the message
is a request (8) or reply (0)
Type(8 / 0) Code (0) Checksum
Data . . .
(optional)
Identifier Sequence no
Computer Networking / Module III/ AKN / 73
Reports of Unreachable Destinations
 When a router cannot forward or deliver an IP datagram, it sends
a ‘destination unreachable’ message back to the original
source
 The code field contains an integer that further describes the
problem
 Code Meaning Cause
 0: Network unreachable (h/w failure)
 1: host unreachable (do)
 2: Protocol unreachable (receiving protocol not running)
 3: Port unreachable (receiving appl. Prg not running)
 4: fragmentation required (D bit set) etc.
Type-3 Code (0-15) Checksum
Part of the received IP datagram including IP header +
first 8 byte of datagram data
Unused - all zeros
Computer Networking / Module III/ AKN / 74
Congestion and Datagram flow control
 IP doesn't have a flow control (rate of sending and receiving)
mechanism, which may lead to congestion. i.e
 The router eventually exhausts memory and discards additional
datagrams arrived
 ‘Source quench’ message has been designed to add a kind
flow control to IP.
 When a datagram is discarded, it sends a source quench
message to the sender, which helps in
 Reporting source that datagram is discarded
 Make the source aware of congestion and to slow down
Type-4 Code -0 Checksum
IP header + first 8 byte of datagram data
Unused - all zeros
Computer Networking / Module III/ AKN / 75
Route change requests
 Routers are assumed to know correct routes; hosts begin with
minimal routing information and learn new routes from routers
 If a host sends a datagram to an incorrect router, then the
router forwards the datagram in correct destination and sends
a ‘redirect message’ to the host.
 Now host updates its table accordingly
 Code
 0: redirection for the network
 1 : redirection for the host
Type-5 Code (0-3) Checksum
IP header + first 8 byte of datagram data
Router Internet Address
Computer Networking / Module III/ AKN / 76
Detecting Circular or long routes
 This message is generated in two cases
 Code 0: TTL exceeded
 If there are errors in one or more routing table a datagram
may travel in a loop. After some time when TTL becomes zero
the datagram is discarded and a ‘Time exceeded’ message is
sent to source
 Code 1: Fragment reassembly time exceeded
 If all fragments that belong to one datagram don‟t arrive at
the destination within a time limit then the fragments are
discarded and a Time exceeded message is sent to the source
Type-11 Code (0-1) Checksum
IP header + first 8 byte of datagram data
Unused
Computer Networking / Module III/ AKN / 77
Reporting Other Problems
 If a router or destination discovers an ambiguous or
missing value in any field of the datagram header then
it sends a ‘Parameter problem’ message back to
source
 Code 0: Error in header fields
 Pointer field points to the byte with problem
 Code 1: Required part of option is missing
 Pointer field not used in this case
Type-12 Code (0-1) Checksum
IP header + first 8 byte of datagram data
Pointer Unused
Computer Networking / Module III/ AKN / 78
Clock Synchronization and Transit Time Estimation
 ‘Time Stamp message’ is used by two machines to determine the round
trip time needed for an IP datagram to travel between them
 Each time the fields hold a no representing time measured in
milliseconds from midnight in GMT
 Calculation:
 Sending time = receive TS - Originate TS
 Receiving time = datagram return time - Trnsmit TS
 Round trip time = sending time + receiving time
Type(13-14) Code -0 Checksum
Source: Originate time stamp
Identifier Sequence number
Destination: Receive time stamp
Destination: Transmit time stamp (departure)
Computer Networking / Module III/ AKN / 79
Obtaining a subnet mask
 ‘Address mask request/reply’ message are used
by a host to obtain its mask from a router
Type(17-18) Code -0 Checksum
Address Mask
Identifier Sequence number
Router Discovery
Type(9) Code -0 Checksum
Router Address 1
Nun addr Life time
Preference level 1
Router Address 2
Addr size
Preference level 2 . . .
Computer Networking / Module III/ AKN / 80
Router Solicitation/Advertisement
 ICMP supports a router discovery scheme that allows hosts to
discover router address.
 A host can broadcast a ‘router solicitation’ message. The
routers that receive the message broad cast their routing
information using „router advertisement’ message
 ICMP router discovery scheme helps in two ways
 1. Instead of providing a statically configured router address
via a boot strap protocol, the scheme allows a host to obtain
information from router itself
 2. The mechanism uses a soft state technique with timers to
prevent hosts from retaining a route after a router crashes
 Routers advertise their information periodically, and a host discards a
route if the timer for a route expires (30min, 10min)
Type(10) Code -0 Checksum
Identifier Sequence number
Computer Networking / Module III/ AKN / 81
Network Layer Protocols
Lecture II
• IPV6
• ICMPR6
• Unicast Routing protocols
• RIP
• OSPF
Computer Networking / Module III/ AKN / 82
IPv6: Need for an alternative
 IPv4 has two level address structure (?) and
categorized into 5 classes. The use of address space
is inefficient
 The internet must accommodate realtime audio and
video transmission, which requires min delay and
reservation of resources
 The Internet must accommodate encryption and
authentication of data for some application
 Not only the computers but various devices
including house hold devices, hand held devices,
telephones etc. needs IP address
Computer Networking / Module III/ AKN / 83
Characteristics of IPv6
 Larger Address Space: 128 bit long
 Huge increase in address space
 Better header format
 options are separated from base header
 New options
 To add new functionalities
 Allowance for extension
 To support new technologies
 Support for resource allocation
 To support traffic such as real-time audio and video
 Support for more security
 Encryption and authentication mechanism
 RFCs
 1365, 1550, 1678, . . .
Computer Networking / Module III/ AKN / 84
IPv6 address
• 128 bits are divided into eight sections of hexadecimal nos, each 2
byte long sections separated by colons
• The address may be abbreviated, i.e the leading zeros can be
omitted (not trailing zeros)
• consecutive sections consisting of zeros
can be replaced with double semicolons
• if there are two runs of zero section than
only one of them can be abbreviated
Computer Networking / Module III/ AKN / 85
Unicast Addresses
 Defines two types of unicast addresses
 Geographically based unicast address (left for future
definition)
 Provider based unicast address (discussed below)
 Type identifier: 3 bit field defines the address as a provider-
based address
Computer Networking / Module III/ AKN / 86
Unicast Addresses contd.
 Registry identifier: 5bit field indicates the agency that has
registered the address.currently three registry has been
defined.
 INTERNIC: center for North America
 RIPNIC: center for European registration
 APNIC: for Asian and Pacific countries
 Provider indentifier: variable-length field identifies the provider
for Internet access (like ISP). A 16 bit length is recommended
for this field
 Subscriber identifier: a 24 bit is assigned to an organization
subscribing to the Internet via provider
 Subnet identifier: a 32 bit is assigned to define a subnet under
the territory of a subscriber
 Node identifier: a 48 bit is assigned for the identity of the node
connected to subnet
Computer Networking / Module III/ AKN / 87
Multicast addresses
 First 8 bits all 1s
 Flag: 4bit field that defines
the group address as either
permanent or transient
 Scope: 4 bit field defines
scope of the group address
 Group ID: 112 bits identifies
group
 Anycast addresses
 A packet destinated for anycast address is delivered to only
one member of the anycast group. i.e. member having
shortest route
 No block is assigned to for this anycast address
Computer Networking / Module III/ AKN / 88
Reserved addresses
 Start with eight zeros
 Unspecified address is used when a host does not know its own
address
 Loopback address is used by a host to test itself
 Compatible address is used during the transition from IPv4 to
IPv6. i.e. when passing from IPv6 to IPv6 via IPv4 network
 Mapped address is also used during transition when sending
from Ipv6 to IPv4 computer
Computer Networking / Module III/ AKN / 89
Local addresses
 Used when an organization wants to use IPv6
without being connected to Internet
 Nobody outside the organization can send a message
to the nodes using these addresses
 A link local address is used in an isolated subnet
 A site local address is used in an isolated site with
several subnets
Computer Networking / Module III/ AKN / 90
Format of an IPv6 datagram
• Each packet is
composed of a
mandatory base
header (40 bytes)
followed by a
payload.
• Payload consists of
two parts (65535
bytes)
• Optional
extension header
• Data from an
upper layer
Computer Networking / Module III/ AKN / 91
Base Header
 Version(4): version of IP
 Priority(4): priority of the packet w.r.t. congestion
 Flow level(3byte): special handling for a particular flow
of data
 Payload length(2 byte): total length of datagram
excluding base header
 Next header(8): either one of the optional extension
headers used by IP or the header for an upper layer
protocol like UDP, TCP
 Hop Limit(8): same as TTL
 Source Address(16byte): IP of source
 Source Address(16byte): IP of destination
Computer Networking / Module III/ AKN / 92
Comparison between IPv4 and IPv6 packet headers
Computer Networking / Module III/ AKN / 93
Extension header
The base header can be followed by six extension headers
 Hop-by-hop Option
 Is used when the source needs to pass information to all
routers visited by the datagram. Three options are defined
 Pad1: 1 byte, designed for alignment purposes
 PadN: used when 2 or more bytes needed for alignment
 Jumbo payload: is used to define a payload longer than 65535
bytes
 Fragmentation
 Only original source can fragment after using a path MTU
discovery to get the smallest MTU supported by any network
on the path
 If it will not use the technique then it must fragment a
datagram to a size <= 576 bytes
Computer Networking / Module III/ AKN / 94
Extension header contd.
 Authentication
 It validates sender, and ensures integrity of data
 Encrypted Security Payload
 It provides confidentiality and guards against
eavesdropping
 Source Routing
 Uses the concept of strict/loose source routing
 Destination Option
 Is used when the source needs to pass information to
the destination only. Intermediate routers are not
permitted access too this information
Computer Networking / Module III/ AKN / 95
Comparison between IPv4 options and IPv6 extension headers
Computer Networking / Module III/ AKN / 96
Transition from IPv4 to IPv6
Because of huge systems using IPV4 that‟s
why three strategies were proposed for
smooth transition
 Dual stack
 A station should run both IPv4 and
IPv6 simultaneously until all the
Internet uses IPv6
 If DNS returns IPV4 address then
source sends IPV4 packet else IPV6
packet
 Tunneling
 When two computers using IPV6 want
to communicate with each other and
the the packet has to pass through a
region that uses IPV4
 Therefore IPV6 packet is encapsulated
in an IPV4 datagram when it enters
that IPv4 region
Computer Networking / Module III/ AKN / 97
Transition from IPv4 to IPv6
 Header Translation
 It is necessary when the majority of the Internet
has moved to IPv6
 i.e. If sender uses IPv6 but receiver uses IPv4
 Header must be completely translated
 It uses mapped address of IPv6
Computer Networking / Module III/ AKN / 98
ICMPv6
Comparison of query messages in ICMPv4 and ICMPv6
Comparison of error-reporting messages in ICMPv4 and ICMPv6
Computer Networking / Module III/ AKN / 99
Unicast Routing Protocols
 A routing protocol allows routers share their knowledge
(routing information) about the network with other routers.
 They maintain a table to keep routing information. This table
gets updated periodically after receiving information from
neighbouring routers
 Routers use routing table to decide about the best route based
on a cost metric
 Cost metric
 Hop count: cost of passing through any network is same. i.e. passing
through one network costs 1 hop
 Max throughput: throughput is more in passing through an fiber than in
radio link
 Min delay: delay is less in fiber than satellite link
 Reliability: some networks may be more reliable than others, it is
decided based on a policy.
 Various routing protocols available are RIP, OSPF etc.
Computer Networking / Module III/ AKN / 100
Routing Information Protocol
 It is based on Distance Vector routing, which uses Bellman-
Ford algorithm for calculating the routing table
 Distance Vector Routing
 In this scheme, each router periodically (30 s) shares (broadcasts) its
own routing information with its neighbours
 Every router keeps a routing table that has three columns in its simplest
form for each entry about a network
• A, B,C, D are
(routers)
• To: destination
network
• Cost: hop count
• Next: next hop
Computer Networking / Module III/ AKN / 101
RIP Updating
Receive: a response RIP message
1. Add one hop to the hop count for each advertised
destination.
2. Repeat the following steps for each advertised
destination:
1. If (destination not in the routing table)
1. Add the advertised information to the table.
2. Else
1. If (next-hop field is the same)
1. Replace entry in the table with the advertised one.
2. Else
1. If (advertised hop count smaller than one in the
table)
1. Replace entry in the routing table.
3. Return.
Computer Networking / Module III/ AKN / 102
Example of updating a routing table
Computer Networking / Module III/ AKN / 103
Initial and Final routing tables in an example network
Computer Networking / Module III/ AKN / 104
Problems with RIP: Count-to-infinity
 Count to infinite
 Suppose there is a
network as shown
 Each router keeps the
information about A
initially as shown
 Now A goes down or link
between A and B Brakes
 At the first packet
exchange B will not
receive any message
from A
 But C tells B that it has a
path to A of length 2
 B now updates its own
information about A
according updation algo
and make it 3
1, - 2, B 3, C 4, D 5, E
A B C D E F
Initially
After 1 exchange
After 2 exchanges
After 3 exchanges
After 4 exchanges
After … exchanges
3, C 2, B 3, C 4, D 5, E
3, C 4, B 3, C 4, D 5, E
5, C 4, B 5, C 4, D 5, E
5, C 6, B 5, C 6, D 5, E
    
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
•The number of exchanges required depends
on the numerical value used for infinity.
•In RIP the value is kept 16, that’s why it
can’t be used in large systems
Computer Networking / Module III/ AKN / 105
Open shortest path First (OSPF)
 It is based on link state routing that uses dijkstra‟s
algorithm
 Link state routing
 In this scheme, each router shares the knowledge about its
own neighbours to all other routers using flooding
 Each router maintains a database about its neighbours and
sends it when there is a change or after a large period.
 The idea is that all routers should have a complete topology
of the network. From this topology the router can calculate
the shortest path between itself and the destination network
using dijkstra‟s graph algorithm
 The topology is represented as a graph, where vertices are
networks or routers and edges are links.
 A cost is associated with each link
Computer Networking / Module III/ AKN / 106
Link state Routing
 Learning about neighbours
 When router is booted, it sends a hello packet on each
point-to-point line
 The router at the other end sends back a reply
 Measuring Link cost
 One echo packet is sent and its time is recorded, other side
sends the packet back immediately and the time of receiving
is recorded again
 The test is conducted several times and the average RTT is
calculated for better result
 Building the Link state packets
 Identity of sender, sequence #, age, a list of neighbours
with their link costs
Computer Networking / Module III/ AKN / 107
Link state Knowledge
 Whole topology can be compiled from the partial
knowledge of each node
Computer Networking / Module III/ AKN / 108
Formation of shortest path tree
 The dijkstra‟s algorithm creates a single source shortest path tree
given a graph(topology), each node is assigned a cumulative cost
from root to that node (called weight or total cost)
Computer Networking / Module III/ AKN / 109
Transport Layer
Lecture III
• User Datagram Protocol
• Transmission Control protocol
• Congestion Control and Quality of
services
Computer Networking / Module III/ AKN / 110
Transport Layer
Protocols used for Transport Layer are UDP or TCP
The responsibility of transport layer is to deliver the
message to the receiving process/Application. i.e.
process to process delivery
Computer Networking / Module III/ AKN / 111
Review
 Internet layer provides a host-to-host packet delivery
 The next problem is turn this service to process-to-
process delivery
 The Transport layer supports communication between
the end application programs, thus called end-to-end
protocol
 The underlying networks upon which the transport
protocol operates has certain limitations like, it may
 Drop messages
 Reorder Messages
 Deliver duplicate copies of messages
 Limit messages to some finite size
 Delivery messages after a long delay
Computer Networking / Module III/ AKN / 112
Review
 The operating system supports multiprogramming
 But specifying that a particular process on a particular
machine is the ultimate destination for a datagram is
misleading, because
 Processes are created and destroyed dynamically(pid),
senders seldom know enough to identify a process on
another machine
 Processes may be replaced without informing to the senders
 We need to identify destinations from the functions they
implement without knowing the process
 Instead of thinking a process as the ultimate
destination, we will imagine that the machine contains
a set of abstract points called protocol ports (integer
nos.)
Computer Networking / Module III/ AKN / 113
Review
 Operating system provides two types of access to
ports
1. Synchronous access
 computation stops during a port access operation.
 i.e. if a process attempts to extract data from a port, then
the operating system temporarily blocks the process till data
is passed to the process and then restarts it
2. Asynchronous access
 Ports are buffered, so that data arrives before a process is
ready to access will not be lost
 To achieve buffering the protocol software places the
packets that arrive for a particular protocol port in a (finite)
queue
 Each message must carry the destination port on
source
Computer Networking / Module III/ AKN / 114
Types of data deliveries
Computer Networking / Module III/ AKN / 115
Port Addressing
 At transport layer, port number is used to deliver a message to
the correct process out of several processes running on
destination host
 Port numbers are 16 bit integers between 0-65535.
 The client program defines itself with a port number, chosen
randomly by transport layer called ephemeral port numbers
 The server program uses well known port number.
 i.e. client gets a new port number each time it runs, but the
port number for server is fixed
 IANA defines some ranges
 Well-know ports: 0-1023 are assigned and controlled by IANA for some
well-know server processes
 Registered ports: 1024-49151 are not assigned or controlled by IANA,
but can be used by processes
 Dynamic ports: 49151-65535 are neither controlled nor registered, called
ephemeral ports
Computer Networking / Module III/ AKN / 116
Other features
 Socket Address
 The IP address and port number pair defines the socket
address
 The client and server‟s socket addresses define client and
server processes uniquely
 A pair of socket address (client and server‟s) uniquely defines a
connection.
 Multiplexing and demultiplexing
 At the sender side, there may be several processes need to
send packets, but there is one transport layer protocol.
 Therefore the protocol accepts messages from different
processes differentiated by their port numbers and interleaves
them
 At the receiver side, the transport layer receives interleaved
packets from network layer and passes to appropriate
application after processing
Computer Networking / Module III/ AKN / 117
Other features contd.
 Connection-less vs connection-oriented service
 In a connection less service, packets are sent from
one party to another, without establishing the
connection
 In case of connection oriented, a connection is
established, data transferred, then connection is
released
 Reliable vs unreliable
 Reliability is achieved by providing error and flow
control at transport layer (data transmission)
 It becomes a slower and more complex service
 Where as unreliable services are faster and simple to
implement (real-time application)
Computer Networking / Module III/ AKN / 118
The User Datagram Protocol (UDP)
 It is the simplest possible transport protocol that
extends the host-to-host delivery into a process-to-
process communication service.
 It only adds a level of demultiplexing, s.t. multiple
application process on each host are allowed to share
the network.
 Aside from this requirement, UDP adds no other
functionality to the best effort service.
 UDP provides an unreliable connection less delivery
service.
 It uses IP to carry messages, but adds the ability to
distinguish among multiple destinations within a given
host computer.
Computer Networking / Module III/ AKN / 119
The UDP message format
 Port nos may vary from 0-65535, and source port is
optional. These are used to demultiplex datagrams
 The Length field contains a count of datagram in octets.
Minimum length is 8
 Checksum is optional and zero is kept if not computed
 The UDP checksum provides the only way to guarantee
that data has arrived intact and should be used
UDP Source Port
Data . . .
UDP Destination Port
UDP message length UDP Checksum
Computer Networking / Module III/ AKN / 120
Checksum Calculation
 UDP uses the same checksum algorithm as IP
 But UDP covers more information than is present in
UDP datagram
 It prepends a pseudo-header to the UDP datagram
 Appends an octets of zeros to pad the datagram to an exact
multiple of 16 bits
 And computes checksum over entire object
 UDP pseudo-Header
Source IP
Destination IP
Zero Protocol UDP Length
Computer Networking / Module III/ AKN / 121
Checksum Calculation (contd.)
 Checksum calculation at the Sender end.
 Add pseudo-header to the user datagram
 Fill the checksum field with zeros
 Divide the total bits in to 16 bit words
 If total bytes are not even, add one byte of all zeros
 Add all 16-bit sections using one‟s complement arithmetic
 Complement the result and insert the result in checksum
field
 Drop the pseudo header and any padding used
 Deliver the datagram
 Checksum calculation at the Receiver end.
 Perform the operation same as above
 If complement is zero drop pseudo-header and padding and
accept the datagram. Otherwise discard the datagram
Computer Networking / Module III/ AKN / 122
Checksum Calculation (contd.)
 Assignment
 Calculate the checksum of the user datagram at sender side
and also test it for the receiver side
153.18.8.105
171.2.14.10
Zero 17 15
1027
U D P T
13
15 0
E S T padding
Computer Networking / Module III/ AKN / 123
Checksum Calculation an example
Computer Networking / Module III/ AKN / 124
Problem with Checksum Calculation
 Pseudo-header contains source and destination IP
addresses
i.e. IP addresses must be known at UDP layer
 Destination IP address is supplied by the user.
 But what about source IP, which is yet to be computed in
IP layer?
 Solution 1: UDP software asks the IP layer to compute addresses
 Solution 2: UDP software computes addresses and after checksum
calculation sends it to IP layer.
 IP layer need to fill remaining IP header fields
 But any of the solution violates the abstraction of layers
 i.e. It is clearly a compromise of pure separation needed
for practical reasons
Computer Networking / Module III/ AKN / 125
UDP Operation
 Connection less service
 Each datagram sent by UDP is an independent datagram.
 Data grams are not numbered, also there is no connection
establishment thus different datagrams may follow different
path
 It cannot send a stream of data, i.e. each request must be
small enough to fit into one user datagram
 Flow and error control
 No flow control hence no window mechanism. Receiver may
overflow
 No error control hence sender does not know if a message is
lost or duplicated
Computer Networking / Module III/ AKN / 126
• At sending side UDP accepts messages from different processes,
differentiated by their port nos.Then it is passed to IP layer
• At receiving side UDP receives datagrams from IP. After error checking
drops the header and delivers to the appropriate processes
 In a host running a TCP/IP software, there is only one UDP but
possibly several processes, that need to use services of UDP
Multiplexing and Demultiplexing
Port1 Port2 Port3
UDP DeMultiplexer
IP
Port1 Port2 Port3
UDP Multiplexer
IP
Computer Networking / Module III/ AKN / 127
Well known ports used for UDP
Computer Networking / Module III/ AKN / 128
Use of UDP
 It is suitable for process that requires simple
and fast request-response communication like
DNS
 Suitable for process with internal flow and error
control mechanism like tftp
 Suitable for multicasting
 Used for management process such as SNMP
 Used for route update protocols like RIP
Computer Networking / Module III/ AKN / 129
Reliable Stream Transport Service
 Stream Orientation
 Data is converted into stream of bits, divided into
octets at source machines
 The stream delivery service on the destination
machine passes to the receiver exactly the same
sequence of octets that the sender has passed.
 Virtual Circuit Connection
 Before data transfer can start, both the
applications interact with their respective OS for a
connection
 i.e. one application places a call, which must be accepted
by the other
Computer Networking / Module III/ AKN / 130
Properties of Reliable Delivery Service
 During transfer, protocol software on the two machines continue
to communicate to verify that data is received correctly otherwise
report the failure to appropriate S/W for necessary action
 Therefore, Application programs view the connection as a
dedicated H/W circuit.
 The reliability is an illusion provided by the stream delivery service
called virtual circuit
 Buffered Transfer
 The protocol software is free to divide/combine the stream into
packets independent of pieces the application program transfers.
 At the sending side, a PUSH mechanism forces protocol S/W to
transfer all the data that has been generated without waiting to fill
a buffer.
 At the other end PUSH causes it to make the data available to
application without delay
Computer Networking / Module III/ AKN / 131
Properties of Reliable Delivery Service
 Unstructured Stream
 TCP/IP stream service doesn‟t honour structured
data stream
 i.e. There is no way for a payroll application to have
the stream service mark the boundaries between
employee records
 Full Duplex Connection
 Connections provided by TCP/IP stream service
allow concurrent transfer on both directions
 The advantage is control information for one stream
can be send back to the source in datagrams
carrying data in the opposite direction
Computer Networking / Module III/ AKN / 132
Transmission Control Protocol
 Reliability
 +ve acknowledgement with retransmission
Sender Receiver
Pkt Recv Pkt
Send Ack
Recv Ack
Send Pkt
The sender keeps a record of each
packet it sends and waits for an ack
before sending the next pkt
Sender also starts a timer and
retransmits a packet if the timer
expires before receiving the ack
• Disadvantages
• Duplication of data / Ack due to premature retransmission
• To avoid confusion caused by delayed or duplicated Ack, seq. no. is
sent back with Ack
• Wasting of substantial amount of N/W bandwidth
Computer Networking / Module III/ AKN / 133
END-to-END vs Point-to-Point
 1. TCP needs an explicit connection establishment s.t.
two parties establish some shared state to enable the
sliding window algorithm to begin
 2. Variations in RTT are possible due to various
reasons.(?) Therefore timeout mechanism that triggers
retransmissions must be adaptive.
 3. How late a packet can arrive at the destination? IP
throws packets away after their TTL expires, TCP
assumes that each packet has a max. segment life
time(MSL).
 TCP has to be prepared for very old packets to suddenly show
up at the receiver, potentially confusing the sliding window
algorithm.
Computer Networking / Module III/ AKN / 134
END-to-END issues
 4. In case of point-to-point link
 delay  bandwidth  window size  buffer space
 The amount of resources dedicated to any one TCP
connection highly variable, especially considering that
any one host can potentially support hundreds of TCP
connections at the same time
 i.e TCP must include a mechanism that each side „learn‟ what
resources the other side is able to apply to the connection
 5. TCP connection has no idea what links will be
traversed to reach at the destination.
 The sending machine might be connected directly to a
relatively fast Ethernet and somewhere in the middle a slower
link has to traversed, which leads to „congestion‟
Computer Networking / Module III/ AKN / 135
TCP Segment
 TCP has three mechanisms to trigger the transmission of a
segment
 1. TCP maintains a variable, maximum segment Size (MSS), and it sends a
segment as soon as it has collected MSS bytes from sending process
 2. Sending process invokes push operation to effectively flush the buffer of
unsent bytes
 3. A timer that periodically fires; the resulting segment contains as many
bytes as are currently in buffer
TCP is a byte oriented protocol.
i.e. It describes the service
provided to appl. process.
The pkts exchanged between
TCP peers are called segments
Appl process
TCP Send
buffer
Appl process
TCP Recv
buffer
segment segment
Write bytes Read bytes
Computer Networking / Module III/ AKN / 136
TCP Segment Header Format
Sequence Number
HLen
Checksum
Options (variable length)
Data
. . .
Src Port
Acknowledgement
Padding
0 4 10 16 19 24 31
Dst Port
unused Flags Advertised window
Urgent pointer
Computer Networking / Module III/ AKN / 137
TCP Header Format Explanation
 SrcPort and DstPort, identify the source and destination
application programs respectively
 A TCP connection is identified by a 4-tuple
{SrcPort, SrcIPAddr, DstPort, DstIPAddr}
 Because TCP is a byte oriented protocol, each byte of
data has a sequence number
 SeqNum field contains the sequence number for the first
octet of data carried in that segment
 Ack field defines the octet number that is expected next
 AdvertisedWindow contains the buffer space available at
receiver
Sender Receiver
seqNum
Ack+advWin
Computer Networking / Module III/ AKN / 138
TCP Header Format Explanation
 Flags: 6 bits, when set it is understood as follows
 5. SYN: Synchronize seq. nos during connection
 6. FIN: Terminate the connection
 4. RESET: reset the connection
 3. PUSH: request for push
 1. URG: urgent pointer is valid
 2. ACK:
 Urgent pointer specifies the position, where the urgent
data ends.
 Options: TCP header can have 40 bytes of optional
information
Computer Networking / Module III/ AKN / 139
TCP Header Options
 Max Seg Size(MSS): 4bytes determined at the
time of connection establishment
 Window Scale factor:3bytes
 Used to increase the window size
 New window size=window size  2scaleFactor
 Largest value possible for scale factor is 16
 i.e. 216  216 = 232 max size of seq. number
 Time Stamp: 10 bytes
 Used to calculate round trip time
Computer Networking / Module III/ AKN / 140
Connection Establishment
 The client sends a segment to the server stating (flags=SYN,
seqNum=x )
 Then server responds with a single segment that both
acknowledges (Flags=ACK, Ack=x+1) and states it own
beginning seqNum (Flags=SYN, seqNum=y)
 Finally client responds with a third segment that acknowledges
the server‟s sequence number (flags=ACK, Ack= y+1)
Client Server
The algorithm used is called
three-way-handshaking
Computer Networking / Module III/ AKN / 141
Connection Termination, four-way-handshaking
 Finally server sends a segment to the client stating (flags=FIN,
seqNum=y )
 The client responds with a segment that acknowledges the
server‟s sequence number (flags=ACK, Ack= y+1)
Client Server
 The client sends a segment to
the server stating (flags=FIN,
seqNum=x )
 Then server responds with a
single segment that acknowledges
(Flags=ACK, Ack=x+1)
 now the connection is in half
close mode. i.e. server can send
data (remaining) but client can‟t
Computer Networking / Module III/ AKN / 142
Connection Resetting
 TCP may request for resetting a connection. i.e.
the current connection is destroyed.
 Resetting is done in one of the following three
cases
 The TCP of one side has requested a connection to
a non-existent port. TCP of other side sends a
segment with RST bit set
 One TCP may want to abort the connection due to
an abnormal situation
 The TCP on one side may discover that the TCP on
the other side has been idle for a long time
Computer Networking / Module III/ AKN / 143
TCP State Transition
 To keep track of all the different events during
connection establishment to connection termination
The TCP of both sides are implemented as a finite
state machine and is represented in a state transition
diagram
 Notations
 The states are shown using ovals
 Transition from one state to another is shown using directed
lines
 Each line is contains two strings separated by slash. First
string is input to TCP and second is output
 Dotted lines represent server and solid lines represent client
Computer Networking / Module III/ AKN / 144
State transition diagram
 Starts in CLOSED state
 When receives an Active
open request from client
application, it sends a SYN
segment to server and
goes to SYN-SENT state
 Client TCP receives a
SYN+ACK segment from
server TCP. It sends an
ACK to server TCP and
goes to ESTABLISHED
state
 This is the data transfer
state. Client remains in
this state till data
transmission continues
Client Diagram
Computer Networking / Module III/ AKN / 145
State transition diagram contd.
 Client TCP receives a close request from its application program.
It sends a FIN segment to the other TCP and goes to FIN-
WAIT-1 state
 When the ACK is received from server TCP, it goes to FIN-
WAIT-2 state. The connection is closed in one direction
 Client receives a FIN segment from server TCP and sends an
ACK and goes to TIME-WAIT state
 When client TCP is in this state it starts a timer and waits till the
timer goes off.
 The value of this timer is set to double the MSL
 The client TCP remains in this state to let all duplicate packets,
if any arrive to be discarded. After the time-out the client goes
to CLOSED state again
Client Diagram
Computer Networking / Module III/ AKN / 146
State transition diagram contd.
 Server TCP starts with CLOSED state
 It receives a passive open request from the server application
and goes to LISTEN state
 IT now receives a SYN segment from the client TCP and sends a
SYN+ACK segment to client TCP and goes to SYN-Rcvd state
 It then receives ACK from client TCP and goes to ESTABLISHED
state. Data transfer occurs between client and server
applications
 After data transmission it receives a FIN segment from client
TCP, it now sends an ACK and goes to CLOSE-WAIT state
 Server TCP receives a close request from server application
program and sends a FIN segment to client TCP and goes to
LAST-ACK state
 When it receives the last ACK from client it goes to CLOSED
state again
Server Diagram
Computer Networking / Module III/ AKN / 147
TCP‟s Sliding Window
 1. It guarantees the reliable delivery of data,
 2. It ensures data is delivered in order and
 3. It enforces flow control between sender and receiver
 The algorithm places a small, fixed size virtual window
on the stream sequence and transmits all octets that lie
inside the window without receiving an Ack.
 Three pointers are maintained into the send buffer
Sending Application
TCP
LastByteWritten
LastByteSent
Receiving Application
TCP
LastByteRead
LastByteRecvdNextByteExpectedLastByteAckd
Direction of transmission
Computer Networking / Module III/ AKN / 148
Reliable and Ordered Delivery
 TCP on sending side maintains a send buffer, this
buffer is used to store data that has been sent but not
yet acknowledged, as well as data that has been written
by the sending application, but not transmitted
 On other side, TCP maintains a receive buffer that
holds data that arrives out of order, as well as the data
that is in correct order but that application process has
not yet read it
 The relations among send buffer pointers can be as
follows
 LastByteAckd  LastByteSent and
 LastByteSent  LastByteWritten
 bytes to the left of LastByteAcked and bytes to the right
of LastByteWritten need not be saved
Computer Networking / Module III/ AKN / 149
Reliable and Ordered Delivery
 Similarly at the receive buffer
 LastByteRead < NextByteExpected is true As a byte
cannot be read by the application until it is received
 NextByteExpected  LastByteRecvd + 1
i.e. if data has arrived in order, NextByteExpected points to
the byte after LastByteRecvd
 if data has arrived out of order, NextByteExpected points to
the start of the first gap in data
 The bytes to the left of LastByteRead need not be buffered
because they have already been read by the local process
 bytes to the right of LastByteRecvd need not be buffered
because they have not yet arrived.
Computer Networking / Module III/ AKN / 150
TCP Flow Control
 Both buffers are of finite size defined by
MaxSendBuffer and MaxRcvBuffer.
 Receiver sends a window advertisement that it can
buffer. At receiving side, it maintains as
 LastByteRecvd – LastByteRead  MaxRcvBuffer to avoid
overflowing its buffer, it therefore advertises a window size
of
 AdvertisedWindow = MaxrecvBuffer- ((NextByteExpected-1) -
LastByteRead) i.e. the free space remaining in receive buffer
 NextByteExpected-1 is same as LastByteExpected in case of
inorder receive, it will be different if out of order receive
 If the receiving process is reading data just as fast as
it arrives, then the advertised window stays open.
Computer Networking / Module III/ AKN / 151
TCP Flow Control
 If the receiving process falls behind, then advertise
window shrinks and eventually goes to zero
 On the other hand sender end TCP ensures that
 LastByteSent – LastByteAcked  AdvertisedWindow
i.e. it calculates How much data it can send as
EffectiveWindow = AdvertisedWindow – (LastByteSent –
LastByteAcked) i.e. how much extra bytes it can send
 Also sending side should ensure that the local process
doesn‟t overflow the send buffer, that is
 LastByteWritten – LastByteAcked  MaxSendBuffer
i.e. if sending process tries to write y bytes and (LastByteWritten
– LastByteAcked) + y > MaxSendBuffer then TCP blocks
sending process to generate more data
Computer Networking / Module III/ AKN / 152
TCP Flow Control
 How does the sending side know that the advertised
window is no longer zero?
 i.e. once the receiver side has advertised a window size of 0,
the sender is not permitted to send any more data, which
mince it has no way to discover that the advertised window
is no longer zero at some time in the future.
 Solution: the sending side persists in sending a
segment with one byte of data every so often. The
data may not be accepted but eventually it gets a
response whenever send buffer becomes free.
 The size of MSS is set to MTU of the directly
connected network minus the size of TCP and IP
header s.t. can be sent without fragmentation
Computer Networking / Module III/ AKN / 153
Adaptive Retransmission
 TCP retransmits each segment if an Ack is not received
in a certain period of time(RTT)
 But choosing an appropriate timeout value is very
difficult and TCP uses adaptive retransmission
mechanism
 Original Algorithm:
 TCP sends a data segment, records the time. When Ack for
that segment arrives, it reads the time again. Difference
between two times gives a SampleRTT.
 TCP then computes a weighted average between the previous
estimate and this new sample as
 EstimatedRTT =   EstimatedRTT + (1 - )  SampleRTT
  between 0.8 and 0.9 used to smooth the EstimatedRTT
Computer Networking / Module III/ AKN / 154
Adaptive Retransmission
 Then TimeOut = 2  EstimatedRTT
 Problems
 Ack does not acknowledges a transmission but receipt of data. i.e. it is
difficult to associate an ACK with an transmission or retransmission
 Associating the ACK with original transmission may be an over estimate
and associating with retransmission may be an under estimate as shown
in two figures
 Solution?
Sender Receiver Sender Receiver
Original transmission Retransmission
Computer Networking / Module III/ AKN / 155
Congestion Control
 Congestion is a situation which may occurs when the load on
the network is greater than the capacity of the network
 i.e. The number of packets sent to the router is much more then
the Number of packets the router can handle.
 Router has so many packets queued that it runs out of buffer
space and has to start dropping packets, which is a worst
condition
 Therefore to control the congestion we try to avoid heavy data
traffic that may cause congestion
If the rate of packet arrival rate is higher than
processing rate then input queues becomes longer
If the rate of packet departure rate is higher than
processing rate then output queues becomes longer
Computer Networking / Module III/ AKN / 156
Traffic descriptors
 Average data rate = amount of
data/total time
 Peak datarate= max datarate of
the traffic
 Max. burst size= max length of
time the traffic is generated at
the peak rate
 Effective bandwidth= is a
function of average datarate,
peak data rate, and max. burst
size
Computer Networking / Module III/ AKN / 157
Traffic Profiles
Constant-bit-rate traffic:
Datarate is constant throughout
Variable bit rate:
The rate of data flow changes in time
Bursty:
The datarate changes suddenly in a
very short period of time. This type of traffic
creates congestion in a network.
Computer Networking / Module III/ AKN / 158
Network performance
 Delay vs Load
 When load is much less than the capacity of
the network, the delay is at a minimum
 Delay composed of propagation delay and
processing delay, which is negligible!
 When load reaches the network capacity, the
delay increases sharply because waiting time
is added to the delay
 Throughput vs Load
 Throughput is the number of packets passing
through the network in unit time
 when the load is below capacity, the
throughput increases proportionally with load
 When load reaches the network capacity,
throughput declines sharply due to discarding
of packets followed by retransmissions further
makes things worse
Computer Networking / Module III/ AKN / 159
Congestion Control
 Two categories of mechanisms for congestion control
 Open Loop: congestion prevention
 Closed Loop: congestion removal
 Open Loop: preventing congestion
 Retransmission policy
 The retransmission policy and retransmission timers must be designed to
optimize the efficiency and to prevent congestion
 Window Policy
 The selective repeat is better than Go-Back-N policy for congestion
control?
 ACK Policy
 If ACK is not received, sender slows down, help prevent congestion
 Discarding Policy
 Selective discarding of less sensitive packets when likelihood of
congestion increases
 Admission Policy
 Before admitting for a flow it checks the resources
Computer Networking / Module III/ AKN / 160
Congestion Control: closed Loop
 Closed Loop: removal of congestion, if occurs
 Back Pressure
 Router informs previous routers to slow down (recursive)
 Choke Point
 Router informs source to slow down by sending a special packet
 Implicit Signaling
 Source predicts about congestion and slows down (like delay in getting
ACK)
 Explicit Signaling
 Router sends an explicit signal by setting a bit in the packet
 Backward signaling:The bit can be set in a packet moving in the opposite
direction. This bit warns the sender to slow down
 Forward signaling:The bit can be set in a packet moving in the direction
of congestion. This bit warns the destination to slow down. Receiver
slows down sending ACK
Computer Networking / Module III/ AKN / 161
Congestion Control TCP
 When congestion occurs in a router and some packets might be
dropped, then sender retransmits those packets. This may create
more congestion and more dropping of packets.
 The condition become so worse that the system can pass no
more data. This situation is called congestion collapse
 i.e. If the cause of the lost segment is congestion,
retransmission of the segment does not remove
the cause—it aggravates it.
 To avoid this situation, TCP assumes that the cause of a lost
segment is due to congestion in the network and takes
necessary action to remove congestion.
Computer Networking / Module III/ AKN / 162
Congestion Control TCP contd.
 The window size is decided not only by the
receiver‟s advertisement but also by congestion
in the network
 Actual Window = Min(receiver‟s window,
Congestion window)
 Congestion avoidance
 To avoid congestion we have two strategies
 Slow start and additive increase till there is no congestion
 Multiplicative Decrease, if congestion occurs
Computer Networking / Module III/ AKN / 163
Congestion avoidance
 Slow start
 At the beginning of a connection TCP sets the congestion
window size = 1MSS
 For each segment ACK it receives the congestion window size
is increased by 1 MSS till it reaches a threshold value = ½ of
allowable window size i.e.
 ACK for 1 seg –> congestion window size = 2 MSS
 ACK for 2 segs -> congestion window size = 4 MSS
 ACK for 4 segs -> congestion window size = 8 MSS
 . . . -> congestion window size = ½ advt. Window
 Additive Increase
 After the size reaches the threshold, it increases the size by
one for each received ACK.
 i.e. ACK may be received for several segments but increase is
only by 1 MSS
Computer Networking / Module III/ AKN / 164
Congestion avoidance
 This strategy continues till it receives ACK before time-out or
congestion window size = advt. Window size.
 Multiplicative Decrease
 The only way to guess that a congestion has occurred is
through a lost segment. i.e. if the sender does not receive
ACK before time-out
 If congestion occurs than threshold value is set to ½ of
congestion window and congestion window is set to 1MSS
again
Computer Networking / Module III/ AKN / 165
Congestion control in frame relay
 Frame relay is designed for high throughput
and low delay but congestion decreases
throughput and increases delay
 Frame relay does not have flow control, but
allows user to transmit bursty data that can
cause congestion
 For congestion avoidance, Frame relay protocol
uses 2 bits the frame to warn the source and
destination about the congestion.
 Backward Explicit congestion Notification (BECN) bit
 Forward Explicit congestion Notification (FECN) bit
Computer Networking / Module III/ AKN / 166
BECN bit
 It warns the sender about congestion in the
network using two methods
 Method 1: the switch uses response frames from
the receiver
 Method 2: the switch can use a predefined
connection, DLCI=1023 to send special frames for
this specific purpose
 Sender responds by reducing data rate
Computer Networking / Module III/ AKN / 167
FECN bit
 Used to warn the receiver about the congestion
 If there is an ACK mechanism at the higher level the receiver
can delay the ACK, thus forcing the source to slow down
 Four cases of congestion in Frame Relay
Computer Networking / Module III/ AKN / 168
Quality of Service (QoS)
 Is an assurance from the network for a particular kind
of service
 e.g. network uses retransmission strategy to make
sure that data arrives correctly.
 This service is ok for non-real time application. But
may not be ok for real-time applications as it does-not
guarantee timeliness
 i.e. we need a new service model in which, application
that need higher assurances can ask the network for
that
 A network that can provide these different level of
services is said to support QoS.
Computer Networking / Module III/ AKN / 169
Flow characteristics
 Reliability
 Lack of reliability means losing a packet or ACK, which may or may not
needs retransmission
 Example: Email, file transfer needs retransmission
 Audio and video may not need retransmission
 Delay (Source-to-destination delay)
 Application can tolerate delay in different degrees
 Example: multimedia application need minimum delay, but in case of file
transfer or email it is less important
 Jitter
 Is a variation in delay for packets belonging to same flow.
 Audio and Video cannot tolerate high jitter
 No effect for file or mail transfer
 Bandwdth
 Different application needs different BW
 In video transmission we need million of bits to refresh a color screen
 While total no of bits in an email may not reach even a million
Computer Networking / Module III/ AKN / 170
Techniques to Improve QoS
 Common methods are scheduling, traffic shaping,
admission control,and resource reservation
 Scheduling (FIFO, priority and weighted fair queuing)
 When packets from different flows arrive at a router, It is
needed to treat the different flows in a fair and appropriate
manner. Some techniques are as follows
 FIFO Queuing with tail drop
 In this queuing, packets wait in a buffer until the node is ready to
process them
 If average arrival rate is higher than the average processing rate, the
queue will fill up and new packets will be discarded without regard to
which flow the packet belongs to or how important the packets is?
 It is simplest and most widely used in Internet routers
Computer Networking / Module III/ AKN / 171
Scheduling Techniques contd.
 Priority Queuing
 Each packet is marked with a priority class
 The router implements multiple FIFO queues, one for each priority class
 It processes packets of higher priority first and moves on to the next
priority if the higher priority one is empty
 If there is a continuous flow in a high priority queue, then this will create
a starvation problem in others
 Therefore this should be optimized to put hard limits on how much high
priority traffic can be inserted in the queue
 These scheduling is used in Internet to protect most important packets
like routing updates
Computer Networking / Module III/ AKN / 172
Scheduling Techniques
 Weighted fair Queuing
 The packets are still assigned to different classes
before inserting to the queues
 The router than serves queues in around-robin
fashion according to the weight of the queue
 i.e. for above example: 3 pkts from first, two from
2nd and one from 3rd queue
Computer Networking / Module III/ AKN / 173
Traffic shaping
 Is a mechanism to control the amount and the rate of the
traffic sent to the network.
 Two techniques used 1. Leaky Bucket, 2. Token Bucket
 Leaky Bucket
 The idea is to have a constant bit rate traffic in the
network in spite of bursty data coming from source.
 i.e. if a bucket has a
small hole at the bottom,
the water leaks from the
bucket at a constant rate
and is independent of the
rate of input to the bucket
Computer Networking / Module III/ AKN / 174
Leaky bucket implementation
 When the packets are of same fixed size then one packet can
be pushed to network per clock tick
 If packets are of variable size than more packets per tick may
be allowed.
 i.e. if rule is 1024 bytes per tick then one 1024 byte packet is
allowed per tick, two 512 bytes per tick and four 256 byte
packets per tick and so on
 Algorithm
 for each clock tick{
1. Initialize a byte counter to n
2. while n  size of the packet
3. send the packet and decrement the counter by the packet size.
4. Stop the transmission till next tick
}
 Where n is max number of bytes allowed per tick
Computer Networking / Module III/ AKN / 175
Leaky bucket contd.
 A leaky bucket algorithms shapes bursty traffic into fixed-rate
traffic by averaging the data rate. The packets will be dropped
if the buffer is full
 This algorithm prevents congestion by avoiding instantaneous
heavy traffic at the output line
 The buffer capacity should be carefully designed s.t. it should
be able to store the bursty data for short period of time,
otherwise packets will be dropped
 Example:
 data comes at a rate 25 Mbps, one 40ms burst every second. Design the
leaky bucket
 Solution:
 total data per sec = 25Mbps * 40 *10-3 = 1Mb
 Thus capacity of buffer can be chosen as 1Mb
 Uniform output rate may be chosen as 2Mbps, s.t. it will take 500ms to
drain the complete data
Computer Networking / Module III/ AKN / 176
Token Bucket
 The leaky bucket is restrictive. i.e. if a host is idle then bucket
becomes empty, if the host has bursty data then bucket allows
only an average rate.
 But the token bucket algorithm allows idle hosts to accumulate
credit for the future in form of tokens
 Algorithm:
 token bucket holds tokens generated by a clock at the rate of one token per
T sec or n tokens per sec
 It consumes one token per packet sent
 i.e. to send a packet
there should be a token
available in the bucket
Computer Networking / Module III/ AKN / 177
Token Bucket contd.
 Leaky bucket and Token Bucket provides different kind of
traffic shaping
 The Leaky bucket algorithm does not allow idle hosts to save up
permission to send large bursts later
 But the token bucket algorithm does allow saving, up to the
max size of bucket. i.e. bursts upto the size of bucket can be
sent at once
 The token bucket algorithm throws away tokens when the
bucket fills up but never discard packets.
 But the Leaky bucket discards packets when bucket fills up
 One variation to Token bucket
 Each token represent the right to send k bytes in place of one
packet.
 A packet can only be sent if enough tokens are available to
cover length in bytes. Fractional tokens are kept for future use
Computer Networking / Module III/ AKN / 178
Quality of Service (QoS)
 Two models have been proposed to
provide Quality of Service in the Internet
 Integrated Services (IntServ)
 Is a flow based QoS model designed for IP. i.e. a
user needs to create a flow, a kind of virtual
circuit, from the source to destination and inform
all routers about the resource requirement.
 Differentiated Services (DiffServ)
 Is a class based QoS model designed for IP. i.e.
the applications, or hosts, define the type of
service they need each time they send a packet.
Computer Networking / Module III/ AKN / 179
Integrated services features
 Signals
 IP is a connection less protocol
 To implement a flow based service a signaling protocol is used
to run over IP that provides the signaling mechanism for
making reservation
 The protocol is named as Resource Reservation Protocol
 Flow Specification
 has two parts: Rspec and Tspec
 Rspec(resource specification)
 Defines the resource that the flow needs to reserve (buffer, bw etc.)
 Tspec(Traffic specification)
 Traffic characterization of the flow
 Admission
 After receiving flow specification the router decides to admit or
deny the flow
Computer Networking / Module III/ AKN / 180
Integrated services features
 Two service classes are defined
 Guaranteed Service Class
 Designed for real time traffic that needs guaranteed
minimum end-to-end delay. (multimedia)
 end-to-end delay = sum of delays in routers + propagation
delay + setup mechanism
 Only delay in router can be guaranteed by router
 The amount of end-to-end delay and the data rate must be
defined by the application
 Controlled-Load Service Class
 Designed for applications that can accept some delays, but
are sensitive to an overload network and to the danger of
losing packets
 Example application are file transfer, email etc.
Computer Networking / Module III/ AKN / 181
Resource ReserVation Protocol (RSVP)
 The resource reservation protocol is a signaling
protocol to help IP create a flow and consequently
make a resource reservation
 The signaling system of RSVP is designed for
multicasting to enable it to provide resource
reservation for all kinds of traffic including multimedia,
which often uses multicasting
 In this case the receivers (not the sender) makes the
reservation
 It has several types of messages for above tasks. Two
of them are used for resource reservation, i.e. Path
message and Resv message
Computer Networking / Module III/ AKN / 182
RSVP Path message
 A Path message travels from the sender and reaches
all the receivers (downstream) in multicast path
 On the way path message stores the necessary
information for the receivers.
 A new message is created when the path diverges.
Computer Networking / Module III/ AKN / 183
RSVP Recv message
 Reservation merging
 Resources are not reserved for each receiver in a
flow.
 Reservation is merged to larger of the two (or
more) requests
 As different qualities for multimedia is required by
different receivers, thus different requirements for
the same flow
 Receiver sends a recv message,
which travels towards sender
(upstream) and makes a resource
reservation on the routers that
support RSVP
 If a router does not support RSVP
on the path, it routes packet using
traditional delivery methods
Computer Networking / Module III/ AKN / 184
Reservation Styles
 When there are more than one flow, the router needs
to make a reservation to accommodate all of them
 RSVP defines three types of reservation styles
 Wild card Filter: router creates a single reservation
for all senders based on largest request. This is
used when flow from different receivers do not
occur at the same time
 Fixed Filter: router creates a distinct reservation for
each flow. It is used when there is a high
probability that from different receivers occurs at
the same time
 Shared Explicit: creates a single reservation which
can be shared by a set of flows
Computer Networking / Module III/ AKN / 185
Differtiated services
 Problems with integrated services
 Scalability
 This model requires that each router keep information for
each flow, which is impractical as load on routers will
increase
 Service type limitation
 It provides two services 1. Guaranteed and control load
 Solutions
 The routers do not have to store information about flows.
 i.e. The applications, or hosts, define the type of service
they need each time they send a packet
 The per-flow service is changed to per class service.
 The router routes the packet based on the class of service
 This is called Differentiated services
Computer Networks Module III
Computer Networks Module III
Computer Networks Module III

Weitere ähnliche Inhalte

Was ist angesagt?

SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJA
SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJASOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJA
SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJAvtunotesbysree
 
Loopback address
Loopback addressLoopback address
Loopback addressCEC Landran
 
Assembling And Cabling Cisco Devices
Assembling And Cabling Cisco DevicesAssembling And Cabling Cisco Devices
Assembling And Cabling Cisco DevicesRavi Shairaywal
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) pptDulith Kasun
 
01 Overview of Data Communication and Networking
01 Overview of Data Communication and Networking01 Overview of Data Communication and Networking
01 Overview of Data Communication and NetworkingMeenakshi Paul
 
Physical layer interface & standards
Physical layer interface & standardsPhysical layer interface & standards
Physical layer interface & standardsSrashti Vyas
 
Networking
NetworkingNetworking
NetworkingRashmi
 
Glimpse of carrier ethernet
Glimpse of carrier ethernetGlimpse of carrier ethernet
Glimpse of carrier ethernetMapYourTech
 
19 Network Layer Protocols
19 Network Layer Protocols19 Network Layer Protocols
19 Network Layer ProtocolsMeenakshi Paul
 
The ethernet frame a walkthrough
The ethernet frame a walkthroughThe ethernet frame a walkthrough
The ethernet frame a walkthroughMapYourTech
 

Was ist angesagt? (20)

SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJA
SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJASOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJA
SOLUTION MANUAL OF COMMUNICATION NETWORKS BY ALBERTO LEON GARCIA & INDRA WIDJAJA
 
Data Link Control
Data Link ControlData Link Control
Data Link Control
 
Loopback address
Loopback addressLoopback address
Loopback address
 
Chapter9
Chapter9Chapter9
Chapter9
 
Chapter5
Chapter5Chapter5
Chapter5
 
Assembling And Cabling Cisco Devices
Assembling And Cabling Cisco DevicesAssembling And Cabling Cisco Devices
Assembling And Cabling Cisco Devices
 
Osi model
Osi modelOsi model
Osi model
 
COMPUTER NETWORK_OSI & TCP/IP
COMPUTER NETWORK_OSI & TCP/IPCOMPUTER NETWORK_OSI & TCP/IP
COMPUTER NETWORK_OSI & TCP/IP
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) ppt
 
01 Overview of Data Communication and Networking
01 Overview of Data Communication and Networking01 Overview of Data Communication and Networking
01 Overview of Data Communication and Networking
 
IP Addressing
IP AddressingIP Addressing
IP Addressing
 
Physical layer interface & standards
Physical layer interface & standardsPhysical layer interface & standards
Physical layer interface & standards
 
Basics of Computer Networks
Basics of Computer NetworksBasics of Computer Networks
Basics of Computer Networks
 
Networking
NetworkingNetworking
Networking
 
Glimpse of carrier ethernet
Glimpse of carrier ethernetGlimpse of carrier ethernet
Glimpse of carrier ethernet
 
Project report
Project reportProject report
Project report
 
19 Network Layer Protocols
19 Network Layer Protocols19 Network Layer Protocols
19 Network Layer Protocols
 
The ethernet frame a walkthrough
The ethernet frame a walkthroughThe ethernet frame a walkthrough
The ethernet frame a walkthrough
 
Cn4,com net
Cn4,com netCn4,com net
Cn4,com net
 
Ethernet_Networks
Ethernet_NetworksEthernet_Networks
Ethernet_Networks
 

Ähnlich wie Computer Networks Module III

IP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxIP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxgamerchan1
 
7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork LayerZahouAmel1
 
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...ZahouAmel1
 
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptIDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptJayaprasanna4
 
Expl net fund_chapter_06_i_pv4_part_2
Expl net fund_chapter_06_i_pv4_part_2Expl net fund_chapter_06_i_pv4_part_2
Expl net fund_chapter_06_i_pv4_part_2kurtmctaggart
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSProf Ansari
 
Chapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptChapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptanwarkade1
 
Chapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptChapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptEsubesisay
 
Rashmi T S-Intrenship PPT.pptx
Rashmi T S-Intrenship PPT.pptxRashmi T S-Intrenship PPT.pptx
Rashmi T S-Intrenship PPT.pptxManojGowdaKb
 
Umutima.ppt
Umutima.pptUmutima.ppt
Umutima.pptkigaliac
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategyMustafa Salam
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingVivek chan
 
IPv4 addressing and subnetting
IPv4 addressing and subnettingIPv4 addressing and subnetting
IPv4 addressing and subnettingShashank Asthana
 
Junos routing overview from Juniper
Junos routing overview from JuniperJunos routing overview from Juniper
Junos routing overview from JuniperNam Nguyen
 

Ähnlich wie Computer Networks Module III (20)

IP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptxIP_ADDRESSING_AND_SUBNETTING.pptx
IP_ADDRESSING_AND_SUBNETTING.pptx
 
Lecture 06
Lecture 06Lecture 06
Lecture 06
 
7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork LayerNetwork Layer
 
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
 
chapter 4.pptx
chapter 4.pptxchapter 4.pptx
chapter 4.pptx
 
gofortution
gofortutiongofortution
gofortution
 
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.pptIDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
IDC lectureA - Network Layer & IP Addressing with Cisco Notes.ppt
 
Expl net fund_chapter_06_i_pv4_part_2
Expl net fund_chapter_06_i_pv4_part_2Expl net fund_chapter_06_i_pv4_part_2
Expl net fund_chapter_06_i_pv4_part_2
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
 
Ipv4 address
Ipv4 addressIpv4 address
Ipv4 address
 
Chapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptChapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.ppt
 
Chapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.pptChapter 5 Network Configuration Basics.ppt
Chapter 5 Network Configuration Basics.ppt
 
Rashmi T S-Intrenship PPT.pptx
Rashmi T S-Intrenship PPT.pptxRashmi T S-Intrenship PPT.pptx
Rashmi T S-Intrenship PPT.pptx
 
Umutima.ppt
Umutima.pptUmutima.ppt
Umutima.ppt
 
15 3
15 315 3
15 3
 
Network Layer V.ppt
Network Layer V.pptNetwork Layer V.ppt
Network Layer V.ppt
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategy
 
CyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & SubnettingCyberLab TCP/IP and IP Addressing & Subnetting
CyberLab TCP/IP and IP Addressing & Subnetting
 
IPv4 addressing and subnetting
IPv4 addressing and subnettingIPv4 addressing and subnetting
IPv4 addressing and subnetting
 
Junos routing overview from Juniper
Junos routing overview from JuniperJunos routing overview from Juniper
Junos routing overview from Juniper
 

Mehr von Ajit Nayak

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testingAjit Nayak
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramAjit Nayak
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Ajit Nayak
 
Software Engineering :UML class diagrams
Software Engineering :UML class diagramsSoftware Engineering :UML class diagrams
Software Engineering :UML class diagramsAjit Nayak
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UMLAjit Nayak
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationAjit Nayak
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process ModelsAjit Nayak
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an IntroductionAjit Nayak
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQLAjit Nayak
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part IAjit Nayak
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt IIAjit Nayak
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIIAjit Nayak
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using CAjit Nayak
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLAjit Nayak
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPIAjit Nayak
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementAjit Nayak
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-BasicsAjit Nayak
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockAjit Nayak
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusAjit Nayak
 

Mehr von Ajit Nayak (20)

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testing
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram
 
Software Engineering :UML class diagrams
Software Engineering :UML class diagramsSoftware Engineering :UML class diagrams
Software Engineering :UML class diagrams
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UML
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & Specification
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process Models
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an Introduction
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQL
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part I
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculus
 

Kürzlich hochgeladen

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 

Kürzlich hochgeladen (20)

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 

Computer Networks Module III

  • 1. COMPUTER NETWORKS Ajit K Nayak, Ph.D. Department of Computer Science & Information Technology, ITER, SOA University. Lecture Notes Module III
  • 2. Computer Networking / Module III/ AKN / 2 Out Line of Module III  Network Layer, Network Layer Protocols  Transport Layer, Congestion control & Quality of service  Application Layer protocols Readings: “Data Communications and Networking” Third Edition, Behrouz A Forcuzan, Chapter 19 - Chapter 23
  • 3. Computer Networking / Module III/ AKN / 3 Network Layer Lecture I • Host-to-Host Delivery • Addressing • Routing •Network Layer Protocols • IPV4 • ARP • ICMP
  • 4. Computer Networking / Module III/ AKN / 4 Network Layer Protocol used is IP for Network Layer Responsibility of this layer to deliver the datagram to the correct destination host. i.e. host-to- host delivery
  • 5. Computer Networking / Module III/ AKN / 5 Classful IP Addresses  Each host on a TCP/IP internet is assigned a unique 32-bit unicast Internet address that is used in all communication with that host.  Each unicast IP address is a pair(netid, hostid), where netid identifies a network and hostid identifies a host on that network  The total address space is 232=4,294,967,296. But all addresses are not usable  It is represented in dotted decimal notation 128.11.3.31 1000000 00001011 00000011 00011111
  • 6. Computer Networking / Module III/ AKN / 6 Type of communication  Unicast: one-to-one communication. i.e. One source sends to exactly one destination host  Multicast: one-to-a group. i.e. one sources sends to a predefined group of destination hosts simultaneously  Broadcast: one-to-all. i.e. one source sends to all other hosts available in that network. Broadcast in Internet is not allowed.  Others: anycast, geocast, etc. read yourself!
  • 7. Computer Networking / Module III/ AKN / 7 Classes of IP addresses  Class A 0.0.0.0 – 127.255.255.255  Class B 128.0.0.0 – 191.255.255.255  Class C 192.0.0.0 – 223.255.255.255  Class D 224.0.0.0 – 239.255.255.255  Class E 240.0.0.0 – 255.255.255.255 0 netid hostid 1 0 netid hostid 1 1 0 netid hostid 1 1 1 0 multicast address 1 1 1 1 reserved for future use
  • 8. Computer Networking / Module III/ AKN / 8 IP Addresses  Class A  First octet defines the netid and first bit is fixed  Max. no of network possible: 27-2=126  All zero and all one values can not be used  24 bits are used for hostid  Max no of hosts 224-2=16,777,214 per network can be connected to a class A network  Class B  First two octet define the netid and two left bits are fixed : 214-2=16,382 networks and  216-2=65,534 hosts/network
  • 9. Computer Networking / Module III/ AKN / 9 IP Addresses  Class C: First three octet defines netid and three bits fixed  221-2=2,097,151 networks  28-2=254 hosts/network  Class D: No net and host ids  First four bits are fixed, remaining 24 bits define multicast addresses?  Class E: No use
  • 10. Computer Networking / Module III/ AKN / 10 Special Addresses  Network Addresses  Addresses having all zero hostids are used to identify a network and is not assigned to any host Specific All 0s . . . 123.0.0.0 123.50.16.90 123.65.7.34 123.90.123.4 Class A
  • 11. Computer Networking / Module III/ AKN / 11 Network Address Find Network addresses of the following IP addresses 24.32.3.29 190.234.211.21 200.23.31.6
  • 12. Computer Networking / Module III/ AKN / 12 Special Addresses contd.  Direct Broadcast Addresses  Used by a router to broadcast a message to all hosts of a network  It can only be used as a destination address by specifying hostid as all 1s Specific All 1s . . . 221.45.71.0 221.45.71.20 221.45.71.64 221.45.71.99 Class C network R 221.45.71.255
  • 13. Computer Networking / Module III/ AKN / 13 Special Addresses contd.  Limited Broadcast Addresses  Used by a host to send a message to every other host in that network  It can only be used as a destination address by specifying netid and hostid as all 1s  Router blocks the packet and discards it. All 1s All 1s . . . 221.45.71.0 221.45.71.20 221.45.71.64 221.45.71.99 Class C network R Blocked here
  • 14. Computer Networking / Module III/ AKN / 14 Special Addresses contd.  This Host Addresses  Used by a DHCP client at bootstrap as a source address to get a valid IP address from the DHCP server  It is specified by all 0s. The destination is a limited broadcast address  It is always a Class A address regardless of the network All 0s All 0s . . . 221.45.71.0 ?.?.?.? 221.45.71.64 221.45.71.99 Class C network B Bootstrap server 221.45.71.1
  • 15. Computer Networking / Module III/ AKN / 15 Special Addresses contd.  Loop Back Addresses  Used by a host to communicate with itself without a special network interface  This is the address with first byte as 127 and the packet never goes out of the machine 127 Any HostP1 P2 127.0.0.1
  • 16. Computer Networking / Module III/ AKN / 16 Private Network Addresses  These IPs should not be used in internet but one can use for hosts that do not require direct access to the Internet  These addresses are filtered by Internet routers and therefore do not have to be globally unique  10.0.0.0 – 10.255.255.255  172.16.0.0 – 172.31.255.255  192.168.0.0 – 192.168.255.255  Automatic Private IP Addressing  Used by windows machine, if there is no DHCP available  169.254.0.0 – 169.254.255.255  Rfcs: 1466, 1918, 1597, 3927 etc.
  • 17. Computer Networking / Module III/ AKN / 17 Masking  To reach at a host we have two level of hierarchy 1. Reach at destination network 2. Reach at host  Masking is a process that extracts the address of physical network from an IP address  Mask is an IP having netid all ones and hostid all zeros 141.14.2.21 255.255.0.0 141.14.0.0  A bit wise and operation is performed 10001101 00001110 00000010 00010101 11111111 11111111 00000000 00000000 141 14 0 0 Mask
  • 18. Computer Networking / Module III/ AKN / 18 Problems with classful  There are three main problems with “classful” addressing, 1. Lack of Internal Address Flexibility: Big organizations are assigned large, “monolithic” blocks of addresses that don't match well the structure of their underlying internal networks. 2. Inefficient Use of Address Space: The existence of only three block sizes (classes A, B and C) leads to waste of limited IP address space. 3. Proliferation of Router Table Entries: As the Internet grows, more and more entries are required for routers to handle the routing of IP datagrams, which causes performance problems for routers. Attempting to reduce inefficient address space allocation leads to even more router table entries.
  • 19. Computer Networking / Module III/ AKN / 19 Subnetting  This technique helps to divide one physical network into some smaller subnets (i.e.to create hierarchies)  Advantage:  Increasing popularity of LAN may exhaust the netids  When many hosts connected to a single network the messages are overcrowded due to the broadcast nature of LANs  The scheme allows multiple physical networks to share a same prefix (1980s)  A second extension is also available to divide suffix and prefix at an arbitrary point called classless addressing and supernetting (1990s)
  • 20. Computer Networking / Module III/ AKN / 20 Subnetting an Example 141.14.0.0 . . . 141.14.0.0 .2.20 .7.96 .22.90 R 141.14.0.0 141.14.0.0 R .2 .7 .22 Without subnet With subnet .2.20 .7.96 .22.90 141.14.2.0 141.14.22.0 141.14.7.0
  • 21. Computer Networking / Module III/ AKN / 21 Subnetting  Rest of the Internet still fills as if one network. i.e packet destinated at 141.14.2.21 still reach at router R and it is aware of three subnets.  Last two octets define two things 1. subnetid 2. hostid  Delivery of packets now involve three steps 1. Delivery to the network 2. Delivery to the subnet 3. Delivery to the host
  • 22. Computer Networking / Module III/ AKN / 22 Example 1 Q. Design 8 subnets from 211.77.20.0 Ans. Taking 3 bits for subnet in last byte, remaining 5 bits are used for hostid
  • 23. Computer Networking / Module III/ AKN / 23 Example 1 contd.  According to classic IP routing rules, it was not possible to use the subnets with all zero or all one values. i.e. subnet #0 and subnet #7  However, most modern machines have no troubles using uppermost or lowermost subnets
  • 24. Computer Networking / Module III/ AKN / 24 Example 2  The network address is x.y.z.0, subnet mask is 255.255.255.248 then design the subnets  From mask it is clear that first five bits of last byte is used as subnetid and last three bits are used as hostids  i.e. 25=32 subnets and 23-2=6 hosts/subnets  Subnet #0: x.y.z.0, x.y.z.1, . . ., x.y.z.6, x.y.z.7  Subnet #1: x.y.z.9, x.y.z.10, . . ., x.y.z.14, x.y.z.15  Subnet #2: x.y.z.16, x.y.z.17, . . ., x.y.z.22, x.y.z.23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  Subnet #29: x.y.z.232, x.y.z.233, . . ., x.y.z.238, x.y.z.239  Subnet #30: x.y.z.240, x.y.z.241, . . ., x.y.z.246, x.y.z.247  Subnet #31: x.y.z.248, x.y.z.249, . . ., x.y.z.254, x.y.z.255  First column is used as subnet id, last column is used as broadcast address.
  • 25. Computer Networking / Module III/ AKN / 25 IP addresses are used not only to uniquely identify IP addresses but also to facilitate the routing of IP datagrams over networks
  • 26. Computer Networking / Module III/ AKN / 26 Problems with IP Addressing  If a host computer moves from one network to another, its IP address must change (manually)  Because routing uses the network portion of the IP address, the path taken by packets traveling to a host with multiple IP address depends on the address used.  Addressing Authorities  IANA: Internet Assigned Number Authority upto 1998  ICANN: Internet Corporation for Assigned Names and Numbers R A B Network 1 Network 2 I2 I2 I3 I5I4 If link I3 fails than A cannot send to B
  • 27. Computer Networking / Module III/ AKN / 27 Dynamic Address configuration  Each computer that is connected to Internet must have following information  Its IP address  Subnet mask  Router/gateway‟s IP address  Name server‟s IP address  These information are maintained in operating system and stored in disk  These information may be acquired by assigning static values or can also be obtained dynamically when needed  DHCP is designed to assign these information dynamically (on demand)  It is a client/server program, when client sends a request to server, server selects an IP address from the pool of unused IP address for a negotiable period of time (lease time)
  • 28. Computer Networking / Module III/ AKN / 28 Dynamic Host Configuration Protocol TRANSITION STATES  All the DHCP servers replies with a DHCPOFFER message, which contains IP address, lease time etc.  client chooses on of the offers. Client now sends a DHCPREQUEST message  Requesting state Remains in this state till it gets the DHCPACK, which creates a binding of physical and logical address  Initializing state  Client broadcasts a DHCPDISCOVER message  Selecting state
  • 29. Computer Networking / Module III/ AKN / 29 DHCP contd.  Bound state  After using 50% of the time, client requests for renewal by sending another DHCPREQUEST, or client can cancel the lease and go back to the initializing state  Renewing state  If it receives the DHCPACK then the timer is reset or client goes again for rebinding. If not received till 87.5% of lease time then goes to rebinding state  Rebinding state  It remains in this state till it receives a DHCPNAK or lease expires, client goes to initializing state for a fresh process or goes to bound state if DHCPACK is received
  • 30. Computer Networking / Module III/ AKN / 30 Network Address Translation  Home users and small business can be connected to Internet via an ADSL or cable modem and every body needs one or more IP addresses  Due to shortage of IP addresses, the demand may be full filled by using the private network address through Network address translation method (NAT)  NAT enables a user to have large set of addresses (private) internally and one or a small set of addresses externally (global) Address translation
  • 31. Computer Networking / Module III/ AKN / 31 NAT contd.  Address translation  All out going packets go through the NAT router, which replaces destination address in the packet with global NAT address.  Similarly all incoming packets also pass through the NAT router, which replaces the destination address with appropriate private address using Translation table Private Address Private Port External Address External Port Transport Protocol 172.18.3.1 1400 25.8.3.2 80 TCP 172.18.3.2 1401 25.8.3.2 80 TCP ... ... ... ... ...
  • 32. Computer Networking / Module III/ AKN / 32 Routing techniques  Usually routing uses an Internet routing table on each machine that stores information about possible destinations and how to reach them  Next Hop Routing network 10.0.0.0 network 20.0.0.0 network 30.0.0.0 network 40.0.0.0 Q R SDest Next hop 10.0.0.0 20.0.0.5 20.0.0.0 Direct 30.0.0.0 Direct 40.0.0.0 30.0.0.7 10.0.0.5 20.0.0.5 20.0.0.6 30.0.0.6 30.0.0.7 40.0.0.7
  • 33. Computer Networking / Module III/ AKN / 33 Network-Specific Routing  Instead of one entry for each destination host, we maintain one entry for total network
  • 34. Computer Networking / Module III/ AKN / 34 Host-Specific Routing  Host-specific routes  Although all routing is based on networks and not on specific hosts, most software allows per-host routes as a special case.  This is helpful for administration purposes like testing, controlling access and debugging etc. Net1 Net2 Net3 R P Q A B Destination Next hop B R Net2 Q Net3 R Table for host A
  • 35. Computer Networking / Module III/ AKN / 35 Default Routing  Default Routes  In this type of routing , it looks in the routing table for the destination network. If no route appears in the table, the routing routines send the datagram to a default router  It is useful when the network has a small set of local addresses and only one connection to the rest of internet Rest of Internet network 10.0.0.0 network 20.0.0.0 Q S Destination Next hop 20.0.0.0 Q Default S • Routing table for a host on network 10.0.0.0
  • 36. Computer Networking / Module III/ AKN / 36 Static versus Dynamic Routing Tables  Routing tables may be constructed statically or dynamically. The success of routing depends on the consistency of routing table information  Static Routing table  Information entered manually, can be used for small intranet that does not change very often. It is not a good choice in Internet where information changes very often  Dynamic Routing table  Updated periodically using the dynamic routing protocols like RIP, OSPF, or BGP etc.  Dynamic routing is preferred over static routing as the updation of routing table is done dynamically thus providing a consistent routing mechanism.
  • 37. Computer Networking / Module III/ AKN / 37 Hierarchical Routing  It is not possible to keep information about each host and or each network in the routing table of each Internet router  To solve this problem we maintain hierarchical routing. According to this technique the we maintain partial information in routers  e.g. if the block assigned to one ISP is a.b.c.d/n and it may create many subnets of e.f.g.h/m for each of its customers, the rest of the Internet does not have to be aware of this division. i.e. all customer of that ISP are defined as a.b.c.d/n to the rest of Internet  There is only one entry needed for this ISP  The router inside ISP recognizes the sub-blocks and routes the packets to the destination  To reduce the size of table further the hierarchical routing may be included. i.e. The routers of ISPs outside Europe will have only one entry for packets to Europe in their routing tables.
  • 38. Computer Networking / Module III/ AKN / 38 Internet Protocol (IPV4:RFC-791)  Connection less delivery system  Internet service consists of an unreliable, best-effort, connection less packet delivery system.  Unreliable because delivery is not guaranteed.  i.e.The packet may be lost, duplicated, delayed or delivered out of order but the service will not detect such conditions, nor will it inform the sender or receiver.  A sequence of sent from one computer to another may travel over different paths, or some may be lost while others are delivered.  It is best-effort delivery because the internet software makes an earnest attempt to delivery packets  i.e. the internet does not discard packets always. Unreliability arises only when resources are exhausted or underlying networks fail.
  • 39. Computer Networking / Module III/ AKN / 39 Internet Protocol (contd.)  The Internet protocol defines unreliable, connection less delivery mechanism ( IP )  It defines the basic unit of data transfer used throughout the internet by specifying the exact format of data  It performs routing function, choosing the path over which the data will be sent  It also includes a set of rules that embody the idea of unreliable packet delivery.  i.e. It tells how to process the packets, how and when error message should be generated, and the conditions under which the packets can be discarded.
  • 40. Computer Networking / Module III/ AKN / 40 Internet Protocol Datagram Format Ver Total length Fragment offsetIdentification Source IP Destination IP IP Options if any Data . . . Service TypeHLen Flag TTL Protocol Header checksum Padding 0 4 8 16 19 24 31
  • 41. Computer Networking / Module III/ AKN / 41 IP Header  Ver: version of IP (4 or 6)  HLen: total length of datagram header (20-60 bytes)  Type of Service: how the datagram should be handled by the router  Precedence: (3 bits) defines priorities in cases like congestion  TOS bits: low delay, high throughput, high reliability, less cost. A hint to router as a decision making factor for routing algorithms. Internet does not guarantee to provide any particular type of service  IETF redefined the meaning  If last three bits are zero than first three bits define precedence (backward compatibility)i.e. xxx000 Precedence D T R C 0 4 7 CODEPOINT unused 0 6 7
  • 42. Computer Networking / Module III/ AKN / 42 IP Header (contd.)  The 64 code point values maps to an underlying service definition and is divided into three groups Pool Codepoint Assigned by 1 xxxxx0 Standards Organization(IETF) 2 xxxx11 Local or Experimental 3 xxxx01 Local or experimental for now  If the standards bodies exhaust all values in pool 1, they may also choose to assign values in pool 3  Total Length: defines total length of the datagram in bytes.  i.e. 216-1=65,535 bytes max. including header
  • 43. Computer Networking / Module III/ AKN / 43 IP Header (contd.)  Fragmentation  Each datagram is encapsulated in a datalink frame before transmission.  It has to travel through different networks and the frame size differs for different networks and is defined by MTU of that network  Identification: IP software keeps a global counter and increments each time a new datagram created.  if the datagram is fragmented then the identification is copied to each fragment of same datagram  Flags:  3 bit field, D:do not fragment M: more fragment U D M
  • 44. Computer Networking / Module III/ AKN / 44 IP Header (contd.)  D=1: datagram must not be fragmented  D=0: datagram can be fragmented  M=1: It is not the last fragment  M=0: It is the last or only fragment  Fragmentation offset: It shows the relative position of the fragment, w.r.t. whole datagram 0 3999 0 1399 1400 2799 2800 3999 Offset measured in bytes 0/8 = 0 1400/8 = 175 2800/8 = 350
  • 45. Computer Networking / Module III/ AKN / 45 IP Header (contd.)  Time to Live:It specifies how long in seconds, the datagram is allowed to remain in the internet system  When a datagram arrives at a router, it records the time and before sending forward it decrements the time to live field.  When it becomes zero, the datagram is discarded and an error message is sent to the source  But to estimate exact time is difficult because routers do not usually know the transit time for physical networks.  Thus in practice the time to live acts as a hop limit rather than an estimate of delay. Each router only decrements the value by one till it becomes zero.
  • 46. Computer Networking / Module III/ AKN / 46 IP Header (contd.)  Protocol: It defines the higher level protocol that uses the IP layer service  ICMP- 1, IGMP-2, TCP-6, UDP-17 etc.  Header Checksum: Ensures the integrity of header values  Divide the packet in to k section of 16 bits each  All sections are added using ones complement method  The final result is complemented to make checksum  Follow the same method at receiver. If the result is zero accept else discard the datagram
  • 47. Computer Networking / Module III/ AKN / 47 IP Header Options  IP header is made of two parts: the fixed part and the variable part. Fixed part is 20 byte long; the variable part comprises the option which can be a max. of 40 bytes.  These are included primarily for network testing and debugging  Format  Code:  It contains copy(1), class(2), and number(5)  Copy = 1: options should be copied to all fragment  Copy = 0: options must be only copied to first fragment Code(8) Length(8) Data (variable length) Copy Class Number
  • 48. Computer Networking / Module III/ AKN / 48 Options field of IP Datagram  Class  00 : used for datagram control, 01: reserved  10: Debugging and management, 11: reserved  Number  Defines the type of options  Length  It defines the total length of the option including the code field and the length field itself  Data  Contains the data that specific options require
  • 49. Computer Networking / Module III/ AKN / 49 Types of Options  0 : End of option, used if options do not end at end of header  1: no operation, used to align octets  7: Record Route, It is used to record the routers that handles the datagrams. It can list up to nine router addresses?  The source creates empty fields for the IP addresses in the data field of the option Options Data 0 7-byte opt 8-byte opt 1 Code Length Pointer First IP Address (empty) Second IP Address (empty) Third IP Address (empty)
  • 50. Computer Networking / Module III/ AKN / 50 Types of Options  Whenever a router handles the datagram, it compares the pointer and length field. If the pointer field is greater than length field, the list is full.  Else router inserts its IP address at the position specified by pointer and increments the pointer by four.  This option requires that two machines must cooperate. i.e. source must enable record route and destination must agree to process the resultant list.  9: Strict source route, used by the source to predetermine a route for the datagram as it travels through internet  i.e. a source may choose a safer route to the destination
  • 51. Computer Networking / Module III/ AKN / 51 Types of Options  If a datagram specifies a strict source route, all of the routers defined in the option must be visited in order by the datagram.  If a datagram reaches at a router not in the list then it is discarded and error message is sent to the source.  If a datagram reaches at the destination and some entries were not visited, it will also be discarded and error message is issued.  i.e. The path between two successive addresses in the list must consists of a single physical network  It is only useful when the network topology is known
  • 52. Computer Networking / Module III/ AKN / 52 Types of Options  3: Loose source route, It is similar to strict source but allows multiple network hops between successive address in the list  Both source route options requires routers along the path to overwrite the list with their local network address.  4: Timestamp, is used to record the time of datagram processing by the router. Code Length Pointer First IP Address First Timestamp . . . OFlow Flags
  • 53. Computer Networking / Module III/ AKN / 53 Types of Options  Length and pointer fields are used to specify the length of the space reserved for the option and the location of the next unused slot.  Oflow(4) contains an integer count of routers that couldnot supply timestamp because the option was too small  Flag(4), controls the exact format of the option and tells how routers should supply timestamps.  0: Record timestamps only, omit IP addresses  1: Precede each timestamp by an IP address  3: IP addresses are specified by sender; a router only records a timestamp if the next IP address in the list matches the router‟s IP address
  • 54. Computer Networking / Module III/ AKN / 54 Routing IP Datagrams  Routing is the process of choosing a path over which to send packets, and router refers to a computer making the choice  The goal of IP is to provide a virtual network that encompasses multiple physical network and offers a connection less datagram delivery service  Routing is divided into two forms 1. Direct delivery: Transmission of a datagram from one computer across a single physical network directly to another 2. Indirect delivery: Transmission of datagram to a destination not attached directly to the senders network, thus forcing the sender to pass the datagram to a router for delivery
  • 55. Computer Networking / Module III/ AKN / 55 Datagram delivery over a single Network  In this case the final destination of the datagram is a host connected to the same physical network R • The sender extracts the network address of destination IP and compares it to the network portion of its own IP . • If a match is found then the delivery is direct and it does not involve routers • Now the destination IP address is used to find its physical address for actual datalink layer delivery? • Extraction of network address takes a few machine instructions making the process extremely efficient
  • 56. Computer Networking / Module III/ AKN / 56 Indirect Delivery  It is more difficult because the sender must identify a router to which the datagram can be sent R R • The datagram goes from router to router until it reaches the destination network • At the destination network it performs direct delivery to reach at the host • How can a host know which router to use for a given destination? • How can a router know where to send datagrams?
  • 57. Computer Networking / Module III/ AKN / 57 Mapping Internet Address to Physical Address  Delivery of a packet requires two levels of addressing.  Hosts and routers are recognized at the network level by their logical addresses, which is universal and implemented in software  But at physical level devices are recognized by their physical addresses  Therefore, the packet to be sent from A to B should be mapped to the physical address of B  Address mapping must be performed at each step along a path from original source to ultimate destination i.e 1. Last hop addressing 2. Intermediate addressing
  • 58. Computer Networking / Module III/ AKN / 58 Mapping Internet Address Physical Address  Last hop addressing  Packet‟s internet address is mapped to the final destinations physical address  Intermediate addressing  At any point along the path packet is mapped to intermediate routers physical address (as destination)  Address resolution problem  The problem of mapping logical to physical address is called the ‘address resolution problem’.  There are two technologies followed by TCP/IP to resolve the problem. 1. Resolution through direct mapping 2. Resolution through Dynamic binding
  • 59. Computer Networking / Module III/ AKN / 59 Mapping Internet Address Physical Address  Resolution through Direct Mapping  In proNET token ring network, the administrator chooses small integers for physical addresses while installing an interface.  Now to have a efficient address resolution one can find a function PA = f (IA) to calculate the numbers.  i.e. if f is simple then the mapping will be simple  Another way is to keep a table containing address pairs (logical, physical) and a hash function may be used to search that table  Another advantage in this method is, if one interface of a computer is changed then also the same physical address can be used for the new interface  Also new computers can be added to the network without changing the existing assignments.
  • 60. Computer Networking / Module III/ AKN / 60 Mapping Internet Address Physical Address  Resolution through dynamic binding  In Ethernet technology the 48 bit physical address is assigned when manufactured  Thus the physical address of a computer changes each time an interface is changed.  Because the physical address is 48 bit long and not assigned by the user thus it is impossible to devise a function for mapping as in previous case  To avoid maintaining a mapping table (not possible !) the designers developed a protocol to bind addresses dynamically known as „Address Resolution Protocol‟  ARP provides a mechanism that is both reasonably efficient and easy to maintain
  • 61. Computer Networking / Module III/ AKN / 61 Resolution through dynamic Binding  Idea  Sender broadcasts a special packet that asks the destination about its physical address  Destination recognizes the packet and sends a reply containing its physical address  Now the sender uses physical address to send packets directly to destination A B C D A B C D A B C D
  • 62. Computer Networking / Module III/ AKN / 62 ARP Packet Format (RFC-826)  H/W Type: 16 bit field defines type of LAN e.g. Ethernet=1  Protocol Type: 16 bit field defining IP version e.g. IPV4=0080016  Hlen: 8 bit, length of hardware address e.g. Ethernet = 6  Plen : 16 bit, length of logical address  Operation : 8 bit, request=1, reply 2 Hardware Type Protocol Type OperationH/W length Protocol length Sender Hardware Address Sender Protocol Address Target Hardware Address Target Protocol Address
  • 63. Computer Networking / Module III/ AKN / 63 Address Resolution Protocol  Encapsulation  ARP packet is encapsulated directly in to a datalink frame  Refinements  If the target machine is down or too busy to accept the request? i.e sender may not receive a reply (1) or it is delayed(2)  Retransmit the request for (1) or it restores the original outgoing packet till it resolves the address SFD Dest Add Source Add Type Data CRC ARP Packet
  • 64. Computer Networking / Module III/ AKN / 64 ARP Implementation  ARP Cache  After receiving an ARP reply, it saves the IP address and corresponding hardware address in its cache for successive lookups  But problem occurs if receiver crashes in between and source gets no information but keep on sending  To resolve above problem a timer is used, when it expires the information in the cache is erased and normal procedure starts again  Another refinement possible is, senders IP-Physical address binding can also be updated in receivers cache before processing the ARP request
  • 65. Computer Networking / Module III/ AKN / 65 Four cases using ARP
  • 66. Computer Networking / Module III/ AKN / 66 Limitations with IP  A datagram travels from router to router till it reaches one that can deliver directly to its final destination  If a router cannot route a datagram?  If the router detects an unusual condition that affects its ability to forward the datagram?  In an connectionless system, each router operates autonomously, i.e without coordination of sender. and  IP fails to deliver the datagram if  The destination is temporarily or permanently disconnected  The TTL expires  The intermediate routers become so congested that they cannot process the incoming traffic
  • 67. Computer Networking / Module III/ AKN / 67 The Internet Control Message Protocol  To allow routers in an internet to report errors or provide information about unexpected circumstances, one mechanism is attached with IP is called “The Internet Control Message Protocol”, ICMP  ICMP allows routers to send error or control messages to other router or hosts; It provides communication between the IP software on one machine and the IP software on another  i.e. The ultimate destination of an ICMP message is not an application program or user on destination but the IP software of that machine  ICMP is not restricted only to routers but is allowed to be used by any arbitrary machine to get some information.  ICMP messages travel across internet in the data portion of IP datagrams
  • 68. Computer Networking / Module III/ AKN / 68 Error Reporting / Error Correction  When a datagram causes an error, ICMP can only report the error condition back to the original source of the datagram.  The source must take some action to correct the error  It cannot be used to inform intermediate routers about the problem  An Example  If a datagram follows a path R1, R2, . . ., Rk and Rk has the incorrect information and mistakenly routes the datagram to Re  Now Re cannot use ICMP to report the error back to Rk but it can send a report back to the original source  And the original source has no control over the misbehaving router. In fact it is not possible for the source to know which router (Rk) causes the problem
  • 69. Computer Networking / Module III/ AKN / 69 ICMP Message  Message Delivery  It requires two levels of encapsulation Header ICMP Data Header Datagram Data Header Frame Data – Even though ICMP messages are encapsulated and sent using IP datagrams, it is not considered a higher level protocol, but a required part of IP – It is Because, it needs to travel across several physical networks to reach their final destination
  • 70. Computer Networking / Module III/ AKN / 70 ICMP Message Format  Type : identifies the message type  Code : provides further information about the message type  Checksum : error detection  ICMP messages that report errors always include the header and first 64 bit data bits of the datagram causing the problem Type (8 bit) Code (8 bit) Checksum (16 bit) Rest of Header Data . . . (Variable size)
  • 71. Computer Networking / Module III/ AKN / 71 ICMP Message Format (contd.)  The total table is available in page 133 of D.E. Comer Type Message 0 Echo Reply 3 Destination unreachable 4 Source Quench 5 Redirect (change route) 8 Echo Request 9 Router Advertisement 10 Router solicitation 11 Time Exceeded for a datagram 12 Parameter problem on a datagram Ping: One of the most frequently used debugging tool that invokes ICMP echo request and echo reply messages - Any machine that receives an echo request formulates an echo reply and return it to the original sender
  • 72. Computer Networking / Module III/ AKN / 72 Echo Request and Reply Message  Optional Data is a variable length field that contains data to be returned to sender  Identifier and Sequence number are used by the sender to match replies to request.  The Type field specifies whether the message is a request (8) or reply (0) Type(8 / 0) Code (0) Checksum Data . . . (optional) Identifier Sequence no
  • 73. Computer Networking / Module III/ AKN / 73 Reports of Unreachable Destinations  When a router cannot forward or deliver an IP datagram, it sends a ‘destination unreachable’ message back to the original source  The code field contains an integer that further describes the problem  Code Meaning Cause  0: Network unreachable (h/w failure)  1: host unreachable (do)  2: Protocol unreachable (receiving protocol not running)  3: Port unreachable (receiving appl. Prg not running)  4: fragmentation required (D bit set) etc. Type-3 Code (0-15) Checksum Part of the received IP datagram including IP header + first 8 byte of datagram data Unused - all zeros
  • 74. Computer Networking / Module III/ AKN / 74 Congestion and Datagram flow control  IP doesn't have a flow control (rate of sending and receiving) mechanism, which may lead to congestion. i.e  The router eventually exhausts memory and discards additional datagrams arrived  ‘Source quench’ message has been designed to add a kind flow control to IP.  When a datagram is discarded, it sends a source quench message to the sender, which helps in  Reporting source that datagram is discarded  Make the source aware of congestion and to slow down Type-4 Code -0 Checksum IP header + first 8 byte of datagram data Unused - all zeros
  • 75. Computer Networking / Module III/ AKN / 75 Route change requests  Routers are assumed to know correct routes; hosts begin with minimal routing information and learn new routes from routers  If a host sends a datagram to an incorrect router, then the router forwards the datagram in correct destination and sends a ‘redirect message’ to the host.  Now host updates its table accordingly  Code  0: redirection for the network  1 : redirection for the host Type-5 Code (0-3) Checksum IP header + first 8 byte of datagram data Router Internet Address
  • 76. Computer Networking / Module III/ AKN / 76 Detecting Circular or long routes  This message is generated in two cases  Code 0: TTL exceeded  If there are errors in one or more routing table a datagram may travel in a loop. After some time when TTL becomes zero the datagram is discarded and a ‘Time exceeded’ message is sent to source  Code 1: Fragment reassembly time exceeded  If all fragments that belong to one datagram don‟t arrive at the destination within a time limit then the fragments are discarded and a Time exceeded message is sent to the source Type-11 Code (0-1) Checksum IP header + first 8 byte of datagram data Unused
  • 77. Computer Networking / Module III/ AKN / 77 Reporting Other Problems  If a router or destination discovers an ambiguous or missing value in any field of the datagram header then it sends a ‘Parameter problem’ message back to source  Code 0: Error in header fields  Pointer field points to the byte with problem  Code 1: Required part of option is missing  Pointer field not used in this case Type-12 Code (0-1) Checksum IP header + first 8 byte of datagram data Pointer Unused
  • 78. Computer Networking / Module III/ AKN / 78 Clock Synchronization and Transit Time Estimation  ‘Time Stamp message’ is used by two machines to determine the round trip time needed for an IP datagram to travel between them  Each time the fields hold a no representing time measured in milliseconds from midnight in GMT  Calculation:  Sending time = receive TS - Originate TS  Receiving time = datagram return time - Trnsmit TS  Round trip time = sending time + receiving time Type(13-14) Code -0 Checksum Source: Originate time stamp Identifier Sequence number Destination: Receive time stamp Destination: Transmit time stamp (departure)
  • 79. Computer Networking / Module III/ AKN / 79 Obtaining a subnet mask  ‘Address mask request/reply’ message are used by a host to obtain its mask from a router Type(17-18) Code -0 Checksum Address Mask Identifier Sequence number Router Discovery Type(9) Code -0 Checksum Router Address 1 Nun addr Life time Preference level 1 Router Address 2 Addr size Preference level 2 . . .
  • 80. Computer Networking / Module III/ AKN / 80 Router Solicitation/Advertisement  ICMP supports a router discovery scheme that allows hosts to discover router address.  A host can broadcast a ‘router solicitation’ message. The routers that receive the message broad cast their routing information using „router advertisement’ message  ICMP router discovery scheme helps in two ways  1. Instead of providing a statically configured router address via a boot strap protocol, the scheme allows a host to obtain information from router itself  2. The mechanism uses a soft state technique with timers to prevent hosts from retaining a route after a router crashes  Routers advertise their information periodically, and a host discards a route if the timer for a route expires (30min, 10min) Type(10) Code -0 Checksum Identifier Sequence number
  • 81. Computer Networking / Module III/ AKN / 81 Network Layer Protocols Lecture II • IPV6 • ICMPR6 • Unicast Routing protocols • RIP • OSPF
  • 82. Computer Networking / Module III/ AKN / 82 IPv6: Need for an alternative  IPv4 has two level address structure (?) and categorized into 5 classes. The use of address space is inefficient  The internet must accommodate realtime audio and video transmission, which requires min delay and reservation of resources  The Internet must accommodate encryption and authentication of data for some application  Not only the computers but various devices including house hold devices, hand held devices, telephones etc. needs IP address
  • 83. Computer Networking / Module III/ AKN / 83 Characteristics of IPv6  Larger Address Space: 128 bit long  Huge increase in address space  Better header format  options are separated from base header  New options  To add new functionalities  Allowance for extension  To support new technologies  Support for resource allocation  To support traffic such as real-time audio and video  Support for more security  Encryption and authentication mechanism  RFCs  1365, 1550, 1678, . . .
  • 84. Computer Networking / Module III/ AKN / 84 IPv6 address • 128 bits are divided into eight sections of hexadecimal nos, each 2 byte long sections separated by colons • The address may be abbreviated, i.e the leading zeros can be omitted (not trailing zeros) • consecutive sections consisting of zeros can be replaced with double semicolons • if there are two runs of zero section than only one of them can be abbreviated
  • 85. Computer Networking / Module III/ AKN / 85 Unicast Addresses  Defines two types of unicast addresses  Geographically based unicast address (left for future definition)  Provider based unicast address (discussed below)  Type identifier: 3 bit field defines the address as a provider- based address
  • 86. Computer Networking / Module III/ AKN / 86 Unicast Addresses contd.  Registry identifier: 5bit field indicates the agency that has registered the address.currently three registry has been defined.  INTERNIC: center for North America  RIPNIC: center for European registration  APNIC: for Asian and Pacific countries  Provider indentifier: variable-length field identifies the provider for Internet access (like ISP). A 16 bit length is recommended for this field  Subscriber identifier: a 24 bit is assigned to an organization subscribing to the Internet via provider  Subnet identifier: a 32 bit is assigned to define a subnet under the territory of a subscriber  Node identifier: a 48 bit is assigned for the identity of the node connected to subnet
  • 87. Computer Networking / Module III/ AKN / 87 Multicast addresses  First 8 bits all 1s  Flag: 4bit field that defines the group address as either permanent or transient  Scope: 4 bit field defines scope of the group address  Group ID: 112 bits identifies group  Anycast addresses  A packet destinated for anycast address is delivered to only one member of the anycast group. i.e. member having shortest route  No block is assigned to for this anycast address
  • 88. Computer Networking / Module III/ AKN / 88 Reserved addresses  Start with eight zeros  Unspecified address is used when a host does not know its own address  Loopback address is used by a host to test itself  Compatible address is used during the transition from IPv4 to IPv6. i.e. when passing from IPv6 to IPv6 via IPv4 network  Mapped address is also used during transition when sending from Ipv6 to IPv4 computer
  • 89. Computer Networking / Module III/ AKN / 89 Local addresses  Used when an organization wants to use IPv6 without being connected to Internet  Nobody outside the organization can send a message to the nodes using these addresses  A link local address is used in an isolated subnet  A site local address is used in an isolated site with several subnets
  • 90. Computer Networking / Module III/ AKN / 90 Format of an IPv6 datagram • Each packet is composed of a mandatory base header (40 bytes) followed by a payload. • Payload consists of two parts (65535 bytes) • Optional extension header • Data from an upper layer
  • 91. Computer Networking / Module III/ AKN / 91 Base Header  Version(4): version of IP  Priority(4): priority of the packet w.r.t. congestion  Flow level(3byte): special handling for a particular flow of data  Payload length(2 byte): total length of datagram excluding base header  Next header(8): either one of the optional extension headers used by IP or the header for an upper layer protocol like UDP, TCP  Hop Limit(8): same as TTL  Source Address(16byte): IP of source  Source Address(16byte): IP of destination
  • 92. Computer Networking / Module III/ AKN / 92 Comparison between IPv4 and IPv6 packet headers
  • 93. Computer Networking / Module III/ AKN / 93 Extension header The base header can be followed by six extension headers  Hop-by-hop Option  Is used when the source needs to pass information to all routers visited by the datagram. Three options are defined  Pad1: 1 byte, designed for alignment purposes  PadN: used when 2 or more bytes needed for alignment  Jumbo payload: is used to define a payload longer than 65535 bytes  Fragmentation  Only original source can fragment after using a path MTU discovery to get the smallest MTU supported by any network on the path  If it will not use the technique then it must fragment a datagram to a size <= 576 bytes
  • 94. Computer Networking / Module III/ AKN / 94 Extension header contd.  Authentication  It validates sender, and ensures integrity of data  Encrypted Security Payload  It provides confidentiality and guards against eavesdropping  Source Routing  Uses the concept of strict/loose source routing  Destination Option  Is used when the source needs to pass information to the destination only. Intermediate routers are not permitted access too this information
  • 95. Computer Networking / Module III/ AKN / 95 Comparison between IPv4 options and IPv6 extension headers
  • 96. Computer Networking / Module III/ AKN / 96 Transition from IPv4 to IPv6 Because of huge systems using IPV4 that‟s why three strategies were proposed for smooth transition  Dual stack  A station should run both IPv4 and IPv6 simultaneously until all the Internet uses IPv6  If DNS returns IPV4 address then source sends IPV4 packet else IPV6 packet  Tunneling  When two computers using IPV6 want to communicate with each other and the the packet has to pass through a region that uses IPV4  Therefore IPV6 packet is encapsulated in an IPV4 datagram when it enters that IPv4 region
  • 97. Computer Networking / Module III/ AKN / 97 Transition from IPv4 to IPv6  Header Translation  It is necessary when the majority of the Internet has moved to IPv6  i.e. If sender uses IPv6 but receiver uses IPv4  Header must be completely translated  It uses mapped address of IPv6
  • 98. Computer Networking / Module III/ AKN / 98 ICMPv6 Comparison of query messages in ICMPv4 and ICMPv6 Comparison of error-reporting messages in ICMPv4 and ICMPv6
  • 99. Computer Networking / Module III/ AKN / 99 Unicast Routing Protocols  A routing protocol allows routers share their knowledge (routing information) about the network with other routers.  They maintain a table to keep routing information. This table gets updated periodically after receiving information from neighbouring routers  Routers use routing table to decide about the best route based on a cost metric  Cost metric  Hop count: cost of passing through any network is same. i.e. passing through one network costs 1 hop  Max throughput: throughput is more in passing through an fiber than in radio link  Min delay: delay is less in fiber than satellite link  Reliability: some networks may be more reliable than others, it is decided based on a policy.  Various routing protocols available are RIP, OSPF etc.
  • 100. Computer Networking / Module III/ AKN / 100 Routing Information Protocol  It is based on Distance Vector routing, which uses Bellman- Ford algorithm for calculating the routing table  Distance Vector Routing  In this scheme, each router periodically (30 s) shares (broadcasts) its own routing information with its neighbours  Every router keeps a routing table that has three columns in its simplest form for each entry about a network • A, B,C, D are (routers) • To: destination network • Cost: hop count • Next: next hop
  • 101. Computer Networking / Module III/ AKN / 101 RIP Updating Receive: a response RIP message 1. Add one hop to the hop count for each advertised destination. 2. Repeat the following steps for each advertised destination: 1. If (destination not in the routing table) 1. Add the advertised information to the table. 2. Else 1. If (next-hop field is the same) 1. Replace entry in the table with the advertised one. 2. Else 1. If (advertised hop count smaller than one in the table) 1. Replace entry in the routing table. 3. Return.
  • 102. Computer Networking / Module III/ AKN / 102 Example of updating a routing table
  • 103. Computer Networking / Module III/ AKN / 103 Initial and Final routing tables in an example network
  • 104. Computer Networking / Module III/ AKN / 104 Problems with RIP: Count-to-infinity  Count to infinite  Suppose there is a network as shown  Each router keeps the information about A initially as shown  Now A goes down or link between A and B Brakes  At the first packet exchange B will not receive any message from A  But C tells B that it has a path to A of length 2  B now updates its own information about A according updation algo and make it 3 1, - 2, B 3, C 4, D 5, E A B C D E F Initially After 1 exchange After 2 exchanges After 3 exchanges After 4 exchanges After … exchanges 3, C 2, B 3, C 4, D 5, E 3, C 4, B 3, C 4, D 5, E 5, C 4, B 5, C 4, D 5, E 5, C 6, B 5, C 6, D 5, E      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . •The number of exchanges required depends on the numerical value used for infinity. •In RIP the value is kept 16, that’s why it can’t be used in large systems
  • 105. Computer Networking / Module III/ AKN / 105 Open shortest path First (OSPF)  It is based on link state routing that uses dijkstra‟s algorithm  Link state routing  In this scheme, each router shares the knowledge about its own neighbours to all other routers using flooding  Each router maintains a database about its neighbours and sends it when there is a change or after a large period.  The idea is that all routers should have a complete topology of the network. From this topology the router can calculate the shortest path between itself and the destination network using dijkstra‟s graph algorithm  The topology is represented as a graph, where vertices are networks or routers and edges are links.  A cost is associated with each link
  • 106. Computer Networking / Module III/ AKN / 106 Link state Routing  Learning about neighbours  When router is booted, it sends a hello packet on each point-to-point line  The router at the other end sends back a reply  Measuring Link cost  One echo packet is sent and its time is recorded, other side sends the packet back immediately and the time of receiving is recorded again  The test is conducted several times and the average RTT is calculated for better result  Building the Link state packets  Identity of sender, sequence #, age, a list of neighbours with their link costs
  • 107. Computer Networking / Module III/ AKN / 107 Link state Knowledge  Whole topology can be compiled from the partial knowledge of each node
  • 108. Computer Networking / Module III/ AKN / 108 Formation of shortest path tree  The dijkstra‟s algorithm creates a single source shortest path tree given a graph(topology), each node is assigned a cumulative cost from root to that node (called weight or total cost)
  • 109. Computer Networking / Module III/ AKN / 109 Transport Layer Lecture III • User Datagram Protocol • Transmission Control protocol • Congestion Control and Quality of services
  • 110. Computer Networking / Module III/ AKN / 110 Transport Layer Protocols used for Transport Layer are UDP or TCP The responsibility of transport layer is to deliver the message to the receiving process/Application. i.e. process to process delivery
  • 111. Computer Networking / Module III/ AKN / 111 Review  Internet layer provides a host-to-host packet delivery  The next problem is turn this service to process-to- process delivery  The Transport layer supports communication between the end application programs, thus called end-to-end protocol  The underlying networks upon which the transport protocol operates has certain limitations like, it may  Drop messages  Reorder Messages  Deliver duplicate copies of messages  Limit messages to some finite size  Delivery messages after a long delay
  • 112. Computer Networking / Module III/ AKN / 112 Review  The operating system supports multiprogramming  But specifying that a particular process on a particular machine is the ultimate destination for a datagram is misleading, because  Processes are created and destroyed dynamically(pid), senders seldom know enough to identify a process on another machine  Processes may be replaced without informing to the senders  We need to identify destinations from the functions they implement without knowing the process  Instead of thinking a process as the ultimate destination, we will imagine that the machine contains a set of abstract points called protocol ports (integer nos.)
  • 113. Computer Networking / Module III/ AKN / 113 Review  Operating system provides two types of access to ports 1. Synchronous access  computation stops during a port access operation.  i.e. if a process attempts to extract data from a port, then the operating system temporarily blocks the process till data is passed to the process and then restarts it 2. Asynchronous access  Ports are buffered, so that data arrives before a process is ready to access will not be lost  To achieve buffering the protocol software places the packets that arrive for a particular protocol port in a (finite) queue  Each message must carry the destination port on source
  • 114. Computer Networking / Module III/ AKN / 114 Types of data deliveries
  • 115. Computer Networking / Module III/ AKN / 115 Port Addressing  At transport layer, port number is used to deliver a message to the correct process out of several processes running on destination host  Port numbers are 16 bit integers between 0-65535.  The client program defines itself with a port number, chosen randomly by transport layer called ephemeral port numbers  The server program uses well known port number.  i.e. client gets a new port number each time it runs, but the port number for server is fixed  IANA defines some ranges  Well-know ports: 0-1023 are assigned and controlled by IANA for some well-know server processes  Registered ports: 1024-49151 are not assigned or controlled by IANA, but can be used by processes  Dynamic ports: 49151-65535 are neither controlled nor registered, called ephemeral ports
  • 116. Computer Networking / Module III/ AKN / 116 Other features  Socket Address  The IP address and port number pair defines the socket address  The client and server‟s socket addresses define client and server processes uniquely  A pair of socket address (client and server‟s) uniquely defines a connection.  Multiplexing and demultiplexing  At the sender side, there may be several processes need to send packets, but there is one transport layer protocol.  Therefore the protocol accepts messages from different processes differentiated by their port numbers and interleaves them  At the receiver side, the transport layer receives interleaved packets from network layer and passes to appropriate application after processing
  • 117. Computer Networking / Module III/ AKN / 117 Other features contd.  Connection-less vs connection-oriented service  In a connection less service, packets are sent from one party to another, without establishing the connection  In case of connection oriented, a connection is established, data transferred, then connection is released  Reliable vs unreliable  Reliability is achieved by providing error and flow control at transport layer (data transmission)  It becomes a slower and more complex service  Where as unreliable services are faster and simple to implement (real-time application)
  • 118. Computer Networking / Module III/ AKN / 118 The User Datagram Protocol (UDP)  It is the simplest possible transport protocol that extends the host-to-host delivery into a process-to- process communication service.  It only adds a level of demultiplexing, s.t. multiple application process on each host are allowed to share the network.  Aside from this requirement, UDP adds no other functionality to the best effort service.  UDP provides an unreliable connection less delivery service.  It uses IP to carry messages, but adds the ability to distinguish among multiple destinations within a given host computer.
  • 119. Computer Networking / Module III/ AKN / 119 The UDP message format  Port nos may vary from 0-65535, and source port is optional. These are used to demultiplex datagrams  The Length field contains a count of datagram in octets. Minimum length is 8  Checksum is optional and zero is kept if not computed  The UDP checksum provides the only way to guarantee that data has arrived intact and should be used UDP Source Port Data . . . UDP Destination Port UDP message length UDP Checksum
  • 120. Computer Networking / Module III/ AKN / 120 Checksum Calculation  UDP uses the same checksum algorithm as IP  But UDP covers more information than is present in UDP datagram  It prepends a pseudo-header to the UDP datagram  Appends an octets of zeros to pad the datagram to an exact multiple of 16 bits  And computes checksum over entire object  UDP pseudo-Header Source IP Destination IP Zero Protocol UDP Length
  • 121. Computer Networking / Module III/ AKN / 121 Checksum Calculation (contd.)  Checksum calculation at the Sender end.  Add pseudo-header to the user datagram  Fill the checksum field with zeros  Divide the total bits in to 16 bit words  If total bytes are not even, add one byte of all zeros  Add all 16-bit sections using one‟s complement arithmetic  Complement the result and insert the result in checksum field  Drop the pseudo header and any padding used  Deliver the datagram  Checksum calculation at the Receiver end.  Perform the operation same as above  If complement is zero drop pseudo-header and padding and accept the datagram. Otherwise discard the datagram
  • 122. Computer Networking / Module III/ AKN / 122 Checksum Calculation (contd.)  Assignment  Calculate the checksum of the user datagram at sender side and also test it for the receiver side 153.18.8.105 171.2.14.10 Zero 17 15 1027 U D P T 13 15 0 E S T padding
  • 123. Computer Networking / Module III/ AKN / 123 Checksum Calculation an example
  • 124. Computer Networking / Module III/ AKN / 124 Problem with Checksum Calculation  Pseudo-header contains source and destination IP addresses i.e. IP addresses must be known at UDP layer  Destination IP address is supplied by the user.  But what about source IP, which is yet to be computed in IP layer?  Solution 1: UDP software asks the IP layer to compute addresses  Solution 2: UDP software computes addresses and after checksum calculation sends it to IP layer.  IP layer need to fill remaining IP header fields  But any of the solution violates the abstraction of layers  i.e. It is clearly a compromise of pure separation needed for practical reasons
  • 125. Computer Networking / Module III/ AKN / 125 UDP Operation  Connection less service  Each datagram sent by UDP is an independent datagram.  Data grams are not numbered, also there is no connection establishment thus different datagrams may follow different path  It cannot send a stream of data, i.e. each request must be small enough to fit into one user datagram  Flow and error control  No flow control hence no window mechanism. Receiver may overflow  No error control hence sender does not know if a message is lost or duplicated
  • 126. Computer Networking / Module III/ AKN / 126 • At sending side UDP accepts messages from different processes, differentiated by their port nos.Then it is passed to IP layer • At receiving side UDP receives datagrams from IP. After error checking drops the header and delivers to the appropriate processes  In a host running a TCP/IP software, there is only one UDP but possibly several processes, that need to use services of UDP Multiplexing and Demultiplexing Port1 Port2 Port3 UDP DeMultiplexer IP Port1 Port2 Port3 UDP Multiplexer IP
  • 127. Computer Networking / Module III/ AKN / 127 Well known ports used for UDP
  • 128. Computer Networking / Module III/ AKN / 128 Use of UDP  It is suitable for process that requires simple and fast request-response communication like DNS  Suitable for process with internal flow and error control mechanism like tftp  Suitable for multicasting  Used for management process such as SNMP  Used for route update protocols like RIP
  • 129. Computer Networking / Module III/ AKN / 129 Reliable Stream Transport Service  Stream Orientation  Data is converted into stream of bits, divided into octets at source machines  The stream delivery service on the destination machine passes to the receiver exactly the same sequence of octets that the sender has passed.  Virtual Circuit Connection  Before data transfer can start, both the applications interact with their respective OS for a connection  i.e. one application places a call, which must be accepted by the other
  • 130. Computer Networking / Module III/ AKN / 130 Properties of Reliable Delivery Service  During transfer, protocol software on the two machines continue to communicate to verify that data is received correctly otherwise report the failure to appropriate S/W for necessary action  Therefore, Application programs view the connection as a dedicated H/W circuit.  The reliability is an illusion provided by the stream delivery service called virtual circuit  Buffered Transfer  The protocol software is free to divide/combine the stream into packets independent of pieces the application program transfers.  At the sending side, a PUSH mechanism forces protocol S/W to transfer all the data that has been generated without waiting to fill a buffer.  At the other end PUSH causes it to make the data available to application without delay
  • 131. Computer Networking / Module III/ AKN / 131 Properties of Reliable Delivery Service  Unstructured Stream  TCP/IP stream service doesn‟t honour structured data stream  i.e. There is no way for a payroll application to have the stream service mark the boundaries between employee records  Full Duplex Connection  Connections provided by TCP/IP stream service allow concurrent transfer on both directions  The advantage is control information for one stream can be send back to the source in datagrams carrying data in the opposite direction
  • 132. Computer Networking / Module III/ AKN / 132 Transmission Control Protocol  Reliability  +ve acknowledgement with retransmission Sender Receiver Pkt Recv Pkt Send Ack Recv Ack Send Pkt The sender keeps a record of each packet it sends and waits for an ack before sending the next pkt Sender also starts a timer and retransmits a packet if the timer expires before receiving the ack • Disadvantages • Duplication of data / Ack due to premature retransmission • To avoid confusion caused by delayed or duplicated Ack, seq. no. is sent back with Ack • Wasting of substantial amount of N/W bandwidth
  • 133. Computer Networking / Module III/ AKN / 133 END-to-END vs Point-to-Point  1. TCP needs an explicit connection establishment s.t. two parties establish some shared state to enable the sliding window algorithm to begin  2. Variations in RTT are possible due to various reasons.(?) Therefore timeout mechanism that triggers retransmissions must be adaptive.  3. How late a packet can arrive at the destination? IP throws packets away after their TTL expires, TCP assumes that each packet has a max. segment life time(MSL).  TCP has to be prepared for very old packets to suddenly show up at the receiver, potentially confusing the sliding window algorithm.
  • 134. Computer Networking / Module III/ AKN / 134 END-to-END issues  4. In case of point-to-point link  delay  bandwidth  window size  buffer space  The amount of resources dedicated to any one TCP connection highly variable, especially considering that any one host can potentially support hundreds of TCP connections at the same time  i.e TCP must include a mechanism that each side „learn‟ what resources the other side is able to apply to the connection  5. TCP connection has no idea what links will be traversed to reach at the destination.  The sending machine might be connected directly to a relatively fast Ethernet and somewhere in the middle a slower link has to traversed, which leads to „congestion‟
  • 135. Computer Networking / Module III/ AKN / 135 TCP Segment  TCP has three mechanisms to trigger the transmission of a segment  1. TCP maintains a variable, maximum segment Size (MSS), and it sends a segment as soon as it has collected MSS bytes from sending process  2. Sending process invokes push operation to effectively flush the buffer of unsent bytes  3. A timer that periodically fires; the resulting segment contains as many bytes as are currently in buffer TCP is a byte oriented protocol. i.e. It describes the service provided to appl. process. The pkts exchanged between TCP peers are called segments Appl process TCP Send buffer Appl process TCP Recv buffer segment segment Write bytes Read bytes
  • 136. Computer Networking / Module III/ AKN / 136 TCP Segment Header Format Sequence Number HLen Checksum Options (variable length) Data . . . Src Port Acknowledgement Padding 0 4 10 16 19 24 31 Dst Port unused Flags Advertised window Urgent pointer
  • 137. Computer Networking / Module III/ AKN / 137 TCP Header Format Explanation  SrcPort and DstPort, identify the source and destination application programs respectively  A TCP connection is identified by a 4-tuple {SrcPort, SrcIPAddr, DstPort, DstIPAddr}  Because TCP is a byte oriented protocol, each byte of data has a sequence number  SeqNum field contains the sequence number for the first octet of data carried in that segment  Ack field defines the octet number that is expected next  AdvertisedWindow contains the buffer space available at receiver Sender Receiver seqNum Ack+advWin
  • 138. Computer Networking / Module III/ AKN / 138 TCP Header Format Explanation  Flags: 6 bits, when set it is understood as follows  5. SYN: Synchronize seq. nos during connection  6. FIN: Terminate the connection  4. RESET: reset the connection  3. PUSH: request for push  1. URG: urgent pointer is valid  2. ACK:  Urgent pointer specifies the position, where the urgent data ends.  Options: TCP header can have 40 bytes of optional information
  • 139. Computer Networking / Module III/ AKN / 139 TCP Header Options  Max Seg Size(MSS): 4bytes determined at the time of connection establishment  Window Scale factor:3bytes  Used to increase the window size  New window size=window size  2scaleFactor  Largest value possible for scale factor is 16  i.e. 216  216 = 232 max size of seq. number  Time Stamp: 10 bytes  Used to calculate round trip time
  • 140. Computer Networking / Module III/ AKN / 140 Connection Establishment  The client sends a segment to the server stating (flags=SYN, seqNum=x )  Then server responds with a single segment that both acknowledges (Flags=ACK, Ack=x+1) and states it own beginning seqNum (Flags=SYN, seqNum=y)  Finally client responds with a third segment that acknowledges the server‟s sequence number (flags=ACK, Ack= y+1) Client Server The algorithm used is called three-way-handshaking
  • 141. Computer Networking / Module III/ AKN / 141 Connection Termination, four-way-handshaking  Finally server sends a segment to the client stating (flags=FIN, seqNum=y )  The client responds with a segment that acknowledges the server‟s sequence number (flags=ACK, Ack= y+1) Client Server  The client sends a segment to the server stating (flags=FIN, seqNum=x )  Then server responds with a single segment that acknowledges (Flags=ACK, Ack=x+1)  now the connection is in half close mode. i.e. server can send data (remaining) but client can‟t
  • 142. Computer Networking / Module III/ AKN / 142 Connection Resetting  TCP may request for resetting a connection. i.e. the current connection is destroyed.  Resetting is done in one of the following three cases  The TCP of one side has requested a connection to a non-existent port. TCP of other side sends a segment with RST bit set  One TCP may want to abort the connection due to an abnormal situation  The TCP on one side may discover that the TCP on the other side has been idle for a long time
  • 143. Computer Networking / Module III/ AKN / 143 TCP State Transition  To keep track of all the different events during connection establishment to connection termination The TCP of both sides are implemented as a finite state machine and is represented in a state transition diagram  Notations  The states are shown using ovals  Transition from one state to another is shown using directed lines  Each line is contains two strings separated by slash. First string is input to TCP and second is output  Dotted lines represent server and solid lines represent client
  • 144. Computer Networking / Module III/ AKN / 144 State transition diagram  Starts in CLOSED state  When receives an Active open request from client application, it sends a SYN segment to server and goes to SYN-SENT state  Client TCP receives a SYN+ACK segment from server TCP. It sends an ACK to server TCP and goes to ESTABLISHED state  This is the data transfer state. Client remains in this state till data transmission continues Client Diagram
  • 145. Computer Networking / Module III/ AKN / 145 State transition diagram contd.  Client TCP receives a close request from its application program. It sends a FIN segment to the other TCP and goes to FIN- WAIT-1 state  When the ACK is received from server TCP, it goes to FIN- WAIT-2 state. The connection is closed in one direction  Client receives a FIN segment from server TCP and sends an ACK and goes to TIME-WAIT state  When client TCP is in this state it starts a timer and waits till the timer goes off.  The value of this timer is set to double the MSL  The client TCP remains in this state to let all duplicate packets, if any arrive to be discarded. After the time-out the client goes to CLOSED state again Client Diagram
  • 146. Computer Networking / Module III/ AKN / 146 State transition diagram contd.  Server TCP starts with CLOSED state  It receives a passive open request from the server application and goes to LISTEN state  IT now receives a SYN segment from the client TCP and sends a SYN+ACK segment to client TCP and goes to SYN-Rcvd state  It then receives ACK from client TCP and goes to ESTABLISHED state. Data transfer occurs between client and server applications  After data transmission it receives a FIN segment from client TCP, it now sends an ACK and goes to CLOSE-WAIT state  Server TCP receives a close request from server application program and sends a FIN segment to client TCP and goes to LAST-ACK state  When it receives the last ACK from client it goes to CLOSED state again Server Diagram
  • 147. Computer Networking / Module III/ AKN / 147 TCP‟s Sliding Window  1. It guarantees the reliable delivery of data,  2. It ensures data is delivered in order and  3. It enforces flow control between sender and receiver  The algorithm places a small, fixed size virtual window on the stream sequence and transmits all octets that lie inside the window without receiving an Ack.  Three pointers are maintained into the send buffer Sending Application TCP LastByteWritten LastByteSent Receiving Application TCP LastByteRead LastByteRecvdNextByteExpectedLastByteAckd Direction of transmission
  • 148. Computer Networking / Module III/ AKN / 148 Reliable and Ordered Delivery  TCP on sending side maintains a send buffer, this buffer is used to store data that has been sent but not yet acknowledged, as well as data that has been written by the sending application, but not transmitted  On other side, TCP maintains a receive buffer that holds data that arrives out of order, as well as the data that is in correct order but that application process has not yet read it  The relations among send buffer pointers can be as follows  LastByteAckd  LastByteSent and  LastByteSent  LastByteWritten  bytes to the left of LastByteAcked and bytes to the right of LastByteWritten need not be saved
  • 149. Computer Networking / Module III/ AKN / 149 Reliable and Ordered Delivery  Similarly at the receive buffer  LastByteRead < NextByteExpected is true As a byte cannot be read by the application until it is received  NextByteExpected  LastByteRecvd + 1 i.e. if data has arrived in order, NextByteExpected points to the byte after LastByteRecvd  if data has arrived out of order, NextByteExpected points to the start of the first gap in data  The bytes to the left of LastByteRead need not be buffered because they have already been read by the local process  bytes to the right of LastByteRecvd need not be buffered because they have not yet arrived.
  • 150. Computer Networking / Module III/ AKN / 150 TCP Flow Control  Both buffers are of finite size defined by MaxSendBuffer and MaxRcvBuffer.  Receiver sends a window advertisement that it can buffer. At receiving side, it maintains as  LastByteRecvd – LastByteRead  MaxRcvBuffer to avoid overflowing its buffer, it therefore advertises a window size of  AdvertisedWindow = MaxrecvBuffer- ((NextByteExpected-1) - LastByteRead) i.e. the free space remaining in receive buffer  NextByteExpected-1 is same as LastByteExpected in case of inorder receive, it will be different if out of order receive  If the receiving process is reading data just as fast as it arrives, then the advertised window stays open.
  • 151. Computer Networking / Module III/ AKN / 151 TCP Flow Control  If the receiving process falls behind, then advertise window shrinks and eventually goes to zero  On the other hand sender end TCP ensures that  LastByteSent – LastByteAcked  AdvertisedWindow i.e. it calculates How much data it can send as EffectiveWindow = AdvertisedWindow – (LastByteSent – LastByteAcked) i.e. how much extra bytes it can send  Also sending side should ensure that the local process doesn‟t overflow the send buffer, that is  LastByteWritten – LastByteAcked  MaxSendBuffer i.e. if sending process tries to write y bytes and (LastByteWritten – LastByteAcked) + y > MaxSendBuffer then TCP blocks sending process to generate more data
  • 152. Computer Networking / Module III/ AKN / 152 TCP Flow Control  How does the sending side know that the advertised window is no longer zero?  i.e. once the receiver side has advertised a window size of 0, the sender is not permitted to send any more data, which mince it has no way to discover that the advertised window is no longer zero at some time in the future.  Solution: the sending side persists in sending a segment with one byte of data every so often. The data may not be accepted but eventually it gets a response whenever send buffer becomes free.  The size of MSS is set to MTU of the directly connected network minus the size of TCP and IP header s.t. can be sent without fragmentation
  • 153. Computer Networking / Module III/ AKN / 153 Adaptive Retransmission  TCP retransmits each segment if an Ack is not received in a certain period of time(RTT)  But choosing an appropriate timeout value is very difficult and TCP uses adaptive retransmission mechanism  Original Algorithm:  TCP sends a data segment, records the time. When Ack for that segment arrives, it reads the time again. Difference between two times gives a SampleRTT.  TCP then computes a weighted average between the previous estimate and this new sample as  EstimatedRTT =   EstimatedRTT + (1 - )  SampleRTT   between 0.8 and 0.9 used to smooth the EstimatedRTT
  • 154. Computer Networking / Module III/ AKN / 154 Adaptive Retransmission  Then TimeOut = 2  EstimatedRTT  Problems  Ack does not acknowledges a transmission but receipt of data. i.e. it is difficult to associate an ACK with an transmission or retransmission  Associating the ACK with original transmission may be an over estimate and associating with retransmission may be an under estimate as shown in two figures  Solution? Sender Receiver Sender Receiver Original transmission Retransmission
  • 155. Computer Networking / Module III/ AKN / 155 Congestion Control  Congestion is a situation which may occurs when the load on the network is greater than the capacity of the network  i.e. The number of packets sent to the router is much more then the Number of packets the router can handle.  Router has so many packets queued that it runs out of buffer space and has to start dropping packets, which is a worst condition  Therefore to control the congestion we try to avoid heavy data traffic that may cause congestion If the rate of packet arrival rate is higher than processing rate then input queues becomes longer If the rate of packet departure rate is higher than processing rate then output queues becomes longer
  • 156. Computer Networking / Module III/ AKN / 156 Traffic descriptors  Average data rate = amount of data/total time  Peak datarate= max datarate of the traffic  Max. burst size= max length of time the traffic is generated at the peak rate  Effective bandwidth= is a function of average datarate, peak data rate, and max. burst size
  • 157. Computer Networking / Module III/ AKN / 157 Traffic Profiles Constant-bit-rate traffic: Datarate is constant throughout Variable bit rate: The rate of data flow changes in time Bursty: The datarate changes suddenly in a very short period of time. This type of traffic creates congestion in a network.
  • 158. Computer Networking / Module III/ AKN / 158 Network performance  Delay vs Load  When load is much less than the capacity of the network, the delay is at a minimum  Delay composed of propagation delay and processing delay, which is negligible!  When load reaches the network capacity, the delay increases sharply because waiting time is added to the delay  Throughput vs Load  Throughput is the number of packets passing through the network in unit time  when the load is below capacity, the throughput increases proportionally with load  When load reaches the network capacity, throughput declines sharply due to discarding of packets followed by retransmissions further makes things worse
  • 159. Computer Networking / Module III/ AKN / 159 Congestion Control  Two categories of mechanisms for congestion control  Open Loop: congestion prevention  Closed Loop: congestion removal  Open Loop: preventing congestion  Retransmission policy  The retransmission policy and retransmission timers must be designed to optimize the efficiency and to prevent congestion  Window Policy  The selective repeat is better than Go-Back-N policy for congestion control?  ACK Policy  If ACK is not received, sender slows down, help prevent congestion  Discarding Policy  Selective discarding of less sensitive packets when likelihood of congestion increases  Admission Policy  Before admitting for a flow it checks the resources
  • 160. Computer Networking / Module III/ AKN / 160 Congestion Control: closed Loop  Closed Loop: removal of congestion, if occurs  Back Pressure  Router informs previous routers to slow down (recursive)  Choke Point  Router informs source to slow down by sending a special packet  Implicit Signaling  Source predicts about congestion and slows down (like delay in getting ACK)  Explicit Signaling  Router sends an explicit signal by setting a bit in the packet  Backward signaling:The bit can be set in a packet moving in the opposite direction. This bit warns the sender to slow down  Forward signaling:The bit can be set in a packet moving in the direction of congestion. This bit warns the destination to slow down. Receiver slows down sending ACK
  • 161. Computer Networking / Module III/ AKN / 161 Congestion Control TCP  When congestion occurs in a router and some packets might be dropped, then sender retransmits those packets. This may create more congestion and more dropping of packets.  The condition become so worse that the system can pass no more data. This situation is called congestion collapse  i.e. If the cause of the lost segment is congestion, retransmission of the segment does not remove the cause—it aggravates it.  To avoid this situation, TCP assumes that the cause of a lost segment is due to congestion in the network and takes necessary action to remove congestion.
  • 162. Computer Networking / Module III/ AKN / 162 Congestion Control TCP contd.  The window size is decided not only by the receiver‟s advertisement but also by congestion in the network  Actual Window = Min(receiver‟s window, Congestion window)  Congestion avoidance  To avoid congestion we have two strategies  Slow start and additive increase till there is no congestion  Multiplicative Decrease, if congestion occurs
  • 163. Computer Networking / Module III/ AKN / 163 Congestion avoidance  Slow start  At the beginning of a connection TCP sets the congestion window size = 1MSS  For each segment ACK it receives the congestion window size is increased by 1 MSS till it reaches a threshold value = ½ of allowable window size i.e.  ACK for 1 seg –> congestion window size = 2 MSS  ACK for 2 segs -> congestion window size = 4 MSS  ACK for 4 segs -> congestion window size = 8 MSS  . . . -> congestion window size = ½ advt. Window  Additive Increase  After the size reaches the threshold, it increases the size by one for each received ACK.  i.e. ACK may be received for several segments but increase is only by 1 MSS
  • 164. Computer Networking / Module III/ AKN / 164 Congestion avoidance  This strategy continues till it receives ACK before time-out or congestion window size = advt. Window size.  Multiplicative Decrease  The only way to guess that a congestion has occurred is through a lost segment. i.e. if the sender does not receive ACK before time-out  If congestion occurs than threshold value is set to ½ of congestion window and congestion window is set to 1MSS again
  • 165. Computer Networking / Module III/ AKN / 165 Congestion control in frame relay  Frame relay is designed for high throughput and low delay but congestion decreases throughput and increases delay  Frame relay does not have flow control, but allows user to transmit bursty data that can cause congestion  For congestion avoidance, Frame relay protocol uses 2 bits the frame to warn the source and destination about the congestion.  Backward Explicit congestion Notification (BECN) bit  Forward Explicit congestion Notification (FECN) bit
  • 166. Computer Networking / Module III/ AKN / 166 BECN bit  It warns the sender about congestion in the network using two methods  Method 1: the switch uses response frames from the receiver  Method 2: the switch can use a predefined connection, DLCI=1023 to send special frames for this specific purpose  Sender responds by reducing data rate
  • 167. Computer Networking / Module III/ AKN / 167 FECN bit  Used to warn the receiver about the congestion  If there is an ACK mechanism at the higher level the receiver can delay the ACK, thus forcing the source to slow down  Four cases of congestion in Frame Relay
  • 168. Computer Networking / Module III/ AKN / 168 Quality of Service (QoS)  Is an assurance from the network for a particular kind of service  e.g. network uses retransmission strategy to make sure that data arrives correctly.  This service is ok for non-real time application. But may not be ok for real-time applications as it does-not guarantee timeliness  i.e. we need a new service model in which, application that need higher assurances can ask the network for that  A network that can provide these different level of services is said to support QoS.
  • 169. Computer Networking / Module III/ AKN / 169 Flow characteristics  Reliability  Lack of reliability means losing a packet or ACK, which may or may not needs retransmission  Example: Email, file transfer needs retransmission  Audio and video may not need retransmission  Delay (Source-to-destination delay)  Application can tolerate delay in different degrees  Example: multimedia application need minimum delay, but in case of file transfer or email it is less important  Jitter  Is a variation in delay for packets belonging to same flow.  Audio and Video cannot tolerate high jitter  No effect for file or mail transfer  Bandwdth  Different application needs different BW  In video transmission we need million of bits to refresh a color screen  While total no of bits in an email may not reach even a million
  • 170. Computer Networking / Module III/ AKN / 170 Techniques to Improve QoS  Common methods are scheduling, traffic shaping, admission control,and resource reservation  Scheduling (FIFO, priority and weighted fair queuing)  When packets from different flows arrive at a router, It is needed to treat the different flows in a fair and appropriate manner. Some techniques are as follows  FIFO Queuing with tail drop  In this queuing, packets wait in a buffer until the node is ready to process them  If average arrival rate is higher than the average processing rate, the queue will fill up and new packets will be discarded without regard to which flow the packet belongs to or how important the packets is?  It is simplest and most widely used in Internet routers
  • 171. Computer Networking / Module III/ AKN / 171 Scheduling Techniques contd.  Priority Queuing  Each packet is marked with a priority class  The router implements multiple FIFO queues, one for each priority class  It processes packets of higher priority first and moves on to the next priority if the higher priority one is empty  If there is a continuous flow in a high priority queue, then this will create a starvation problem in others  Therefore this should be optimized to put hard limits on how much high priority traffic can be inserted in the queue  These scheduling is used in Internet to protect most important packets like routing updates
  • 172. Computer Networking / Module III/ AKN / 172 Scheduling Techniques  Weighted fair Queuing  The packets are still assigned to different classes before inserting to the queues  The router than serves queues in around-robin fashion according to the weight of the queue  i.e. for above example: 3 pkts from first, two from 2nd and one from 3rd queue
  • 173. Computer Networking / Module III/ AKN / 173 Traffic shaping  Is a mechanism to control the amount and the rate of the traffic sent to the network.  Two techniques used 1. Leaky Bucket, 2. Token Bucket  Leaky Bucket  The idea is to have a constant bit rate traffic in the network in spite of bursty data coming from source.  i.e. if a bucket has a small hole at the bottom, the water leaks from the bucket at a constant rate and is independent of the rate of input to the bucket
  • 174. Computer Networking / Module III/ AKN / 174 Leaky bucket implementation  When the packets are of same fixed size then one packet can be pushed to network per clock tick  If packets are of variable size than more packets per tick may be allowed.  i.e. if rule is 1024 bytes per tick then one 1024 byte packet is allowed per tick, two 512 bytes per tick and four 256 byte packets per tick and so on  Algorithm  for each clock tick{ 1. Initialize a byte counter to n 2. while n  size of the packet 3. send the packet and decrement the counter by the packet size. 4. Stop the transmission till next tick }  Where n is max number of bytes allowed per tick
  • 175. Computer Networking / Module III/ AKN / 175 Leaky bucket contd.  A leaky bucket algorithms shapes bursty traffic into fixed-rate traffic by averaging the data rate. The packets will be dropped if the buffer is full  This algorithm prevents congestion by avoiding instantaneous heavy traffic at the output line  The buffer capacity should be carefully designed s.t. it should be able to store the bursty data for short period of time, otherwise packets will be dropped  Example:  data comes at a rate 25 Mbps, one 40ms burst every second. Design the leaky bucket  Solution:  total data per sec = 25Mbps * 40 *10-3 = 1Mb  Thus capacity of buffer can be chosen as 1Mb  Uniform output rate may be chosen as 2Mbps, s.t. it will take 500ms to drain the complete data
  • 176. Computer Networking / Module III/ AKN / 176 Token Bucket  The leaky bucket is restrictive. i.e. if a host is idle then bucket becomes empty, if the host has bursty data then bucket allows only an average rate.  But the token bucket algorithm allows idle hosts to accumulate credit for the future in form of tokens  Algorithm:  token bucket holds tokens generated by a clock at the rate of one token per T sec or n tokens per sec  It consumes one token per packet sent  i.e. to send a packet there should be a token available in the bucket
  • 177. Computer Networking / Module III/ AKN / 177 Token Bucket contd.  Leaky bucket and Token Bucket provides different kind of traffic shaping  The Leaky bucket algorithm does not allow idle hosts to save up permission to send large bursts later  But the token bucket algorithm does allow saving, up to the max size of bucket. i.e. bursts upto the size of bucket can be sent at once  The token bucket algorithm throws away tokens when the bucket fills up but never discard packets.  But the Leaky bucket discards packets when bucket fills up  One variation to Token bucket  Each token represent the right to send k bytes in place of one packet.  A packet can only be sent if enough tokens are available to cover length in bytes. Fractional tokens are kept for future use
  • 178. Computer Networking / Module III/ AKN / 178 Quality of Service (QoS)  Two models have been proposed to provide Quality of Service in the Internet  Integrated Services (IntServ)  Is a flow based QoS model designed for IP. i.e. a user needs to create a flow, a kind of virtual circuit, from the source to destination and inform all routers about the resource requirement.  Differentiated Services (DiffServ)  Is a class based QoS model designed for IP. i.e. the applications, or hosts, define the type of service they need each time they send a packet.
  • 179. Computer Networking / Module III/ AKN / 179 Integrated services features  Signals  IP is a connection less protocol  To implement a flow based service a signaling protocol is used to run over IP that provides the signaling mechanism for making reservation  The protocol is named as Resource Reservation Protocol  Flow Specification  has two parts: Rspec and Tspec  Rspec(resource specification)  Defines the resource that the flow needs to reserve (buffer, bw etc.)  Tspec(Traffic specification)  Traffic characterization of the flow  Admission  After receiving flow specification the router decides to admit or deny the flow
  • 180. Computer Networking / Module III/ AKN / 180 Integrated services features  Two service classes are defined  Guaranteed Service Class  Designed for real time traffic that needs guaranteed minimum end-to-end delay. (multimedia)  end-to-end delay = sum of delays in routers + propagation delay + setup mechanism  Only delay in router can be guaranteed by router  The amount of end-to-end delay and the data rate must be defined by the application  Controlled-Load Service Class  Designed for applications that can accept some delays, but are sensitive to an overload network and to the danger of losing packets  Example application are file transfer, email etc.
  • 181. Computer Networking / Module III/ AKN / 181 Resource ReserVation Protocol (RSVP)  The resource reservation protocol is a signaling protocol to help IP create a flow and consequently make a resource reservation  The signaling system of RSVP is designed for multicasting to enable it to provide resource reservation for all kinds of traffic including multimedia, which often uses multicasting  In this case the receivers (not the sender) makes the reservation  It has several types of messages for above tasks. Two of them are used for resource reservation, i.e. Path message and Resv message
  • 182. Computer Networking / Module III/ AKN / 182 RSVP Path message  A Path message travels from the sender and reaches all the receivers (downstream) in multicast path  On the way path message stores the necessary information for the receivers.  A new message is created when the path diverges.
  • 183. Computer Networking / Module III/ AKN / 183 RSVP Recv message  Reservation merging  Resources are not reserved for each receiver in a flow.  Reservation is merged to larger of the two (or more) requests  As different qualities for multimedia is required by different receivers, thus different requirements for the same flow  Receiver sends a recv message, which travels towards sender (upstream) and makes a resource reservation on the routers that support RSVP  If a router does not support RSVP on the path, it routes packet using traditional delivery methods
  • 184. Computer Networking / Module III/ AKN / 184 Reservation Styles  When there are more than one flow, the router needs to make a reservation to accommodate all of them  RSVP defines three types of reservation styles  Wild card Filter: router creates a single reservation for all senders based on largest request. This is used when flow from different receivers do not occur at the same time  Fixed Filter: router creates a distinct reservation for each flow. It is used when there is a high probability that from different receivers occurs at the same time  Shared Explicit: creates a single reservation which can be shared by a set of flows
  • 185. Computer Networking / Module III/ AKN / 185 Differtiated services  Problems with integrated services  Scalability  This model requires that each router keep information for each flow, which is impractical as load on routers will increase  Service type limitation  It provides two services 1. Guaranteed and control load  Solutions  The routers do not have to store information about flows.  i.e. The applications, or hosts, define the type of service they need each time they send a packet  The per-flow service is changed to per class service.  The router routes the packet based on the class of service  This is called Differentiated services