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

Lecture 5 - Network Layer - 2019

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Lecture 5 - Network Layer - 2019

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

Lecture 5

Network Layer

Computer Networks
The slides are made by J.F Kurose and K.W. Ross,
adapted by Phuong Vo

Network Layer 5-1


Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-2


Network layer
application

❖ transport segment from transport


network

sending to receiving host data link


physical
network network

❖ on sending side network


data link
data link
physical
data link
physical

encapsulates segments physical network


data link
network
data link

into datagrams physical physical

❖ on receiving side, delivers network


data link
network
data link

segments to transport
physical physical
network
data link

layer network
physical
application
transport
❖ network layer protocols network
data link
physical
network
data link
network
data link

in every host, router data link


physical
physical physical

❖ router examines header


fields in all IP datagrams
passing through it
Network Layer 5-3
Network service model
Q: What service model for “channel” transporting
datagrams from sender to receiver?
example services for example services for a flow
individual datagrams: of datagrams:
❖ guaranteed delivery ❖ in-order datagram
❖ guaranteed delivery with delivery
less than 40 msec delay ❖ guaranteed minimum
bandwidth to flow
❖ restrictions on changes in
inter-packet spacing

Network Layer 5-4


Two key network-layer functions

network-layer functions: analogy: taking a trip


❖forwarding: move packets ▪ forwarding: process of
from router’s input to getting through single
appropriate router output interchange
❖routing: determine route
taken by packets from ▪ routing: process of
source to destination planning trip from source
▪ routing algorithms to destination

Network Layer: Data Plane 4-5


Network layer: data plane, control plane

Data plane Control plane


▪ local, per-router function ▪ network-wide logic
▪ determines how datagram ▪ determines how datagram is
arriving on router input routed among routers along
port is forwarded to end-end path from source host
router output port to destination host
▪ forwarding function ▪ two control-plane approaches:
• traditional routing algorithms:
values in arriving
packet header implemented in routers
• software-defined networking
0111 1
(SDN): implemented in
(remote) servers
2
3

Network Layer: Data Plane 4-6


Per-router control plane
Individual routing algorithm components in each and every
router interact in the control plane

Routing
Algorithm
control
plane

data
plane

values in arriving
packet header
0111 1
2
3

Network Layer: Control Plane 5-7


Logically centralized control plane
A distinct (typically remote) controller interacts with local
control agents (CAs)

Remote Controller

control
plane

data
plane

CA
CA CA CA CA
values in arriving
packet header

0111 1
2
3

Network Layer: Control Plane 5-8


Network service model
Q: What service model for “channel” transporting
datagrams from sender to receiver?
example services for example services for a flow
individual datagrams: of datagrams:
▪ guaranteed delivery ❖ in-order datagram
▪ guaranteed delivery with delivery
less than 40 msec delay ❖ guaranteed minimum
bandwidth to flow
❖ restrictions on changes in
inter-packet spacing

Network Layer: Data Plane 4-9


Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-10


Router architecture overview
❖ high-level view of generic router architecture:
routing, management
routing control plane (software)
processor operates in millisecond
time frame
forwarding data plane
(hardware) operttes in
nanosecond
timeframe
high-seed
switching
fabric

router input ports router output ports

Network Layer: Data Plane 4-11


Input port functions
lookup,
link forwarding
line layer switch
termination protocol fabric
(receive)
queueing

physical layer:
bit-level reception
data link layer: decentralized switching:
e.g., Ethernet ❖ using header field values, lookup output
see chapter 5 port using forwarding table in input port
memory (“match plus action”)
❖ goal: complete input port processing at
‘line speed’
❖ queuing: if datagrams arrive faster than
forwarding rate into switch fabric
Network Layer: Data Plane 4-12
Input port functions
lookup,
link forwarding
line layer switch
termination protocol fabric
(receive)
queueing

physical layer:
bit-level reception
decentralized switching:
data link layer: ❖ using header field values, lookup output
e.g., Ethernet port using forwarding table in input port
see chapter 5 memory (“match plus action”)
❖ destination-based forwarding: forward based
only on destination IP address (traditional)
❖ generalized forwarding: forward based on
any set of header field values

Network Layer: Data Plane 4-13


Datagram forwarding table
Destination Address Range Link Interface

11001000 00010111 00010000 00000000


through 0
11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000


through 1
11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000


