0% found this document useful (0 votes)
11 views

CommunicationAndNetworking2-Chapter1-Part1

The 'Communication and Networking 2' course is designed for computer science engineers to understand network communication, troubleshoot systems, and learn about various networking concepts essential for roles in cloud computing, cybersecurity, and IoT. The course covers topics such as the OSI model, routing protocols, network security, and the structure of networks, with a focus on practical applications and hands-on labs. It aims to equip students with the knowledge necessary to manage and secure interconnected systems effectively.

Uploaded by

Mohi Gpt4
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)
11 views

CommunicationAndNetworking2-Chapter1-Part1

The 'Communication and Networking 2' course is designed for computer science engineers to understand network communication, troubleshoot systems, and learn about various networking concepts essential for roles in cloud computing, cybersecurity, and IoT. The course covers topics such as the OSI model, routing protocols, network security, and the structure of networks, with a focus on practical applications and hands-on labs. It aims to equip students with the knowledge necessary to manage and secure interconnected systems effectively.

Uploaded by

Mohi Gpt4
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
You are on page 1/ 75

Communication and

Networking 2

Pr. Hajar El Hammouti

2
Why Communication and Networking Course is Relevant to a
Computer Science Engineer?

Pr. Hajar El Hammouti Communications & Networking 2 3


Motivation

- Knowledge of networks is critical for domains like:

• Cloud Computing: Managing interconnected cloud resources.

• Cybersecurity: Protecting data transmitted across networks.

• IoT (Internet of Things): Connecting and managing smart devices.

• AI and Big Data: Handling massive data transfers efficiently.

• Companies across industries rely on networked systems to design, secure, and


maintain their solutions over the network.

• Roles such as Network Engineer, System Administrator, and Cloud Architect are
directly related to networking.

Pr. Hajar El Hammouti Communications & Networking 2 4


Motivation

- The main idea behind the course is:

- To understand how devices communicate over the network.

- To set the foundations of Internet.

- To troubleshoot communication systems.

Pr. Hajar El Hammouti Communications & Networking 2 5


Brief Reminder from Communications and Networking 1

What is a network?

What does the OSI model stand for?

What is the OSI model used for?

What is a protocol?

How long is the IPv4 address?

What are the classes of IPv4 addresses?

Pr. Hajar El Hammouti Communications & Networking 2 6


Brief Reminder from Communication and Networking 1

OSI Model

Pr. Hajar El Hammouti Communications & Networking 2 7


Brief Reminder from Communication and Networking 1

OSI Model
Provides a user interface to access the network (e.g., URL in the browser),
7) Application Layer example of protocol: HTTP, HTTPs, DNS translation (name into IP)
Presentation of the data: Translates from one format of the data to another, encrypts (using
6) Presentation Layer TLS protocol or SSL), or compresses data for the application layer in preparation for the data
to be sent).
Starts the network functionality, manages sessions/sockets or connections between
5) Session Layer
devices, defines which protocol to be used in the transport layer, session number is
defined.
4) Transport Layer Ensures reliable data transfer, flow control, and error recovery (e.g. TCP and UDP).
(Structures the data into Segments)
3) Network Layer Manages routing, forwarding, and logical addressing to determine the best path
for data. (Packets)

2) Data Link Layer Adds the Ethernet header, Handles error detection, error correction, and framing for
data packets. (Frames)
Concerned with the physical transmission of raw data bits over a medium (e.g.,
1) Physical Layer
cables, wireless signals). (Bits)

Pr. Hajar El Hammouti Communications & Networking 2 8


Objectives of this Course

Routing, within the same Autonomous System (AS) and between


7) Application Layer different AS (Dynamic Routing, different routing protocols with
advantages and disadvantages).
6) Presentation Layer What is SDN ? And How does it help in routing?

5) Session Layer ICMP (Internet Control Message Protocol): protocol that detects
errors in routing and help troubleshooting the network
4) Transport Layer

3) Network Layer

2) Data Link Layer

1) Physical Layer

Pr. Hajar El Hammouti Communications & Networking 2 9


Communications and Networking 2

What are the Objectives of this Course?

Pr. Hajar El Hammouti Communications & Networking 2 10


Objectives of this Course

7) Application Layer Review multiple access schemes (channel


partitionning, random access, taking turns)
6) Presentation Layer LANs, VLANs (MPLS)

5) Session Layer Putting it all together: how this actually work


