Top Banner
COMPUTER NETWORKS (BCSE 3306) Lecture Notes Module III Ajit K Nayak [email protected] Department of Computer Science Engineering & Application
188

computer network Module 3

Nov 13, 2014

Download

Documents

shakti139
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: computer network Module 3

COMPUTER NETWORKS(BCSE 3306)

Lecture NotesModule III

Ajit K [email protected]

Department of Computer Science Engineering & Application

Page 2: computer network Module 3

Out Line of Module III

Network Layer, Network Layer ProtocolsTransport Layer, Congestion controlQuality of service

Computer Networking / Module III/ AKN / 2

Text: “Data Communications and Networking” Third Edition,Behrouz A Forcuzan, Tata Mc Graw-Hill.Chapter 19 - Chapter 23

Page 3: computer network Module 3

Computer Networking / Module III/ AKN / 3

Network LayerNetwork LayerLecture ILecture I

•• HostHost--toto--Host DeliveryHost Delivery•• Addressing Addressing •• Routing Routing

••Network Layer ProtocolsNetwork Layer Protocols•• IPV4IPV4•• ARPARP•• ICMPICMP

Page 4: computer network Module 3

Network Layer

Computer Networking / Module III/ AKN / 4

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

Page 5: computer network Module 3

Classful IP AddressesEach 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 networkThe total address space is 232=4,294,967,296. But all addresses are not usableIt is represented in dotted decimal notation

128.11.3.31

1000000 00001011 00000011 00011111Computer Networking / Module III/ AKN / 5

Page 6: computer network Module 3

Type of communication

Computer Networking / Module III/ AKN / 6

Unicast: one-to-one communication. i.e. One source sends to exactly one destination hostMulticast: one-to-a group. i.e. one sources sends to a predefined group of destination hosts simultaneouslyBroadcast: 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!

Page 7: computer network Module 3

Classes of IP addresses

Computer Networking / Module III/ AKN / 7

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

Page 8: computer network Module 3

IP Addresses

Computer Networking / Module III/ AKN / 8

Class AFirst octet defines the netid and first bit is fixedMax. no of network possible: 27-2=126All zero and all one values can not be used24 bits are used for hostidMax no of hosts 224-2=16,777,214 per network can be connected to a class A network

Class BFirst two octet define the netid and two left bits are fixed : 214-2=16,382 networks and216-2=65,534 hosts/network

Page 9: computer network Module 3

IP Addresses

Computer Networking / Module III/ AKN / 9

Class C: First three octet defines netid and three bits fixed

221-2=2,097,151 networks28-2=254 hosts/network

Class D: No net and host idsFirst four bits are fixed, remaining 24 bits define multicastaddresses?

Class E: No use

Page 10: computer network Module 3

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 AComputer Networking / Module III/ AKN / 10

Page 11: computer network Module 3

Network Address

Computer Networking / Module III/ AKN / 11

Find Network addresses of the following IP addresses24.32.3.29

190.234.211.21

200.23.31.6

Page 12: computer network Module 3

Special Addresses contd.

Computer Networking / Module III/ AKN / 12

Direct Broadcast AddressesUsed by a router to broadcast a message to all hosts of a networkIt 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

R221.45.71.255

Page 13: computer network Module 3

Special Addresses contd.

Computer Networking / Module III/ AKN / 13

Limited Broadcast AddressesUsed by a host to send a message to every other host in that networkIt can only be used as a destination address by specifying netid and hostid as all 1sRouter 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

RBlocked here

255.255.255.255

Page 14: computer network Module 3

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 serverIt is specified by all 0s. The destination is a limited broadcast addressIt 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

BBootstrap server

255.255.255.2550.0.0.0

221.45.71.1

Computer Networking / Module III/ AKN / 14

Page 15: computer network Module 3

Special Addresses contd.Loop Back Addresses

Used by a host to communicate with itself without a special network interfaceThis 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 / 15

Page 16: computer network Module 3

Private Network Addresses

Computer Networking / Module III/ AKN / 16

These IPs should not be used in internet but one can use for hosts that do not require direct access to the InternetThese addresses are filtered by Internet routers and therefore do not have to be globally unique10.0.0.0 – 10.255.255.255172.16.0.0 – 172.31.255.255192.168.0.0 – 192.168.255.255Automatic Private IP Addressing

Used by windows machine, if there is no DHCP available169.254.0.0 – 169.254.255.255

Rfcs: 1466, 1918, 1597, 3927 etc.

Page 17: computer network Module 3

MaskingTo reach at a host we have two level of hierarchy1. Reach at destination network 2. Reach at host

Masking is a process that extracts the address of physical network from an IP addressMask 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 performed10001101 00001110 00000010 0001010111111111 11111111 00000000 00000000

141 14 0 0

Mask

Computer Networking / Module III/ AKN / 17

Page 18: computer network Module 3

Problems with classful

Computer Networking / Module III/ AKN / 18

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.

Page 19: computer network Module 3

Subnetting

Computer Networking / Module III/ AKN / 19

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 netidsWhen 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)

Page 20: computer network Module 3

Subnetting an Example

Computer Networking / Module III/ AKN / 20

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

Page 21: computer network Module 3

Subnetting

Computer Networking / Module III/ AKN / 21

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. hostidDelivery of packets now involve three steps1. Delivery to the network2. Delivery to the subnet3. Delivery to the host

Page 22: computer network Module 3

Example 1

Computer Networking / Module III/ AKN / 22

Q. Design 8 subnets from 211.77.20.0Ans. Taking 3 bits for subnet in last byte, remaining 5 bits are used for hostid

Page 23: computer network Module 3

Example 1 contd.

Computer Networking / Module III/ AKN / 23

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

Page 24: computer network Module 3

Example 2

Computer Networking / Module III/ AKN / 24

The network address is x.y.z.0, subnet mask is 255.255.255.248 then design the subnetsFrom mask it is clear that first five bits of last byte is used as subnetid and last three bits are used as hostidsi.e. 25=32 subnets and 23-2=6 hosts/subnetsSubnet #0: x.y.z.0, x.y.z.1, . . ., x.y.z.6, x.y.z.7Subnet #1: x.y.z.9, x.y.z.10, . . ., x.y.z.14, x.y.z.15Subnet #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.239Subnet #30: x.y.z.240, x.y.z.241, . . ., x.y.z.246, x.y.z.247Subnet #31: x.y.z.248, x.y.z.249, . . ., x.y.z.254, x.y.z.255First column is used as subnet id, last column is used as broadcast address.

Page 25: computer network Module 3

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

Page 26: computer network Module 3

Problems with IP AddressingIf 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 AuthoritiesIANA: Internet Assigned Number Authority upto 1998ICANN: Internet Corporation for Assigned Names and Numbers

R A B

Network 1

Network 2

I2I2 I3

I5I4

If link I3 fails than A cannot send to B

Computer Networking / Module III/ AKN / 26

Page 27: computer network Module 3

Dynamic Address configuration

Computer Networking / Module III/ AKN / 27

Each computer that is connected to Internet must have following information

Its IP addressSubnet maskRouter/gateway’s IP addressName 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 neededDHCP 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)

Page 28: computer network Module 3