through 2
11001000 00010111 00011111 11111111

otherwise 3

Network Layer 5-14


Longest prefix matching
longest prefix matching
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.

Destination Address Range Link interface

11001000 00010111 00010*** ********* 0

11001000 00010111 00011000 ********* 1

11001000 00010111 00011*** ********* 2

otherwise 3

examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer 5-15
Router architecture overview
two key router functions:
❖ run routing algorithms/protocol (RIP, OSPF, BGP)
❖ forwarding datagrams from incoming to outgoing link

forwarding tables computed, routing


pushed to input ports routing, management
processor
control plane (software)

forwarding data
plane (hardware)

high-speed
switching
fabric

router input ports router output ports


Network Layer 5-16
Switching fabrics
❖ transfer packet from input buffer to appropriate
output buffer
❖ switching rate: rate at which packets can be
transfer from inputs to outputs
▪ often measured as multiple of input/output line rate
▪ N inputs: switching rate N times line rate desirable
❖ three types of switching fabrics

memory

memory bus crossbar

Network Layer 5-17


Output port queueing

switch
switch
fabric
fabric

at t, packets more one packet time later


from input to output

❖ buffering when arrival rate via switch exceeds


output line speed
❖ queueing (delay) and loss due to output port buffer
overflow!
Network Layer 5-18
Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-19


The Internet network layer
host, router network layer functions:

transport layer: TCP, UDP

routing protocols IP protocol


• path selection • addressing conventions
• RIP, OSPF, BGP • datagram format
network • packet handling conventions
layer forwarding
table
ICMP protocol
• error reporting
• router
“signaling”
link layer

physical layer

Network Layer 5-20


IP datagram format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
(variable length, list of routers
❖ 20 bytes of TCP
typically a TCP to visit.
❖ 20 bytes of IP
or UDP segment)
❖ = 40 bytes + app
layer overhead

Network Layer 5-21


IP fragmentation, reassembly
❖ network links have MTU
(max.transfer size) -
largest possible link-level fragmentation:
frame


in: one large datagram
▪ different link types, out: 3 smaller datagrams
different MTUs
❖ large IP datagram divided
(“fragmented”) within net reassembly
▪ one datagram becomes
several datagrams
▪ “reassembled” only at …
final destination
▪ IP header bits used to
identify, order related
fragments
Network Layer 5-22
IP fragmentation, reassembly
length ID fragflag offset
example: =4000 =x =0 =0
❖ 4000 byte datagram
one large datagram becomes
❖ MTU = 1500 bytes several smaller datagrams

1480 bytes in length ID fragflag offset


data field =1500 =x =1 =0

offset = length ID fragflag offset


1480/8 =1500 =x =1 =185

length ID fragflag offset


=1040 =x =0 =370

Network Layer 5-23


Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-24


Directly Connected Networks
and the IP Routing Table(*)
192.168.2.0/24 172.16.0.0/16 192.168.1.0/24 10.0.0.0/8
RTA RTB RTC
e0 s0 s0 s1 s1 e0

.1 .1 .2 .1 .2 .1

RTA#show ip route
Codes: C - connected,.. <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0

RTB#show ip route
Codes: C - connected,.. <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.1.0/24 is directly connected, Serial1

RTC#show ip route
Codes: C - connected,.. <Other codes and gateway information omitted>
C 10.0.0.0/8 is directly connected, Ethernet0
C 192.168.1.0/24 is directly connected, Serial1

(*)This slide and next 05 slides is from CCNA 3.0 curriculum. Network Layer 5-25
Directly Connected Networks
and the IP Routing Table
192.168.2.0/24 172.16.0.0/16 192.168.1.0/24 10.1.0.0/16
RTA RTB RTC
e0 s0 s0 s1 s1 e0

.1 .1 .2 .1 .2 .1
RTA#show ip route
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
RTA#ping 172.16.0.1
!!!!!

RTA#ping 172.16.0.2
!!!!!

RTA#ping 192.168.1.1
.....

RTA#ping 192.168.1.2
.....

RTA#ping 10.1.0.1
.....

Network Layer 5-26


Static Routing
Router(config)#ip route destination-prefix destination-
prefix-mask {address | interface} [distance] [tag tag]
[permanent]

Network Layer 5-27