when we request a web page on the
4) Transport Layer Internet?

3) Network Layer

2) Data Link Layer

1) Physical Layer

Pr. Hajar El Hammouti Communications & Networking 2 11


Objectives of this Course

7) Application Layer Wireless: Infrastructure, wave


propagation, WLAN

6) Presentation Layer Cellular Networks 4G, 5G

5) Session Layer Mobility is handled in cellular


networks
4) Transport Layer

3) Network Layer

2) Data Link Layer

1) Physical Layer

Pr. Hajar El Hammouti Communications & Networking 2 12


Objectives of this Course

Network Security
7) Application Layer

6) Presentation Layer
• Message integrity, authentication
• Securing e-mail
5) Session Layer
• Securing TCP connections: TLS
• Network layer security: IPsec
4) Transport Layer • Security in wireless and mobile networks
• Operational security: firewalls and IDS (intrusion
3) Network Layer detection system)

2) Data Link Layer

1) Physical Layer

Pr. Hajar El Hammouti Communications & Networking 2 13


Structure of the Course

Typical Week
- 1h30 Lecture Lecturer and TAs:

- Hajar El Hammouti
- 1h30 Lab/Project
- Abdoulkarim Saliah
- Assane Sankara
Weights of Exams
Office Hours:
- Mid-term: 30%
- Wednesdays 5pm-6pm
- Final Exam: 40%

- Lab: 10%

- Project: 20%

Pr. Hajar El Hammouti Communications & Networking 2 14


Chapter1: Network Layer-
Dynamic Routing

15
Everything Needed to Connect Devices Together

Modem Router Switch Hub Repeater Home Network


router Internet
Card

Pr. Hajar El Hammouti Communications & Networking 2 16


Everything Needed to Connect Devices Together

Components of router

Router Ethernet

Network Fast Ethernet


CPU Memory
Interfaces

Gigabit Ethernet
RAM LAN
10 Gigabit Ethernet
ROM Serial
WAN
Flash ISDN
NVRAM Console

Pr. Hajar El Hammouti Communications & Networking 2 17


Context

Assume this computer


would like to communicate
with a far away computer,
how the packets will find
their way to the destination?

Pr. Hajar El Hammouti Communications & Networking 2 18


Routing Protocols

mobile network
Routing protocol goal: determine “good” national or global ISP
paths (equivalently, routes), from sending
hosts to receiving host, through network of
routers application
transport
network
link
path: sequence of routers packets traverse physical
network network

from given initial source host to final link


physical
link
physical

destination host network


link network

“good”: least “cost”, “fastest”, “least physical link


physical network
link datacenter
congested” physical network

application
transport
network
enterprise link
network physical

Pr. Hajar El Hammouti Communications & Networking 2 19


Routing Protocols

Output of a Routing Protocol: Forwarding table


- It stores the next hop to which the packet should be sent.

Forwarding table

Range of IP
v w
0 1 Addresses to be Forwarding Port
u reached
3 2

x 198.0.0.0 à 194.0.0.0 - Port 1


- ….. -…
- …. -…

Pr. Hajar El Hammouti Communications & Networking 2 20


Routing- Graph Abstraction

5 - ca,b: cost of direct link connecting a and b


v 3 w e.g., cw,z = 5, cu,z = ∞
2 5
- Cost defined by network operator: could
u 2 1 z
3 be related to throughput, congestion,
1
x y 2 delay…
1

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) }

Pr. Hajar El Hammouti Communications & Networking 2 21


Classification of Routing Algorithms

Global Vs Decentralized Static Vs Dynamic Intra vs Inter domain/AS

Global: all routers have complete Static: routes do not Intra: Interior routing
topology, link cost info change over time withing the same
• “link state” algorithms autonomous system

Decentralized: iterative process of Dynamic: routes change more Inter: Exterior routes between
computation, exchange of info with quickly AS
neighbors • periodic updates or in
• routers initially only know link response to link cost
costs to attached neighbors changes
• “distance vector” algorithms

Pr. Hajar El Hammouti Communications & Networking 2 22


Network Layer: Control Plane Vs Data Plane

Control Plane Data Plane


- Decides how data is managed, routed, and - Is responsible for the actual moving of data.
processed
- Forwarding the packets following the
- Decides how packets should be routed. instructions of the control plane

- Uses protocols to communicate between


different systems, mostly common routing
protocols like BGP, OSPF…

