0% found this document useful (0 votes)
40 views108 pages

Internet Routing and Forwarding Explained

The document provides an overview of routing and forwarding in computer networks, detailing how packets are transferred within routers and the role of routing algorithms in determining packet paths. It discusses the components of routers, including input ports, output ports, switching fabric, and routing processors, as well as various switching methods and the implications of queuing and packet loss. Additionally, it introduces concepts like match-plus-action in packet processing and the OpenFlow protocol for network management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views108 pages

Internet Routing and Forwarding Explained

The document provides an overview of routing and forwarding in computer networks, detailing how packets are transferred within routers and the role of routing algorithms in determining packet paths. It discusses the components of routers, including input ports, output ports, switching fabric, and routing processors, as well as various switching methods and the implications of queuing and packet loss. Additionally, it introduces concepts like match-plus-action in packet processing and the OpenFlow protocol for network management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Advanced Computer

Networks
[Link]. Course, 1st Semester 2025-2026
Prof. Dr. Emad Hasan Abbood
Routing on the Internet
Forwarding and Routing

Forwarding involves the transfer of a packet from an incoming link to


an outgoing link within a single router

Routing involves all of network’s routers, whose collective


interactions via routing protocols determine the paths that packets
take on their trips from source to destination node.

The network layer must determine the route or path taken by packets
as they flow from a sender to a receiver. The algorithms that
calculate these paths are referred to as routing algorithms.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 2


Control Plane (Traditional Approach)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 3


Control Plane (SDN Approach)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 4


Inside a Router: A Routing Table
The routing algorithm determines the
values that are inserted into the
routers’ forwarding tables.

Connection Setup
Some network-layer architectures, for
example, ATM, frame relay, and MPLS
require the routers along the chosen
path from source to destination to
handshake with each other in order to
set up state before network-layer data
packets within a given source-to-
destination connection can begin to
flow.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 5
Four components:
Inside a Router: Forwarding Function 1. Input ports
2. Switch Fabric
3. Output ports
4. Routing processor

Advanced Computer Networks Prof. Dr. Emad H. Abbood 6


A Look Inside a Router
Connects the router’s input ports
performs control-plane functions to its output ports (a network inside
of a network router)

Performs the
physical layer
function of
terminating an
incoming physical
link at a router

Performs link-layer
functions needed
to interoperate
with the link layer
at the other side of
the incoming link

A lookup function is performed. The forwarding table is consulted to


An output port stores packets received from the switching
determine the router output port to which an arriving packet will be fabric and transmits these packets on the outgoing link by
forwarded via the switching fabric. performing the necessary link-layer and physical-layer
functions
Advanced Computer Networks Prof. Dr. Emad H. Abbood 7
Inside a Router: Input ports

Input ports performs several functions


• It performs the physical layer function of terminating an
incoming physical link at a router
• Performs link-layer functions needed to interoperate with the
link layer at the other side of the incoming link
• the lookup function (the forwarding table is consulted to
determine the router output port to which an arriving packet
will be forwarded via the switching fabric)
• Control packets (for example, packets carrying routing
protocol information) are forwarded from an input port to the
routing processor.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 8
Inside a Router: Switching Fabric

The switching fabric connects the router’s input ports to its


output ports. This switching fabric is completely contained
within the router, a network inside of a network router!

Advanced Computer Networks Prof. Dr. Emad H. Abbood 9


Inside a Router: Output ports

▪ Stores packets received from the switching fabric


and transmits these packets on the outgoing link by
performing the necessary link-layer and physical-
layer functions.
▪ When a link is bidirectional, an output port will
typically be paired with the input port for that link
on the same line card (a printed circuit board
containing one or more input ports, which is
connected to the switching fabric).
Advanced Computer Networks Prof. Dr. Emad H. Abbood 10
Inside a Router: Routing Processor

▪ Performs control plane functions


▪ In traditional routers:
o Executes the routing protocols,
o maintains routing tables and attached link state information, and
o computes the forwarding table for the router.

▪ In SDN routers:
o responsible for communicating with the remote controller in order to (among other activities)
receive forwarding table entries computed by the remote controller, and install these entries
in the router’s input ports.
o The routing processor also performs the network management functions

Advanced Computer Networks Prof. Dr. Emad H. Abbood 11


Router Input Processing

The forwarding table is computed and updated by the routing processor, with a shadow copy typically
stored at each input port. The forwarding table is copied from the routing processor to the line cards
over a separate bus (e.g., a PCI bus) indicated by the dashed line from the routing processor to the
input line cards in the previous figure. With a shadow copy, forwarding decisions can be made locally,
at each input port, without invoking the centralized routing processor on a per-packet basis and thus
avoiding a centralized processing bottleneck.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 12


Router Input Processing (continued)

• Lookup is conceptually simple (search through the forwarding table looking for the longest prefix
match)
• In Gigabit transmission rates, this lookup must be performed in nanoseconds
▪ techniques beyond a simple linear search through a large table are needed
▪ surveys of fast lookup algorithms can be found in [Gupta 2001, Ruiz-Sanchez 2001]
▪ On-Chip DRAM and faster SRAM
▪ TCAM (Ternary Content Address Memories) are used for lookups

Advanced Computer Networks Prof. Dr. Emad H. Abbood 13


Router Input Processing (continued)

• A packet may be temporarily blocked from entering the switching fabric if packets from other input
ports are currently using the fabric
• A blocked packet will be queued at the input port and then scheduled to cross the fabric at a later
point in time

Advanced Computer Networks Prof. Dr. Emad H. Abbood 14


Switching
Switching fabric is accomplished in many ways:
1) Switching via memory. The simplest, earliest routers were traditional computers, with
switching between input and output ports being done under direct control of the CPU (routing
processor).

Advanced Computer Networks Prof. Dr. Emad H. Abbood 15


Switching via Memory
▪ Input and output ports functioned as traditional I/O devices in a traditional operating system
▪ Arriving packet, signaled the routing processor via an interrupt.
▪ The packet copied from the input port into processor memory
▪ The routing processor then extracted the destination address from the header, looked up the
appropriate output port in the forwarding table, and copied the packet to the output port’s buffers.
▪ if the memory bandwidth is such that B packets per second can be written into, or read from, memory,
then the overall forwarding throughput (the total rate at which packets are transferred from input ports
to output ports) must be less than B/2.
▪ two packets cannot be forwarded at the same time, even if they have different destination ports, since
only one memory read/write over the shared system bus can be done at a time.
▪ Many modern routers switch via memory
▪ A major difference from early routers, lookup of the destination address and the storing of the
packet into the appropriate memory location are performed by processing on the input line cards.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 16
Switching
Switching fabric is accomplished in many ways:
2) Switching via a bus. In this approach, an input port transfers a packet directly to the output port
over a shared bus, without intervention by the routing processor.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 17