Dynamic Host Configuration ProtocolTRANSITION 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 stateRemains in this state till it gets the DHCPACK, which creates a binding of

physical and logical address

Initializing stateClient broadcasts a DHCPDISCOVER message

Selecting state

Computer Networking / Module III/ AKN / 28

Page 29: computer network Module 3

DHCP contd.

Computer Networking / Module III/ AKN / 29

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 stateIf 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 stateIt 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

Page 30: computer network Module 3

Network Address TranslationHome users and small business can be connected to Internet via an ADSL or cable modem and every body needs one or more IP addressesDue 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 translationComputer Networking / Module III/ AKN / 30

Page 31: computer network Module 3

NAT contd.

Computer Networking / Module III/ AKN / 31

Address translationAll 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

ExternalAddress

1400 25.8.3.225.8.3.2

...1401

...

External Port

TransportProtocol

172.18.3.1 80 TCP172.18.3.2 80 TCP

... ... ...

Page 32: computer network Module 3

Routing techniquesUsually routing uses an Internet routing table on each machine that stores information about possible destinations and how to reach them Next Hop Routing

network10.0.0.0

network20.0.0.0

network30.0.0.0

network40.0.0.0

Q R

SDest Next hop10.0.0.0 20.0.0.520.0.0.0 Direct30.0.0.0 Direct40.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 / 32

Page 33: computer network Module 3

Network-Specific RoutingInstead of one entry for each destination host, we maintain one entry for total network

Computer Networking / Module III/ AKN / 33

Page 34: computer network Module 3

Host-Specific RoutingHost-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.

Computer Networking / Module III/ AKN / 34

Net1

Net2 Net3

R

P

Q

A

B

Destination Next hopB RNet2 QNet3 R

Table for host A

Page 35: computer network Module 3

Default Routing

Computer Networking / Module III/ AKN / 35

Default RoutesIn 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 routerIt is useful when the network has a small set of local addresses and only one connection to the rest of internet

Rest ofInternet

network10.0.0.0

network20.0.0.0Q

SDestination Next hop20.0.0.0 QDefault S

• Routing table for a host on network 10.0.0.0

Page 36: computer network Module 3

Static versus Dynamic Routing Tables

Computer Networking / Module III/ AKN / 36

Routing tables may be constructed statically or dynamically. The success of routing depends on the consistency of routing table informationStatic 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 tableUpdated periodically using the dynamic routing protocols like RIP, OSPF, or BGP etc.Dynamic routing is preferred over static routing as theupdation of routing table is done dynamically thus providing a consistent routing mechanism.

Page 37: computer network Module 3

Hierarchical Routing

Computer Networking / Module III/ AKN / 37

It is not possible to keep information about each host and or each network in the routing table of each Internet routerTo solve this problem we maintain hierarchical routing. According to this technique the we maintain partial information in routerse.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 InternetThere is only one entry needed for this ISPThe router inside ISP recognizes the sub-blocks and routes the packets to the destinationTo reduce the size of table further the hierarchical routing maybe included. i.e. The routers of ISPs outside Europe will have only one entry for packets to Europe in their routing tables.

Page 38: computer network Module 3

Internet Protocol (IPV4:RFC-791)

Computer Networking / Module III/ AKN / 38

Connection less delivery systemInternet 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 packetsi.e. the internet does not discard packets always. Unreliability arises only when resources are exhausted or underlying networks fail.

Page 39: computer network Module 3

Internet Protocol (contd.)

Computer Networking / Module III/ AKN / 39

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 dataIt performs routing function, choosing the path over which the data will be sentIt 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.

Page 40: computer network Module 3

Internet Protocol Datagram Format

Ver Total lengthFragment offsetIdentification

Source IPDestination IP

IP Options if anyData

. . .

Service TypeHLenFlag

TTL Protocol Header checksum

Padding

0 4 8 16 19 24 31

Computer Networking / Module III/ AKN / 40

Page 41: computer network Module 3

IP HeaderVer: 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 congestionTOS 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 meaningIf 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 unused0 6 7

Computer Networking / Module III/ AKN / 41

Page 42: computer network Module 3

IP Header (contd.)

Computer Networking / Module III/ AKN / 42

The 64 code point values maps to an underlying service definition and is divided into three groupsPool Codepoint Assigned by1 xxxxx0 Standards Organization(IETF)2 xxxx11 Local or Experimental3 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 3Total Length: defines total length of the datagram in bytes. i.e. 216-1=65,535 bytes max. including header

Page 43: computer network Module 3

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 datagramFlags:

3 bit field, D:do not fragment M: more fragment

U D M

Computer Networking / Module III/ AKN / 43

Page 44: computer network Module 3

IP Header (contd.)

Computer Networking / Module III/ AKN / 44

D=1: datagram must not be fragmentedD=0: datagram can be fragmentedM=1: It is not the last fragmentM=0: It is the last or only fragmentFragmentation 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

Page 45: computer network Module 3

IP Header (contd.)

Computer Networking / Module III/ AKN / 45

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 sourceBut 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 limitrather than an estimate of delay. Each router only decrements the value by one till it becomes zero.

Page 46: computer network Module 3

IP Header (contd.)

Computer Networking / Module III/ AKN / 46

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 eachAll sections are added using ones complement methodThe final result is complemented to make checksumFollow the same method at receiver. If the result is zero accept else discard the datagram

Page 47: computer network Module 3

IP Header OptionsIP 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 debuggingFormat

Code:It contains copy(1), class(2), and number(5)Copy = 1: options should be copied to all fragmentCopy = 0: options must be only copied to first fragment

Code(8) Length(8) Data (variable length)

Copy Class Number

Computer Networking / Module III/ AKN / 47

Page 48: computer network Module 3

Options field of IP Datagram

Computer Networking / Module III/ AKN / 48

Class00 : used for datagram control, 01: reserved10: Debugging and management, 11: reserved

NumberDefines the type of options

LengthIt defines the total length of the option including the code field and the length field itself

DataContains the data that specific options require

Page 49: computer network Module 3

Types of Options

Computer Networking / Module III/ AKN / 49

0 : End of option, used if options do not end at end of header1: 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

OptionsData

07-byte opt8-byte opt

1

Code Length PointerFirst IP Address (empty)

Second IP Address (empty)Third IP Address (empty)

Page 50: computer network Module 3

Types of Options

Computer Networking / Module III/ AKN / 50

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

Page 51: computer network Module 3

Types of Options

Computer Networking / Module III/ AKN / 51

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 networkIt is only useful when the network topology is known

Page 52: computer network Module 3

Types of Options

Computer Networking / Module III/ AKN / 52

3: Loose source route, It is similar to strict source but allows multiple network hops between successive address in the listBoth 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 PointerFirst IP AddressFirst Timestamp

. . .

OFlow Flags

Page 53: computer network Module 3

Types of Options

Computer Networking / Module III/ AKN / 53

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 smallFlag(4), controls the exact format of the option and tells how routers should supply timestamps.

0: Record timestamps only, omit IP addresses1: Precede each timestamp by an IP address3: 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

Page 54: computer network Module 3

Routing IP Datagrams

Computer Networking / Module III/ AKN / 54