Pr. Hajar El Hammouti Communications & Networking 2 23


Link State: Dijkstra Routing Algorithm

Pr. Hajar El Hammouti Communications & Networking 2 24


Link State: Dijkstra Routing Algorithm

notation
§ Centralized: network topology, link
costs known to all nodes § cx,y: direct link cost from
node x to y; = ∞ if not direct
• accomplished via “link state neighbors
broadcast”
• all nodes have same info
§ D(v): current estimate of
cost of least-cost-path from
§ Computes least cost paths from one source to destination v
node (“source”) to all other nodes § p(v): predecessor node
• gives forwarding table for that node along path from source to v
§ Iterative: iterative process § N': set of nodes whose
least-cost-path definitively
known

Pr. Hajar El Hammouti Communications & Networking 2 25


Link State: Dijkstra Routing Algorithm
1 Initialization:
2 N' = {u} /* compute least cost path from u to all other nodes */
3 for all nodes v
4 if v adjacent to u /* u initially knows direct-path-cost only to direct neighbors */
5 then D(v) = cu,v /* but may not be minimum cost! */
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) + cw,v )
13 /* new least-path-cost to v is either old least-cost-path to v or known
14 least-cost-path to w plus direct-cost from w to v */
15 until all nodes in N'

Pr. Hajar El Hammouti Communications & Networking 2 26


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1
2
3
4
5

5 Initialization (step 0):


For all a: if a adjacent to u then D(a) = cu,a
v 3 w
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 27


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux
2
3
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 28


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2
3
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5 11 update D(b) for all b adjacent to a and not in N' :
u 2 1 z D(b) = min ( D(b), D(a) + ca,b )
3
1 2 D(v) = min ( D(v), D(x) + cx,v ) = min(2, 1+2) = 2
x y
1 D(w) = min ( D(w), D(x) + cx,w ) = min (5, 1+3) = 4
D(y) = min ( D(y), D(x) + cx,y ) = min(inf,1+1) = 2
Pr. Hajar El Hammouti Communications & Networking 2 29
Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy
3
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 30


Link State: Dijkstra Routing Algorithm

Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)


0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5 11 update D(b) for all b adjacent to a and not in N' :
u 2 1 z D(b) = min ( D(b), D(a) + ca,b )
3
1
x y 2 D(w) = min ( D(w), D(y) + cy,w ) = min (4, 2+1) = 3
1 D(z) = min ( D(z), D(y) + cy,z ) = min(inf,2+2) = 4
Pr. Hajar El Hammouti Communications & Networking 2 31
Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 32


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5 11 update D(b) for all b adjacent to a and not in N' :
u 2 1 z D(b) = min ( D(b), D(a) + ca,b )
3
1
x y 2 D(w) = min ( D(w), D(v) + cv,w ) = min (3, 2+3) = 3
1

Pr. Hajar El Hammouti Communications & Networking 2 33


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 34


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5 11 update D(b) for all b adjacent to a and not in N' :
u 2 1 z D(b) = min ( D(b), D(a) + ca,b )
3
1
x y 2 D(z) = min ( D(z), D(w) + cw,z ) = min (4, 3+5) = 4
1

Pr. Hajar El Hammouti Communications & Networking 2 35


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5
u 2 1 z
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 36


Link State: Dijkstra Routing Algorithm

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz
8 Loop
5 9 find a not in N' such that D(a) is a minimum
v 3 w
10 add a to N'
2 5 11 update D(b) for all b adjacent to a and not in N' :
u 2 1 z D(b) = min ( D(b), D(a) + ca,b )
3
1 2
x y
1

Pr. Hajar El Hammouti Communications & Networking 2 37


Link State: Dijkstra Routing Algorithm

v 3 w
2 5
u 2 1 z
3
1 2
x y
1

resulting least-cost-path tree from u: resulting forwarding table in u:


destination outgoing link
v w
v (u,v) route from u to v directly
u z x (u,x)
y (u,x) route from u to all
x y w (u,x) other destinations
x (u,x) via x

Pr. Hajar El Hammouti Communications & Networking 2 38


Link State: Dijkstra Routing Algorithm

v w x y z
D(v), D(w), D(x), D(y), D(z), x
9
Step N' p(v) p(w) p(x) p(y) p(z)

0 u 7,u 3,u 5,u ∞ ∞ 5 7


