Protocol 145 239
Protocol 145 239
6 Presentation
5 Session
4 Transport Lecture IX
3.NETWORK LAYER
3 Network
2 Data Link
1 Physical
1- Static
2- Default
3- Dynamic
• Flooding routing.
other of changes.
• forwarding: move
packets from router’s
input to appropriate
router output
value in arriving
packet’s header
0111
2
1
3
Algorithems
B(A,2) C(B,3)
5 Session B 1 C
2
4 Transport A(-,-) 3 2 3
D(E,3)
2
A F(E,4)
3 Network D
1
1 F
E(A,2) 2
2 Data Link 2
E
1 Physical
A– E–D –F
A – E – F is the answer. (hops& cost)
Asst.Prof.Dr.Mohmed Shujaa 156
Example:Find the shortest path from a specified
source to all other destinations in the network.
6 Presentation 2. Flooding :
Packet to IMP C
5 Session Packet IMP Packet to IMP D
4 Transport B Packet to IMP E
To prevent packets from circulating indefinitely, a
3 Network packet has a hop counter. Every time a packet arrives
at an IMP, the hop counter is decrease by 1. Once the
hop counter of a packet reaches 0, the packet is
2 Data Link
discarded.
every incoming packet is sent out on every outgoing line
1 Physical except the one it arrived on.
2 Data Link
1 Physical
5
v 3 w
u 2 5z
2 3 1
graph: G = (N,E)
1 x y 2
1
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 is useful in other network contexts, e.g.,
P2P, where N is set of peers and E is set of TCP connections
LS. Algorithem
Dijkstra’s algorithm
• net topology, link costs known notation:
to all nodes
• c(x,y): link cost from
– accomplished via “link state node x to y; = ∞ if not
broadcast” direct neighbors
– all nodes have same info • D(v): current value of
• computes least cost paths from cost of path from source to
one node (‘source”) to all dest. v
other nodes • p(v): predecessor node
– gives forwarding table for along path from source to
that node v
• iterative: after k iterations, • N': set of nodes whose
know least cost path to k dest.’s least cost path definitively
known
Asst.Prof.Dr.Mohmed Shujaa 4-163
Link State Routing
1. Discover neighbors, learn network addresses.
2. Set distance/cost metric to each neighbor.
3. Construct packet telling all learned.
4. Send packet to, receive packets from other routers.
5. Compute shortest path to every other router.
v w
u z
x y
v (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x) Asst.Prof.Dr.Mohmed Shujaa 4-165
Dijkstra’s algorithm: example
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
5
v 3 w
u 2 5z
2 3 1
1 x y 2
1 Asst.Prof.Dr.Mohmed Shujaa 4-166
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
each iteration: need to check all nodes, w, not in N
n(n+1)/2 comparisons
oscillations possible:
e.g., support link cost equals amount of carried traffic:
given these costs, find new routing resulting in new costs
1
A 1+e A A A
2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0
C 0 1 1+e 0
C C C
1 1
e
initially
Asst.Prof.Dr.Mohmed Shujaa 4-167
Building Link State Packets
(a) A network. (b) The link state packets for this network.
Asst.Prof.Dr.Mohmed Shujaa 168
Lecture XII
D.V. Algorithm
from
from
y ∞ ∞ ∞ y 2 0 1
from
y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0
node y cost to cost to cost to
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from
from
y 2 0 1 y 7
from
2 0 1 y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0
from
from
y y 2 0 1 y 2 0 1
∞ ∞ ∞
z z 3 1 0 z 3 1 0
7 1 0
time
189
Asst.Prof.Dr.Mohmed
Shujaa
Lecture XIV
Network Protocols
messages.
and the hop count of the route is set to 16, which means the
becomes invalid.
z
w x y
A D B
C
routing table in router D
destination subnet next router # hops to dest
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Asst.Prof.Dr.Mohmed Shujaa 4-196
RIP: example
z
w x y
A D B
C
routing table in router D
destination subnet next router # hops to dest
w A 2
y B 2
A 5
z B 7
x -- 1
…. …. ....
Asst.Prof.Dr.Mohmed Shujaa 4-197
OSPF (Open Shortest Path First)
• “open”: publicly available
• uses link state algorithm
– LS packet dissemination
– topology map at each node
– route computation using Dijkstra’s algorithm
• OSPF advertisement carries one entry per neighbor
• advertisements flooded to entire AS
– carried in OSPF messages directly over IP (rather than TCP
or UDP
• security: all OSPF messages authenticated (to prevent
malicious intrusion)
• multiple same-cost paths allowed (only one path in RIP)
Asst.Prof.Dr.Mohmed Shujaa 4-198
Hierarchical OSPF
boundary router
backbone router
backbone
area
border
routers
area 3
internal
routers
area 1
area 2
Asst.Prof.Dr.Mohmed Shujaa 4-199
Hierarchical OSPF
• two-level hierarchy: local area, backbone.
– link-state advertisements only in area
– each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.
• area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.
• backbone routers: run OSPF routing limited to
backbone.
• boundary routers: connect to other AS’s.
An autonomous system
Asst.Prof.Dr.Mohmed Shujaa 201
OSPF—An Interior Gateway
Routing Protocol
• The IBGP used to connect different routers have same AS(same company)
• The EBGP used to connect different routers have different AS(different company)
3c
BGP
3a message
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Asst.Prof.Dr.Mohmed Shujaa 4-206
BGP basics: distributing path information
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.
eBGP session
3a iBGP session
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Asst.Prof.Dr.Mohmed Shujaa 4-207
BGP messages
DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP server!
dest: 255.255.255.255, 68
Here’s an IP address
yiaddrr: you can
223.1.2.4
use ID: 654
transaction
lifetime:
DHCP request
src: 0.0.0.0, 68
Broadcast: OK. I’ll take
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
that IP address!
transaction ID: 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
Broadcast: OK. You’ve
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
gottransaction
that IPID:address!
655
lifetime: 3600 secs
Asst.Prof.Dr.Mohmed Shujaa 4-211
DHCP: more than IP addresses
encapsulation of DHCP
DHCP DHCP server, frame forwarded
DHCP UDP to client, demuxing up to
DHCP IP DHCP at client
DHCP Eth router with DHCP
DHCP
Phy server built into client now knows its IP
router address, name and IP
address of DNS server, IP
address of its first-hop
router
…
in: one large datagram
frame out: 3 smaller datagrams
• large IP datagram divided
(“fragmented”) within net
– IP header bits used to reassembly
identify, order related
fragments
…
Transport Mode
Router Router
Tunnel Mode
IP protocols
Asst.Prof.Dr.Mohmed 4-234
Shujaa
IP Version 6
IPV6 is written in hexadecimal and
consists of 8 groups, consists 4 hex digits
Transport Protocols