Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
Computer Network NCS-601
1 EDITED BY: PAWAN PANDEY
UNIT-3
3.1 NETWORK LAYER DESIGN ISSUES
3.1.1 Store-and-forward packet switching:
3.1.2 Connectionless Service – Datagrams
3.1.3 Connection-Oriented – Virtual Circuits
3.1.4 Comparison of Virtual-Circuits & Datagrams
3.2 ROUTING ALGORITHMS
3.2.1 The Optimality Principle
3.2.2 Shortest Path Algorithm
3.2.3 Flooding
3.2.4 Distance Vector Routing
3.2.5 Link State Routing
3.2.6 Hierarchical Routing
3.2.7 Broadcast Routing
3.2.8 Multicast Routing
3.2.9 Routing for Mobile Hosts
3.3 CONGESTION CONTROL
3.3.1 Congestion Control in Virtual Circuits
3.3.2 Congestion Control in Datagram Subnet
3.3.2.1 The warning bit
3.3.2.2 Choke Packet Technique
3.3.2.3 Hop-by Hop Choke Packets
3.3.2.4 Load shedding
3.3.2.3 Jitter Control
3.3.3 Quality of Service
3.3.4 Congestion Control Algorithms
3.3.4.1 Leaky Bucket
3.3.4.2 Token bucket
3.4 HEADER FORMATS: TCP, UDP, IPv4 & IPv6
3.5 IP ADDRESS CLASSES
Computer Network NCS-601
2 EDITED BY: PAWAN PANDEY
3.1 NETWORK LAYER DESIGN ISSUES:
Responsible for delivering packets between endpoints over multiple links. Network Layer is the
lowest layer in the OSI Reference Model that deals with end-to-end transmission. It provides
services to the Transport Layer.
a) The services should be independent of the router technology.
b) The transport layer should be shielded from the number, type, and topology of the
routers present.
c) The network addresses made available to the transport layer should use a uniform
numbering plan, even across LANs and WANs.
3.1.1 Store-and-forward packet switching:
Host H1 is directly connected to one of the ISP’s routers, A, perhaps as a home computer that is
plugged into a DSL modem. In contrast, H2 is on a LAN, which might be an office Ethernet,
with a router, F, owned and operated by the customer.
A host with a packet to send transmits it to the nearest router, either on its own LAN or over a
point-to-point link to the ISP. The packet is stored there until it has fully arrived and the link has
finished its processing by verifying the checksum. Then it is forwarded to the next router along
the path until it reaches the destination host, where it is delivered. This mechanism is store-and-
forward packet switching
Computer Network NCS-601
3 EDITED BY: PAWAN PANDEY
3.1.2 Connectionless Service – Datagrams: Different packets may take different paths
3.1.3 Connection-Oriented – Virtual Circuits: Virtual circuit (VC) is set up ahead of time
Computer Network NCS-601
4 EDITED BY: PAWAN PANDEY
3.1.4 Comparison of Virtual-Circuits & Datagrams:
3.2 ROUTING ALGORITHMS:
Routing algorithms can be grouped into two major classes: nonadaptive and adaptive.
Nonadaptive algorithms do not base their routing decisions on any measurements or estimates
of the current topology and traffic.
Adaptive algorithms, in contrast, change their routing decisions to reflect changes in the
topology, and sometimes changes in the traffic as well. These dynamic routing algorithms differ
in where they get their information (e.g., locally, from adjacent routers, or from all routers).
Certain properties are desirable in a routing algorithm: correctness, simplicity, robustness,
stability, fairness, and efficiency.
Computer Network NCS-601
5 EDITED BY: PAWAN PANDEY
Suppose that there is enough traffic between A and A′, between B and B′, and between C and C′
to saturate the horizontal links. To maximize the total flow, the X to X′ traffic should be shut off
altogether. Unfortunately, X and X′ may not see it that way. Evidently, some compromise
between global efficiency and fairness to individual connections is needed. This is called
tradeoff between fairness and efficiency.
3.2.1 The Optimality Principle:
Each portion of a best path is also a best path; the union of them to a router is a tree called the
sink tree
3.2.2 Shortest Path Algorithm
a) Dijkstra’s algorithm computes a sink tree on the graph
b) Each link is assigned a non-negative weight/distance
c) Shortest path is the one with lowest total weight
d) Using weights of 1 gives paths with fewest hops
Algorithm:
a) Start with sink, set distance at other nodes to infinity
b) Relax (i.e., evaluate) distance to adjacent nodes
c) Pick the lowest adjacent distance node, add it to sink tree
d) Repeat until all nodes are in the sink tree
Computer Network NCS-601
6 EDITED BY: PAWAN PANDEY
3.2.3 Flooding
A simple local technique is flooding, in which every incoming packet is sent out on every
outgoing line except the one it arrived on. Flooding obviously generates vast numbers of
duplicate packets, in fact, an infinite number unless some measures are taken to damp the
process. One such measure is to have a hop counter contained in the header of each packet that
is decremented at each hop, with the packet being discarded when the counter reaches zero.
Ideally, the hop counter should be initialized to the length of the path from source to destination.
If the sender does not know how long the path is, it can initialize the counter to the worst case,
namely, the full diameter of the network.
A variant of flooding called selective flooding partially addresses these issues by only sending
packets to routers in the same direction. In selective flooding the routers don't send every
incoming packet on every line but only on those lines which are going approximately in the right
direction.
Computer Network NCS-601
7 EDITED BY: PAWAN PANDEY
3.2.4 Distance Vector Routing
a) Distance Vector Routing uses the Bellman-Ford routing algorithm
b) Distance vector is a distributed routing algorithm
c) Shortest path computation is split across nodes (each router maintains its own routing
table giving the best known distance (and link to use) to every router in the network).
Algorithm:
a) Each node knows distance of links to its neighbors
b) Each node advertises vector of lowest known distances to all neighbors
c) Each node uses received vectors to update its own
d) Repeat periodically
The Count-to-Infinity Problem
Distance Vector (DV) algorithm has a convergence issue in that it can converge to a correct
routing map slowly because it reacts rapidly to good news but leisurely to bad news Failures can
cause DV to “count to infinity” while seeking a path to an unreachable node.
Computer Network NCS-601
8 EDITED BY: PAWAN PANDEY
3.2.5 Link State Routing
a) Discover its neighbors and learn their network addresses.
b) Set the distance or cost metric to each of its neighbors.
c) Construct a packet telling all it has just learned.
d) Send this packet to and receive packets from all other routers.
e) Compute the shortest path to every other router.
3.2.5.1 Learning about the Neighbors
When a router is booted, its first task is to learn who its neighbors are. It accomplishes this goal
by sending a special HELLO packet on each point-to-point line.
3.2.5.2 Setting Link Costs
The most direct way to determine this delay is to send over the line a special ECHO packet that
the other side is required to send back immediately. By measuring the round-trip time and
dividing it by two, the sending router can get a reasonable estimate of the delay
Computer Network NCS-601
9 EDITED BY: PAWAN PANDEY
3.2.5.3 Distributing the Link State Packets
3.2.5.4 Computing the New Routes
Once a router has accumulated a full set of link state packets, it can construct the entire network
graph because every link is represented. Every link is, in fact, represented twice, once for each
direction. The different directions may even have different costs. The shortest-path computations
may then find different paths from router A to B than from router B to A. Now Dijkstra’s
algorithm can be run locally to construct the shortest paths to all possible destinations. The
results of this algorithm tell the router which link to use to reach each destination. This
information is installed in the routing tables, and normal operation is resumed.
3.2.6 Hierarchical Routing
When hierarchical routing is used, the routers are divided into what we will call regions. Each
router knows all the details about how to route packets to destinations within its own region but
knows nothing about the internal structure of other regions. When different networks are
interconnected, it is natural to regard each one as a separate region to free the routers in one
network from having to know the topological structure of the other ones.
Computer Network NCS-601
10 EDITED BY: PAWAN PANDEY
3.2.7 Broadcast Routing
Sending a packet to all destinations simultaneously is called broadcasting. Several Methods of
Broadcast Routing are:
a) Multi destination routing, in which each packet contains either a list of destinations or a
bit map indicating the desired destinations. When a packet arrives at a router, the router
checks all the destinations to determine the set of output lines that will be needed.
b) Flooding: When implemented with a sequence number per source, flooding uses links
efficiently with a decision rule at routers that is relatively simple. Although flooding is
illsuited for ordinary point-to-point communication, it rates serious consideration for
broadcasting.
c) Reverse path forwarding: Sink tree
A spanning tree is a subset of the network that includes all the routers but contains no
loops. Sink trees are spanning trees. If each router knows which of its lines belong to the
spanning tree, it can copy an incoming broadcast packet onto all the spanning tree lines
except the one it arrived on. This method makes excellent use of bandwidth, generating
the absolute minimum number of packets necessary to do the job.
3.2.8 Multicast Routing:
Computer Network NCS-601
11 EDITED BY: PAWAN PANDEY
3.2.9 Routing for Mobile Hosts:
all hosts are assumed to have a permanent home location that never changes. Each hosts also has
a permanent home address that can be used to determine its home location, analogous to the way
the telephone number 1-212-5551212 indicates the United States (country code 1) and
Manhattan (212). The following registration messages are sent when a mobile host registers with
its home agent:
a) The mobile host sends a registration request to the foreign agent, containing its
permanent IP address, its home agent address, and a care-of address.
b) The foreign agent relays the request to the home agent.
c) The home agent grants or denies the service and sends a registration reply back to the
foreign agent.
d) The foreign agent relays the registration reply to the mobile host.
3.3 CONGESTION CONTROL
Problem: when too many packets are transmitted through a network, congestion occurs At very
high traffic, performance collapses completely, and almost no packets are delivered
Causes: bursty nature of traffic is the root cause. When part of the network no longer can cope a
sudden increase of traffic, congestion builds upon. Other factors, such as lack of bandwidth, ill-
configuration and slow routers can also bring up congestion
Solution: congestion control, and two basic approaches:
a) Open-loop: try to prevent congestion occurring by good design
b) Closed-loop: monitor the system to detect congestion, pass this information to
where action can be taken, and adjust system operation to correct the problem
(detect, feedback and correct)
Differences between congestion control and flow control:
Congestion control try to make sure subnet can carry
offered traffic, a global issue involving all the hosts and
routers. It can be open-loop based or involving feedback.
Flow control is related to point-to-point traffic between
given sender and receiver, it always involves direct
feedback from receiver to sender.
Computer Network NCS-601
12 EDITED BY: PAWAN PANDEY
Prevention: Different policies at various layers can affect congestion, and these are summarised
in the table
3.3.1 Congestion Control in Virtual Circuits:
These are closed-loop based designed for virtual circuits subnets, which are connection oriented
during connection set up, something can be done to help congestion control.
Admission control: Once congestion has been signaled, no more new virtual circuits can be set
up until the problem has gone away. This is crude but simple and easy to do.
Select alternative routes to avoid part of the network that is overloaded, i.e. temporarily rebuild
your view of network.
Computer Network NCS-601
13 EDITED BY: PAWAN PANDEY
3.3.2 Congestion Control in Datagram Subnet:
3.3.2.1 The warning bit
When a new packet is to be transmitted on the output line marked as warning state, a special bit
is added in header to signal this state. At the destination, this information is sent back with ACK
to the sender so that it could cut the traffic. When warning bit is absent, sender increases its
transmitting rate.
Note: It uses a whole trip (source → destination → source) to tell the source to slow down.
3.3.2.2 Choke Packet Technique
In this approach, the router sends a choke packet back to the source host. The original packet is
marked so that it would not generate any more choke packets further along the path and is then
forwarded in the usual way. When the source gets the choke packet, it is required to reduce the
traffic by X packets. The whole process is illustrated in figure.
It does not work well if the choke packet travels a long distance to reach the source because
reduction of flow starts from source node rather than intermediate node. This problem can be
solved by hop-by-hop approach.
3.3.2.3 Hop-by Hop Choke Packets
In this approach, unlike choke packet, reduction of flow starts from intermediate node rather
than source node. The net effect of hop-by-hop scheme is to provide quick relief at the point of
congestion at the price of using up more buffers upstream.
3.3.2.4 Load shedding
In load shedding approach, router just throw packet away. In other words, router starts dropping
packets. Now issue is-which packets to discard? Router may pick packets at random to drop or it
may depend on the application running. For example, for file transfer, an old packet is important
more than a new one and for multimedia application, a new packet is more important than an old
one.
Computer Network NCS-601
14 EDITED BY: PAWAN PANDEY
3.3.2.5 Jitter Control:
If you know what delay is, jitter is simply the difference in packet delay. In other words, jitter is
measuring time difference in packet inter-arrival time. Jitter should be minimized.
Computer Network NCS-601
15 EDITED BY: PAWAN PANDEY
3.3.3 Quality of Service:
The needs of each flow can be characterized by four primary parameters: bandwidth, delay,
jitter, and loss. Several common applications and the stringency of their network requirements
are listed in Figure:
3.3.4 Congestion Control Algorithms:
3.3.4.1 Leaky Bucket
a) Leaky bucket: consists of a finite queue.
b) When a packet arrives, if there is a room on the queue it is joined the queue; otherwise, it
is discarded.
c) At every (fixed) clock tick, one packet is transmitted unless the queue is empty.
d) It eliminates bursts completely: packets passed to the subnet at the same rate.
e) This may be a bit overdone, and also packets can get lost (when bucket is full)
Computer Network NCS-601
16 EDITED BY: PAWAN PANDEY
3.3.4.2 Token bucket
Tokens are added at a constant rate. For a packet to be transmitted, it must capture and destroy
one token.
a) shows that the bucket holds three tokens with five packets waiting to be transmitted.
b) shows that three packets have gotten through but the other two are stuck waiting for
tokens to be generated.
Computer Network NCS-601
17 EDITED BY: PAWAN PANDEY
3.4 HEADER FORMATS:
3.4.1 TCP
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Source Port Destination Port
Sequence Number
Acknowledgment Number
Data Offset reserved ECN Control Bits Window
Checksum Urgent Pointer
Options and padding :::
Data :::
ECN, Explicit Congestion Notification: 3 bits
00 01 02
N C E
Control Bits: 6 bits
00 01 02 03 04 05
U A P R S F
U, URG. 1 bit.
Urgent pointer valid flag.
A, ACK. 1 bit.
Acknowledgment number valid
flag.
P, PSH. 1 bit.
Push flag.
R, RST. 1 bit.
Reset connection flag.
S, SYN. 1 bit.
Synchronize sequence numbers
flag.
F, FIN. 1 bit.
End of data flag.
Computer Network NCS-601
18 EDITED BY: PAWAN PANDEY
EXAMPLE:
The following is a dump of a TCP header in hexadecimal format.
05320017 00000001 00000000 500207FF 00000000
a. What is the source port number?
b. What is the destination port number?
c. What is the sequence number?
d. What is the acknowledgment number?
e. What is the length of header?
f. What is the type of segment?
g. What is the window size?
a. Source port number = (0532)16 = 1330
b. What is the destination port number?
Destination port number = (0017)16 = 23
c. What the sequence number?
Sequence number = (00000001)16
d. What is the acknowledgment number?
Acknowledgement number = (00000000)16
e. What is the length of the header?
Length of the header = 5*4 = 20
f. What is the type of the segment?
It is a SYN segment.
g. What is the window size?
Windows size = (07FF)16
3.4.2 UDP
Computer Network NCS-601
19 EDITED BY: PAWAN PANDEY
3.4.3 IPv4
Version: The first header field in an IP packet is the four-bit version field. The Version field
indicates the format of the internet header.
Header length or Internet Header Length (IHL): The second field (4 bits) is the Internet
Header Length (IHL) telling the number of 32-bit words in the header.
Type of Service (ToS): now known as Differentiated Services Code Point (DSCP). The TOS
field is used to carry information to provide quality of service features.
Total Length: This 16-bit field defines the entire datagram size, including header and data, in
bytes.
Identification: This field is an identification field and is primarily used for uniquely identifying
fragments of an original IP datagram.
Flags: A three-bit field follows and is used to control or identify fragments. They are (in order,
from high order to low order):
bit 0: Reserved; must be zero.
bit 1: Don’t Fragment (DF)
bit 2: More Fragments (MF)
Don’t Fragment: Sets the Don’t Fragment bit in sent packets. When an IP datagram has its DF
flag set, intermediate devices are not allowed to fragment it so if it needs to travel across a
network with a MTU(Maximum Transmission Unit) smaller that datagram length the datagram
will have to be dropped.
Computer Network NCS-601
20 EDITED BY: PAWAN PANDEY
More Fragments: Sets the More Fragments bit in sent packets. The MF flag is set to indicate the
receiver that the current datagram is a fragment of some larger datagram.
Fragment Offset: The fragment offset field, measured in units of eight-byte blocks, is 13 bits
long and specifies the offset of a particular fragment relative to the beginning of the original un
fragmented IP datagram.
Time To Live (TTL): It is of 8 bit field. This field indicates the maximum time the datagram is
allowed to remain in the internet system.
Protocol: This field defines the protocol used in the data portion of the IP datagram. The Internet
Assigned Numbers Authority maintains a list of IP protocol numbers.
Header Checksum: The 16-bit checksum field is used for error-checking of the header.
Source address: Sets the source IP address. This option lets you specify a custom IP address to
be used as source IP address in sent packets.
Destination address: An IPv4 address indicating the receiver of the packet.
Options: Additional header fields may follow the destination address field, but these are not
often used.
3.4.4 IPv6
Computer Network NCS-601
21 EDITED BY: PAWAN PANDEY
Version (4-bits): It represents the version of Internet Protocol.
Traffic Class (8-bits): These 8 bits are divided into two parts. The most significant 6 bits are
used for Type of Service to let the Router Known what services should be provided to this
packet. The least significant 2 bits are used for Explicit Congestion Notification (ECN).
Flow Label (20-bits): This label is used to maintain the sequential flow of the packets
belonging to a communication. The source labels the sequence to help the router identify that a
particular packet belongs to a specific flow of information. This field helps avoid re-ordering of
data packets. It is designed for streaming/real-time media.
Payload Length (16-bits): This field is used to tell the routers how much information a
particular packet contains in its payload. Payload is composed of Extension Headers and Upper
Layer data. With 16 bits, up to 65535 bytes can be indicated; but if the Extension Headers
contain Hop-by-Hop Extension Header, then the payload may exceed 65535 bytes and this field
is set to 0.
Next Header (8-bits): This field is used to indicate either the type of Extension Header, or if the
Extension Header is not present then it indicates the Upper Layer PDU. The values for the type
of Upper Layer PDU are same as IPv4’s.
Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. This is
same as TTL in IPv4. The value of Hop Limit field is decremented by 1 as it passes a link
(router/hop). When the field reaches 0 the packet is discarded.
Source Address (128-bits): This field indicates the address of originator of the packet.
Destination Address (128-bits): This field provides the address of intended recipient of the
packet.
3.5 IP ADDRESS CLASSES:
The 32-bit IP address contains information about the host and its network. It is very necessary to
distinguish both. For this, routers use Subnet Mask, which is as long as the size of the network
address in the IP address. Subnet Mask is also 32 bits long. If the IP address in binary is ANDed
with its Subnet Mask, the result yields the Network address. For example, say the IP Address is
192.168.1.152 and the Subnet Mask is 255.255.255.0 then:
Computer Network NCS-601
22 EDITED BY: PAWAN PANDEY
The first octet referred here is the left most of all. The octets numbered as follows depicting
dotted decimal notation of IP Address:
The number of networks and the number of hosts per class can be derived by this formula:
3.5.1 Class A Address
The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges from 1 – 127,
i.e.
Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP range
127.x.x.x is reserved for loopback IP addresses.
The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class A
addressing can have 126 networks (27-2) and 16777214 hosts (2
24-2).
3.5.2 Class B Address
An IP address which belongs to class B has the first two bits in the first octet set to 10, i.e.
Computer Network NCS-601
23 EDITED BY: PAWAN PANDEY
Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class B
is 255.255.x.x. Class B has 16384 (214
) Network addresses and 65534 (216
-2) Host addresses.
3.5.3 Class C Address
The first octet of Class C IP address has its first 3 bits set to 110, that is:
Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for Class
C is 255.255.255.x. Class C gives 2097152 (221
) Network addresses and 254 (28-2) Host
addresses.
3.5.4 Class D Address
Very first four bits of the first octet in Class D IP addresses are set to 1110, giving a range of:
Class D has IP address rage from 224.0.0.0 to 239.255.255.255. Class D is reserved for
Multicasting. In multicasting data is not destined for a particular host, that is why there is no
need to extract host address from the IP address, and Class D does not have any subnet mask.
3.5.5 Class E Address
This IP Class is reserved for experimental purposes only for R&D or Study. IP addresses in this
class ranges from 240.0.0.0 to 255.255.255.254. Like Class D, this class too is not equipped
with any subnet mask.
Computer Network NCS-601
24 EDITED BY: PAWAN PANDEY
IP Class Default Subnet Network bits Host bits Total hosts Valid hosts
A 255.0.0.0 First 8 bits Last 24 bits 16, 777, 216 16, 777, 214
B 255.255.0.0 First 16 bits Last 16 bits 65,536 65,534
C 255.255.255.0 First 24 bits Last 8 bits 256 254
EXAMPLE:
An ISP is granted a block of addresses starting with 190.100.0.0/16.
The ISP needs to distribute these addresses to three groups of customers as follows:
1. The first group has 64 customers; each needs 256 addresses.
2. The second group has 128 customers; each needs 128 addresses.
3. The third group has 128 customers; each needs 64 addresses.
Design the subblocks and give the slash notation for each subblock. Find out how m any
addresses are still available after these allocations.
Computer Network NCS-601
25 EDITED BY: PAWAN PANDEY