4
1 uw 6,w 5,u 11,w ∞ 8
2 uwx 6,w 11,w 14,x 3 w y z
u
2
3 uwxv 10,v 14,x
3
4 uwxvy 12,y 7 4

5 uwxvyz v

Pr. Hajar El Hammouti Communications & Networking 2 39


Link State: Dijkstra Routing Algorithm-Discussion

What is the complexity of Djikstra algorithm ?

Pr. Hajar El Hammouti Communications & Networking 2 40


Link State: Dijkstra Routing Algorithm-Discussion

algorithm complexity: n nodes


§ each of n iteration: need to check all nodes, w, not in N
§ O(n2) complexity
§ more efficient implementations possible: O(nlogn)
message complexity:
§ each router must broadcast its link state information to other n-1 routers
§ efficient (and interesting!) broadcast algorithms: O(n) link crossings to
disseminate a broadcast message from one source
§ each router’s message crosses O(n) links: overall message complexity: O(n2)

Pr. Hajar El Hammouti Communications & Networking 2 41


Vector Distance: Bellman Ford Algorithm

Pr. Hajar El Hammouti Communications & Networking 2 42


Vector Distance: Bellman Ford Algorithm

Based on Bellman-Ford (BF) equation :


Bellman-Ford equation

Let Dx(y): cost of least-cost path from x to y (also


called distance vector).
Then:
Dx(y) = minv { cx,v + Dv(y) }

v’s estimated least-cost-path cost to y


min taken over all neighbors v of x direct cost of link from x to v

Pr. Hajar El Hammouti Communications & Networking 2 43


Vector Distance: Bellman Ford Algorithm

key idea:
§ from time-to-time, each node sends its own distance vector
estimate to neighbors
§ when x receives new DV estimate from any neighbor, it updates its
own DV using B-F equation:
Dx(y) ← minv{cx,v + Dv(y)} for each node y ∊ N

§ the estimate Dx(y) converge to the actual least cost dx(y)

Pr. Hajar El Hammouti Communications & Networking 2 44


Vector Distance: Bellman Ford Algorithm

Advantages:
Iterative, asynchronous: each local iteration caused by:
§ local link cost change
§ DV update message from neighbor

Distributed, self-stopping: each node notifies neighbors only when its


DV changes
§ neighbors then notify their neighbors – only if necessary
§ no notification received, no actions taken!

Pr. Hajar El Hammouti Communications & Networking 2 45


Vector Distance: Bellman Ford Algorithm

DV in a:
Da(a)=0
Da(b) = 8
Da(c) = ∞ a b c
Da(d) = 1 8 1
Da(e) = ∞
t=0 Da(f) = ∞
1 1
Da(g) = ∞
Da(h) = ∞
§ All nodes have Da(i) = ∞
distance
estimates to A few asymmetries:
d e f § missing link
nearest 1 1
neighbors (only) § larger cost
§ All nodes send
their local 1 1 1
distance vector
to their neighbors
g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 46


Vector Distance: Bellman Ford Algorithm

a b c
8 1

t=1 1 1
All nodes:
§ receive distance
vectors from
neighbors d e f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 47


Vector Distance: Bellman Ford Algorithm

a
compute compute
b compute
c
8 1

t=1 1 1
All nodes:
§ receive distance
vectors from
neighbors d
compute compute
e compute
f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g
compute h
compute compute
i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 48


Vector Distance: Bellman Ford Algorithm

a b c
8 1

t=1 1 1
All nodes:
§ receive distance
vectors from
neighbors d e f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 49


Vector Distance: Bellman Ford Algorithm

a b c
8 1

t=2 1 1
All nodes:
§ receive distance
vectors from
neighbors d e f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 50


Vector Distance: Bellman Ford Algorithm

compute
a compute
b compute
c
2 1

t=2 1 1
All nodes:
§ receive distance
vectors from
neighbors compute
d compute
e compute
f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g
compute compute
h compute
i
8 1

Pr. Hajar El Hammouti Communications & Networking 2 51


Vector Distance: Bellman Ford Algorithm

a b c
8 1

t=2 1 1
All nodes:
§ receive distance
vectors from
neighbors d e f
§ compute their 1 1
new local
distance vector
§ send their new 1 1 1
local distance
vector to
neighbors
g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 52


Vector Distance: Bellman Ford Algorithm

And so on….

1 1

Pr. Hajar El Hammouti Communications & Networking 2 53


