SlideShare a Scribd company logo
IP Routing
Mekuanint A. (PhD)
memekuanint@gmail.com
Faculty of Computing
Bahir Dar Institute of Technology
Bahir Dar University
Advanced Computer Networks
IPAddressing
• how hosts and routers are connected into the network?
• A host typically has only a single link into the network
• IP in the host wants to send a datagram, it does over this link
• The boundary between the host and the physical link is called an
interface
• router: receives a datagram on one link and forwards the datagram
on some other link
• router necessarily has two or more links to which it is connected
Advanced Computer Networks
• A router has multiple interfaces, one for each of its links
• Because every host and router is capable of sending and
receiving IP datagrams, IP requires each host and router
interface to have its own IP address
• Thus, an IP address is technically associated with an interface,
rather than with the host or router containing that interface
Advanced Computer Networks
• Each IP address is 32 bits long
• A total of 2^32 possible IP addresses: 4 billon IP addresses
• typically written in dotted-decimal notation
• Each interface on every host and router in the global Internet
must have an IP address that is globally unique
Advanced Computer Networks
Advanced Computer Networks
IPAddressing
• IP address: 32-bit
identifier for host, router
interface
• interface: connection
between host/router and
physical link
– router‟s typically have
multiple interfaces
– host typically has one
interface
– IP addresses associated
with each interface
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 1
1
Subnet
• A subnet is also called an IP network or simply a network in
the Internet literature
• IP addressing assigns an address to the subnet: 223.1.1.0/24
• the /24 notation, sometimes known as a subnet mask, indicates
that the leftmost 24 bits of the 32-bit quantity define the subnet
address
• Any additional hosts attached to the 223.1.1.0/24 subnet
would be required to have an address of the form 223.1.1.xxx.
Advanced Computer Networks
Advanced Computer Networks
Subnets
• IP address:
– subnet part (high order
bits)
– host part (low order bits)
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
network consisting of 3 subnets
subnet
Advanced Computer Networks
Subnets
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
• To determine the subnets,
detach each interface from
its host or router, creating
islands of isolated
networks.
• Each isolated network is
called a subnet.
Subnet mask: /24
Advanced Computer Networks
Subnets
• How many subnets?
 all devices on a given
subnet have the same
subnet address
 different subnets could
have quite different
subnet addresses
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2
223.1.2.1
223.1.2.6
223.1.3.2
223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1
223.1.8.0
223.1.8.1
223.1.9.1
223.1.9.2
Advanced Computer Networks
IP addressing
CIDR: The Internet's address assignment strategy: Classless
Inter-Domain Routing (CIDR)
• Generalizes the notion of subnet addressing
– subnet portion of address of arbitrary length
– address format: a.b.c.d/x, where x is # bits in subnet portion of
address
11001000 00010111 00010000 00000000
subnet
part
host
part
200.23.16.0/23
• The x most significant bits of an address of the form a.b.c.d/x
constitute the network portion of the IP address (prefix or network
prefix of the address)
• Organization: has a range of addresses with a common prefix
• when a router outside the organization forwards a datagram whose
destination address is inside the organization, only the leading x
bits of the address need be considered
• The remaining 32-x bits of an address can be thought of as
distinguishing among the devices within the organization
• These are the bits that will be considered when forwarding
packets at routers within the organization
Advanced Computer Networks
Obtaining a Block of Addresses
• ISP: provide addresses from a larger block of addresses that had already
been allocated to the ISP
• ISP may itself have been allocated the address block 200.23.16.0/20
• ISP divides its address block into eight equal-sized contiguous address
blocks
Advanced Computer Networks
DHCP: Dynamic Host Configuration Protocol
 A system administrator will typically manually configure the
IP addresses into the router
 Host addresses can also be configured manually, but more
often this task is now done using DHCP
 DHCP allows a host to obtain (be allocated) an IP address
automatically
Advanced Computer Networks
Advanced Computer Networks
DHCP client-server scenario
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
A
B
E
DHCP
server
arriving DHCP
client needs
address in this
network
DHCP is a client-server protocol
Advanced Computer Networks
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server when it joins
network
Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected an “on”)
Support for mobile users who want to join network (more shortly)
DHCP overview:
– host broadcasts “DHCP discover” msg
– DHCP server responds with “DHCP offer” msg
– host requests IP address: “DHCP request” msg
– DHCP server sends address: “DHCP ack” msg
Advanced Computer Networks
DHCP client-server scenario
DHCP server: 223.1.2.5 arriving
client
time
DHCP discover
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs
Advanced Computer Networks
Forwarding and Routing
• forwarding: move packets
from router‟s input to
appropriate router output
• routing: determine route
taken by packets from source
to dest.
– routing algorithms
analogy:
 routing: process of