Switching via a Bus
▪ Each packet is labeled to the output port being transferred to
▪ The packet is delivered to all output ports
▪ Only the port that matches the label will keep the packet
▪ If multiple packets arrive to the router at the same time, each at a different input port,
all but one must wait since only one packet can cross the bus at a time.
▪ Because every packet must cross the single bus, the switching speed of the router is
limited to the bus speed;

Advanced Computer Networks Prof. Dr. Emad H. Abbood 18


Switching
Switching fabric is accomplished in many ways:
3) Switching via an interconnection network
To overcome the limitation of a shared bus is to use
a more sophisticated interconnection network
known as crossbar. A crossbar switch is an
interconnection network consisting of 2N buses
that connect N input ports to N output ports.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 19


Switching via an interconnection network
▪ Each vertical bus intersects each horizontal bus at a crosspoint,
which can be opened or closed at any time by the switch fabric
controller (whose logic is part of the switching fabric itself).
▪ When a packet arrives from port A and needs to be forwarded to
port Y, the switch controller closes the crosspoint at the
intersection of busses A and Y, and port A then sends the packet
onto its bus, which is picked up (only) by bus Y.
▪ A packet from port B can be forwarded to port X at the same time,
since the A-to-Y and B-to-X packets use different input and output
busses. Crossbar networks are capable of forwarding multiple
packets in parallel.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 20


Switching via an interconnection network
▪ A crossbar switch is non-blocking - a packet being forwarded to an
output port will not be blocked from reaching that output port as long
as no other packet is currently being forwarded to that output port.
▪ If two packets from two different input ports are destined to the same
output port, then one will have to wait at the input, since only one
packet can be sent over any given bus at a time.
▪ More sophisticated interconnection networks use multiple stages of
switching elements to allow packets from different input ports to
proceed towards the same output port at the same time through the
switching fabric.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 21


Output Processing

▪ Output port processing takes packets that have been stored in the output port’s
memory and transmits them over the output link. This includes selecting and de-
queueing packets for transmission, and performing the needed link layer and
physical-layer transmission functions.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 22


Router Queues and Packet Loss
A router with N input ports and N output ports:
𝑅𝑙𝑖𝑛𝑒 = is the line speed (transmission rate) of an input or output port
𝑅𝑠𝑤𝑖𝑡𝑐ℎ = is the switch fabric speed (transfer rate)

Assume arriving packets have same equal lengths and arrive in synchronous manner (the time to
send a packet on any link is equal to the time to receive a packet on any link), 𝑅𝑠𝑤𝑖𝑡𝑐ℎ is N times
faster than 𝑅𝑙𝑖𝑛𝑒 . Then only: Negligible queuing will occur at input port

This is because even in the worst case, where all N input lines are receiving packets, and all packets are to
be forwarded to the same output port, each batch of N packets (one packet per input port) can be cleared
through the switch fabric before the next batch arrives

Advanced Computer Networks Prof. Dr. Emad H. Abbood 23


Input Queuing

▪ What happens if the switch fabric is not fast enough (relative to


the input line speeds) to transfer all arriving packets through the
fabric without delay?
o Packet queuing can also occur at the input ports
▪ If two packets at the front of two input queues are destined for the
same output queue, then one of the packets will be blocked and
must wait at the input queue - the switching fabric can transfer
only one packet to a given output port at a time.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 24


Input Queuing
▪ Head-of-the-line (HOL) blocking: A
queued packet in an input queue must
wait for transfer through the fabric
(even though its output port is free)
because it is blocked by another
packet at the head of the line.
▪ [Karol 1987] shows that due to HOL
blocking, the input queue will grow to
unbounded length (informally, this is
equivalent to saying that significant
packet loss will occur) under certain
assumptions as soon as the packet
arrival rate on the input links reaches
only 58 percent of their capacity. A
number of solutions to HOL blocking
are discussed in [McKeown 1997].
Advanced Computer Networks Prof. Dr. Emad H. Abbood 25
Output Queuing
What happens at the output ports?

▪ In this case, in the time it takes to send a single


packet onto the outgoing link, N new packets
will arrive at this output port.
▪ Output port can transmit one packet per time,
N arriving packets have to queue (wait)
▪ If N more packets arrive, the number of queued
packets grow large enough to exhaust available
memory at the output port, in which case
packets are dropped

Advanced Computer Networks Prof. Dr. Emad H. Abbood 26


Buffer Size
How much buffering is required?

• [RFC 3439], a rule of thumb:

𝐵𝑢𝑓𝑓𝑒𝑟 𝑠𝑖𝑧𝑒 𝐵 = 𝑅𝑇𝑇 × 𝐶


Where C is the link capacity.

Example:
If Link capacity = 10Gbps, RTT = 250 msec -> B = 0.625 Gbytes

• [Appenzeller 2004], suggest that when there are a large number of TCP flows (N) passing through
a link, the amount of buffering needed is:
𝐶
𝐵𝑢𝑓𝑓𝑒𝑟 𝑠𝑖𝑧𝑒 𝐵 = 𝑅𝑇𝑇 ×
𝑁
With a large number of flows typically passing through large backbone router links the value of
N can be large, with the decrease in needed buffer size becoming quite significant.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 27


Router Queues and Packet Loss
How much buffering is required?

▪ Increasing the amount of per-hop buffer by a factor of 10 to decrease packet loss


could increase the end-end delay by a factor of 10! Increased RTTs also make
TCP senders less responsive and slower to respond to incipient congestion
and/or packet loss. These delay-based considerations show that buffering is a
double-edged sword - buffering can be used to absorb short-term statistical
fluctuations in traffic but can also lead to increased delay and the attendant
concerns

Advanced Computer Networks Prof. Dr. Emad H. Abbood 28