Routing is the process of choosing a path over which to send packets, and router refers to a computer making the choiceThe goal of IP is to provide a virtual network that encompasses multiple physical network and offers a connection less datagram delivery serviceRouting is divided into two forms1. Direct delivery: Transmission of a datagram from one computer across a single physical network directly to another2. 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

Page 55: computer network Module 3

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 / 55

Page 56: computer network Module 3

Indirect DeliveryIt 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

Computer Networking / Module III/ AKN / 56

• How can a host know which router to use for a given destination?• How can a router know where to send datagrams?

Page 57: computer network Module 3

Mapping Internet Address to Physical Address

Computer Networking / Module III/ AKN / 57

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 softwareBut at physical level devices are recognized by their physical addressesTherefore, the packet to be sent from A to B should be mapped to the physical address of BAddress 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

Page 58: computer network Module 3

Mapping Internet Address Physical Address

Computer Networking / Module III/ AKN / 58

Last hop addressingPacket’s internet address is mapped to the final destinations physical address

Intermediate addressingAt any point along the path packet is mapped to intermediate routers physical address (as destination)

Address resolution problemThe 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 mapping2. Resolution through Dynamic binding

Page 59: computer network Module 3

Mapping Internet Address Physical Address

Computer Networking / Module III/ AKN / 59

Resolution through Direct MappingIn 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 simpleAnother way is to keep a table containing address pairs (logical, physical) and a hash function may be used to search that tableAnother 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 interfaceAlso new computers can be added to the network without changing the existing assignments.

Page 60: computer network Module 3

Mapping Internet Address Physical Address

Computer Networking / Module III/ AKN / 60

Resolution through dynamic bindingIn Ethernet technology the 48 bit physical address is assigned when manufacturedThus 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 caseTo 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

Page 61: computer network Module 3

Resolution through dynamic Binding

Computer Networking / Module III/ AKN / 61

IdeaSender broadcasts a special packet that asks the destination about its physical addressDestination recognizes the packet and sends a reply containing its physical addressNow the sender uses physical address to send packets directly to destination

A B C D

A B C D

A B C D

Page 62: computer network Module 3

ARP Packet Format (RFC-826)Hardware Type Protocol Type

OperationH/W length Protocol lengthSender Hardware AddressSender Protocol AddressTarget Hardware AddressTarget Protocol Address

Computer Networking / Module III/ AKN / 62

H/W Type: 16 bit field defines type of LAN e.g. Ethernet=1Protocol Type: 16 bit field defining IP version e.g. IPV4=0080016

Hlen: 8 bit, length of hardware address e.g. Ethernet = 6Plen : 16 bit, length of logical addressOperation : 8 bit, request=1, reply 2

Page 63: computer network Module 3

Address Resolution ProtocolEncapsulation

ARP packet is encapsulated directly in to a datalink frame

RefinementsIf 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 / 63

Page 64: computer network Module 3

ARP Implementation

Computer Networking / Module III/ AKN / 64

ARP CacheAfter receiving an ARP reply, it saves the IP address and corresponding hardware address in its cache for successive lookupsBut problem occurs if receiver crashes in between and source gets no information but keep on sendingTo resolve above problem a timer is used, when it expires the information in the cache is erased and normal procedure starts againAnother refinement possible is, senders IP-Physical address binding can also be updated in receivers cache before processing the ARP request

Page 65: computer network Module 3

Four cases using ARP

Computer Networking / Module III/ AKN / 65

Page 66: computer network Module 3

Limitations with IP

Computer Networking / Module III/ AKN / 66

A datagram travels from router to router till it reaches one that can deliver directly to its final destinationIf 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. andIP fails to deliver the datagram if

The destination is temporarily or permanently disconnectedThe TTL expiresThe intermediate routers become so congested that they cannot process the incoming traffic

Page 67: computer network Module 3

The Internet Control Message Protocol

Computer Networking / Module III/ AKN / 67

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”, ICMPICMP 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 machineICMP is not restricted only to routers but is allowed to be usedby any arbitrary machine to get some information.ICMP messages travel across internet in the data portion of IP datagrams

Page 68: computer network Module 3

Error Reporting / Error Correction

Computer Networking / Module III/ AKN / 68

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 errorIt cannot be used to inform intermediate routers about the problemAn 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 sourceAnd 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

Page 69: computer network Module 3

ICMP MessageMessage Delivery

It requires two levels of encapsulationHeader ICMP Data

Header Datagram Data

Header Frame Data

Computer Networking / Module III/ AKN / 69

– 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

Page 70: computer network Module 3

ICMP Message FormatType (8 bit) Code (8 bit) Checksum (16 bit)

Rest of HeaderData . . .

(Variable size)

Computer Networking / Module III/ AKN / 70

Type : identifies the message typeCode : provides further information about the message typeChecksum : error detectionICMP messages that report errors always include the header and first 64 bit data bits of the datagram causing the problem

Page 71: computer network Module 3

Computer Networking / Module III/ AKN / 71

ICMP Message Format (contd.)

The total table is available in page 133 of D.E. Comer

Type Message0 Echo Reply3 Destination unreachable4 Source Quench5 Redirect (change route)

8 Echo Request9 Router Advertisement10 Router solicitation11 Time Exceeded for a datagram12 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

Page 72: computer network Module 3

Echo Request and Reply Message Type(8 / 0) Code (0) Checksum

Data . . .

(optional)

Identifier Sequence no

Computer Networking / Module III/ AKN / 72

Optional Data is a variable length field that contains data to be returned to senderIdentifier 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)

Page 73: computer network Module 3

Reports of Unreachable DestinationsType-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 / 73

When a router cannot forward or deliver an IP datagram, it sendsa ‘destination unreachable’ message back to the original sourceThe 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.

Page 74: computer network Module 3

Congestion and Datagram flow controlType-4 Code -0 Checksum

IP header + first 8 byte of datagram dataUnused - all zeros

Computer Networking / Module III/ AKN / 74

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 discardedMake the source aware of congestion and to slow down

Page 75: computer network Module 3

Route change requestsType-5 Code (0-3) Checksum

IP header + first 8 byte of datagram dataRouter Internet Address

Computer Networking / Module III/ AKN / 75

Routers are assumed to know correct routes; hosts begin with minimal routing information and learn new routes from routersIf 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 accordinglyCode

0: redirection for the network 1 : redirection for the host

Page 76: computer network Module 3

Detecting Circular or long routes

Computer Networking / Module III/ AKN / 76

This message is generated in two casesCode 0: TTL exceededIf 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 sourceCode 1: Fragment reassembly time exceededIf 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 dataUnused

Page 77: computer network Module 3

Reporting Other ProblemsType-12 Code (0-1) Checksum

IP header + first 8 byte of datagram dataPointer Unused

Computer Networking / Module III/ AKN / 77

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 sourceCode 0: Error in header fields

Pointer field points to the byte with problemCode 1: Required part of option is missing

Pointer field not used in this case

Page 78: computer network Module 3

Clock Synchronization and Transit Time Estimation

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 / 78

‘Time Stamp message’ is used by two machines to determine the round trip time needed for an IP datagram to travel between themEach time the fields hold a no representing time measured in milliseconds from midnight in GMTCalculation:

Sending time = receive TS - Originate TSReceiving time = datagram return time - Trnsmit TSRound trip time = sending time + receiving time

Page 79: computer network Module 3

Obtaining a subnet mask

Computer Networking / Module III/ AKN / 79

‘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 DiscoveryType(9) Code -0 Checksum

Router Address 1 Nun addr Life time

Preference level 1 Router Address 2

Addr size

Preference level 2 . . .

Page 80: computer network Module 3

Router Solicitation/AdvertisementType(10) Code -0 Checksum

Identifier Sequence number

Computer Networking / Module III/ AKN / 80

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 itself2. 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)

Page 81: computer network Module 3

Computer Networking / Module III/ AKN / 81

Network Layer ProtocolsNetwork Layer ProtocolsLecture IILecture II

•• IPV6 IPV6 •• ICMPR6 ICMPR6 •• Unicast Unicast Routing protocolsRouting protocols

•• RIPRIP•• OSPFOSPF

Page 82: computer network Module 3

IPv6: Need for an alternative

Computer Networking / Module III/ AKN / 82

IPv4 has two level address structure (?) and categorized into 5 classes. The use of address space is inefficientThe internet must accommodate realtime audio and video transmission, which requires min delay and reservation of resourcesThe Internet must accommodate encryption and authentication of data for some applicationNot only the computers but various devices including house hold devices, hand held devices, telephones etc. needs IP address

Page 83: computer network Module 3

Characteristics of IPv6

Computer Networking / Module III/ AKN / 83

Larger Address Space: 128 bit longHuge increase in address space

Better header formatoptions are separated from base header

New optionsTo add new functionalities

Allowance for extensionTo support new technologies

Support for resource allocationTo support traffic such as real-time audio and video

Support for more securityEncryption and authentication mechanism

RFCs1365, 1550, 1678, . . .

Page 84: computer network Module 3

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)

Computer Networking / Module III/ AKN / 84

• 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

Page 85: computer network Module 3

Unicast AddressesDefines 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 / 85

Page 86: computer network Module 3

Unicast Addresses contd.

Computer Networking / Module III/ AKN / 86

Registry identifier: 5bit field indicates the agency that has registered the address.currently three registry has been defined.

INTERNIC: center for North AmericaRIPNIC: center for European registrationAPNIC: 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 fieldSubscriber identifier: a 24 bit is assigned to an organization subscribing to the Internet via providerSubnet identifier: a 32 bit is assigned to define a subnet underthe territory of a subscriberNode identifier: a 48 bit is assigned for the identity of the node connected to subnet

Page 87: computer network Module 3

Multicast addressesFirst 8 bits all 1sFlag: 4bit field that defines the group address as either permanent or transientScope: 4 bit field defines scope of the group addressGroup ID: 112 bits identifies group

Anycast addressesA packet destinated for anycast address is delivered to only one member of the anycast group. i.e. member having shortest routeNo block is assigned to for this anycast address

Computer Networking / Module III/ AKN / 87

Page 88: computer network Module 3

Reserved addressesStart with eight zeros

Computer Networking / Module III/ AKN / 88

Unspecified address is used when a host does not know its own addressLoopback address is used by a host to test itselfCompatible address is used during the transition from IPv4 to IPv6. i.e. when passing from IPv6 to IPv6 via IPv4 networkMapped address is also used during transition when sending from Ipv6 to IPv4 computer

Page 89: computer network Module 3

Local addressesUsed when an organization wants to use IPv6 without being connected to Internet

Computer Networking / Module III/ AKN / 89

Nobody outside the organization can send a message to the nodes using these addressesA link local address is used in an isolated subnetA site local address is used in an isolated site with several subnets

Page 90: computer network Module 3

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 / 90

Page 91: computer network Module 3

Base Header

Computer Networking / Module III/ AKN / 91

Version(4): version of IPPriority(4): priority of the packet w.r.t. congestionFlow level(3byte): special handling for a particular flow of dataPayload length(2 byte): total length of datagram excluding base headerNext header(8): either one of the optional extension headers used by IP or the header for an upper layer protocol like UDP, TCPHop Limit(8): same as TTLSource Address(16byte): IP of sourceSource Address(16byte): IP of destination

Page 92: computer network Module 3

Comparison between IPv4 and IPv6 packet headers

Computer Networking / Module III/ AKN / 92

Page 93: computer network Module 3

Extension header

Computer Networking / Module III/ AKN / 93

The base header can be followed by six extension headersHop-by-hop Option

Is used when the source needs to pass information to all routers visited by the datagram. Three options are definedPad1: 1 byte, designed for alignment purposesPadN: used when 2 or more bytes needed for alignmentJumbo payload: is used to define a payload longer than 65535 bytes

FragmentationOnly original source can fragment after using a path MTU discovery to get the smallest MTU supported by any network on the pathIf it will not use the technique then it must fragment a datagram to a size <= 576 bytes

Page 94: computer network Module 3

Extension header contd.

Computer Networking / Module III/ AKN / 94

AuthenticationIt validates sender, and ensures integrity of data

Encrypted Security PayloadIt provides confidentiality and guards against eavesdropping

Source RoutingUses the concept of strict/loose source routing

Destination OptionIs used when the source needs to pass information to the destination only. Intermediate routers are not permitted access too this information

Page 95: computer network Module 3

Comparison between IPv4 options and IPv6 extension headers

Computer Networking / Module III/ AKN / 95

Page 96: computer network Module 3

Transition from IPv4 to IPv6

Computer Networking / Module III/ AKN / 96

Because of huge systems using IPV4 that’s why three strategies were proposed for smooth transition

Dual stackA station should run both IPv4 and IPv6 simultaneously until all the Internet uses IPv6If DNS returns IPV4 address then source sends IPV4 packet else IPV6 packet

TunnelingWhen two computers using IPV6 want to communicate with each other and the the packet has to pass through a region that uses IPV4Therefore IPV6 packet is encapsulated in an IPV4 datagram when it enters that IPv4 region

Page 97: computer network Module 3

Transition from IPv4 to IPv6Header Translation

It is necessary when the majority of the Internet has moved to IPv6i.e. If sender uses IPv6 but receiver uses IPv4Header must be completely translatedIt uses mapped address of IPv6

Computer Networking / Module III/ AKN / 97

Page 98: computer network Module 3

Computer Networking / Module III/ AKN / 98

ICMPv6

Comparison of query messages in ICMPv4 and ICMPv6

Comparison of error-reporting messages in ICMPv4 and ICMPv6

Page 99: computer network Module 3

Unicast Routing Protocols

Computer Networking / Module III/ AKN / 99

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 routersRouters use routing table to decide about the best route based on a cost metricCost metric

Hop count: cost of passing through any network is same. i.e. passing through one network costs 1 hopMax throughput: throughput is more in passing through an fiber than in radio linkMin delay: delay is less in fiber than satellite linkReliability: some networks may be more reliable than others, it is decided based on a policy.

Various routing protocols available are RIP, OSPF etc.

Page 100: computer network Module 3

Routing Information Protocol

Computer Networking / Module III/ AKN / 100

