Understanding Network Layer Functions
Understanding Network Layer Functions
Network Layer
Computer
Networking: A Top
Down Approach
Dr. Dayanand J. 6th edition
Jim Kurose, Keith Ross
Professor CSE Dept.
network network
data link data link
physical physical
network
data link
physical
application
network transport
data link network
network
physical data link
network data link
physical
data link physical
physical
routing algorithm
value in arriving
packet’s header
0111 1
3 2
call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host address)
every router on source-dest path maintains “state” for each passing
connection
link, router resources (bandwidth, buffers) may be allocated to VC
(dedicated resources = predictable service)
12 22 32
1 3
2
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
application
5. Data flow begins 6. Receive data application
transport
4. Call connected 3. Accept call transport
network
1. Initiate call 2. incoming call network
data link
data link
physical
physical
application
application
transport
transport
network
1. Send data 2. Receive data network
data link
data link
physical
physical
otherwise 3
Examples
Physical layer:
bit-level reception
Data link layer: Decentralized switching:
given datagram dest., lookup output port using
e.g., Ethernet
see chapter 5 forwarding table in input port memory
goal: complete input port processing at ‘line speed’
queuing: if datagrams arrive faster than forwarding
rate into switch fabric
System Bus
Buffering required when datagrams arrive from fabric faster than the transmission rate
Scheduling discipline chooses among queued datagrams for transmission
buffering when arrival rate via switch exceeds output line speed
queueing (delay) and loss due to output port buffer overflow!
Link layer
physical layer
223 1 1 1
Recipe
To determine the subnets,
detach each interface from
its host or router, creating
islands of isolated networks.
Each isolated network is
called a subnet.
[Link]/24
[Link]
[Link] [Link]
[Link] [Link]
[Link] [Link]
[Link] [Link]
subnet host
part part
11001000 00010111 00010000 00000000
[Link]/23
Network Layer 4-42
IP addresses: how to get one?
A DHCP [Link]
[Link]
server
[Link]
[Link] [Link]
B
[Link] arriving DHCP
[Link] [Link] E client needs
address in this
[Link] [Link]
network
DHCP offer
src: [Link], 67
dest: [Link], 68
yiaddrr: [Link]
transaction ID: 654
Lifetime: 3600 secs
DHCP request
src: [Link], 68
dest:: [Link], 67
yiaddrr: [Link]
transaction ID: 655
time Lifetime: 3600 secs
DHCP ACK
src: [Link], 67
dest: [Link], 68
yiaddrr: [Link]
transaction ID: 655
Lifetime: 3600 secs
Organization 0
[Link]/23
Organization 1
“Send me anything
[Link]/23 with addresses
Organization 2 beginning
[Link]/23 . Fly-By-Night-ISP [Link]/20”
.
. . Internet
.
Organization 7 .
[Link]/23
“Send me anything
ISPs-R-Us
with addresses
beginning
[Link]/16”
“Send me anything
with addresses
Organization 2 beginning
[Link]/23 . Fly-By-Night-ISP [Link]/20”
.
. . Internet
.
Organization 7 .
[Link]/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning [Link]/16
or [Link]/23”
[Link]/23
[Link]
[Link]
[Link]
[Link]
2. connection to
relay initiated 1. connection to
by client relay initiated
[Link]
by NATted host
3. relaying
Client
established
[Link] NAT
router
A B E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
data data
A-to-B: E-to-F:
B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside
IPv4 IPv4
Network Layer 4-68
Chapter 4: Network Layer
4. 1 Introduction 4.5 Routing algorithms
4.2 Virtual circuit and Link state
Distance Vector
datagram networks
Hierarchical routing
4.3 What’s inside a router
4.6 Routing in the Internet
4.4 IP: Internet Protocol
RIP
Datagram format
OSPF
IPv4 addressing
BGP
ICMP
4.7 Broadcast and multicast
IPv6
routing
routing algorithm
value in arriving
packet’s header
0111 1
3 2
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) }
5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y
v w
u z
x y
Oscillations possible:
e.g., link cost = amount of carried traffic
1 A A A A
1+e 2+e 0 0 2+e 2+e 0
D 0 0 B D B D B D B
1+e 1 0 0 1+e 1
0 e 0 0 1 1+e 0 e
1
C C C C
1
e
… recompute … recompute … recompute
initially
routing
Network Layer 4-79
Chapter 4: Network Layer
4. 1 Introduction 4.5 Routing algorithms
4.2 Virtual circuit and Link state
Distance Vector
datagram networks
Hierarchical routing
4.3 What’s inside a router
4.6 Routing in the Internet
4.4 IP: Internet Protocol
RIP
Datagram format
OSPF
IPv4 addressing
BGP
ICMP
4.7 Broadcast and multicast
IPv6
routing
Then
dx(y) = min
v {c(x,v) + dv(y) }
Distributed:
each node notifies neighbors only recompute estimates
when its DV changes
neighbors then notify their
neighbors if necessary
if DV to any dest has changed, notify
neighbors
from
y ∞ ∞ ∞ y 2 0 1
z ∞ ∞ ∞ z 7 1 0
node y table
cost to
x y z y
2 1
x ∞ ∞ ∞
x z
from
y 2 0 1 7
z ∞ ∞ ∞
node z table
cost to
x y z
x ∞∞ ∞
from
y ∞ ∞ ∞
z 7 1 0
time
Network Layer 4-86
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
node x table = min{2+1 , 7+0} = 3
cost to cost to cost to
x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
from
from
y ∞ ∞ ∞ y 2 0 1 y 2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0
node y table
cost to cost to cost to
x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7
from x 0 2 3 x z
from
from
y 2 0 1 y 2 0 1 y 7
2 0 1
z ∞ ∞ ∞ z 7 1 0 z 3 1 0
node z table
cost to cost to cost to
x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from
from
from
y y 2 0 1 y 2 0 1
∞ ∞ ∞
z z 3 1 0 z 3 1 0
7 1 0
time
Network Layer 4-87
Distance Vector: link cost changes
Link cost changes: 1
node detects local link cost change y
4 1
updates routing info, recalculates
x z
distance vector 50
if DV changes, notify neighbors
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1 forwarding table configured
by both intra- and inter-AS
routing algorithm
Intra-AS Inter-AS
Routing Routing
intra-AS sets entries for
algorithm algorithm
internal dests
Forwarding inter-AS & intra-As sets entries
table
for external dests
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
Network Layer 4-95
Example: Setting forwarding table in router 1d
3c
… x
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b AS1
1d
Network Layer 4-96
Example: Choosing among multiple ASes
now suppose AS1 learns from inter-AS protocol that subnet x is
reachable from AS3 and from AS2.
to configure forwarding table, router 1d must determine towards
which gateway it should forward packets for dest x.
this is also job of inter-AS routing protocol!
3c … x …
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
1d AS1
u destination hops
v
u 1
A B w v 2
w 2
x 3
x y 3
z C D z 2
y
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Routing/Forwarding table in D
C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z BA 75
x -- 1
…. …. ....
Routing/Forwarding table in D Network Layer 4-105
RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link declared
dead
routes via neighbor invalidated
new advertisements sent to neighbors
neighbors in turn send out new advertisements (if tables
changed)
link failure info quickly (?) propagates to entire net
poison reverse used to prevent ping-pong loops (infinite
distance = 16 hops)
routed routed
Transprt Transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical
eBGP session
3c iBGP session
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
Network Layer 4-115
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.
eBGP session
3c iBGP session
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b
AS1 1d
Network Layer 4-116
Path attributes & BGP routes
advertised prefix includes BGP attributes.
prefix + attributes = “route”
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!
Network Layer 4-121
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
duplicate
duplicate
R1 creation/transmission R1
duplicate
R2 R2
R3 R4 R3 R4
source in-network
duplication duplication
A A
B B
c c
D D
F E F E
G G
(a) Broadcast initiated at A (b) Broadcast initiated at D
A A
3
B B
c c
4
2
D D
F E F E
1 5
G G
(a) Stepwise construction of (b) Constructed spanning tree
spanning tree
Network Layer 4-127
Multicast Routing: Problem Statement
Goal: find a tree (or trees) connecting routers having
local mcast group members
tree: not all paths between routers used
source-based: different tree from each sender to rcvrs
shared-tree: same tree used by all group members
S: source LEGEND
R1 2
1 R4 router with attached
group member
R2 5
router with no attached
3 4
R5 group member
R3 6 i link used for forwarding,
R6 R7 i indicates order link
added by algorithm
Reverse Path Forwarding
S: source LEGEND
LEGEND
Dense: Sparse:
group members densely # networks with group members
packed, in “close” small wrt # interconnected
proximity. networks
bandwidth more plentiful group members “widely
dispersed”
bandwidth not plentiful
Consequences of Sparse-Dense Dichotomy:
Dense Sparse:
group membership by routers no membership until routers
assumed until routers explicitly join
explicitly prune receiver- driven construction of
data-driven construction on mcast tree (e.g., center-based)
mcast tree (e.g., RPF) bandwidth and non-group-
bandwidth and non-group- router processing conservative
router processing profligate
PIM- Dense Mode