Match and Action
▪ Traditional Match: Looking up a destination IP address
▪ Traditional Action: Sending the packet into the switching
Controller
fabric to the specified output port
▪ Generalized match-plus-action
o The “match” can be made over multiple header fields associated
with different protocols at different layers in the protocol stack.
o The “action” can include:
✓ forwarding the packet to one or more output ports (as in destination-
based forwarding),
✓ load balancing packets across multiple outgoing interfaces that lead
to a service (as in load balancing),
✓ rewriting header values (as in NAT),
✓ purposefully blocking/dropping a packet (as in a firewall),
✓ sending a packet to a special server for further processing and action
and more.
▪ A match-plus-action table in each packet switch being
computed, installed, and updated by a remote controller
Advanced Computer Networks Prof. Dr. Emad H. Abbood 29
OpenFlow Protocol
▪ The network protocol that connects
an OpenFlow switch(s) with an
OpenFlow controller(s)
▪ The OpenFlow switch has two parts:
o Queues, frame transmitters and frame
receivers with associated flow tables
o Communication with controller using
OpenFlow signaling protocol
▪ OpenFlow uses a secure SSL/TLS
channel to authenticate both ends
of the communication (to reduce
the risk of attacks)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 30


OpenFlow Flow Table
Each entry in the match-plus-action forwarding table, known as a flow table in
OpenFlow, includes:
▪ A set of header field values to which an incoming packet will be
matched. A packet that matches no flow table entry can be dropped or sent
to the remote controller for more processing. In practice, a flow table may be
implemented by multiple flow tables for performance or cost reasons.
▪ A set of counters that are updated as packets are matched to flow table
entries. These counters might include the number of packets that have
been matched by that table entry, and the time since the table entry was last
updated.
▪ A set of actions to be taken when a packet matches a flow table entry.
These actions might be to forward the packet to a given output port, to drop
the packet, makes copies of the packet and sent them to multiple output
ports, and/or to rewrite selected header fields.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 31
Match
▪ The 11 packet-header fields and the incoming port ID that can be matched in an OpenFlow
1.0 match-plus-action rule.
▪ The set of 12 values that can be matched in the OpenFlow 1.0 specification has grown to 41
values in more recent OpenFlow specifications

Advanced Computer Networks Prof. Dr. Emad H. Abbood 32


Action
▪ Each flow table entry has a list of zero or more actions that determine the processing that
is to be applied to a packet that matches a flow table entry. If there are multiple actions,
they are performed in the order specified in the list.
▪ Among the most important possible actions are:
o Forwarding
✓ Forwarded to a particular physical output port,
✓ broadcast over all ports (except the port on which it arrived) or
✓ multicast over a selected set of ports.
✓ The packet may be encapsulated and sent to the remote controller for this device.
That controller then may (or may not) take some action on that packet, including
installing new flow table entries, and may return the packet to the device for
forwarding under the updated set of flow table rules
o Dropping: A flow table entry with no action indicates that a matched packet should be
dropped
o Modify field: The values in 10 packet-header fields (all layer 2, 3, and 4 fields except
the IP Protocol field) may be re-written before the packet is forwarded to the chosen
output port
Advanced Computer Networks Prof. Dr. Emad H. Abbood 33
Example: Simple Forwarding
Packets from h5 or h6 destined to h3
or h4 are to be forwarded from s3 to
s1, and then from s1 to s2 (thus
completely avoiding the use of the
link between s3 and s2)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 34


Example: Load Balancing
Datagrams from h3 destined to 10.1.*.* are to be
forwarded over the direct link between s2 and s1,
while datagrams from h4 destined to 10.1.*.* are
to be forwarded over the link between s2 and s3
(and then from s3 to s1).

Flow table entries are also needed at s1 to forward the datagrams received from s2 to either h1 or h2;
and flow table entries are needed at s3 to forward datagrams received on interface 4 from s2 over
interface 3 toward s1.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 35


Example: Firewalling
A firewall scenario in which s2 wants only to
receive (on any of its interfaces) traffic sent from
hosts attached to s3

If there were no other entries in s2’s flow table, then only traffic from 10.3.*.* would be forwarded to the
hosts attached to s2.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 36


The SDN Control Plane

The SDN control plane is the network-wide logic that controls


packet forwarding among a network’s SDN-enabled devices, as well
as the configuration and management of these devices and their
services.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 37


SDN Key Characteristics load 3. control plane
access
routing control balance
functions external to
data-plane switches
4. programmable Remote Controller
control
applications
control
plane

data
plane

CA 2. control, data
CA CA CA CA
plane separation

1: generalized “flow-based”
forwarding (e.g., OpenFlow)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 38


Data-plane switches
network-control applications

routing

▪ Fast, simple, commodity switches implementing
access load
generalized data-plane forwarding in hardware control balance

▪ Flow (forwarding) table computed, installed under control


northbound API plane
controller supervision
▪ API for table-based switch control (e.g., SDN Controller
(network operating system)
OpenFlow)
southbound API
▪ Defines what is controllable, what is not protocol
for communicating with controller (e.g., data
plane
OpenFlow)

SDN-controlled switches

Advanced Computer Networks Prof. Dr. Emad H. Abbood 39


SDN controller (network OS)
network-control applications

routing

▪ Maintain network state information
access load
control balance
▪ Interacts with network control
control
applications “above” via northbound API northbound API plane

▪ Interacts with network switches “below” SDN Controller


(network operating system)
via southbound API
southbound API
▪ Implemented as distributed system for
performance, scalability, fault-tolerance, data
plane
robustness
SDN-controlled switches

Advanced Computer Networks Prof. Dr. Emad H. Abbood 40


Network Control Apps
network-control applications

routing

▪ “brains” of control: implement access load
control balance
control functions using lower-level control
northbound API plane
services, API provided by SDN
SDN Controller
controller (network operating system)

▪ Unbundled: can be provided by 3rd southbound API

party: distinct from routing vendor, data


plane

or SDN controller
SDN-controlled switches

Advanced Computer Networks Prof. Dr. Emad H. Abbood 41


Components of
SDN Controller
Interface layer to network control apps:
abstractions API (Northbound
interface)
Network-wide state management
layer: state of networks links,
switches, services: a distributed
database
Communication layer:
communicate between SDN
controller and controlled switches
(Southbound Interface)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 42


OpenFlow Protocol (1/3)

▪Operates between controller, switch


▪TCP used to exchange messages
owith a default port number of 6653
ooptional encryption
▪Three classes of OpenFlow messages:
ocontroller-to-switch
oasynchronous (switch to controller)
osymmetric (misc)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 43


OpenFlow Protocol (2/3)
Key controller-to-switch messages OpenFlow Controller

• features: controller queries switch features,


switch replies
• configure: controller queries/sets switch
configuration parameters
• modify-state: add, delete, modify flow entries
in the OpenFlow tables
• packet-out: controller can send this packet
out of specific switch port (The message
itself contains the packet to be sent in its
payload)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 44