It is based on Distance Vector routing, which uses Bellman-Ford algorithm for calculating the routing tableDistance Vector Routing

In this scheme, each router periodically (30 s) shares (broadcasts) its own routing information with its neighboursEvery 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

Page 101: computer network Module 3

RIP Updating

Computer Networking / Module III/ AKN / 101

Receive: a response RIP message1. 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.

Page 102: computer network Module 3

Example of updating a routing table

Computer Networking / Module III/ AKN / 102

Page 103: computer network Module 3

Computer Networking / Module III/ AKN / 103

Initial and Final routing tables in an example network

Page 104: computer network Module 3

Problems with RIP: Count-to-infinity

Computer Networking / Module III/ AKN / 104

Count to infiniteSuppose there is a network as shownEach router keeps the information about A initially as shownNow A goes down or link between A and B BrakesAt the first packet exchange B will not receive any message from ABut C tells B that it has a path to A of length 2B 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

Page 105: computer network Module 3

Open shortest path First (OSPF)

Computer Networking / Module III/ AKN / 105

It is based on link state routing that uses dijkstra’s algorithmLink state routing

In this scheme, each router shares the knowledge about its own neighbours to all other routers using floodingEach 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 algorithmThe topology is represented as a graph, where vertices are networks or routers and edges are links.A cost is associated with each link

Page 106: computer network Module 3

Link state Routing

Computer Networking / Module III/ AKN / 106

Learning about neighboursWhen router is booted, it sends a hello packet on each point-to-point lineThe router at the other end sends back a reply

Measuring Link costOne echo packet is sent and its time is recorded, other side sends the packet back immediately and the time of receiving is recorded againThe test is conducted several times and the average RTT is calculated for better result

Building the Link state packetsIdentity of sender, sequence #, age, a list of neighbours with their link costs

Page 107: computer network Module 3

Link state Knowledge

Computer Networking / Module III/ AKN / 107

Whole topology can be compiled from the partial knowledge of each node

Page 108: computer network Module 3

Formation of shortest path tree

Computer Networking / Module III/ AKN / 108

The dijkstra’s algorithm creates a single source shortest path tree given a graph(topology), each node is assigned a cumulative costfrom root to that node (called weight or total cost)

Page 109: computer network Module 3

Computer Networking / Module III/ AKN / 109

Transport LayerTransport LayerLecture IIILecture III

•• UserUser DatagramDatagram ProtocolProtocol•• Transmission Control protocolTransmission Control protocol•• Congestion Control and Quality of Congestion Control and Quality of servicesservices

Page 110: computer network Module 3

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 / 110

Page 111: computer network Module 3

Review

Computer Networking / Module III/ AKN / 111

Internet layer provides a host-to-host packet deliveryThe next problem is turn this service to process-to-process deliveryThe Transport layer supports communication between the end application programs, thus called end-to-end protocolThe underlying networks upon which the transport protocol operates has certain limitations like, it may

Drop messagesReorder MessagesDeliver duplicate copies of messagesLimit messages to some finite sizeDelivery messages after a long delay

Page 112: computer network Module 3

Review

Computer Networking / Module III/ AKN / 112

The operating system supports multiprogrammingBut 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 machineProcesses may be replaced without informing to the sendersWe 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.)

Page 113: computer network Module 3

Review

Computer Networking / Module III/ AKN / 113

Operating system provides two types of access to ports1. 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 accessPorts are buffered, so that data arrives before a process is ready to access will not be lostTo 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

Page 114: computer network Module 3

Types of data deliveries

Computer Networking / Module III/ AKN / 114

Page 115: computer network Module 3

Port Addressing

Computer Networking / Module III/ AKN / 115

At transport layer, port number is used to deliver a message to the correct process out of several processes running on destination hostPort 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 numbersThe 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 fixedIANA defines some ranges

Well-know ports: 0-1023 are assigned and controlled by IANA for some well-know server processesRegistered ports: 1024-49151 are not assigned or controlled by IANA, but can be used by processesDynamic ports: 49151-65535 are neither controlled nor registered, called ephemeral ports

Page 116: computer network Module 3

Other features

Computer Networking / Module III/ AKN / 116

Socket AddressThe IP address and port number pair defines the socket addressThe 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 demultiplexingAt 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 themAt the receiver side, the transport layer receives interleaved packets from network layer and passes to appropriate application after processing

Page 117: computer network Module 3

Other features contd.

Computer Networking / Module III/ AKN / 117

Connection-less vs connection-oriented serviceIn a connection less service, packets are sent from one party to another, without establishing the connectionIn case of connection oriented, a connection is established, data transferred, then connection is released

Reliable vs unreliableReliability is achieved by providing error and flow control at transport layer (data transmission)It becomes a slower and more complex serviceWhere as unreliable services are faster and simple to implement (real-time application)

Page 118: computer network Module 3

The User Datagram Protocol (UDP)

Computer Networking / Module III/ AKN / 118

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.

Page 119: computer network Module 3

The UDP message formatUDP Source Port

Data . . .

UDP Destination PortUDP message length UDP Checksum

Computer Networking / Module III/ AKN / 119

Port nos may vary from 0-65535, and source port is optional. These are used to demultiplex datagramsThe Length field contains a count of datagram in octets. Minimum length is 8Checksum is optional and zero is kept if not computedThe UDP checksum provides the only way to guarantee that data has arrived intact and should be used

Page 120: computer network Module 3

Checksum Calculation

Computer Networking / Module III/ AKN / 120

UDP uses the same checksum algorithm as IPBut UDP covers more information than is present in UDP datagram

It prepends a pseudo-header to the UDP datagramAppends an octets of zeros to pad the datagram to an exact multiple of 16 bitsAnd computes checksum over entire object

UDP pseudo-HeaderSource IP

Destination IPZero Protocol UDP Length

Page 121: computer network Module 3

Checksum Calculation (contd.)

Computer Networking / Module III/ AKN / 121

Checksum calculation at the Sender end.Add pseudo-header to the user datagramFill the checksum field with zerosDivide the total bits in to 16 bit wordsIf total bytes are not even, add one byte of all zerosAdd all 16-bit sections using one’s complement arithmeticComplement the result and insert the result in checksum fieldDrop the pseudo header and any padding usedDeliver the datagram

Checksum calculation at the Receiver end.Perform the operation same as aboveIf complement is zero drop pseudo-header and padding and accept the datagram. Otherwise discard the datagram

Page 122: computer network Module 3

Checksum Calculation (contd.)153.18.8.105171.2.14.10

Zero 17 151027 13

Computer Networking / Module III/ AKN / 122

AssignmentCalculate the checksum of the user datagram at sender side and also test it for the receiver side

U D P T15 0

E S T padding

Page 123: computer network Module 3

Checksum Calculation an example

Computer Networking / Module III/ AKN / 123

Page 124: computer network Module 3

Problem with Checksum Calculation

Computer Networking / Module III/ AKN / 124

Pseudo-header contains source and destination IP addresses

i.e. IP addresses must be known at UDP layerDestination 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 layersi.e. It is clearly a compromise of pure separation needed for practical reasons

Page 125: computer network Module 3

UDP Operation