planning trip from source
to dest
 forwarding: process of
getting through single
interchange
Advanced Computer Networks
1
2
3
0111
value in arriving
packet’s header
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
Routing and forwarding
Advanced Computer Networks
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
Graph: G = (N,E)
N = set of routers = { u, v, w, x, y, z }
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
Graph Abstraction
Advanced Computer Networks
Graph abstraction: costs
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5 • c(x,x‟) = cost of link (x,x‟)
- e.g., c(w,z) = 5
Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
Question: What‟s the least-cost path between u and z ?
Routing algorithm: algorithm that finds least-cost path
Advanced Computer Networks
Routing Algorithm classification
Global or decentralized
information?
Global:
• all routers have complete
topology, link cost info
• “link state” algorithms
Decentralized:
• router knows physically-
connected neighbors, link costs
to neighbors
• iterative process of computation,
exchange of info with neighbors
• “distance vector” algorithms
Static or dynamic?
Static:
• routes change slowly over
time
Dynamic:
• routes change more
quickly
– periodic update
– in response to link cost
changes
Advanced Computer Networks
A Link-State Routing Algorithm
Dijkstra‟s algorithm
• net topology, link costs known to
all nodes
– accomplished via “link state
broadcast”
– all nodes have same info
• computes least cost paths from
one node („source”) to all other
nodes
– gives forwarding table for that
node
• iterative: after k iterations, know
least cost path to k dest.‟s
Notation:
• c(x,y): link cost from node x to
y; = ∞ if not direct neighbors
• D(v): current value of cost of
path from source to dest. v
• p(v): predecessor node along
path from source to v
• N': set of nodes whose least cost
path definitively known
Advanced Computer Networks
Dijsktra’s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'
Advanced Computer Networks
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
uxyvw
uxyvwz
D(v),p(v)
2,u
2,u
2,u
D(w),p(w)
5,u
4,x
3,y
3,y
D(x),p(x)
1,u
D(y),p(y)
∞
2,x
D(z),p(z)
∞
∞
4,y
4,y
4,y
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
Advanced Computer Networks
Dijkstra’s algorithm
u
y
x
w
v
z
Resulting shortest-path tree from u:
v
x
y
w
z
(u,v)
(u,x)
(u,x)
(u,x)
(u,x)
destination link
Resulting forwarding table in u:
Distance Vector Algorithm
Advanced Computer Networks
• Distance vector (DV) algorithm is iterative, asynchronous,
and distributed
 Distributed:
• each node receives information from its directly attached
neighbors
• performs a calculation
• distributes the results of its calculation back to its
neighbor
 Iterative:
• continues until no nodes exchange info
• self-terminating: no “signal” to stop
 Asynchronous