OpenFlow Protocol (3/3)
Key switch-to-controller messages OpenFlow Controller

▪ packet-in: transfer packet (and its


control) to controller. (packets not
match, matched packets are sent to
controller for further processing)
▪ flow-removed: flow table entry
deleted at switch
▪ port status: inform controller of a
change on a port.
Fortunately, network operators don’t “program” switches by creating/sending
OpenFlow messages directly. Instead use higher-level abstraction at
controller
Advanced Computer Networks Prof. Dr. Emad H. Abbood 45
SDN: control/data plane interaction example (1/2)
1. Switch s1, experiencing a link failure
between itself and s2, notifies the SDN
controller of the link-state change using
the OpenFlow port-status message.
2. The SDN controller receives the OpenFlow
message indicating the link-state change,
and notifies the link-state manager, which
updates a link-state database.
3. The network-control application that
implements Dijkstra’s link-state routing
has previously registered to be notified
when link state changes. That application
receives the notification of the link-state
change.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 46
SDN: control/data plane interaction example (2/2)
4. The link-state routing application interacts with the
link-state manager to get updated link state; it might
also consult other components in the state-
management layer. It then computes the new least-
cost paths.
5. The link-state routing application then interacts with
the flow table manager, which determines the flow
tables to be updated.
6. The flow table manager then uses the OpenFlow
protocol to update flow table entries at affected
switches—s1 (which will now route packets
destined to s2 via s4), s2 (which will now begin
receiving packets from s1 via intermediate switch
s4), and s4 (which must now forward packets from
s1 destined to s2).

Advanced Computer Networks Prof. Dr. Emad H. Abbood 47


The OpenDaylight Controller (ODL)
The Service Abstraction Layer (SAL)

▪ Interconnects internal, external


applications and services.

▪ The SAL also provides a uniform abstract


interface to specific protocols operating
between the ODL controller and the
controlled devices. These protocols
include OpenFlow, SNMP, NETCONF, The
Open vSwitch Database Management
Protocol (OVSDB) is used to manage data
center switching, an important application
area for SDN technology.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 48


The ONOS Controller
Three layers:

▪ Northbound abstractions and protocols. A


unique feature of ONOS is its intent
framework, which allows an application to
request a high-level service (e.g., to setup a
connection between host A and Host B, or
conversely to not allow Host A and host B to
communicate) without having to know the
details of how this service is performed. State
information is provided to network-control
applications across the northbound API
either synchronously (via query) or
asynchronously (via listener callbacks, e.g.,
when network state changes).

Advanced Computer Networks Prof. Dr. Emad H. Abbood 49


The ONOS Controller
Three layers:

▪ Distributed core. The state of the


network’s links, hosts, and devices is
maintained in ONOS’s distributed
core. The ONOS core provides the
mechanisms for service replication
and coordination among instances,
providing the applications above and
the network devices below with the
abstraction of logically centralized
core services.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 50


The ONOS Controller
Three layers:

▪ Southbound abstractions and


protocols. The southbound
abstractions mask the heterogeneity
of the underlying hosts, links,
switches, and protocols, allowing
the distributed core to be both
device and protocol agnostic ().

Open Network Operating System

Advanced Computer Networks Prof. Dr. Emad H. Abbood 51


The Network Configuration Protocol (NETCONF)
▪ Operates between the managing server and the managed network devices, providing messaging
to:
i. retrieve, set, and modify configuration data at managed devices;

ii. to query operational data and statistics at managed devices; and

iii. to subscribe to notifications generated by managed devices.

▪ The managing server actively controls a managed device by sending it configurations, which are
specified in a structured XML document, and activating a configuration at the managed device.

▪ NETCONF uses a remote procedure call (RPC) paradigm, where protocol messages are also
encoded in XML and exchanged between the managing server and a managed device over a
secure, connection-oriented session such as the TLS (Transport Layer Security) protocol over TCP.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 52


The Network Configuration Protocol (NETCONF)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 53


The Network Configuration Protocol (NETCONF)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 54


The Network Configuration Protocol (NETCONF)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 55


The Network Configuration Protocol (NETCONF)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 56


Routing Algorithms
A set of rules and relations to examine the good (best) path in terms of cost a
router should use to send a packet.

Cost: A value (in terms of time, money, reliability, …) of a link connecting


routers.
Hop: A node on the Internet (a router).
Source router destination router
1st hop router Last hop router

LAN LAN

Advanced Computer Networks Prof. Dr. Emad H. Abbood 57


5
Routing Terminologies v w
3
Graph G = (N, E) 2 5

❑ N = set of nodes (routers) 2 3


u 1 z
❑ E = set of edges (links)
1 2
o Each edge = pair of connected nodes in N 1
❑ Node y is a neighbor of node x if (x, y) ∈ E y
x
Cost:
❑ Each edge has a value representing the cost of the link
o c(x, y) = cost of edge between nodes x & y
o if (x, y) ∉ E, then c(x, y) = ∞
❑ We will assume c(x, y) = c(y, x)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 58


5
Routing Terminologies v w
3
A path in a graph G = (N, E) is a sequence of 2 5

nodes (𝑥1 , 𝑥2 , … , 𝑥𝑝 ) such that each of the pairs 2 3


u 1 z
(𝑥1 , 𝑥2 ), (𝑥2 , 𝑥3 ), …, (𝑥𝑝−1 , 𝑥𝑝 ) are edges in E. 1 2
1
The cost of a path is the sum of edge costs: c(𝑥1 , 𝑥2 ),
c(𝑥2 , 𝑥3 ), …, c(𝑥𝑝−1 , 𝑥𝑝 ) x y

There could be multiple paths between two nodes,


each with a different cost. One or more of these is a
least-cost path.

Example: the least-cost path between u and w is (u, x, y, w) ⇒ c(u, x, y, w) = 3. If all edges have
the same cost, then least-cost path = shortest path

Advanced Computer Networks Prof. Dr. Emad H. Abbood 59


Algorithm classifications

Global routing algorithms Decentralized routing algorithms


• Compute the least-cost path using • No node has complete information
complete knowledge of the about the costs of all links
network • A node initially knows only its
• The algorithm knows the direct links
connectivity between all nodes & • Iterative process: calculate &
costs exchange info with neighbors
• Centralized algorithm • Eventually calculate the least-cost
• link-state (LS) algorithms path to a destination
• Distance-Vector (DV) algorithm

Advanced Computer Networks Prof. Dr. Emad H. Abbood 60