DV in b: DV in c:
Vector Distance: Bellman Ford Algorithm Dc(a) = ∞
Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Example of DV Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a:
computations Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b c
8 1 Dc(g) = ∞
Da(d) = 1
Dc(h) = ∞
Da(e) = ∞
t=0 Da(f) = ∞
1 1
Dc(i) = ∞
Da(g) = ∞
§ b receives DVs Da(h) = ∞ DV in e:
from a, c, e Da(i) = ∞ De(a) = ∞
De(b) = 1
d e f De(c) = ∞
1 1 De(d) = 1
De(e) = 0
De(f) = 1
1 1 1 De(g) = ∞
De(h) = 1
De(i) = ∞

g h i
1 1

Pr. Hajar El Hammouti Communications & Networking 2 54


DV in b: DV in c:
Vector Distance: Bellman Ford Algorithm Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a:
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b
compute c Dc(g) = ∞
Da(d) = 1 8 1
Dc(h) = ∞
Da(e) = ∞
t=1 Da(f) = ∞
1 1
Dc(i) = ∞
Da(g) = ∞
§ b receives DVs Da(h) = ∞ DV in e:
from a, c, e, Da(i) = ∞ De(a) = ∞
computes: e
De(b) = 1
d e f De(c) = ∞
1
Db(a) = min{cb,a+Da(a), cb,c +Dc(a), cb,e+De(a)} = min{8,∞,∞} =8 1 De(d) = 1
Db(c) = min{cb,a+Da(c), cb,c +Dc(c), c b,e +De(c)} = min{∞,1,∞} = 1 De(e) = 0
Db(d) = min{cb,a+Da(d), cb,c +Dc(d), c b,e +De(d)} = min{9,2,∞} = 2 De(f) = 1
1 1 1 De(g) = ∞
Db(e) = min{cb,a+Da(e), cb,c +Dc(e), c b,e +De(e)} = min{∞,∞,1} = 1
DV in b: De(h) = 1
Db(f) = min{cb,a+Da(f), cb,c +Dc(f), c b,e +De(f)} = min{∞,∞,2} = 2 De(i) = ∞
Db(g) = min{cb,a+Da(g), cb,c +Dc(g), c b,e+De(g)} = min{∞, ∞, ∞} = ∞ Db(a) = 8 Db(f) =2
g D (c) = 1 Db(g)
i =∞
1
Db(h) = min{cb,a+Da(h), cb,c +Dc(h), c b,e+De(h)} = min{∞, ∞, 2} = 2 h 1Db(d) = 2
b Db(h) = 2
Db(i) = min{cb,a+Da(i), cb,c +Dc(i), c b,e+De(i)} = min{∞, ∞, ∞} = ∞ Db(e) = 1 Db(i) = ∞
Pr. Hajar El Hammouti Communications & Networking 2 55
DV in b: DV in c:
Vector Distance: Bellman Ford Algorithm
Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in a:
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
Da(c) = ∞ a b c
8 1 Dc(g) = ∞
Da(d) = 1
Dc(h) = ∞
Da(e) = ∞
t=1 Da(f) = ∞
1 1
Dc(i) = ∞
Da(g) = ∞
§ c receives DVs Da(h) = ∞ DV in e:
from b Da(i) = ∞ De(a) = ∞
De(b) = 1
d e f De(c) = ∞
1 1 De(d) = 1
De(e) = 0
De(f) = 1
1 1 1 De(g) = ∞
De(h) = 1
De(i) = ∞

g h i
1 1
Pr. Hajar El Hammouti Communications & Networking 2 56
DV in b: DV in c:
Vector Distance: Bellman Ford Algorithm Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
Db(e) = 1 Db(i) = ∞ Dc(d) = ∞
Dc(e) = ∞
Dc(f) = ∞
a b c
compute Dc(g) = ∞
8 1
Dc(h) = ∞

t=1 1 1
Dc(i) = ∞