Computer Networking / Module III/ AKN / 125

Connection less serviceEach 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 pathIt cannot send a stream of data, i.e. each request must be small enough to fit into one user datagram

Flow and error controlNo flow control hence no window mechanism. Receiver may overflowNo error control hence sender does not know if a message is lost or duplicated

Page 126: computer network Module 3

Multiplexing and DemultiplexingIn a host running a TCP/IP software, there is only one UDP but possibly several processes, that need to use services of UDP

Port1 Port2 Port3

UDP DeMultiplexer

IP

Port1 Port2 Port3

UDP Multiplexer

IP

• 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

Computer Networking / Module III/ AKN / 126

Page 127: computer network Module 3

Well known ports used for UDP

Computer Networking / Module III/ AKN / 127

Page 128: computer network Module 3

Use of UDP

Computer Networking / Module III/ AKN / 128

It is suitable for process that requires simple and fast request-response communication like DNSSuitable for process with internal flow and error control mechanism like tftpSuitable for multicastingUsed for management process such as SNMPUsed for route update protocols like RIP

Page 129: computer network Module 3

Reliable Stream Transport Service

Computer Networking / Module III/ AKN / 129

Stream OrientationData is converted into stream of bits, divided into octets at source machinesThe stream delivery service on the destination machine passes to the receiver exactly the same sequence of octets that the sender has passed.

Virtual Circuit ConnectionBefore 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

Page 130: computer network Module 3

Properties of Reliable Delivery Service

Computer Networking / Module III/ AKN / 130

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 actionTherefore, 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 TransferThe 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

Page 131: computer network Module 3

Properties of Reliable Delivery Service

Computer Networking / Module III/ AKN / 131

Unstructured StreamTCP/IP stream service doesn’t honour structured data streami.e. There is no way for a payroll application to have the stream service mark the boundaries between employee records

Full Duplex ConnectionConnections provided by TCP/IP stream service allow concurrent transfer on both directionsThe advantage is control information for one stream can be send back to the source in datagrams carrying data in the opposite direction

Page 132: computer network Module 3

Transmission Control Protocol

Computer Networking / Module III/ AKN / 132

Reliability+ve acknowledgement with retransmissionSender ReceiverPkt Recv Pkt

Send AckRecv 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

Page 133: computer network Module 3

END-to-END vs Point-to-Point

Computer Networking / Module III/ AKN / 133

1. TCP needs an explicit connection establishment s.t. two parties establish some shared state to enable the sliding window algorithm to begin2. 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.

Page 134: computer network Module 3

END-to-END issues

Computer Networking / Module III/ AKN / 134

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’

Page 135: computer network Module 3

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 process2. Sending process invokes push operation to effectively flush the buffer of unsent bytes3. 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 Recvbuffer

segment segment

Write bytes Read bytes

Computer Networking / Module III/ AKN / 135

Page 136: computer network Module 3

TCP Segment Header Format

Computer Networking / Module III/ AKN / 136

Sequence Number

HLenChecksumOptions (variable length)

Data

. . .

4 10 16 19 24 310Src Port Dst Port

Acknowledgementunused Flags Advertised window

Urgent pointerPadding

Page 137: computer network Module 3

TCP Header Format Explanation

Computer Networking / Module III/ AKN / 137

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 segmentAck field defines the octet number that is expected nextAdvertisedWindow contains the buffer space available at receiver

Sender ReceiverseqNum

Ack+advWin

Page 138: computer network Module 3

TCP Header Format Explanation

Computer Networking / Module III/ AKN / 138

Flags: 6 bits, when set it is understood as follows 5. SYN: Synchronize seq. nos during connection6. FIN: Terminate the connection 4. RESET: reset the connection3. PUSH: request for push1. URG: urgent pointer is valid2. ACK:

Urgent pointer specifies the position, where the urgent data ends.Options: TCP header can have 40 bytes of optional information

Page 139: computer network Module 3

TCP Header Options

Computer Networking / Module III/ AKN / 139

Max Seg Size(MSS): 4bytes determined at the time of connection establishmentWindow Scale factor:3bytes

Used to increase the window sizeNew window size=window size × 2scaleFactor

Largest value possible for scale factor is 16i.e. 216 × 216 = 232 max size of seq. number

Time Stamp: 10 bytesUsed to calculate round trip time

Page 140: computer network Module 3

Connection EstablishmentClient Server

SYN, seqNum=x

SYN+ACK seqNum=y

ACK=y+1

The algorithm used is called three-way-handshaking

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)

Computer Networking / Module III/ AKN / 140

Page 141: computer network Module 3

Connection Termination, four-way-handshaking Client Server

FIN, seqNum=x

ACK =x+1

ACK=y+1

FIN, seqNum=y

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

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)

Computer Networking / Module III/ AKN / 141

Page 142: computer network Module 3

Connection Resetting

Computer Networking / Module III/ AKN / 142

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 setOne TCP may want to abort the connection due to an abnormal situationThe TCP on one side may discover that the TCP on the other side has been idle for a long time

Page 143: computer network Module 3

TCP State Transition

Computer Networking / Module III/ AKN / 143

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 diagramNotations

The states are shown using ovalsTransition from one state to another is shown using directed linesEach line is contains two strings separated by slash. First string is input to TCP and second is outputDotted lines represent server and solid lines represent client

Page 144: computer network Module 3

State transition diagram

Computer Networking / Module III/ AKN / 144

Starts in CLOSED stateWhen receives an Active open request from client application, it sends a SYN segment to server and goes to SYN-SENT stateClient TCP receives a SYN+ACK segment from server TCP. It sends an ACK to server TCP and goes to ESTABLISHEDstateThis is the data transfer state. Client remains in this state till data transmission continues

Client Diagram

Page 145: computer network Module 3

State transition diagram contd.Client Diagram

Computer Networking / Module III/ AKN / 145

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 stateWhen the ACK is received from server TCP, it goes to FIN-WAIT-2 state. The connection is closed in one directionClient receives a FIN segment from server TCP and sends an ACK and goes to TIME-WAIT stateWhen 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 MSLThe 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

Page 146: computer network Module 3

State transition diagram contd.

Computer Networking / Module III/ AKN / 146

Server TCP starts with CLOSED stateIt receives a passive open request from the server application and goes to LISTEN stateIT now receives a SYN segment from the client TCP and sends a SYN+ACK segment to client TCP and goes to SYN-Rcvd stateIt then receives ACK from client TCP and goes to ESTABLISHEDstate. Data transfer occurs between client and server applicationsAfter data transmission it receives a FIN segment from client TCP, it now sends an ACK and goes to CLOSE-WAIT stateServer TCP receives a close request from server application program and sends a FIN segment to client TCP and goes to LAST-ACK stateWhen it receives the last ACK from client it goes to CLOSEDstate again

Server Diagram

Page 147: computer network Module 3

TCP’s Sliding Window

Computer Networking / Module III/ AKN / 147

1. It guarantees the reliable delivery of data,2. It ensures data is delivered in order and3. 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 bufferSending Application

TCPLastByteWritten

LastByteSent

Receiving ApplicationTCP

LastByteRead

LastByteRecvdNextByteExpectedLastByteAckdDirection of transmission