Algorithm classifications

Static routing algorithms Dynamic routing algorithms


Routes change very slowly over time Change routing paths as network
traffic loads or topology change

Load-sensitive algorithms Load-insensitive algorithms


Link costs vary to reflect the current Ignore current or recent levels of
level of congestion congestion

Advanced Computer Networks Prof. Dr. Emad H. Abbood 61


Link-State (LS): Dijkstra’s Algorithm
o Assumption:
❑ Entire network topology & link costs are known
❑ Each node broadcasts link-state packets to all other nodes
❑ All nodes have an identical, complete view of the network
o Compute least-cost path from one node to all other nodes in the network
o Iterative algorithm
❑ After k iterations, least-cost paths are known to k nodes

Advanced Computer Networks Prof. Dr. Emad H. Abbood 62


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Initialize:
N’ = current node Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
N’ = { u }
0 u 2,u 5,u 1,u ∞ ∞
for all nodes v
if v is a neighbor of u
D(v) = c(u, v)
else
D(v) = ∞

Advanced Computer Networks Prof. Dr. Emad H. Abbood 63


Dijkstra’s Algorithm 5
v 3
w
skip 𝑢, it is
2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣 in 𝑵’
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
Loop until 𝑵 = 𝑵’: 0 u 2,u 5,u ∞ ∞
1, 𝑢
Find a node n not in N’ such that D(n) is a
minimum 1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
→ Node x has minimum D(n)
add n to N’
N’ = {u, x} Cost to
for each neighbor m of n not in N’: Cost to 𝑤 We now
𝑣 is Ignore 𝑥, it
for each neighbor of node x is better have a
not better is in 𝑵’
D(m) = min( D(m), D(n) + c(n, m)) through 𝑥 path to 𝑦
through 𝑥
new cost = old cost or cost through x
if D(m) changed, set p(m) = n

Advanced Computer Networks Prof. Dr. Emad H. Abbood 64


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Loop until 𝑵 = 𝑵’: Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
find n not in N’ such that D(n) is
a minimum 0 u 2,u 5,u 1, 𝑢 ∞ ∞
→ Nodes v & y have minimum D(n),
Pick any one: we choose y 1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
add n to N’ 2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
N’ = {u, x, y}
for each neighbor m of n not in N’:
for each neighbor of node y Cost to w We now
D(m) = min(D(m), D(n) + c(n, m)) Skip 𝑥 and 𝑦,
is even better have a
new cost = old cost or cost through x are in 𝑵’
through y path to 𝑧
if D(m) changed, set p(m) = n

Advanced Computer Networks Prof. Dr. Emad H. Abbood 65


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Loop until 𝑵 = 𝑵’: Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
find n not in N’ such that D(n) is
a minimum 0 u 2,u 5,u 1, 𝑢 ∞ ∞
→ Nodes v has minimum D(n)
1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
add n to N’ 2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
N’ = {u, x, y, v}
for each neighbor m of n not in N’: 3 𝑢𝑥𝑦𝑣 3, 𝑦 4, 𝑦
for each neighbor of node y
D(m) = min(D(m), D(n) + c(n, m)) No change
new cost = old cost or cost through x No improvement Z is not a
if D(m) changed, set p(m) = n (2+3) ≮ 3 neighbor

Advanced Computer Networks Prof. Dr. Emad H. Abbood 66


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Loop until 𝑵 = 𝑵’: Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
find n not in N’ such that D(n) is
a minimum 0 u 2,u 5,u 1, 𝑢 ∞ ∞
→ Nodes w has minimum D(n)
1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
add n to N’ 2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
N’ = {u, x, y, v, w}
for each neighbor m of n not in N’: 3 𝑢𝑥𝑦𝑣 3, 𝑦 4, 𝑦
for each neighbor of node y 4, 𝑦
4 𝑢𝑥𝑦𝑣𝑤
D(m) = min(D(m), D(n) + c(n, m))
new cost = old cost or cost through x
if D(m) changed, set p(m) = n No improvement
(3+5) ≮ 4

Advanced Computer Networks Prof. Dr. Emad H. Abbood 67


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y

Loop until 𝑵 = 𝑵’: Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
find n not in N’ such that D(n) is
a minimum 0 u 2,u 5,u 1, 𝑢 ∞ ∞
→ Node z is the only one left
1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
add n to N’ 2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
N’ = {u, x, y, v, w, z}
for each neighbor m of n not in N’: 3 𝑢𝑥𝑦𝑣 3, 𝑦 4, 𝑦
There are no neighbors not in 𝑵’! 4, 𝑦
4 𝑢𝑥𝑦𝑣𝑤
Complete
5 𝑢𝑥𝑦𝑣𝑤𝑧

Advanced Computer Networks Prof. Dr. Emad H. Abbood 68


Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

(3) u is x’s x y
predecessor

𝑵 = 𝑵’: Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
All nodes are in 𝑵’
0 u 2,u 5,u 1, 𝑢 ∞ ∞
For each node, we have the total
cost from the source and the 1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
predecessor along that path.
2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
We can look up the predecessor to
find its predecessor 3 𝑢𝑥𝑦𝑣 3, 𝑦 4, 𝑦

4 𝑢𝑥𝑦𝑣𝑤 4, 𝑦
Example: least-cost path from u → y
is u → x → y 5 𝑢𝑥𝑦𝑣𝑤𝑧

(1) y is w’s (2) x is y’s


predecessor predecessor
Advanced Computer Networks Prof. Dr. Emad H. Abbood 69
Dijkstra’s Algorithm 5
v 3
w

2 5
𝐷(𝑣): cost of least-cost path from source to 𝑣
2 3
𝑝(𝑣): previous node (neighbor of v) along the least-cost path u 1 z
1 2
to 𝑣
1
𝑁 : subset of nodes for which we found the least-cost path

x y
We can create a forwarding table that
stores the next hop on the least-cost Step 𝑁′ 𝐷(𝑣), 𝑝(𝑣) 𝐷(𝒘), 𝑝(𝒘) 𝐷(𝒙), 𝑝(𝒙) 𝐷(𝒚), 𝑝(𝒚) 𝐷(𝒛), 𝑝(𝒛)
route
Forwarding table for node u 0 u 2,u 5,u 1, 𝑢 ∞ ∞
Dest. link 1 𝑢𝑥 2, 𝑢 4, 𝑥 2, 𝑥 ∞
v uv 2 𝑢𝑥𝑦 2, 𝑢 3, 𝑦 4, 𝑦
w ux 3 𝑢𝑥𝑦𝑣 3, 𝑦 4, 𝑦
x ux 4 𝑢𝑥𝑦𝑣𝑤 4, 𝑦
y ux 5 𝑢𝑥𝑦𝑣𝑤𝑧