§ c receives DVs
from b
computes:
Dc(a) = min{cc,bd+Db(a}} = 1 + 8 = 9 e f
DV in c:
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Dc(a) = 9
Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Dc(d) = 2
Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞
Dc(e) = ∞
Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ Dc(f) = ∞
g +Db(h)} = 1+ ∞ = ∞
Dc(h) = min{cbc,b h Dc(g) = ∞ i
Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞ Dc(h) = ∞
Dc(i) = ∞
Pr. Hajar El Hammouti Communications & Networking 2 57
DV in b:
Vector Distance: Bellman Ford Algorithm Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞
Db(d) = ∞ Db(h) = ∞ DV in e:
DV in d: Db(e) = 1 Db(i) = ∞
De(a) = ∞
Dc(a) = 1 De(b) = 1
Dc(b) = ∞ a De(c) = ∞
Dc(c) = ∞
b c
8 1 De(d) = 1
Dc(d) = 0 De(e) = 0
t=1 Dc(e) = 1
Dc(f) = ∞
Q: what is new DV computed in e De(f) = 1
1 at1 t=1? De(g) = ∞
§ e receives DVs Dc(g) = 1 De(h) = 1
from b, d, f, h Dc(h) = ∞ De(i) = ∞
Dc(i) = ∞
d compute
e f DV in f:
DV in h: 1 1
Dc(a) = ∞
Dc(a) = ∞ Dc(b) = ∞
Dc(b) = ∞ Dc(c) = ∞
Dc(c) = ∞ 1 1 1 Dc(d) = ∞
Dc(d) = ∞ Dc(e) = 1
Dc(e) = 1 Dc(f) = 0
Dc(f) = ∞ Dc(g) = ∞
Dc(g) = 1 g h i Dc(h) = ∞
1 1
Dc(h) = 0 Dc(i) = 1
Dc(i) = 1
Pr. Hajar El Hammouti Communications & Networking 2 58
Vector Distance: Bellman Ford Algorithm
Iterative communication, computation steps diffuses information through network:
t=0 c’s state at t=0 is at c only
a b c
8 1
c’s state at t=0 has propagated to b, and
t=1 may influence distance vector
computations up to 1 hop away, i.e., at b 1 1 t=1
t=2
c’s state at t=0 may now influence
t=2 distance vector computations up to 2
hops away, i.e., at b and now at a, e as well d e f
1 1

c’s state at t=0 may influence distance


t=3
vector computations up to 3 hops away, 1 1 1 t=3
i.e., at d, f, h
c’s state at t=0 may influence distance
t=4
vector computations up to 4 hops away, g
1
h 1 i
t=4
i.e., at g, i
Pr. Hajar El Hammouti Communications & Networking 2 59
Vector Distance: Link cost changes

link cost changes:


§ node detects local link cost change
§ updates routing info, recalculates local DV
§ if DV changes, notify neighbors

1
y
4 1

x z
50

Pr. Hajar El Hammouti Communications & Networking 2 60


Vector Distance: Link cost changes

1
link cost changes: y
4 1
§ node detects local link cost change x z
50
§ updates routing info, recalculates local DV
§ if DV changes, notify neighbors

t0 : y detects link-cost change, updates its DV, informs its neighbors.


“good news t1 : z receives update from y, updates its DV, computes new least
travels fast” cost to x , sends its neighbors its DV.
t2 : y receives z’s update, updates its DV. y’s least costs do not
change, so y does not send a message to z.

Pr. Hajar El Hammouti Communications & Networking 2 61


Vector Distance: Link cost changes

DV in Y:
Dy(x) = 4
Dy(z) = 1
Dy(y) = 0
DV in X: DV in Z:
t=t_0 Dx(y) = 4
Dx(z) = 5 y Dz(x) = 5
Dz(y) = 1
§ The DV algorithm Dx(x) = 0 4 1 Dz(z) = 0
has converged
x z
50

Pr. Hajar El Hammouti Communications & Networking 2 62


Vector Distance: Link cost changes

DV in Y:
Dy(x) = 4 1
Dy(z) = 1
Dy(y) = 0
DV in X: DV in Z:
1
t=t_0+1 Dx(y) = 4 1
Dx(z) = 5 y Dz(x) = 5
Dz(y) = 1
§ The cost of the Dx(x) = 0 4 1 Dz(z) = 0
link between x
and y goes down x z
to 1
50
§ X and Y update
their DV

Pr. Hajar El Hammouti Communications & Networking 2 63


Vector Distance: Link cost changes

Updated DV vector
DV in Y:
Dy(x) = min (Dy(x) , DV in Y:
t=t_0+2 Dz(x)+ Cyz)=
min(1,5+1)=1 Dy(x) = 4 1
Dy(z) = 1 Updated DV
§ The updated DV Dy(y) = 0
Dy(z) = min (Dy(z), vector
are sent to Z Dx(z)+Cxy)=min(1,1+1
DV in X: DV in Z: DV in Z:
0)=1
§ X Y and Z
Dx(y) = 4 1
1
recompute their Dx(z) = 5 Dy(y) = 0 y Dz(x) = 5 Dz(x) = min (Dz(x),
DV Updated DV vector Dz(y) = 1 Dy(x)+ Cyz)=
Dx(x) = 0 4 1 Dz(z) = 0 min(5,1+1)=2
DV in x:
Dx(y) = min (Dx(y) ,
x z Dz(y) = min (Dz(y),
Dx(y)+Cxz)=min(1,1+5
Dx(z)+ Cxz)= 50
0)=1
min(1,1+50)=1
Dz(z) = 0
Dx(z) = min (Dx(z),
Dx(y)+Cxy)=min(1,1+5
0)=1

Dx(x) = 0
Pr. Hajar El Hammouti Communications & Networking 2 64
Vector Distance: Link cost changes

link cost changes:


§ node detects local link cost change

60
y
4 1

x z
50

Pr. Hajar El Hammouti Communications & Networking 2 65


Vector Distance: Link cost changes

DV in Y:
Dy(x) = 4 Via xy
Dy(z) = 1 Via yz
Dy(y) = 0 local
DV in X: DV in Z:
t=t_0 Dx(y) = 4 Via xy
Dx(z) = 5 Via xy y Dz(x) = 5 Via yz
Dz(y) = 1 Via yz
§ The DV algorithm Dx(x) = 0 4 1 Dz(z) = 0 local
has converged local

x z
50

Pr. Hajar El Hammouti Communications & Networking 2 66


Vector Distance: Link cost changes

DV in Y:
Dy(x) = 4 60 Via xy
Dy(z) = 1 Via yz
Dy(y) = 0 local
DV in X: DV in Z:
t=t_0+1 Dx(y) = 4 60 Via xy
Dx(z) = 5 61 Via xy 60 y Dz(x) = 5 Via yz
Dz(y) = 1 Via yz
§ The cost of the Dx(x) = 0 local 4 1 Dz(z) = 0 local
link between x
and y goes up to x z
60
50 z does not update
§ X and Y update because it has not
their DV received the
Dx(z) becomes 61, because x knows updates yet
that initially z was reached through y
and now the link with y has a cost of 60

Pr. Hajar El Hammouti Communications & Networking 2 67


Vector Distance: Link cost changes
DV in Y:
Dy(x) = min (Dy(x) ,
Dz(x)+ Cyz)=
min(60,5+1)=6 DV in Y:
t=t_0+2 Dy(z) = min (Dy(z), Dy(x) = 60 Via xy
§ The routers send Dx(z)+Cxy)=min(1,61+ Dy(z) = 1 Via yz
their updated vectors 60)=1 Dy(y) = 0 local
§ X Y and Z DV in X: Dy(y) = 0 DV in Z:
recompute their Dx(y) =60 Via xy
Dz(x) = 5 Via yz
DV Dx(z) = 61 Via xy y Dz(y) = 1 Via yz
Dx(x) = 0 local 1 Dz(z) = 0
60 local
DV in x:
x z DV in Z:
Dx(y) = min (Dx(y) ,
Dx(z)+ Cxz)= 50 Dz(x) = min (Dz(x),
min(60,61+50)=60 Dy(x)+ Cyz)=
min(5,60+1)=5
Dx(z) = min (Dx(z),
Dy(z)+Cxy)=min(61,1+ Dz(y) = min (Dz(y),
60)=61 Dx(y)+Cxz)=min(1,60+
50)=1
Dx(x) = 0 Dz(z) = 0

Pr. Hajar El Hammouti Communications & Networking 2 68


Vector Distance: Link cost changes

DV in Y:
t=t_0+2 Dy(x) = 6 Via zy
§ The updated vectors Dy(z) = 1 Via yz
become Dy(y) = 0 local
§ X Y and Z DV in X: DV in Z:
recompute their Dx(y) =60 Via xy
Dz(x) = 5 Via yz
DV Dx(z) = 61 Via xy y Dz(y) = 1 Via yz
Dx(x) = 0 local 1 Dz(z) = 0
60 local

x z
50

Pr. Hajar El Hammouti Communications & Networking 2 69


Vector Distance: Link cost changes

DV in Z:
DV in Y:
t=t_0+3 Dy(x) = 6 Via zy
Dz(x) =7 Via yz
Dz(y) = 1 Via yz
§ The updated vectors Dy(z) = 1 Via yz Dz(z) = 0 local
are sent again Dy(y) = 0 local
§ X Y and Z DV in X: DV in Z:
recompute their Dx(y) =60 Via xy
Dz(x) = 5 Via yz
DV Dx(z) = 61 Via xy y Dz(y) = 1 Via yz
Dx(x) = 0 local 1 Dz(z) = 0
60 local

x z
50
Z notices that in order to reach x, it should
Nothing changes at go through y. However, the distance from
the level of X and Y y to x is Dy(x)=6, so the value Dz(x) = 5
(even if they run cannot be true since it goes through y =>
computations) this distance is replaced by the cost to
reach y + Dy(x)= 7
Pr. Hajar El Hammouti Communications & Networking 2 70
Vector Distance: Link cost changes

Y notices that in order to reach x, it should go


through z. However, the distance from z to x is DV in Y:
Dz(x)=7, so the value Dy(x) = 6 cannot be true DV in Y:
t=t_0+3 (because Dy(x) should be greater than Dz(x)
Dy(x) = 6 Via zy
Dz(x) =8 Via yz
Dz(y) = 1 Via yz
)since it goes true z => this distance is Dy(z) = 1 Via yz
Dz(z) = 0 local
replaced by the cost to reach z + Dz(x)= 8 Dy(y) = 0 local
DV in X: DV in Z:
§ The updated vectors
are sent again Dx(y) =60 Via xy
Dz(x) = 7 Via yz
Dx(z) = 61 Via xy y Dz(y) = 1
§ X Y and Z Via yz
Dx(x) = 0 local 1 Dz(z) = 0
recompute their 60 local
DV
x z
50
This process is repeated
Nothing changes at until the distance between x
the level of Z and and z is updated with its real
YX(even if they run value 50, and then the
computations) routes are recomputed
correctly
Pr. Hajar El Hammouti Communications & Networking 2 71
Vector Distance: Link cost changes

60
link cost changes: y
4 1
§ node detects local link cost change x z
50
§ “bad news travel slow” – count-to-infinity problem:
• y sees direct link to x has new cost 60, but z has said it has a path at cost of 5. So y
computes “my new cost to x will be 6, via z); notifies z of new cost of 6 to x.
• z learns that path to x via y has new cost 6, so z computes “my new cost
to x will be 7 via y), notifies y of new cost of 7 to x.
• y learns that path to x via z has new cost 7, so y computes “my new cost
to x will be 8 via y), notifies z of new cost of 8 to x.
• z learns that path to x via y has new cost 8, so z computes “my new cost
to x will be 9 via y), notifies y of new cost of 9 to x.

