CommunicationAndNetworking2-Chapter1-Part1
CommunicationAndNetworking2-Chapter1-Part1
Networking 2
2
Why Communication and Networking Course is Relevant to a
Computer Science Engineer?
• Roles such as Network Engineer, System Administrator, and Cloud Architect are
directly related to networking.
What is a network?
What is a protocol?
OSI Model
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)
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
1) Physical Layer
3) Network Layer
1) Physical Layer
3) Network Layer
1) Physical Layer
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)
1) Physical Layer
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%
15
Everything Needed to Connect Devices Together
Components of router
Router Ethernet
Gigabit Ethernet
RAM LAN
10 Gigabit Ethernet
ROM Serial
WAN
Flash ISDN
NVRAM Console
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
application
transport
network
enterprise link
network physical
Forwarding table
Range of IP
v w
0 1 Addresses to be Forwarding Port
u reached
3 2
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) }
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
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
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
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
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
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
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
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
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
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
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
v 3 w
2 5
u 2 1 z
3
1 2
x y
1
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)
5 uwxvyz v
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
Advantages:
Iterative, asynchronous: each local iteration caused by:
§ local link cost change
§ DV update message from neighbor
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
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
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
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
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
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
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
And so on….
1 1
g h i
1 1
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
1
y
4 1
x z
50
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
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
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
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
60
y
4 1
x z
50
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
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
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
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
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.
…