z ux

Advanced Computer Networks Prof. Dr. Emad H. Abbood 70


Dijkstra’s Algorithm
Computational cost
o 1st iteration: search n nodes to find the minimum cost node
o 2nd iteration: search n-1 nodes
o 3rd iteration: search n-2 nodes
o nth iteration: search 1 node

o Total of n iterations = 𝑛 + 𝑛 − 1 + 𝑛 − 2 + … + 1 = σ𝑛𝑖=0 𝑛 − 𝑖


o We need to search n(n+1)/2 nodes
o Complexity = 𝑂(𝑛2 )

Advanced Computer Networks Prof. Dr. Emad H. Abbood 71


Oscillations with congestion-based routing

• Oscillations can occur if link cost is based on link traffic


(such as delay).
• link costs are not symmetric; that is, c(u,v) equals c(v,u) only
if the load carried on both directions on the link (u,v) is the
• same
node z originates a unit of traffic destined for w, node x also
originates a unit of traffic destined for w, and node y injects
an amount of traffic equal to e, also destined for w. Initial routing

• When the LS algorithm is next run, node y determines (based on the


link costs shown, that the clockwise path to w has a cost of 1, while
the counterclockwise path to w (which it had been using) has a
cost of 1 + e. Hence y’s least-cost path to w is now clockwise.
Similarly, x determines that its new least-cost path to w is also
clockwise, resulting in costs shown in Figure
x, y detect better path to w, clockwise
Advanced Computer Networks Prof. Dr. Emad H. Abbood 72
Oscillations with congestion-based routing
• When the LS algorithm is run next, nodes x, y, and z all detect a zero-cost path to w in the
counterclockwise direction, and all route their traffic to the counterclockwise routes. The next time the
LS algorithm is run, x, y, and z all then route their traffic to the clockwise routes.

x, y, z detect better path to w, x, y, z, detect better path


counterclockwise to w, clockwise

Advanced Computer Networks Prof. Dr. Emad H. Abbood 73


How to Avoid Oscillations?

• What can be done to prevent such oscillations (which can occur in any algorithm, not just an LS algorithm,
that uses a congestion or delay-based link metric)? One solution would be to mandate that link costs not
depend on the amount of traffic carried—an unacceptable solution since one goal of routing is to avoid
highly congested (for example, high-delay) links.

• Another solution is to ensure that not all routers run the LS algorithm at the same time. This seems a more
reasonable solution, since we would hope that even if routers ran the LS algorithm with the same periodicity,
the execution instance of the algorithm would not be the same at each node.
• Interestingly, researchers have found that routers in the Internet can self-synchronize among themselves
[Floyd Synchronization 1994]. That is, even though they initially execute the algorithm with the same period
but at different instants of time, the algorithm execution instance can eventually become, and remain,
synchronized at the routers. One way to avoid such self-synchronization is for each router to randomize the
time it sends out a link advertisement.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 74


Distance-Vector Routing Algorithm
o Initial assumption
❑ Each router (node) knows the cost to reach its directly-connected neighbors
o Iterative, asynchronous, distributed algorithm
❑ Multiple iterations
Process continues until no more information is exchanged between neighbors.
(Interestingly, the algorithm is also self-terminating—there is no signal that the
computation should stop; it just stops.)
❑ Asynchronous
Does not require lockstep synchronization
❑ Distributed
Each node receives some information from one or more of its directly attached
neighbors, performs a calculation, and then distributes the results of its calculation
back to its neighbors.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 75


Bellman-Ford Equation
It states that:
o If x is not directly connected to y, it needs to first hop to some neighbor v
o The lowest cost is
(the cost of the first hop to v) + (the lowest cost from v to y) = 𝒄(𝒙, 𝒗) + 𝒅𝒗 (𝒚)
o The least cost path from x to y, 𝑑𝑥 (𝑦), is the minimum of the lowest cost of all of x’s
neighbors
𝑑𝑥 (𝑦) = 𝑚𝑖𝑛𝑣 { 𝑐(𝑥, 𝑣) + 𝑑𝑣 (𝑦)}
o The value of v that satisfies the equation is the forwarding table entry in x’s router for
destination y

Advanced Computer Networks Prof. Dr. Emad H. Abbood 76


Distance-Vector Routing Algorithm
❖ At each node x we store:
▪ 𝒄(𝒙, 𝒗) = cost for the direct link from x to v for each neighbor v
▪ 𝑫𝒙 (𝒚) = estimate of the cost of the least-cost path from x to y
▪ Distance Vector is the set of 𝐷𝑥 (𝑦) for all nodes y in N
𝐷𝑥 = [𝐷𝑥 (𝑦): 𝑦 ∈ 𝑁 ]
▪ Distance vectors received from its neighbors
𝐷𝑣 = [𝐷𝑣 (𝑦): 𝑦 ∈ 𝑁 ] Least-cost estimates
from x to all other
nodes y
Set of least-cost
estimates from each
neighbor v to each
node y

Advanced Computer Networks Prof. Dr. Emad H. Abbood 77


Distance-Vector Routing Algorithm
❖ Each node v periodically sends its distance vector, Dv to its neighbors
▪ When a node receives a distance vector, it saves it and updates its own distance vector
using the Bellman-Ford equation
𝑫𝒙 (𝒚) = 𝒎𝒊𝒏𝒗 { 𝒄(𝒙, 𝒗) + 𝑫𝒗 (𝒚)} 𝑓𝑜𝑟 𝑒𝑎𝑐ℎ 𝑛𝑜𝑑𝑒 𝑦 ∈ 𝑁

▪ If this results in a change to x’s DV, it sends the new DV to its neighbors
Each cost estimate 𝐷𝑥 (𝑦) converges to the actual least-cost 𝐷𝑥 (𝑦)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 78


DV Example y
Node x DV table Node y DV table Node z DV table
Cost to Cost to Cost to
2 1
x y z x y z x y z
from

x 0 2 7 x ∞ ∞ ∞ x ∞ ∞ ∞

from
from
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ x 7 z
z ∞ ∞ ∞ z ∞ ∞ ∞ z 7 1 0

Node x sends its DV {0, 2, 7} to


nodes y and z
Node x DV table Node y DV table Node z DV table
Cost to Cost to Cost to
x y z x y z x y z
x 0 2 7 x 0 2 7 x 0 2 7
from

from
from

y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞
z ∞ ∞ ∞ z ∞ ∞ ∞ z 7 1 0
c(y, x) = 2 c(z, x) = 7
Advanced Computer Networks Prof. Dr. Emad H. Abbood 79
DV Example y
Node x DV table Node y DV table Node z DV table
Cost to Cost to Cost to
2 1
x y z x y z x y z
from

x 0 2 7 x 0 2 7 x 0 2 7

from
from
y ∞ ∞ ∞ y 2 0 1 y ∞ ∞ ∞ x 7 z
z ∞ ∞ ∞ z ∞ ∞ ∞ z 7 1 0
From y: c(y,z) is 1 Node y sends its DV {2, 0, 1}
c(x, z) = c(x, y) + c(y,z) = 2 + 1 = 3 to nodes x and z
Less than old value, 7
Node z sends its DV {7, 1, 0}
Node x DV table Node y DV table Node z DV table
to nodes x and y
Cost to Cost to Cost to
x y z x y z x y z Every update to a node’s
x 0 2 3 x 0 2 7 x 0 2 7 DV also updates the

from
from

from

forwarding table
y 2 0 1 y 2 0 1 y 2 0 1 From y: c(y,x) is 2
c(z, x) = c(z,y) + c(y,x) = 1 + 2 = 3
z 7 1 0 z 7 1 0 z 3 1 0 Less than old value, 7
c(x, y) = 2 c(y, x) = 2 c(z, y) = 1
Advanced Computer Networks Prof. Dr. Emad H. Abbood 80
DV Example y
Node x DV table Node y DV table Node z DV table
Cost to Cost to Cost to
2 1
x y z x y z x y z
from

x 0 2 7

from
x 0 2 3 x 0 2 7

from
y 2 0 1 y 2 0 1 y 2 0 1 x 7 z
z 7 1 0 z 7 1 0 z 3 1 0
• Node x sends its DV {0, 2,
3} to nodes y and z
Node z DV table
• Node y’s vector did not
Node x DV table Node y DV table
change – it stays quiet
Cost to Cost to Cost to • Node z sends its DV {3, 1,
x y z x y z x y z 0} to nodes x and y
from

from
x 0 2 3
from

x 0 2 3 x 0 2 3
y 2 0 1 y 2 0 1 y 2 0 1
z 3 1 0 z 3 1 0 z 3 1 0
We converged. Everyone has the same view of the network. Nobody has updates to send.
Advanced Computer Networks Prof. Dr. Emad H. Abbood 81
Link cost changes
❖ The DV algorithm remains quiet once it converges until some link cost changes
❖ If a node detects link cost change between itself and a neighbor
o It updates its distance vector
o If there is a change in the cost of any least-cost path
o it informs its neighbors of the new distance vector
o Each neighbor computes a new least cost
▪ If the value changed from its previous value, it sends its DV to its neighbors
▪ Recompute until values converge

Advanced Computer Networks Prof. Dr. Emad H. Abbood 82


Link Loss and Count to Infinity Problem

Suppose we lose the link to C: c(B,C) = ∞


B will send an update to A but A thinks its cost to C is 3
B will think there is a route to C: B→A→C with a cost of (c(B,A) + 3) = 4

Advanced Computer Networks Prof. Dr. Emad H. Abbood 83


Mitigation: Poison Reverse
o If A routes through B to get to C
▪ A will advertise to B that its distance is infinity
▪ B will then never attempt to route through A
o This does not work with loops involving 3 or more nodes!
o Other approaches
o Limit size of network by setting a hop (cost) limit
o Send full path information in route advertisement
o Perform explicit queries for loops

Advanced Computer Networks Prof. Dr. Emad H. Abbood 84


Hierarchical routing
Solution to the previous problems exists:

• Aggregate routers into


regions, “autonomous
systems” (AS)
▪ Routers in same AS run
same routing protocol
“intra-AS” routing
protocol
▪ Routers in different AS
can run different intra- Forwarding table configured
by both intra- and inter-AS
AS routing protocol routing algorithm
• gateway router: o intra-AS sets entries for
internal destinations
▪ At “edge” of its own AS o inter-AS & intra-AS sets
▪ Has link to router in entries for external
destinations
another AS

Advanced Computer Networks Prof. Dr. Emad H. Abbood 85


Inter-AS Tasks
Suppose router in AS1 receives datagram destined outside of AS1: router should forward
packet to gateway router, but which one?

AS1 must:
• learn which destinations are
reachable through AS2,
which through AS3
• propagate this reachability
info to all routers in AS1

Advanced Computer Networks Prof. Dr. Emad H. Abbood 86


Inter-AS Tasks
Example: Setting forwarding table in router 1d
❑ Suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c), but
not via AS2
o inter-AS protocol propagates reachability info to all internal routers
❑ router 1d determines from intra-AS routing info that its interface I is on the least cost path to
1c
o installs forwarding table entry (x,I)
X