Pr. Hajar El Hammouti Communications & Networking 2 72


Vector Distance: Link cost changes

• What is the solution of Bad News Travel Slow?

Pr. Hajar El Hammouti Communications & Networking 2 73


Vector Distance: Link cost changes

• How does Poison


Reverse(unreachable strategy) work DV in Y:
to avoid the count to infinity?
Dy(x) = 4 Infinity Unreachable
Dy(z) = 1 Via yz
Dy(y) = 0 local
DV in X: DV in Z:
t=t_0+1 Dx(y) = 4 Infinity Unreachable
Dx(z) = 5 61 50 60 y Dz(x) = 5 Via yz
Dz(y) = 1 Via yz
§ The cost of the Dx(x) = 0 local 4 1 Dz(z) = 0 local
link between x
and y goes up to x z
60
50 At the next slot, z will notice
§ X and Y update that x is unreachable
their DV through y , and therefore it
will switch to the direct link
with x which costs 50

Pr. Hajar El Hammouti Communications & Networking 2 74


Comparison between Link State and Vector Distance

Time complexity robustness: which one between


LS: O(n2) algorithm, O(n2) LS and DV is less robust to
messages (improved version of malicious routers?
nlog n)
DV:
DV: Under fixed/stable network
(no failure), what is the speed of • DV router can advertise incorrect
convergence? path cost (“I have a really low-cost
path to everywhere”): black-holing
• A malicious router can manipulate
the count-to-infinity problem by
continuously increasing hop counts,
delaying convergence indefinitely.

Pr. Hajar El Hammouti Communications & Networking 2 75

You might also like