Static Routing
192.168.2.0/24 172.16.0.0/16 192.168.1.0/24 10.1.0.0/16
RTA RTB RTC
e0 s0 s0 s1 s1 e0

.1 .1 .2 .1 .2 .1

RTA(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2

Network/subnet route
Intermediate-Address
RTA#show ip route (usually “next-hop”)
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
S 192.168.1.0/24 [1/0] via 172.16.0.2
C 192.168.2.0/24 is directly connected, Ethernet0

Network Layer 5-28


Static Routing
192.168.2.0/24 172.16.0.0/16 192.168.1.0/24 10.1.0.0/16
RTA RTB RTC
e0 s0 s0 s1 s1 e0

.1 .1 .2 .1 .2 .1

RTA(config)#ip route 192.168.1.0 255.255.255.0 serial 0

Network/subnet route
Outgoing interface
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
S 192.168.1.0/24 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0

Network Layer 5-29


Common uses for Static Routes
Default

10.1.1.1/24
ISP

ip route 172.16.0.0 255.255.0.0 10.1.1.2


10.1.1.2/24

ip route 0.0.0.0 0.0.0.0 10.1.1.1 172.16.0.0/16


RTB#show ip route
Gateway of last resort is 10.1.1.1 to network 0.0.0.0
C 172.16.0.0/16 is directly connected, Ethernet0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1
S* 0.0.0.0/0 [1/0] via 10.1.1.1

❖ Any packets not matching the routes 172.16.0.0/16 or 10.1.1.0/24 are sent to the router 10.1.1.1
– where it is now their “problem.” Network Layer 5-30
Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-31


Graph abstraction
5

v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
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) }

aside: graph abstraction is useful in other network contexts, e.g.,


P2P, where N is set of peers and E is set of TCP connections

Network Layer 5-32


Graph abstraction: costs
5
c(x,x’) = cost of link (x,x’)
3 e.g., c(w,z) = 5
v w 5
2
u cost could always be 1, or
2
3
1 z inversely related to bandwidth,
1 2 or related to congestion
x 1
y

cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

key question: what is the least-cost path between u and z ?


routing algorithm: algorithm that finds that least cost path

Network Layer 5-33


Routing algorithm classification
Q: global or decentralized Q: static or dynamic?
information?
static:
global: ❖ routes change slowly over
❖ all routers have complete time
topology, link cost info dynamic:
❖ “link state” algorithms ❖ routes change more
decentralized: quickly
❖ router knows physically- ▪ periodic update
connected neighbors, link ▪ in response to link
costs to neighbors cost changes
❖ iterative process of
computation, exchange of
info with neighbors
❖ “distance vector” algorithms
Network Layer 5-34
Chapter 5: outline
5.1 Overview of Network 5.4 static routing
layer 5.5 routing algorithms
▪ data plane ▪ link state
▪ control plane ▪ distance vector
5.2 What’s inside a router ▪ hierarchical routing
5.3 IP: Internet Protocol 5.6 routing in the Internet
datagram format ▪ RIP
▪ datagram format ▪ OSPF
▪ fragmentation ▪ BGP

Network Layer 5-35


A Link-State Routing Algorithm
Dijkstra’s algorithm notation:
❖ net topology, link costs ❖ c(x,y): link cost from
known to all nodes node x to y; = ∞ if not
▪ accomplished via “link state direct neighbors
broadcast” ❖ D(v): current value of
▪ all nodes have same info cost of path from source
❖ computes least cost paths to dest. v
from one node (‘source”) ❖ p(v): predecessor node
to all other nodes along path from source to
▪ gives forwarding table for v
that node ❖ N': set of nodes whose
❖ iterative: after k least cost path definitively
iterations, know least cost known
path to k dest.’s
Network Layer 5-36
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'

Network Layer 5-37


Dijkstra’s algorithm: example
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9

notes: 5 7
4
❖ construct shortest path tree by
tracing predecessor nodes 8
❖ ties can exist (can be broken u 3 w y z
arbitrarily) 2
3
7 4
v
Network Layer 5-38
Dijkstra’s algorithm: another 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

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

Network Layer 5-39


Dijkstra’s algorithm: example (2)
resulting shortest-path tree from u:

v w
u z
x y

resulting forwarding table in u:


destination link
v (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Network Layer 5-40
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
❖ each iteration: need to check all nodes,
w, not in N
❖ n(n+1)/2 comparisons: O(n2)

❖ more efficient implementations


possible: O(nlogn)

Network Layer 5-41


Example
1) Find the shortest paths from the source node A
to the other nodes using Dijkstra’s algorithm in the
following network topology? (Show all steps
towards your solution.)

2) Draw the shortest-path tree?


Network Layer 5-42
Chapter 5: outline
5.1 introduction 5.5 static routing
5.2 virtual circuit and 5.6 routing algorithms
datagram networks ▪ link state
5.3 what’s inside a router ▪ distance vector
5.4 IP: Internet Protocol ▪ hierarchical routing
▪ datagram format 5.7 routing in the Internet
▪ DHCP ▪ RIP
▪ ICMP ▪ OSPF
▪ IPv6 ▪ BGP

Network Layer 5-43


Distance vector algorithm
Bellman-Ford equation (dynamic programming)

let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min
v
{c(x,v) + dv (y) }

cost from neighbor v to destination y


cost to neighbor v of x

min taken over all neighbors v of x


Network Layer 5-44
Bellman-Ford example
5
3
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
x y
1 c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding table
Network Layer 5-45
Distance vector algorithm
❖ Dx(y) = estimate of least cost from x to y
▪ x maintains distance vector Dx = [Dx(y): y є N ]
❖ node x:
▪ knows cost to each neighbor v: c(x,v)
▪ maintains its neighbors’ distance vectors. For
each neighbor v, x maintains
Dv = [Dv(y): y є N ]

Network Layer 5-46


Distance vector algorithm
key idea:
❖ from time-to-time, each node sends its own
distance vector estimate to neighbors
❖ when 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)

Network Layer 5-47


Distance vector algorithm
iterative, asynchronous: each node:
each local iteration
caused by:
❖ local link cost change wait for (change in local link
cost or msg from neighbor)
❖ DV update message from
neighbor
distributed: recompute estimates
❖ each node notifies
neighbors only when its
DV changes if DV to any dest has
▪ neighbors then notify their changed, notify neighbors
neighbors if necessary

Network Layer 5-48


Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to
table x y z x y z
x 0 2 7 x 0 2 3

from
from

y ∞∞ ∞ y 2 0 1
z ∞∞ ∞ z 7 1 0

node y cost to
table x y z y
2 1
x ∞ ∞ ∞
x z
from

y 2 0 1 7
z ∞∞ ∞

node z cost to
table x y z
x ∞∞ ∞
from

y ∞∞ ∞
z 7 1 0
time
Network Layer 5-49
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

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 2 0 1 7

from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0

node z cost to cost to cost to


table x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from

y 2 0 1 y 2 0 1
from

y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Network Layer 5-50
Distance vector: link cost changes
link cost changes: 1
❖ node detects local link cost change 4
y
1
❖ updates routing info, recalculates x z
distance vector 50
❖ if DV changes, notify neighbors
❖ e.g. , focus on the y’s and z’s entries to
destination x:
“good t0 : y detects link-cost change, updates its DV, informs its
news neighbors.
travels t1 : z receives update from y, updates its table, computes new
fast” least cost to x , sends its neighbors its DV.

t2 : y receives z’s update, updates its distance table. y’s least costs
do not change, so y does not send a message to z.

Network Layer 5-51


Distance vector: link cost changes
link cost changes: 60
❖ node detects local link cost change 4
y
1
❖ 44 iterations before algorithm x z
stabilizes: see text 50
❖ bad news travels slow - “count to
infinity” problem!
poisoned reverse:
❖ If Z gets to X via Y :
▪ 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?

Network Layer 5-52


Comparison of LS and DV algorithms
message complexity robustness: what happens if
❖ LS: with n nodes, E links, O(nE) router malfunctions?
msgs sent LS:
❖ DV: exchange between neighbors ▪ node can advertise incorrect
only link cost
▪ convergence time varies ▪ each node computes only its
own table
speed of convergence DV:
❖ LS:O(n2) algorithm requires
O(nE) msgs ▪ DV node can advertise
incorrect path cost
▪ may have oscillations
▪ each node’s table used by
❖ DV: convergence time varies others
▪ may be routing loops • error propagate thru
▪ count-to-infinity problem network

Network Layer 5-53


Oscillations with delay-
based/congestion link metric
oscillations possible:
❖ e.g., support link cost equals amount of carried
traffic:
(for any routing protocols with delay-based/congestion link
metric)

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
1 C C C
1
e
given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing….
resulting in new costs resulting in new costs resulting in new costs