Advanced Computer Networks Prof. Dr. Emad H. Abbood 87


Inter-AS Tasks
Example: Choosing among multiple ASes
❑ Suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from
AS2.
❑ to configure forwarding table, router 1d must determine which gateway it should forward
packets towards for destination x
o this is also job of inter-AS routing protocol!
o Hot potato routing: send packet towards closest of two routers.
X

Advanced Computer Networks Prof. Dr. Emad H. Abbood 88


Inter-AS Tasks
Example: Choosing among multiple ASes

Advanced Computer Networks Prof. Dr. Emad H. Abbood 89


AS types
Stub AS
❑ Carries only traffic for which it is a source or a destination
❑ Does not route traffic between ASes

Multihomed stub AS
❑ Like a stub AS but connected to multiple other ASes
❑ Provides fault tolerant connectivity for systems in the AS but does not offer routing from
other ASes

Transit AS
❑ Provides connections through itself to other networks

Advanced Computer Networks Prof. Dr. Emad H. Abbood 90


Intra-AS Routing: RIP
Routing Information Protocol (RIP)
o Intra-AS protocol = Interior Gateway Protocol (IGP)
o RIP: distance-vector routing protocol – used as an IGP
o Hop count is used as a cost metric (cost of each link = 1)
o Cost = # hops from the source router to a destination subnet (including the subnet)
o Minimum cost = 1
o Maximum cost = 15 (to avoid routing loops)

How RIP works?


o Each router maintains a routing table
▪ Contains the router’s distance vector & the forwarding table
❖ Each subnet identifies the next router & # hops to the destination

