Unit 2 Network Layer
Unit 2 Network Layer
fig 5-1
Store-and-Forward Packet
Switching
• 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 carrier.
• The packet is stored there until it has fully
arrived so the checksum can be verified. 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, as we have seen in previous
chapters.
Services Provided to the Transport
Layer
• The service should be independent of the
router technology.
5-4
Routing Algorithms
• Adaptive Algorithms
Change routes dynamically
Gather information at runtime
locally
from adjacent routers
from all other routers
Change routes
Every delta T seconds
When load changes
When topology changes
Shortest Path Routing
(a nonadaptive routing algorithm)
• Each node is labeled (in parentheses) with its distance from the
source node along the best-known path.
• Initially, no paths are known, so all nodes are labeled with infinity.
As the algorithm proceeds and paths are found, the labels may
change, reflecting better paths.
• A label may be either tentative or permanent.
• Initially, all labels are tentative.
• When it is discovered that a label represents the shortest possible
path from the source to that node, it is made permanent and never
changed thereafter.
Example of Shortest Path Routing
working
• We want to find the shortest path from A to D.
• We start out by marking node A as permanent, indicated by a
filled-in circle.
• Then we examine, in turn, each of the nodes adjacent to A (the
working node), relabeling each one with the distance to A.
• Whenever a node is relabeled, we also label it with the node from
which the probe was made so that we can reconstruct the final
path later.
• Having examined each of the nodes adjacent to A, we examine all
the tentatively labeled nodes in the whole graph and make the one
with the smallest label permanent, This one becomes the new
working node.
• We now start at B and examine all nodes adjacent to it. If the sum of the
label on B and the distance from B to the node being considered is less
than the label on that node, we have a shorter path, so the node is
relabeled.
• After all the nodes adjacent to the working node have been inspected and
the tentative labels changed if possible, the entire graph is searched for
the tentatively-labeled node with the smallest value. This node is made
permanent and becomes the working node for the next round.
Flooding
(a nonadaptive routing algorithm)
Brute force routing
Every incoming packet is sent on every outgoing line
Always finds the shortest path quickly
Also finds many long paths
Time to live is set to size of subnet
Selective Flooding
Flood only in the direction of the destination
Practical in a few settings
Military Applications
Distributed Databases
Metric for comparison
Distance Vector Routing
(an adaptive routing algorithm)
(a) A subnet. (b) Input from A, I, H, K, and the new routing table for J.
Distance Vector Routing
• Consider how J computes its new route to router G. It knows that it
can get to A in 8 msec, and A claims to be able to get to G in 18
msec, so J knows it can count on a delay of 26 msec to G if it
forwards packets bound for G to A.
• Similarly, it computes the delay to G via I, H, and K as 41 (31 + 10),
18 (6 + 12), and 37 (31 + 6) msec, respectively.
• The best of these values is 18,
• so it makes an entry in its routing table that the delay to G is 18
msec
• and that the route to use is via H.
• The same calculation is performed for all the other destinations,
with the new routing table shown in the last column of the figure.
The Count to infinity Problem
• Distance vector routing works in theory but has a serious drawback
in practice: It reacts rapidly to good news, but leisurely to bad
news.
• To see how fast good news propagates, consider the five-node
(linear) subnet of fig (a),
• where the delay metric is the number of hops. Suppose A is down
initially and all the other routers know this. In other words, they
have all recorded the delay to A as infinity.
• When A comes up, the other routers learn about it via the vector
exchanges.
• At the time of the first exchange,
• B learns that its left neighbor has zero delay to A. B now makes an
entry in its routing table that A is one hop away to the left. All the
other routers still think that A is down.
The count-to-infinity problem
Send “Hello” packet on each point-to-point line. Destination node replies with its
address.
Learning about the Neighbors
(a) A subnet. (b) The link state packets for this subnet.
Distributing the Link State Packets
• Use selective flooding
• Sequence numbers prevent duplicate packets from being propagated
• Lower sequence numbers are rejected as obsolete
• This algorithm has a few problems but is manageable.
• First: If the sequence number wrap-around, (use 32-bit Sequence
Number, one link per second, it would take 137 years to wrap around.).
• Second: If a router ever crashes, it will lose track of its Sequence
Number. If its starts again at 0, the next packet will be rejected as a
duplicate.
• Third: if a sequence number is ever corrupted.
The solution to all these problems is to indicate the age of each packet
after the sequence number and decrement it once per second. When the
age hits zero, the information from the router is discarded.
Distributing the Link State
Packets
The packet buffer for router B in the previous slide (Fig. 5-
13).
Computing the New Routes
Dijkstra’s Shortest Path algorithm is used to determine the
shortest path to each destination.
The Network Layer in the Internet
• The IP Protocol
• IP Addresses
• Internet Control Protocols
• OSPF – The Interior Gateway Routing Protocol
• BGP – The Exterior Gateway Routing Protocol
• Internet Multicasting
• Mobile IP
• IPv6
Design Principles for Internet
1. Make sure it works.
2. Keep it simple.
3. Make clear choices.
4. Exploit modularity.
5. Expect heterogeneity.
6. Avoid static options and parameters.
7. Look for a good design; it need not be perfect.
8. Be strict when sending and tolerant when receiving.
9. Think about scalability.
10. Consider performance and cost.
Collection of Subnetworks
5-69
0 8 16 24 31
Decimal 192 168 21 76
Hex C0 A8 15 4C
0 31
Pfx Network Host
1-126
0 2 8 16 24 31
Example: NEU
Class B 10 Network Host
129.10.*.*
128-191
0 3 8 16 24 31
Example:
Class C 110 Network Host
216.63.78.*
50
192-223
How Do You Get IPs?
51
Two Level Hierarchy
Networ
Pfx Host
k
Subtree size
determined by …
network class 52
Class Sizes
Extract host:
IP Address: 10110101 11011101 01010100 01110010
Subnet Mask: & ~(11111111 11111111 11000000 00000000)
Result: 00000000 00000000 00010100 01110010
55
Internet control ptotocols
ICMP –Internetcontrol message protocol
ARP- Address Resolution Protocol
DHCP- Dynamic Host Configuration Protocol
Internet Control Message Protocol
The principal ICMP message types.
ARP– The Address Resolution
Protocol
Three interconnected /24 networks: two Ethernets and an FDDI ring.
Dynamic Host Configuration Protocol
Operation of DHCP.
Multi-Protocol
Label Switch
(MPLS)
What is MPLS?
From MPLS Resource center:
“MPLS stands for "Multiprotocol Label Switching". In an MPLS
network, incoming packets are assigned a "label" by a "label edge
router (LER)". Packets are forwarded along a "label switch path
(LSP)" where each "label switch router (LSR)" makes forwarding
decisions based solely on the contents of the label. At each hop,
the LSR strips off the existing label and applies a new label which
tells the next hop how to forward the packet.
TCP UDP
IP
MPLS MPS
PPP FR ATM Ethernet DWDM
Physical
Label-A1 Label-B1
Label-A2 Label-B2
Label-A3 Label-B3
Label-A4 Label-B4
MPLS
A protocol to establish an end-to-end path from
source to the destination
A hop-by-hop forwarding mechanism
Use labels to set up the path
Require a protocol to set up the labels along the
path
Itbuilds a connection-oriented service on the IP
network
Terminology
LSR - Routers that support MPLS are called Label Switch Router
LER - LSR at the edge of the network is called Label Edge Router
(a.k.a Edge LSR)
Ingress LER is responsible for adding labels to unlabeled IP packets.
Egress LER is responsible for removing the labels.
Label Switch Path (LSP) – the path defined by the labels through
LSRs between two LERs.
Label Forwarding Information Base (LFIB) – a forwarding table
(mapping) between labels to outgoing interfaces.
Forward Equivalent Class (FEC) – All IP packets follow the same
path on the MPLS network and receive the same treatment at each
node.
How does it work?
IP Label Label IP
Routing Switching Switching Routing
MPLS Operation
R1 --- E0 172.16.1.0
S1 6
R2 6 S0 172.16.1.0
S2 11
R3 11 S0 172.16.1.0
S3 7
R4 7 S1 172.26.1.0
E0 --
Q: create LFIB for R4 => R3 => R2 => R1
MPLS process
Label Switch Path
Routing Protocol
L2 Label IP Datagram
Header Header
MPLS Encapsulation is specified over various media
types. Labels may use existing format (e.g., VPI/VCI)
or use a new shim label format.
Shim Header
The Label (Shim Header) is represented as a
sequence of Label Stack Entry
Each Label Stack Entry is 4 bytes (32 bits)
20 Bits is reserved for the Label Identifier (also named
Label)
5-43
A connectionless internet.
Tunneling
Tunneling a packet from Paris to London.
Tunneling (2)
Tunneling a car from France to England.
Internetwork Routing
(a) An internetwork. (b) A graph of the internetwork.
Fragmentation