Network Layer
Network Layer
The network layer services have been designed with the following
goals :
▶ The services should be independent of the router technology.
▶ The transport layer should be shielded from the number, type and
topology of the routers present.
▶ The network addresses made available to the transport layer
should use a uniform numbering plan, even across LANs and
WANs.
STORE-AND-FORWARD PACKET SWITCHING
5-4
ROUTING ALGORITHMS
The Optimality Principle
Shortest Path Routing
Flooding
Distance Vector Routing
Link State Routing
Hierarchical Routing
Broadcast Routing
Multicast Routing
Routing for Mobile Hosts
Routing in Ad Hoc Networks
ROUTING ALGORITHMS
• The main function of the network layer is routing packets from the source machine to
the destination machine. The algorithms that choose the routes and the data structures
that they use are a major area of the network layer design.
• The routing algorithm is that part of the network layer software responsible for
deciding which output line an incoming packet should be terminated on.
• If the subnet uses datagrams internally, this decision must be made a new for arriving
packets since the best route may have changed since last time.
ROUTING ALGORITHMS
• If the subnet uses virtual circuits internally, routing decision are made only when a
new virtual circuit is being set up.
• This case is sometimes called session routing because a route remains in force for an
entire user session.
ROUTING ALGORITHMS
• Routing algorithms can be grouped into two major classes : Non adaptive and
adaptive.
• Non adaptive algorithms do not base their routing decisions on measurements or
estimates of the current traffic and topology. This procedure is sometimes called
static routing.
Flooding is not commonly used for routing for the following reasons:
• Flooding leads to unbounded number of packets
• May lead to congestion in the network
• A number of copies of the same packet is delivered at the destination node
ROUTING ALGORITHMS
Define Autonomous Systems.
Distance vector algorithms (also known as Bellman-Ford algorithms) call for each router
to send all or some portion of its routing table, but only to its neighbors. In essence, link-
state algorithms send small updates everywhere, while distance vector algorithms send
larger updates only to neighboring routers. Distance vector algorithms know only about
their neighbors.
SHORTEST PATH ROUTING
A 0 1 1 1 1
� �
B 1 0 1
� � � �
C 1 1 0 1
� � �
D 1 0 1
� � � �
E 1 0
� � � � �
F 1 0 1
� � � �
G 1 1 0
�stored at�
Table : Initial distances �
each node(global view). �
We can represent each node's knowledge about the distances to all other nodes as a table
DISTANCE VECTOR ROUTING
Note that each node only knows the information in one row of the table.
1. Every node sends a message to its directly connected neighbors containing its
personal list of distance. ( for example, A sends its information to its
neighbors B,C,E, and F. )
2. If any of the recipients of the information from A find that A is advertising a path
shorter than the one they currently know about, they update their list to give the new
path length and note that they should send packets for that destination through A.
( node Blearns from A that node E can be reached at a cost of 1; B also knows it can
reach A at a cost of 1, so it adds these to get the cost of reaching E by means
of A. B records that it can reach E at a cost of 2 by going through A.)
DISTANCE VECTOR ROUTING
3. After every node has exchanged a few updates with its directly connected neighbors, all
nodes will know the least-cost path to all the other nodes.
4. In addition to updating their list of distances when they receive updates, the nodes need
to keep track of which node told them about the path that they used to calculate the
cost, so that they can create their forwarding table. ( for example, B knows that it was
A who said " I can reach E in one hop" and so B puts an entry in its table that says "
To reach E, use the link to A.)
DISTANCE VECTOR ROUTING
Information Distance to Reach Node
Stored at Node A B C D E F G
A 0 1 1 2 1 1 2
B 1 0 1 2 2 2 3
C 1 1 0 1 2 2 2
D
2
2 1 0 3 2 1
E 1 2 2 3 0 2 3
F 1 2 2 2 2 0 1
G
2
3 2 1 3 1 0
Table: final distances stored at each node ( global view).
DISTANCE VECTOR ROUTING
Table : shows the complete routing table maintained at node B for the network
DISTANCE VECTOR ROUTING
(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.
DISTANCE VECTOR ROUTING
Reliable Flooding is the process of making sure that all the nodes
participating in the routing protocol get a copy of the link-state
information from all the other nodes. As the term " flooding"
suggests, the basic idea is for a node to send its link-state
information out on all of its directly connected links, with each
node that receives this information forwarding it out on all of its
link. This process continues until the information has reached
all the nodes in the network.
LINK STATE ROUTING
A subnet in which the East and West parts are connected by two lines.
BUILDING LINK STATE PACKETS
(a) A subnet. (b) The link state packets for this subnet.
DISTRIBUTING THE LINK STATE
PACKETS
When hierarchical routing is used, the routers are divided into what
we call regions, with each router knowing all the details about
how to route packets to destinations with in own region, but
knowing nothing about the internal structure of other regions.
Hierarchical routing.
BROADCAST ROUTING
Reverse path forwarding. (a) A subnet. (b) a Sink tree. (c) The tree built by reverse
path forwarding.
BROADCAST ROUTING
•In some applications, hosts need to send messages to many or all other hosts.
•For example, a service distributing weather reports, stock market updates or live radio
programs.
•Sending a packet to all destinations simultaneously is called broadcasting.
•Various methods have been proposed for doing it :
BROADCAST ROUTING
•One broadcasting method that requires no special features from the subnet is for the
source to simply send a distinct packet to each destinations.
•Not only is the method wasteful of bandwidth, but it also requires the source to have a
complete list of all destinations.
•In practice this may be the only possibility, but it is the least desirable of the methods.
BROADCAST ROUTING
•Flooding is another method.
•Although Flooding is ill-suited for ordinary point-to-point communication, for
broadcasting it might rate serious consideration.
•The problem with flooding as a broadcast technique is the same problem it has a point-
to-point routing algorithms: it generates too many packets and consumes too much
bandwidth.
BROADCAST ROUTING
•A third algorithm is multi destination routing.
•If this method is used, 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 what will be needed.
•The router regenerates a new copy of the packet for each output line to be used and
includes in each packet only those destinations that are to use the line.
BROADCAST ROUTING
•Fourth broadcast algorithm makes explicit use of the sink tree for the router initiating the
broadcast- or any other convenient spanning tree for that matter.
•A spanning subtree is a subset of the subnet that includes all the routers but contains no
loops.
•If each router knows which of its lines belong to the spanning tree lines except the one
copy of an incoming broadcast packet onto all the spanning tree lines except the one is
arrived on.
•This method makes excellent use of bandwidth, generating the absolute minimum
number of packets necessary to do the job.
BROADCAST ROUTING
•Our last broadcast algorithm is an attempt to approximate the behavior of the previous
one.
•The idea is called, reverse path forwarding, is remarkably simple once it has been
pointed out..
•When a broadcast packet arrives at a router, the router checks to see if the packet arrived
on the line that is normally used for sending broadcast packets to the source of the
broadcast.
•If so, there is an excellent chance that the broadcast packet itself followed the best route
from the router and is therefore the first copy to arrive the router.
•This being the case, the router forwards copies of it onto all lines except the one it
arrived on.
MULTICAST ROUTING
1. Retransmission policy
2. Window Policy
3. Acknowledgment Policy
4. Discarding Policy
5. Admission Policy
CONGESTION CONTROL
Retransmission Policy
Discarding Policy
Admission Policy
Backpressure
Choke Packet
The congestion control in the choke packet scheme can be monitored in the
following manner : -
▶ Each link is monitored to estimate the level of utilization.
▶ If the utilization crosses a certain threshold limit, the link goes to a warning
state and a choke packet is send to the source.
▶ On receiving the choke packet, the source reduces the transmitting limit to a
certain level (say, by 50%).
▶ If still warning state persists, more choke packets are sent further reducing
the traffic. This continues until the link recovers from the warning state.
▶ If no further choke packet is received by the source within a time interval,
the traffic is increased gradually so that the system doesn’t go to congestion
state again.
CONGESTION CONTROL
Implicit Signaling
Explicit Signaling
▶ The node that experiences congestion can explicitly send a signal to the
source or destination.
▶ Explicit signaling is differ than choke packet –
Explicit Signaling
▶ Explicit Signaling can occur in either the forward or backward direction :-
Forward Signaling – A bit can be set in a packet moving in the direction of the
congestion. This bit can warn the destination that there is congestion.
Receiver can use ACK policies , slow down the ACK, to alleviate the
congestion.
CONGESTION PREVENTION
POLICIES
5-30
THE LEAKY BUCKET ALGORITHM
(a) A leaky bucket with water. (b) a leaky bucket with packets.
THE LEAKY BUCKET ALGORITHM
The following steps are performed:
▶ When the host has to send a packet, the packet is thrown into the
bucket.
▶ The bucket leaks at a constant rate, meaning the network
interface transmits packets at a constant rate.
▶ Bursty traffic is converted to a uniform traffic by the leaky
bucket.
▶ In practice the bucket is a finite queue that outputs at a finite rate.
THE LEAKY BUCKET ALGORITHM
5-34
▶ The token bucket algorithm is less restrictive than the leaky bucket
algorithm, in a sense that it allows bursty traffic.
(a) Host 3 requests a channel to host 1. (b) Host 3 then requests a second channel, to
host 2. (c) Host 5 requests a channel to host 1.
EXPEDITED FORWARDING
5-43
Note:
Note:
Solution
We replace each group of 8 bits with its equivalent decimal number (see Appendix
B) and add dots for separation:
a. 129.11.11.239
b. 249.155.251.15
Cont …
Change the following IP addresses from dotted-decimal notation to binary notation.
a. 111.56.45.78
b. 75.45.34.78
Solution
We replace each decimal number with its binary equivalent (see Appendix B):
Note:
Solution
See the procedure in Figure 19.11.
Solution
a. The first byte is 227 (between 224 and 239); the class is D.
b. The first byte is 252 (between 240 and 255); the class is E.
c. The first byte is 134 (between 128 and 191); the class is B.
Netid and hostid
Blocks in class A
Cont …
Note:
Note:
Note:
Note:
Solution
The class is A. Only the first byte defines the netid. We can find the
network address by replacing the hostid bytes (56.7.91) with 0s. Therefore,
the network address is 23.0.0.0.
Cont …
Given the address 132.6.17.85, find the network address.
Solution
The class is B. The first 2 bytes defines the netid. We can find the network
address by replacing the hostid bytes (17.85) with 0s. Therefore, the
network address is 132.6.0.0.
Cont …
Given the network address 17.0.0.0, find the class.
Solution
The class is A because the netid is only 1 byte.
Cont …
Note:
Network Layer
Protocols:
ARP, IPv4, ICMPv4,
IPv6, and ICMPv6
Protocols at network layer
AR
P
• Mappin
g
• Packet
Format
• Encapsulatio
n
• Operatio
n
ARP operation
ARP packet
Encapsulation of ARP packet
Four cases using ARP
Cont …
Note:
• Datagram
• Fragmentatio
n
IP datagram
IP datagram
HLEN (4 bits): Length of the header, expressed as the number of 32-bit words. Minimum
size is 5, and maximum 15.
Total Length (16 bits): Length in bytes of the datagram, including headers. Maximum
datagram size is (216) 65536 bytes.
Service Type (8 bits): Allows packet to be assigned a priority. Router can use this field to
route packets. Not universally used.
IP datagram
Time to Live (8 bits): Prevents a packet from traveling forever in a loop. Senders sets a
value, that is decremented at each hop. If it reaches zero, packet is discarded.
• Protocol: Defines the higher level protocol that uses the service of the IP layer
Steps:
Note:
•Identification: A16-bit field identifies a datagram originating from the source host.
• Flags: There are 3 bits, the first bit is reserved, the second bit is do not fragment bit,
and the last bit is more fragment bit.
• Fragmentation offset: This 13-bit field shows the relative position of the segment with
respect to the complete datagram measured in units of 8 bytes.
Fragmentation example
Fragmentation example, where a packet is fragmented into packets of 1600 bytes. So, the
offset of the second fragmented packet is 1600/8 = 200 and the offset of the third
fragmented packet is 400 and so on.
ICM
P
▶Introduction
▶ Messages
▶ Debugging Tools
▶ ICMP Package
ICM
P
▶To make efficient use of the network resources, IP was designed
to provide unreliable and connectionless best-effort datagram
delivery service. As a consequence, IP has no error-control
mechanism and also lacks mechanism for host and management
queries. A companion protocol known as Internet Control
Message Protocol (ICMP), has been designed to compensate
these two deficiencies.
ICM
P
▶ICMP encapsulation
ICM
P
ICMP
▶ICMP Messages
messages are divided into error-reporting messages and query
messages. The error-reporting messages report problems that a router or a
host (destination) may encounter. The query messages get specific
information from a router or another host.
ICM
P
▶ICMP Messages
ICM
P
ICMP messages
ICM
P
Message Format
Message Format
ICM
P
ERROR REPORTING
IP, as an unreliable protocol, is not concerned with error checking and error control.
ICMP was designed, in part, to compensate for this shortcoming. ICMP does not
correct errors, it simply reports them.
The source must slow down the sending of datagrams until the
congestion is relieved.
ICM
P
Source-quench format
When the final destination does not receive all of the fragments in a
set time, it discards the received fragments and sends a time-
exceeded message to the original source.
ICM
P
Time-exceeded message
code 0 is used only by routers to show that the value of the time-to-
live field is zero. Code 1 is used only by the destination host to
show that not all of the fragments have arrived within a set time.
ICM
P
Time-exceeded message format
ICM
P
Time-exceeded message format
ICM
P
Parameter-problem
ICMP can also diagnose some network problems through the query
messages, a group of four different pairs of messages. In this type of
ICMP message, a node sends a message that is answered in a
specific format by the destination node.
ICM
P
ICM
P
$ ping fhda.edu
We use the traceroute program to find the route from the computer
voyager.deanza.edu to the server fhda.edu. The following shows the result:
$ traceroute fhda.edu
To give an idea of how ICMP can handle the sending and receiving of ICMP
messages, an ICMP package made of two modules: an input module and an output
module.
ICMP
ICMP Package
IPv6 address
Abbreviated address
Abbreviated address with consecutive zeros
CIDR address
Format of an IPv6 datagram
IPV6
PROTOCOL
Comparison between IPv4 and IPv6 packet header
IPV6
PROTOCOL
Tunneling
Header translation