Advanced Computer Networks Prof. Dr. Emad H. Abbood 91


RIP
How RIP works?
RIP advertisements
o Each router sends a RIP advertisement to its neighbors approximately every 30 seconds
o UDP port 520
o The advertisement contains the router’s routing table
o If a router does not hear from a neighbor in 180 seconds
▪ It assumes the neighbor is dead or disconnected
▪ Removes the neighbor from its routing table & propagates info to neighbors

Upon receiving an advertisement


o Merge the received table with your own table
▪ Choose the smallest # of hops to each destination
▪ Add any new destination subnets

Advanced Computer Networks Prof. Dr. Emad H. Abbood 92


RIP Timers
Periodic (from 25 to 35 seconds)
o Controls the advertising of regular update messages
o Each router has one periodic timer that is randomly set to a number between 25 and 35. It
counts down; when zero is reached, the update message is sent, and the timer is randomly
set once again.
Expiration (180 second)
o governs the validity of a route.
o When a router receives update information for a route, the expiration timer is set to 180 s for
that particular route.
o Every time a new update for the route is received, the timer is reset. In normal situations this
occurs every 30s.
o If there is a problem on an internet and no update is received within the allotted 180 s, the
route is considered expired and the hop count of the route is set to 16, which means the
destination is unreachable.
o Every route has its own expiration timer.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 93


RIP Timers
Garbage Collection (120 seconds)
o When the information about a route becomes invalid, the router does not immediately
purge that route from its table. Instead, it continues to advertise the route with a metric
value of 16.
o At the same time, a timer called the garbage collection timer is set to 120 s for that route.
o When the count reaches zero, the route is purged from the table. This timer allows
neighbors to become aware of the invalidity of a route prior to purging.

Advanced Computer Networks Prof. Dr. Emad H. Abbood 94


RIP Timers
Example: A routing table has 20 entries. It does not receive information about five routes for
200 s. How many timers are running at this time?

Solution
The 21 timers are listed below:
o Periodic timer: 1
o Expiration timer: 20 − 5 = 15
o Garbage collection timer: 5

Advanced Computer Networks Prof. Dr. Emad H. Abbood 95


Example on RIP operation

W X Y
A D B k

Advanced Computer Networks Prof. Dr. Emad H. Abbood 96


Example on RIP operation

W X Y
A D B B

What do we merge?
• Destination z via A is 5 hops vs. 7
• We know of a destination to w (2
hops via A)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 97


Running RIP
• On UNIX/BSD/Linux
o RIP runs as a background process called routed (“route daemon”)
o Application layer process that can modify routing tables
• On routers
o RIP runs in the control plane
• Downsides of RIP
o Converges slowly
o Does not scale to very large networks
o Insecure (plain text authentication)
• But it’s still widely used

Advanced Computer Networks Prof. Dr. Emad H. Abbood 98


Intra-AS Routing: OSPF
Open Shortest Path First (OSPF)
❑ Another interior gateway protocol (intra-AS routing)
• Designed as a successor to RIP
• Typically used in large enterprise networks
❑ RIP is based on the Distance-Vector algorithm
❑ OSPF is based on Dijkstra’s shortest-path (Link State) algorithm
• Each router constructs a complete graph of the entire AS
• Each router runs Dijkstra’s algorithm to determine the shortest path to all subnets with
itself as the root node
o Costs of links are configured by the admin (simplest case: each link = 1)
• If the link state of a router changes (connectivity or cost)
o It broadcasts the change to all routers in the AS, not just the neighbors
❑ OSPF implemented as a special upper-layer protocol
• Protocol 89 in the IP protocol field (TCP=6, UDP=17, ICMP=1)

Advanced Computer Networks Prof. Dr. Emad H. Abbood 99


Features of OSPF
o Security
• Shared secret key among routers
• Send MD5 hash(OSPF packet content, shared key)
• Receiver validates the hash to ensure that the contents have not been
• modified
• Each message includes a sequence number to prevent replay attacks
o Allow multiple paths to be used if they have the same cost
o Support multicast routing
o Allow an AS to be configured into a hierarchy: OSPF Areas

Advanced Computer Networks Prof. Dr. Emad H. Abbood 100


OSPF Areas: “ASes within an AS”

OSPF Areas
o Subdivision of an OSPF autonomous system
o Each area
➢ Runs its own OSPF link state routing algorithm
➢ Has one or more area border routers (ABR) to route outside the area
Backbone area:
o Contains all area border routers in the AS (and possibly others)
o Inter-area routing
➢ route to an ABR, through the backbone, and to the ABR in the destination area
Advanced Computer Networks Prof. Dr. Emad H. Abbood 101
Inter-AS Routing: BGP
Border Gateway Protocol: BGP
❑ Border Gateway Protocol: exterior gateway protocol (EGP)
• inter-AS protocol: routes between autonomous systems (AS)
• BGP version 4 is the standard inter-AS protocol in the Internet

Advanced Computer Networks Prof. Dr. Emad H. Abbood 102


BGP Sessions

❑ Pairs of routers exchange information via semi-permanent TCP connections


• One connection for each link between gateway routers
o External BGP (eBGP) session
• Two routers with a BGP connection are BGP peers
• Also, BGP TCP connections between routers inside an AS
o Typically, between each pair of routers
o Internal BGP (iBGP) session

Advanced Computer Networks Prof. Dr. Emad H. Abbood 103


Learning destinations
❑ BGP destinations are CIDR prefixes
• Range of IP addresses representing one or more subnets

Advanced Computer Networks Prof. Dr. Emad H. Abbood 104


Learning destinations
❑ What if [Link]/24 was in AS1?

Advanced Computer Networks Prof. Dr. Emad H. Abbood 105


BGP Reachability Propagation via eBGP

❑ AS1 sends prefix reachability info to AS2


❑ AS2 sends prefix reachability info to AS1
❑ AS3 sends prefix reachability info to AS2
❑ AS2 sends prefix reachability info to AS3

Advanced Computer Networks Prof. Dr. Emad H. Abbood 106


BGP Reachability Propagation via eBGP

❑ When a gateway gets prefix reachability info via eBGP


▪ It propagates the information to routers inside the AS via iBGP

Advanced Computer Networks Prof. Dr. Emad H. Abbood 107


Readvertising Learned Routes

❑ If a gateway router learns of new prefixes


• It can re-advertise to its peers via eBGP

Advanced Computer Networks Prof. Dr. Emad H. Abbood 108

You might also like