Network Layer 5-54


Chapter 5: outline
5.1 introduction 5.5 static routing
5.2 virtual circuit and 5.6 routing algorithms
datagram networks ▪ link state
5.3 what’s inside a router ▪ distance vector
5.4 IP: Internet Protocol ▪ hierarchical routing
▪ datagram format 5.7 routing in the Internet
▪ DHCP ▪ RIP
▪ ICMP ▪ OSPF
▪ IPv6 ▪ BGP

Network Layer 5-55


Hierarchical routing
our routing study thus far - idealization
❖ all routers identical
❖ network “flat”
… not true in practice

scale: with 600 million administrative autonomy


destinations: ❖ internet = network of
❖ can’t store all dest’s in networks
routing tables! ❖ each network admin may
❖ routing table exchange want to control routing in
would swamp links! its own network

Network Layer 5-56


Hierarchical routing
❖ aggregate routers into gateway router:
regions, “autonomous ❖ at “edge” of its own AS
systems” (AS) ❖ has link to router in
❖ routers in same AS another AS
run same routing
protocol
▪ “intra-AS” routing
protocol
▪ routers in different AS
can run different intra-
AS routing protocol

Network Layer 5-57


Interconnected ASes

3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b AS1
1d ❖ forwarding table
configured by both intra-
and inter-AS routing
Intra-AS Inter-AS algorithm
Routing Routing
algorithm algorithm ▪ intra-AS sets entries
Forwarding
for internal dests
table ▪ inter-AS & intra-AS
sets entries for
external dests
Network Layer 5-58
Inter-AS tasks
❖ suppose router in AS1 AS1 must:
receives datagram 1. learn which dests are
destined outside of AS1: reachable through AS2,
▪ router should forward which through AS3
packet to gateway 2. propagate this
router, but which one? reachability info to all
routers in AS1
job of inter-AS routing!

3c
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 5-59


Example: setting forwarding table in router 1d
❖ suppose AS1 learns (via inter-AS protocol) that subnet x
reachable via AS3 (gateway 1c), but not via AS2
▪ inter-AS protocol propagates reachability info to all internal
routers
❖ router 1d determines from intra-AS routing info that its
interface I is on the least cost path to 1c
▪ installs forwarding table entry (x,I)

3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 5-60


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
which gateway it should forward packets towards for dest x
▪ this is also job of inter-AS routing protocol!

3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
Network Layer 5-61
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!
❖ hot potato routing: send packet towards closest of two
routers.

use routing info determine from


learn from inter-AS hot potato routing: forwarding table the
from intra-AS
protocol that subnet choose the gateway interface I that leads
protocol to determine
x is reachable via that has the to least-cost gateway.
costs of least-cost
multiple gateways smallest least cost Enter (x,I) in
paths to each
of the gateways forwarding table

Network Layer 5-62


Chapter 5: outline
5.1 introduction 5.5 static routing
5.2 virtual circuit and 5.6 routing algorithms
datagram networks ▪ link state
5.3 what’s inside a router ▪ distance vector
5.4 IP: Internet Protocol ▪ hierarchical routing
▪ datagram format 5.7 routing in the Internet
▪ DHCP ▪ RIP
▪ ICMP ▪ OSPF
▪ IPv6 ▪ BGP

Network Layer 5-63


Intra-AS Routing
❖ also known as interior gateway protocols (IGP)
❖ most common intra-AS routing protocols:
▪ RIP: Routing Information Protocol
▪ OSPF: Open Shortest Path First
▪ IGRP: Interior Gateway Routing Protocol
(Cisco proprietary)

Network Layer 5-64


RIP ( Routing Information Protocol)
❖ included in BSD-UNIX distribution in 1982
❖ distance vector algorithm
▪ distance metric: # hops (max = 15 hops), each link has cost 1
▪ DVs exchanged with neighbors every 30 sec in response message (aka
advertisement)
▪ each advertisement: list of up to 25 destination subnets (in IP addressing
sense)

from router A to destination subnets:


u v subnet hops
w u 1
A B
v 2
w 2
x x 3
z C D y 3
y z 2
Network Layer 5-65
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
z B 7
x -- 1
…. …. ....
Network Layer 5-66
RIP: example
A-to-D advertisement
dest next hops
w - 1
x - 1
z C 4
…. … ... 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
…. …. ....
Network Layer 5-67
RIP: link failure, 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)