• it does not require all of the nodes to operate in lockstep
with each other
Advanced Computer Networks
Distance Vector Algorithm
Bellman-Ford Equation
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min {c(x,v) + dv(y) }
where min is taken over all neighbors v of x
v
Advanced Computer Networks
Bellman-Ford Example
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
du(z) = min { c(u,v) + dv(z),
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path ➜ forwarding table
B-F equation says:
Advanced Computer Networks
Distance Vector Algorithm
 Dx(y) = estimate of least cost from x to y
 With the DV algorithm, each node x maintains the following
routing information:
• Node x knows cost to each neighbor v: c(x,v)
• Node x maintains distance vector Dx = [Dx(y): y є N ]
• Node x also maintains its neighbors‟ distance vectors
– For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
Advanced Computer Networks
Distance vector algorithm
Basic idea:
• From time-to-time, each node sends its own distance
vector estimate to neighbors
• When a node x receives new DV estimate from neighbor, it
updates its own DV using B-F equation:
Dx(y) = minv{c(x,v) + Dv(y)} for each node y ∊ N
 Under minor, natural conditions, the estimate Dx(y)
converge to the actual least cost dx(y)
Advanced Computer Networks
Advanced Computer Networks
x y z
x
y
z
0 2 7
∞ ∞ ∞
∞ ∞ ∞
from
cost to
from
from
x y z
x
y
z
0
from
cost to
x y z
x
y
z
∞ ∞
∞ ∞ ∞
cost to
x y z
x
y
z
∞ ∞ ∞
7 1 0
cost to
∞
2 0 1
∞ ∞ ∞
2 0 1
7 1 0
time
x z
1
2
7
y
node x table
node y table
node z table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
3
2
Advanced Computer Networks
x y z
x
y
z
0 2 7
∞ ∞ ∞
∞ ∞ ∞
from
cost to
from
from
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
∞ ∞
∞ ∞ ∞
cost to
x y z
x
y
z
0 2 7
from
cost to
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 7
from
cost to
x y z
x
y
z
∞ ∞ ∞
7 1 0
cost to
∞
2 0 1
∞ ∞ ∞
2 0 1
7 1 0
2 0 1
7 1 0
2 0 1
3 1 0
2 0 1
3 1 0
2 0 1
3 1 0
2 0 1
3 1 0
time
x z
1
2
7
y
node x table
node y table
node z table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
Advanced Computer Networks
Distance Vector: link cost changes
Link cost changes:
 node detects local link cost change
 updates routing info, recalculates
distance vector
 if DV changes, notify neighbors
x z
1
4
50
y
1
At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors.
At time t1, z receives the update from y and updates its table.
It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z‟s update and updates its distance table.
y‟s least costs do not change and hence y does not send any
message to z.
Advanced Computer Networks
Distance Vector: link cost changes
Link cost changes:
 good news travels fast
 bad news travels slow - “count
to infinity” problem!
 44 iterations before algorithm
stabilizes
Poisoned reverse:
 If Z routes through Y to get to
X :
 Z tells Y its (Z‟s) distance to X
is infinite (so Y won‟t route to
X via Z)
 will this completely solve count
to infinity problem?
x z
1
4
50
y
60
Advanced Computer Networks
Comparison of LS and DV algorithms
Message complexity
• LS: with n nodes, E links, O(nE)
msgs sent
• DV: exchange between neighbors
only
– convergence time varies
Speed of Convergence
• LS: O(n2) algorithm requires
O(nE) msgs
– may have oscillations
• DV: convergence time varies
– may be routing loops
– count-to-infinity problem
Robustness: what happens if
router malfunctions?
LS:
– node can advertise incorrect
link cost
– each node computes only its
own table
DV:
– DV node can advertise
incorrect path cost
– each node‟s table used by
others
• error propagate thru network
Class Work
• Consider the network shown below, and assume that each node
initially knows the cost to each of its neighbors. Consider the
distance-vector algorithm and show the distance table entries at
node E.
Advanced Computer Networks
Advanced Computer Networks
Intra-AS Routing
• An intra-AS routing protocol is used to determine how routing
is performed within an autonomous system (AS)
• also known as Interior Gateway Protocols (IGP)
• most common Intra-AS routing protocols of Internet:
– RIP: Routing Information Protocol
– OSPF: Open Shortest Path First
– IGRP: Interior Gateway Routing Protocol
Inter-AS routing
• Different routing protocols on each AS
• Different metrics in each AS
• The AS‟s didn't trust each other
• routes are growing very fast
• The point of Border Gateway Protocol (BGP) is to route traffic
between AS‟s which didn‟t trust each other
Advanced Computer Networks
Advanced Computer Networks
Border Gateway Protocol (BGP)
• BGP provides each AS a means to:
1. Obtain subnet reachability information from neighboring
ASs
2. Propagate reachability information to all AS-internal
routers
3. Determine “good” routes to subnets based on reachability
information and policy
• allows subnet to advertise its existence to rest of Internet: “I
am here”
• If it weren't for BGP, each subnet would be isolated-alone and
unknown by the rest of the Internet
Advanced Computer Networks
BGP basics
 Pairs of routers (BGP peers) exchange routing info over TCP connections: BGP sessions
 BGP session that spans two ASs: external BGP (eBGP) session
 BGP session between routers in the same AS: internal BGP (iBGP) session
 BGP sessions need not correspond to physical links.
 when AS2 advertises a prefix to AS1:
 AS2 promises it will forward datagrams towards that prefix.
 AS2 can aggregate prefixes in its advertisement
3b
1d
3a
1c
2a
AS3
AS1
AS2
1a
2c
2b
1b
3c
eBGP session
iBGP session
Advanced Computer Networks
Distributing reachability info
• using eBGP session between 3a and 1c, AS3 sends prefix reachability info to
AS1.
– 1c can then use iBGP do distribute new prefix info to all routers in AS1
– 1b can then re-advertise new reachability info to AS2 over 1b-to-2a eBGP
session
• when router learns of new prefix, it creates entry for prefix in its forwarding
table.
3b
1d
3a
1c
2a
AS3
AS1
AS2
1a
2c
2b
1b
3c
eBGP session
iBGP session
Advanced Computer Networks
Path attributes & BGP routes
• advertised prefix includes BGP attributes.
– prefix + attributes = “route”
• two important attributes:
– AS-PATH: contains ASs through which prefix advertisement
has passed: e.g, AS67, AS17
– NEXT-HOP: indicates specific internal-AS router to next-hop
AS. (may be multiple links from current AS to next-hop-AS)
• when gateway router receives route advertisement, uses import
policy to accept/decline.
Advanced Computer Networks
BGP route selection
• router may learn about more than one route to some prefix.
Router must select route.
• Elimination rules:
1. local preference value attribute: policy decision
2. shortest AS-PATH
3. closest NEXT-HOP router
4. additional criteria
Advanced Computer Networks
BGP messages
• BGP messages exchanged using TCP.
• BGP messages:
– OPEN: opens TCP connection to peer and authenticates sender
– UPDATE: advertises new path (or withdraws old)
– KEEPALIVE keeps connection alive in absence of UPDATES;
also ACKs OPEN request
– NOTIFICATION: reports errors in previous msg; also used to
close connection
Advanced Computer Networks
BGP routing policy
 A,B,C are provider networks
 X,W,Y are customer (of provider networks)
 X is dual-homed: attached to two networks
 X does not want to route from B via X to C
 .. so X will not advertise to B a route to C
A
B
C
W
X
Y
legend:
customer
network:
provider
network
Advanced Computer Networks
BGP routing policy
• A advertises path AW to B
• B advertises path BAW to X
• Should B advertise path BAW to C?
• No way! B gets no “revenue” for routing CBAW since
neither W nor C are B‟s customers
• B wants to force C to route to w via A
• B wants to route only to/from its customers!
A
B
C
W
X
Y
legend:
customer
network:
provider
network
Advanced Computer Networks
Why different Intra- and Inter-AS routing ?
Policy:
• Inter-AS: admin wants control over how its traffic routed, who
routes through its net.
• Intra-AS: single admin, so no policy decisions needed
Scale:
• hierarchical routing saves table size, reduced update traffic
Performance:
• Intra-AS: can focus on performance
• Inter-AS: policy may dominate over performance

More Related Content

PPTX
Week11 lec2
PPTX
Computer Networking Michaelmas/Lent Term M/W/F 11:00-12:00 LT1 in Gates Buil...
PPTX
Network layer. pptx
PPTX
Network layer of osi model .pptx
PPT
module10-rip (1).ppt
PPT
Introduction to Computer Networks
PPT
Intro 2 Computer Networks
PPTX
numeric network in the world of heart then ay iks jsns
Week11 lec2
Computer Networking Michaelmas/Lent Term M/W/F 11:00-12:00 LT1 in Gates Buil...
Network layer. pptx
Network layer of osi model .pptx
module10-rip (1).ppt
Introduction to Computer Networks
Intro 2 Computer Networks
numeric network in the world of heart then ay iks jsns

Similar to IP Address Routing _________________2_IP Routing.pdf (20)

PPT
IP Addressing.ppt
PPTX
Computer Networking: A Top-Down Approach
PDF
Network Layers | Computer Communication and Networks
PPT
ch4_ip address-2ed_31july2002SamirAdditions.ppt
PPT
ch4_2ed_31july2002SamirAdditions ipp address.ppt
PPT
IP Addressing for the extereme beggeners
PPTX
Module 3- transport_layer .pptx
PDF
Lec12 on Computer Networks by Tarun Mangla.pdf
PPT
4d routing
PDF
Lecture set 5
PPT
Powerpoint one
PPT
Powerpoint one
PPTX
IPAddressing .pptx
PPT
Network_Layer.ppt
PPT
destination. The network layer must know the topology of the subnet and choos...
PDF
PPTX
7-Lect_7 .pptxNetwork LayerNetwork Layer
PPTX
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
PDF
MULTIMEDIA COMMUNICATION & NETWORKS
PPTX
UNIT2-nw layer autonomy.pptx
IP Addressing.ppt
Computer Networking: A Top-Down Approach
Network Layers | Computer Communication and Networks
ch4_ip address-2ed_31july2002SamirAdditions.ppt
ch4_2ed_31july2002SamirAdditions ipp address.ppt
IP Addressing for the extereme beggeners
Module 3- transport_layer .pptx
Lec12 on Computer Networks by Tarun Mangla.pdf
4d routing
Lecture set 5
Powerpoint one
Powerpoint one
IPAddressing .pptx
Network_Layer.ppt
destination. The network layer must know the topology of the subnet and choos...
7-Lect_7 .pptxNetwork LayerNetwork Layer
7-Lect_7 .pptxNetwork Layer. Addressing Subnetting Mask (default and subnet) ...
MULTIMEDIA COMMUNICATION & NETWORKS
UNIT2-nw layer autonomy.pptx
Ad

More from amarehope21 (14)

PPT
Elective(Intellegent agent )__cha.Two.ppt
PPT
Chapter 3. Literature review_______.ppt
PDF
Backpropagation_Backpropagation a step by step.pdf
PDF
1_________Elements of Moderen Network.pdf
PDF
NLP_Chapter #2 Morphological Analysis.pdf
PPTX
Chapter #1 Introduction to NConfigure and administer Server LP.pptx
PPT
INTRODUCTION TO INFORMATION RETRIEVALChapter 1-IR.ppt
PPTX
chapter 4 enterprise/product/service .ppt.pptx
PPTX
Advanced Networking link layer..chap-5.pptx
PDF
introduction to computer network lecture one
PPTX
chapter 2(IO and stream)/chapter 2, IO and stream
PPTX
CHAPTER FIVE WEBBASED MARKET5.pptx/ WEBBASED MARKET5
PDF
wireless networking chapter three WAN.pdf
PPTX
basic research in it introduction BRMIT.ppt
Elective(Intellegent agent )__cha.Two.ppt
Chapter 3. Literature review_______.ppt
Backpropagation_Backpropagation a step by step.pdf
1_________Elements of Moderen Network.pdf
NLP_Chapter #2 Morphological Analysis.pdf
Chapter #1 Introduction to NConfigure and administer Server LP.pptx
INTRODUCTION TO INFORMATION RETRIEVALChapter 1-IR.ppt
chapter 4 enterprise/product/service .ppt.pptx
Advanced Networking link layer..chap-5.pptx
introduction to computer network lecture one
chapter 2(IO and stream)/chapter 2, IO and stream
CHAPTER FIVE WEBBASED MARKET5.pptx/ WEBBASED MARKET5
wireless networking chapter three WAN.pdf
basic research in it introduction BRMIT.ppt
Ad

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Machine learning based COVID-19 study performance prediction
PPT
Teaching material agriculture food technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
20250228 LYD VKU AI Blended-Learning.pptx
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.
The AUB Centre for AI in Media Proposal.docx
Machine learning based COVID-19 study performance prediction
Teaching material agriculture food technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11

IP Address Routing _________________2_IP Routing.pdf

  • 1. IP Routing Mekuanint A. (PhD) memekuanint@gmail.com Faculty of Computing Bahir Dar Institute of Technology Bahir Dar University Advanced Computer Networks
  • 2. IPAddressing • how hosts and routers are connected into the network? • A host typically has only a single link into the network • IP in the host wants to send a datagram, it does over this link • The boundary between the host and the physical link is called an interface • router: receives a datagram on one link and forwards the datagram on some other link • router necessarily has two or more links to which it is connected Advanced Computer Networks
  • 3. • A router has multiple interfaces, one for each of its links • Because every host and router is capable of sending and receiving IP datagrams, IP requires each host and router interface to have its own IP address • Thus, an IP address is technically associated with an interface, rather than with the host or router containing that interface Advanced Computer Networks
  • 4. • Each IP address is 32 bits long • A total of 2^32 possible IP addresses: 4 billon IP addresses • typically written in dotted-decimal notation • Each interface on every host and router in the global Internet must have an IP address that is globally unique Advanced Computer Networks
  • 5. Advanced Computer Networks IPAddressing • IP address: 32-bit identifier for host, router interface • interface: connection between host/router and physical link – router‟s typically have multiple interfaces – host typically has one interface – IP addresses associated with each interface 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.1 = 11011111 00000001 00000001 00000001 223 1 1 1
  • 6. Subnet • A subnet is also called an IP network or simply a network in the Internet literature • IP addressing assigns an address to the subnet: 223.1.1.0/24 • the /24 notation, sometimes known as a subnet mask, indicates that the leftmost 24 bits of the 32-bit quantity define the subnet address • Any additional hosts attached to the 223.1.1.0/24 subnet would be required to have an address of the form 223.1.1.xxx. Advanced Computer Networks
  • 7. Advanced Computer Networks Subnets • IP address: – subnet part (high order bits) – host part (low order bits) 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 network consisting of 3 subnets subnet
  • 8. Advanced Computer Networks Subnets 223.1.1.0/24 223.1.2.0/24 223.1.3.0/24 • To determine the subnets, detach each interface from its host or router, creating islands of isolated networks. • Each isolated network is called a subnet. Subnet mask: /24
  • 9. Advanced Computer Networks Subnets • How many subnets?  all devices on a given subnet have the same subnet address  different subnets could have quite different subnet addresses 223.1.1.1 223.1.1.3 223.1.1.4 223.1.2.2 223.1.2.1 223.1.2.6 223.1.3.2 223.1.3.1 223.1.3.27 223.1.1.2 223.1.7.0 223.1.7.1 223.1.8.0 223.1.8.1 223.1.9.1 223.1.9.2
  • 10. Advanced Computer Networks IP addressing CIDR: The Internet's address assignment strategy: Classless Inter-Domain Routing (CIDR) • Generalizes the notion of subnet addressing – subnet portion of address of arbitrary length – address format: a.b.c.d/x, where x is # bits in subnet portion of address 11001000 00010111 00010000 00000000 subnet part host part 200.23.16.0/23
  • 11. • The x most significant bits of an address of the form a.b.c.d/x constitute the network portion of the IP address (prefix or network prefix of the address) • Organization: has a range of addresses with a common prefix • when a router outside the organization forwards a datagram whose destination address is inside the organization, only the leading x bits of the address need be considered • The remaining 32-x bits of an address can be thought of as distinguishing among the devices within the organization • These are the bits that will be considered when forwarding packets at routers within the organization Advanced Computer Networks
  • 12. Obtaining a Block of Addresses • ISP: provide addresses from a larger block of addresses that had already been allocated to the ISP • ISP may itself have been allocated the address block 200.23.16.0/20 • ISP divides its address block into eight equal-sized contiguous address blocks Advanced Computer Networks
  • 13. DHCP: Dynamic Host Configuration Protocol  A system administrator will typically manually configure the IP addresses into the router  Host addresses can also be configured manually, but more often this task is now done using DHCP  DHCP allows a host to obtain (be allocated) an IP address automatically Advanced Computer Networks
  • 14. Advanced Computer Networks DHCP client-server scenario 223.1.1.1 223.1.1.2 223.1.1.3 223.1.1.4 223.1.2.9 223.1.2.2 223.1.2.1 223.1.3.2 223.1.3.1 223.1.3.27 A B E DHCP server arriving DHCP client needs address in this network DHCP is a client-server protocol
  • 15. Advanced Computer Networks DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an “on”) Support for mobile users who want to join network (more shortly) DHCP overview: – host broadcasts “DHCP discover” msg – DHCP server responds with “DHCP offer” msg – host requests IP address: “DHCP request” msg – DHCP server sends address: “DHCP ack” msg
  • 16. Advanced Computer Networks DHCP client-server scenario DHCP server: 223.1.2.5 arriving client time DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs
  • 17. Advanced Computer Networks Forwarding and Routing • forwarding: move packets from router‟s input to appropriate router output • routing: determine route taken by packets from source to dest. – routing algorithms analogy:  routing: process of planning trip from source to dest  forwarding: process of getting through single interchange
  • 18. Advanced Computer Networks 1 2 3 0111 value in arriving packet’s header routing algorithm local forwarding table header value output link 0100 0101 0111 1001 3 2 2 1 Routing and forwarding
  • 19. Advanced Computer Networks u y x w v z 2 2 1 3 1 1 2 5 3 5 Graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } Graph Abstraction
  • 20. Advanced Computer Networks Graph abstraction: costs u y x w v z 2 2 1 3 1 1 2 5 3 5 • c(x,x‟) = cost of link (x,x‟) - e.g., c(w,z) = 5 Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) Question: What‟s the least-cost path between u and z ? Routing algorithm: algorithm that finds least-cost path
  • 21. Advanced Computer Networks Routing Algorithm classification Global or decentralized information? Global: • all routers have complete topology, link cost info • “link state” algorithms Decentralized: • router knows physically- connected neighbors, link costs to neighbors • iterative process of computation, exchange of info with neighbors • “distance vector” algorithms Static or dynamic? Static: • routes change slowly over time Dynamic: • routes change more quickly – periodic update – in response to link cost changes
  • 22. Advanced Computer Networks A Link-State Routing Algorithm Dijkstra‟s algorithm • net topology, link costs known to all nodes – accomplished via “link state broadcast” – all nodes have same info • computes least cost paths from one node („source”) to all other nodes – gives forwarding table for that node • iterative: after k iterations, know least cost path to k dest.‟s Notation: • c(x,y): link cost from node x to y; = ∞ if not direct neighbors • D(v): current value of cost of path from source to dest. v • p(v): predecessor node along path from source to v • N': set of nodes whose least cost path definitively known
  • 23. Advanced Computer Networks Dijsktra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N'
  • 24. Advanced Computer Networks Dijkstra’s algorithm: example Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(v),p(v) 2,u 2,u 2,u D(w),p(w) 5,u 4,x 3,y 3,y D(x),p(x) 1,u D(y),p(y) ∞ 2,x D(z),p(z) ∞ ∞ 4,y 4,y 4,y u y x w v z 2 2 1 3 1 1 2 5 3 5
  • 25. Advanced Computer Networks Dijkstra’s algorithm u y x w v z Resulting shortest-path tree from u: v x y w z (u,v) (u,x) (u,x) (u,x) (u,x) destination link Resulting forwarding table in u:
  • 26. Distance Vector Algorithm Advanced Computer Networks • Distance vector (DV) algorithm is iterative, asynchronous, and distributed  Distributed: • each node receives information from its directly attached neighbors • performs a calculation • distributes the results of its calculation back to its neighbor  Iterative: • continues until no nodes exchange info • self-terminating: no “signal” to stop  Asynchronous • it does not require all of the nodes to operate in lockstep with each other
  • 27. Advanced Computer Networks Distance Vector Algorithm Bellman-Ford Equation Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors v of x v
  • 28. Advanced Computer Networks Bellman-Ford Example u y x w v z 2 2 1 3 1 1 2 5 3 5 Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table B-F equation says:
  • 29. Advanced Computer Networks Distance Vector Algorithm  Dx(y) = estimate of least cost from x to y  With the DV algorithm, each node x maintains the following routing information: • Node x knows cost to each neighbor v: c(x,v) • Node x maintains distance vector Dx = [Dx(y): y є N ] • Node x also maintains its neighbors‟ distance vectors – For each neighbor v, x maintains Dv = [Dv(y): y є N ]
  • 30. Advanced Computer Networks Distance vector algorithm Basic idea: • From time-to-time, each node sends its own distance vector estimate to neighbors • When a node x receives new DV estimate from neighbor, it updates its own DV using B-F equation: Dx(y) = minv{c(x,v) + Dv(y)} for each node y ∊ N  Under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)
  • 32. Advanced Computer Networks x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞ from cost to from from x y z x y z 0 from cost to x y z x y z ∞ ∞ ∞ ∞ ∞ cost to x y z x y z ∞ ∞ ∞ 7 1 0 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 time x z 1 2 7 y node x table node y table node z table Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3 3 2
  • 33. Advanced Computer Networks x y z x y z 0 2 7 ∞ ∞ ∞ ∞ ∞ ∞ from cost to from from x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z ∞ ∞ ∞ ∞ ∞ cost to x y z x y z 0 2 7 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 3 from cost to x y z x y z 0 2 7 from cost to x y z x y z ∞ ∞ ∞ 7 1 0 cost to ∞ 2 0 1 ∞ ∞ ∞ 2 0 1 7 1 0 2 0 1 7 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 2 0 1 3 1 0 time x z 1 2 7 y node x table node y table node z table Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2 Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3
  • 34. Advanced Computer Networks Distance Vector: link cost changes Link cost changes:  node detects local link cost change  updates routing info, recalculates distance vector  if DV changes, notify neighbors x z 1 4 50 y 1 At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t2, y receives z‟s update and updates its distance table. y‟s least costs do not change and hence y does not send any message to z.
  • 35. Advanced Computer Networks Distance Vector: link cost changes Link cost changes:  good news travels fast  bad news travels slow - “count to infinity” problem!  44 iterations before algorithm stabilizes Poisoned reverse:  If Z routes through Y to get to X :  Z tells Y its (Z‟s) distance to X is infinite (so Y won‟t route to X via Z)  will this completely solve count to infinity problem? x z 1 4 50 y 60
  • 36. Advanced Computer Networks Comparison of LS and DV algorithms Message complexity • LS: with n nodes, E links, O(nE) msgs sent • DV: exchange between neighbors only – convergence time varies Speed of Convergence • LS: O(n2) algorithm requires O(nE) msgs – may have oscillations • DV: convergence time varies – may be routing loops – count-to-infinity problem Robustness: what happens if router malfunctions? LS: – node can advertise incorrect link cost – each node computes only its own table DV: – DV node can advertise incorrect path cost – each node‟s table used by others • error propagate thru network
  • 37. Class Work • Consider the network shown below, and assume that each node initially knows the cost to each of its neighbors. Consider the distance-vector algorithm and show the distance table entries at node E. Advanced Computer Networks
  • 38. Advanced Computer Networks Intra-AS Routing • An intra-AS routing protocol is used to determine how routing is performed within an autonomous system (AS) • also known as Interior Gateway Protocols (IGP) • most common Intra-AS routing protocols of Internet: – RIP: Routing Information Protocol – OSPF: Open Shortest Path First – IGRP: Interior Gateway Routing Protocol
  • 39. Inter-AS routing • Different routing protocols on each AS • Different metrics in each AS • The AS‟s didn't trust each other • routes are growing very fast • The point of Border Gateway Protocol (BGP) is to route traffic between AS‟s which didn‟t trust each other Advanced Computer Networks
  • 40. Advanced Computer Networks Border Gateway Protocol (BGP) • BGP provides each AS a means to: 1. Obtain subnet reachability information from neighboring ASs 2. Propagate reachability information to all AS-internal routers 3. Determine “good” routes to subnets based on reachability information and policy • allows subnet to advertise its existence to rest of Internet: “I am here” • If it weren't for BGP, each subnet would be isolated-alone and unknown by the rest of the Internet
  • 41. Advanced Computer Networks BGP basics  Pairs of routers (BGP peers) exchange routing info over TCP connections: BGP sessions  BGP session that spans two ASs: external BGP (eBGP) session  BGP session between routers in the same AS: internal BGP (iBGP) session  BGP sessions need not correspond to physical links.  when AS2 advertises a prefix to AS1:  AS2 promises it will forward datagrams towards that prefix.  AS2 can aggregate prefixes in its advertisement 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b 3c eBGP session iBGP session
  • 42. Advanced Computer Networks Distributing reachability info • using eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1. – 1c can then use iBGP do distribute new prefix info to all routers in AS1 – 1b can then re-advertise new reachability info to AS2 over 1b-to-2a eBGP session • when router learns of new prefix, it creates entry for prefix in its forwarding table. 3b 1d 3a 1c 2a AS3 AS1 AS2 1a 2c 2b 1b 3c eBGP session iBGP session
  • 43. Advanced Computer Networks Path attributes & BGP routes • advertised prefix includes BGP attributes. – prefix + attributes = “route” • two important attributes: – AS-PATH: contains ASs through which prefix advertisement has passed: e.g, AS67, AS17 – NEXT-HOP: indicates specific internal-AS router to next-hop AS. (may be multiple links from current AS to next-hop-AS) • when gateway router receives route advertisement, uses import policy to accept/decline.
  • 44. Advanced Computer Networks BGP route selection • router may learn about more than one route to some prefix. Router must select route. • Elimination rules: 1. local preference value attribute: policy decision 2. shortest AS-PATH 3. closest NEXT-HOP router 4. additional criteria
  • 45. Advanced Computer Networks BGP messages • BGP messages exchanged using TCP. • BGP messages: – OPEN: opens TCP connection to peer and authenticates sender – UPDATE: advertises new path (or withdraws old) – KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request – NOTIFICATION: reports errors in previous msg; also used to close connection
  • 46. Advanced Computer Networks BGP routing policy  A,B,C are provider networks  X,W,Y are customer (of provider networks)  X is dual-homed: attached to two networks  X does not want to route from B via X to C  .. so X will not advertise to B a route to C A B C W X Y legend: customer network: provider network
  • 47. Advanced Computer Networks BGP routing policy • A advertises path AW to B • B advertises path BAW to X • Should B advertise path BAW to C? • No way! B gets no “revenue” for routing CBAW since neither W nor C are B‟s customers • B wants to force C to route to w via A • B wants to route only to/from its customers! A B C W X Y legend: customer network: provider network
  • 48. Advanced Computer Networks Why different Intra- and Inter-AS routing ? Policy: • Inter-AS: admin wants control over how its traffic routed, who routes through its net. • Intra-AS: single admin, so no policy decisions needed Scale: • hierarchical routing saves table size, reduced update traffic Performance: • Intra-AS: can focus on performance • Inter-AS: policy may dominate over performance