Page 148: computer network Module 3

Reliable and Ordered Delivery

Computer Networking / Module III/ AKN / 148

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 transmittedOn 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 itThe relations among send buffer pointers can be as follows

LastByteAckd ≤ LastByteSent andLastByteSent ≤ LastByteWritten

bytes to the left of LastByteAcked and bytes to the right of LastByteWritten need not be saved

Page 149: computer network Module 3

Reliable and Ordered Delivery

Computer Networking / Module III/ AKN / 149

Similarly at the receive bufferLastByteRead < NextByteExpected is true As a byte cannot be read by the application until it is receivedNextByteExpected ≤ LastByteRecvd + 1

i.e. if data has arrived in order, NextByteExpected points to the byte after LastByteRecvdif data has arrived out of order, NextByteExpected points to the start of the first gap in dataThe bytes to the left of LastByteRead need not be buffered because they have already been read by the local processbytes to the right of LastByteRecvd need not be buffered because they have not yet arrived.

Page 150: computer network Module 3

TCP Flow Control

Computer Networking / Module III/ AKN / 150

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 ofAdvertisedWindow = MaxrecvBuffer- ((NextByteExpected-1) -LastByteRead) i.e. the free space remaining in receive bufferNextByteExpected-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.

Page 151: computer network Module 3

TCP Flow Control

Computer Networking / Module III/ AKN / 151

If the receiving process falls behind, then advertise window shrinks and eventually goes to zeroOn the other hand sender end TCP ensures that

LastByteSent – LastByteAcked ≤ AdvertisedWindowi.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

LastByteAcked ≤ MaxSendBuffertries to write y bytes and (LastByteWritten – LastByteAcked) + itten – LastByteAcked) + y > MaxSendBuffer then TCP blocks

Page 152: computer network Module 3

TCP Flow Control

Computer Networking / Module III/ AKN / 152

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

Page 153: computer network Module 3

Adaptive Retransmission

Computer Networking / Module III/ AKN / 153

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 mechanismOriginal 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 asEstimatedRTT = α × EstimatedRTT + (1 - α) × SampleRTTα between 0.8 and 0.9 used to smooth the EstimatedRTT

Page 154: computer network Module 3

Adaptive RetransmissionThen TimeOut = 2 × EstimatedRTTProblems

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 figuresSolution?

Sam

pleR

TT

Sender ReceiverOriginal TransmissionRetransmission

ACK

Sender ReceiverOriginal Transmission

ACK

RetransmissionSa

mpl

eRTT

Original transmission RetransmissionComputer Networking / Module III/ AKN / 154

Page 155: computer network Module 3

Congestion Control

Computer Networking / Module III/ AKN / 155

Congestion is a situation which may occurs when the load on the network is greater than the capacity of the networki.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 conditionTherefore 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

Page 156: computer network Module 3

Traffic descriptors

Computer Networking / Module III/ AKN / 156

Average data rate = amount of data/total timePeak datarate= max datarate of the trafficMax. burst size= max length of time the traffic is generated at the peak rateEffective bandwidth= is a function of average datarate, peak data rate, and max. burst size

Page 157: computer network Module 3

Traffic ProfilesConstant-bit-rate traffic:

Datarate is constant throughout

Variable bit rate:The rate of data flow changes in time

Computer Networking / Module III/ AKN / 157

Bursty:The datarate changes suddenly in a

very short period of time. This type of traffic creates congestion in a network.

Page 158: computer network Module 3

Network performance

Computer Networking / Module III/ AKN / 158

Delay vs LoadWhen load is much less than the capacity of the network, the delay is at a minimumDelay composed of propagation delay and processing delay, which is negligible!When load reaches the network capacity, the delay increases sharply because waiting timeis added to the delay

Throughput vs LoadThroughput is the number of packets passing through the network in unit timewhen the load is below capacity, the throughput increases proportionally with loadWhen load reaches the network capacity, throughput declines sharply due to discarding of packets followed by retransmissions further makes things worse

Page 159: computer network Module 3

Computer Networking / Module III/ AKN / 159

Congestion ControlTwo categories of mechanisms for congestion control

Open Loop: congestion preventionClosed Loop: congestion removal

Open Loop: preventing congestionRetransmission policy

The retransmission policy and retransmission timers must be designed to optimize the efficiency and to prevent congestion

Window PolicyThe selective repeat is better than Go-Back-N policy for congestion control?

ACK PolicyIf ACK is not received, sender slows down, help prevent congestion

Discarding PolicySelective discarding of less sensitive packets when likelihood of congestion increases

Admission PolicyBefore admitting for a flow it checks the resources

Page 160: computer network Module 3

Computer Networking / Module III/ AKN / 160

Congestion Control: closed LoopClosed Loop: removal of congestion, if occurs

Back PressureRouter informs previous routers to slow down (recursive)

Choke PointRouter informs source to slow down by sending a special packet

Implicit SignalingSource predicts about congestion and slows down (like delay in getting ACK)

Explicit SignalingRouter sends an explicit signal by setting a bit in the packetBackward signaling:The bit can be set in a packet moving in the opposite direction. This bit warns the sender to slow downForward 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

Page 161: computer network Module 3

Computer Networking / Module III/ AKN / 161

Congestion Control TCPWhen 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 collapsei.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.

Page 162: computer network Module 3

Congestion Control TCP contd.

Computer Networking / Module III/ AKN / 162

The window size is decided not only by the receiver’s advertisement but also by congestion in the networkActual Window = Min(receiver’s window, Congestion window)Congestion avoidance

To avoid congestion we have two strategiesSlow start and additive increase till there is no congestionMultiplicative Decrease, if congestion occurs

Page 163: computer network Module 3

Congestion avoidance

Computer Networking / Module III/ AKN / 163

Slow startAt the beginning of a connection TCP sets the congestion window size = 1MSSFor 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 MSSACK for 2 segs -> congestion window size = 4 MSSACK for 4 segs -> congestion window size = 8 MSS . . . -> congestion window size = ½ advt. Window

Additive IncreaseAfter 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

Page 164: computer network Module 3

Congestion avoidance

Computer Networking / Module III/ AKN / 164

This strategy continues till it receives ACK before time-out or congestion window size = advt. Window size.

Multiplicative DecreaseThe 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-outIf congestion occurs than threshold value is set to ½ of congestion window and congestion window is set to 1MSS again

Page 165: computer network Module 3

Congestion control in frame relay

Computer Networking / Module III/ AKN / 165

Frame relay is designed for high throughput and low delay but congestion decreases throughput and increases delayFrame relay does not have flow control, but allows user to transmit bursty data that can cause congestionFor congestion avoidance, Frame relay protocol uses 2 bits the frame to warn the source and destination about the congestion.

Backward Explicit congestion Notification (BECN) bitForward Explicit congestion Notification (FECN) bit

Page 166: computer network Module 3

BECN bit

Computer Networking / Module III/ AKN / 166

It warns the sender about congestion in the network using two methods

Method 1: the switch uses response frames from the receiverMethod 2: the switch can use a predefined connection, DLCI=1023 to send special frames for this specific purposeSender responds by reducing data rate