Network Layer 5-68


Basic RIP Configuration on Cisco’s
router(*)
❖ Specifying Networks:
Use the network
command to:
▪ Enable RIP on all
interfaces that belong to
this network
▪ Advertise this network
in RIP updates sent to
other routers every 30
seconds

(*)The following 4 slides are from Cisco’s CCNA 3.1.


Verification and Troubleshooting
❖ To verify and troubleshoot
routing
-show ip route
-show ip protocols
-debug ip rip
Verification and Troubleshooting
❖ Passive interface command: Used to prevent a
router from sending updates through an interface
Default Route and RIP
❖ Propagating the Default Route in RIP
❖ Default-information originate command
▪ used to specify that the router is to originate default
information, by propagating the static default route in
RIP.
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
❖ IS-IS routing protocol: nearly identical to OSPF

Network Layer 5-73


OSPF “advanced” features (not in RIP)
❖ security: all OSPF messages authenticated (to prevent
malicious intrusion)
❖ multiple same-cost paths allowed (only one path in
RIP)
❖ for each link, multiple cost metrics for different
Type-of-Service (TOS) (e.g., satellite link cost set
“low” for best effort ToS; high for real time ToS)
❖ integrated uni- and multicast support:
▪ Multicast OSPF (MOSPF) uses same topology data
base as OSPF
❖ hierarchical OSPF in large domains.

Network Layer 4-74


Hierarchical OSPF
boundary router
backbone router

backbone
area
border
routers

area 3

internal
routers
area 1
area 2

Network Layer 4-75


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.

Network Layer 4-76


Basic OSPF Configuration on
Cisco’s router

(*)The following 3 slides are from Cisco’s CCNA 3.1.


Basic OSPF Configuration on
Cisco’s router
Verifying OSPF Configuration
❖ show ip protocol
❖ show ip route
❖ show ip ospf interface
❖ show ip ospf
❖ show ip ospf neighbor detail
❖ show ip ospf database
Internet inter-AS routing: BGP
❖ BGP (Border Gateway Protocol): the de facto
inter-domain routing protocol
▪ “glue that holds the Internet together”
❖ BGP provides each AS a means to:
▪ eBGP: obtain subnet reachability information from
neighboring ASs.
▪ iBGP: propagate reachability information to all AS-
internal routers.
▪ determine “good” routes to other networks based on
reachability information and policy.
❖ allows subnet to advertise its existence to rest of
Internet: “I am here”
Network Layer 5-80
BGP basics
❖ BGP session: two BGP routers (“peers”) exchange BGP
messages:
▪ advertising paths to different destination network prefixes (“path vector”
protocol)
▪ exchanged over semi-permanent TCP connections

❖ when AS3 advertises a prefix to AS1:


▪ AS3 promises it will forward datagrams towards that prefix
▪ AS3 can aggregate prefixes in its advertisement

3c
BGP
3a message
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d

Network Layer 5-81


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

Network Layer 5-82


Path attributes and 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., AS 67, AS 17
▪ NEXT-HOP: indicates specific internal-AS router to next-
hop AS. (may be multiple links from current AS to next-
hop-AS)
❖ gateway router receiving route advertisement uses
import policy to accept/decline
▪ e.g., never route through AS x
▪ policy-based routing

Network Layer 5-83


BGP route selection
❖ router may learn about more than 1 route to
destination AS, selects route based on:
1. local preference value attribute: policy decision
2. shortest AS-PATH
3. closest NEXT-HOP router: hot potato routing
4. additional criteria

Network Layer 5-84


Why different Intra-, 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

Network Layer 5-85


Summary
5.1 introduction 5.5 static routing
5.2 virtual circuit and 5.6 routing algorithms
datagram networks ▪ link state
5.3 what’s inside a router ▪ distance vector
5.4 IP: Internet Protocol ▪ hierarchical routing
▪ DHCP, ICMP, IPv6 5.7 routing in the Internet
▪ RIP, OSPF, BGP

❖ understand principles behind network layer services:


▪ network layer service models, forwarding versus routing
how a router works, routing (path selection)
❖ instantiation, implementation in the Internet

Network Layer 5-86

You might also like