Page 167: computer network Module 3

FECN bitUsed 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

Computer Networking / Module III/ AKN / 167

Four cases of congestion in Frame Relay

Page 168: computer network Module 3

Quality of Service (QoS)

Computer Networking / Module III/ AKN / 168

Is an assurance from the network for a particular kind of servicee.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 timelinessi.e. we need a new service model in which, application that need higher assurances can ask the network for thatA network that can provide these different level of services is said to support QoS.

Page 169: computer network Module 3

Flow characteristics

Computer Networking / Module III/ AKN / 169

ReliabilityLack of reliability means losing a packet or ACK, which may or may not needs retransmissionExample: Email, file transfer needs retransmissionAudio and video may not need retransmission

Delay (Source-to-destination delay)Application can tolerate delay in different degreesExample: multimedia application need minimum delay, but in case of file transfer or email it is less important

JitterIs a variation in delay for packets belonging to same flow.Audio and Video cannot tolerate high jitterNo effect for file or mail transfer

BandwdthDifferent application needs different BWIn 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

Page 170: computer network Module 3

Techniques to Improve QoS

Computer Networking / Module III/ AKN / 170

Common methods are scheduling, traffic shaping, admission control,and resource reservationScheduling (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 followsFIFO Queuing with tail drop

In this queuing, packets wait in a buffer until the node is ready to process themIf 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

Page 171: computer network Module 3

Scheduling Techniques contd.

Computer Networking / Module III/ AKN / 171

Priority QueuingEach packet is marked with a priority classThe router implements multiple FIFO queues, one for each priority classIt processes packets of higher priority first and moves on to the next priority if the higher priority one is emptyIf there is a continuous flow in a high priority queue, then this will create a starvation problem in othersTherefore this should be optimized to put hard limits on how much high priority traffic can be inserted in the queueThese scheduling is used in Internet to protect most important packets like routing updates

Page 172: computer network Module 3

Scheduling Techniques

Computer Networking / Module III/ AKN / 172

Weighted fair QueuingThe packets are still assigned to different classes before inserting to the queuesThe router than serves queues in around-robin fashion according to the weight of the queuei.e. for above example: 3 pkts from first, two from 2nd and one from 3rd queue

Page 173: computer network Module 3

Traffic shapingIs 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

Computer Networking / Module III/ AKN / 173

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

Page 174: computer network Module 3

Leaky bucket implementation

Computer Networking / Module III/ AKN / 174

When the packets are of same fixed size then one packet can be pushed to network per clock tickIf 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 isallowed per tick, two 512 bytes per tick and four 256 byte packets per tick and so onAlgorithm

for each clock tick{1. Initialize a byte counter to n 2. while n ≥ size of the packet3. 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

Page 175: computer network Module 3

Leaky bucket contd.

Computer Networking / Module III/ AKN / 175

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 fullThis algorithm prevents congestion by avoiding instantaneous heavy traffic at the output lineThe 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 droppedExample:

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 = 1MbThus capacity of buffer can be chosen as 1MbUniform output rate may be chosen as 2Mbps, s.t. it will take 500ms to drain the complete data

Page 176: computer network Module 3

Token Bucket

Computer Networking / Module III/ AKN / 176

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 tokensAlgorithm:

token bucket holds tokens generated by a clock at the rate of one token per ∆T sec or n tokens per secIt consumes one token per packet sent

i.e. to send a packet there should be a token available in the bucket

Page 177: computer network Module 3

Token Bucket contd.

Computer Networking / Module III/ AKN / 177

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 laterBut 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 onceThe 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 bucketEach 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

Page 178: computer network Module 3

Quality of Service (QoS)

Computer Networking / Module III/ AKN / 178

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.

Page 179: computer network Module 3

Integrated services features

Computer Networking / Module III/ AKN / 179

SignalsIP is a connection less protocolTo implement a flow based service a signaling protocol is used to run over IP that provides the signaling mechanism for making reservationThe protocol is named as Resource Reservation Protocol

Flow Specification has two parts: Rspec and TspecRspec(resource specification)

Defines the resource that the flow needs to reserve (buffer, bw etc.)Tspec(Traffic specification)

Traffic characterization of the flow

AdmissionAfter receiving flow specification the router decides to admit or deny the flow

Page 180: computer network Module 3

Integrated services features

Computer Networking / Module III/ AKN / 180

Two service classes are definedGuaranteed 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 mechanismOnly delay in router can be guaranteed by routerThe amount of end-to-end delay and the data rate must be defined by the application

Controlled-Load Service ClassDesigned for applications that can accept some delays, but are sensitive to an overload network and to the danger of losing packetsExample application are file transfer, email etc.

Page 181: computer network Module 3

Resource ReserVation Protocol (RSVP)

Computer Networking / Module III/ AKN / 181

The resource reservation protocol is a signaling protocol to help IP create a flow and consequently make a resource reservationThe 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 multicastingIn this case the receivers (not the sender) makes the reservationIt has several types of messages for above tasks. Two of them are used for resource reservation, i.e. Path message and Resv message

Page 182: computer network Module 3

RSVP Path messageA Path message travels from the sender and reaches all the receivers (downstream) in multicast pathOn 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 / 182

Page 183: computer network Module 3

RSVP Recv message

Computer Networking / Module III/ AKN / 183

Reservation mergingResources are not reserved for each receiver in a flow.Reservation is merged to larger of the two (or more) requestsAs 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 RSVPIf a router does not support RSVP on the path, it routes packet using traditional delivery methods

Page 184: computer network Module 3

Reservation Styles

Computer Networking / Module III/ AKN / 184

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 timeFixed 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 timeShared Explicit: creates a single reservation which can be shared by a set of flows

Page 185: computer network Module 3

Differtiated services

Computer Networking / Module III/ AKN / 185

Problems with integrated servicesScalability

This model requires that each router keep information for each flow, which is impractical as load on routers will increase

Service type limitationIt provides two services 1. Guaranteed and control load

SolutionsThe 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 packetThe per-flow service is changed to per class service. The router routes the packet based on the class of serviceThis is called Differentiated services

Page 186: computer network Module 3

Differentiated service features

Computer Networking / Module III/ AKN / 186

Each packet contains a field called DS field. The value of this field is set by the first router designated as the boundary router.contains two sub-fields:

Differentiated services code point: defines per hop behavior (PHB) and an unused fieldDE PHB(default PHB) same as TOS.EF PHB (expedited forwarding) provides following services like Low loss, Low latency, Ensured bandwidth.AF PHB (Assured forwarding) delivers the packet with a high assurance as long as the class traffic does not exceed the traffic profile of the node. The users of the network need to be aware that some packets may be discarded

Page 187: computer network Module 3

Traffic conditioner

Computer Networking / Module III/ AKN / 187

The DS node uses traffic conditioners likeMeters: checks to see if the incoming flow matches the negotiated traffic profileMarker: can remark a packet that is using best-effort delivery or down-mark a packet based on information received from the meter.Shaper: reshapes the traffic if not compliant with negotiated trafficDropper: discards a packet if flow severely violates the negotiated profile

Page 188: computer network Module 3

Computer Networking / Module III/ AKN / 188

END of module III

Thank You