3rd Edition: Chapter 2
Download
Report
Transcript 3rd Edition: Chapter 2
ECE/CS 372 – introduction to computer networks
Lecture 9
Announcements:
Chapter 4
Credit for lecture slides to Professor Bechir Hamdaoui
Adapted from Jim Kurose & Keith Ross (original copyright)
Chapter 4, slide: 1
Chapter 3: Recap
What we covered in chapter 3:
Transport layer services: required vs. available
• Reliability/Bandwidth/Timing/Security
Connectionless vs. connection-oriented
• TCP vs. UDP
Reliable data transfer
• ACK/Retransmit/RTT and Timeout
Flow control
• Sender should not overwhelm receiver’s buffer
Congestion control
• TCP Tahoe/Reno: Fast retransmit, slow start, congestion avoidance
Chapter 4, slide: 2
Chapter 4: Network Layer
Chapter goals:
understand principles behind network layer
services:
network layer service models
forwarding versus routing
subnetting and IP addressing
routing algorithms (path selection)
Chapter 4, slide: 3
Network layer
network layer protocols
run at
end systems &
routers
Sender side:
get segments from
transport layer
encapsulates segments
into IP datagrams
router examines header
fields in all IP datagrams
Receiver side:
application
transport
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
network
data link
data link
physical
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
application
transport
network
data link
physical
delivers segments to
transport layer
Chapter 4, slide: 4
Interplay between routing and forwarding
forwarding
table: a lookup
table for
figuring out
output port for
each input pkt
routing algorithm:
constructs routing
tables
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
forwarding process:
3
2
2
1
move pkts from input
to output
value in arriving
packet’s header
0111
Source
routing process: find
1
3 2
Destination
route taken by packets
from source to dest.
Chapter 4, slide: 5
Two Key Network-Layer Functions
forwarding: move
packets from router’s
input to appropriate
router output
routing: determine
route taken by
packets from source
to dest.
analogy:
routing: process of
planning trip from
source to dest
forwarding: process
of getting through
single interchange
routing algorithms
Chapter 4, slide: 6
Network service model
Q: What network services are needed/offered to
deliver datagrams from sender to receiver?
Example services for
individual datagrams:
Reliability
Guaranteed delivery
End-to-end delay
guaranteed delivery
within 40 msec delay
Example services for a flow
of datagrams:
In-order
in-order datagram delivery
Throughput
guaranteed minimum
bandwidth to flow
Jitter delay
restrictions on changes in
inter-packet spacing
Chapter 4, slide: 7
Network layer: connection and
connection-less services
Network-layer versus transport-layer services
Transport layer
Network layer
Service
Process to process Host to host
Choice
Reliable (TCP) and
unreliable (UDP)
Implementation Edge (Hosts)
Unreliable only
(Best effort)
Core (routers)
datagram network provides network-layer
connectionless service
Chapter 4, slide: 8
Datagram networks
no call setup at network layer
no state about end-to-end connections is kept in
routers
no network-level concept of “connection”
packets forwarded using dest. host address
packets (same source-dest pair) may take different paths
application
transport
network
data link 1. Send data
physical
application
transport
2. Receive data network
data link
physical
Chapter 4, slide: 9
Forwarding table
Destination Address Range
4 billion
possible entries
Link Interface
11001000 00010111 00010000 00000000
through
11001000 00010111 00010111 11111111
0
11001000 00010111 00011000 00000000
through
11001000 00010111 00011000 11111111
1
11001000 00010111 00011001 00000000
through
11001000 00010111 00011111 11111111
2
otherwise
3
Chapter 4, slide: 10
Longest prefix matching
Prefix Match
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise
Link Interface
0
1
2
3
Examples
DA: 11001000 00010111 00010110 10100001
Which interface?
DA: 11001000 00010111 00011000 10101010
Which interface?
Chapter 4, slide: 11
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 12
The Internet Network layer
Host, router network layer functions:
Transport layer: TCP, UDP
Network
layer
IP protocol
•addressing conventions
•datagram format
•packet handling conventions
Routing protocols
•path selection
•RIP, OSPF, BGP
forwarding
table
ICMP protocol
•error reporting
•router “signaling”
Link layer
physical layer
Chapter 4, slide: 13
IP Fragmentation & Reassembly
network links have MTU
(max.transfer size) - largest
possible link-level frame.
different link types,
different MTUs
fragmentation:
in: one large datagram
out: 3 smaller datagrams
large IP datagram divided
(“fragmented”) within net
one datagram becomes
several datagrams
“reassembled” only at final
destination
IP header bits used to
identify, order related
fragments
reassembly
Chapter 4, slide: 14
IP Fragmentation & Reassembly (ctd)
Example
4000 byte datagram
= 20 (header) + 3980 (data)
MTU = 1500 bytes
length ID fragflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
Chapter 4, slide: 15
IP Fragmentation & Reassembly (ctd)
Example
4000 byte datagram
= 20 (header) + 3980 (data)
MTU = 1500 bytes
length ID fragflag offset
=4000 =x
=0
=0
One large datagram becomes
several smaller datagrams
1480 bytes in
data field
offset =
1480/8
1040= 20 (header) + 1020 (data)
1020 (data) =3980 – 1480 -1480
length ID fragflag offset
=1500 =x
=1
=0
length ID fragflag offset
=1500 =x
=1
=185
length ID fragflag offset
=1040 =x
=0
=370
Chapter 4, slide: 16
IP Addressing: introduction
IP address: 32-bit
identifier for
223.1.1.1 = 11011111 00000001 00000001 00000001
host,
router interface
223
1
1
1
223.1.1.1
interface: connection
between host/router and
physical link
multiple interfaces per
router
one interface per host
one IP address per
interface
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.3.1
223.1.2.9
223.1.3.27
223.1.2.2
223.1.3.2
Chapter 4, slide: 17
Subnets
IP address:
subnet part (higher bits)
host part (lower bits)
subnet
part
host
part
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
11001000 00010111 00010000 00000000
223.1.3.27
223.1.2.2
subnet
200.23.16.0/23
223.1.3.1
What’s a subnet ?
device interfaces with same
subnet part of IP address
can physically reach each
other without intervening
router
223.1.2.9
223.1.3.2
network consisting of 3 subnets
Chapter 4, slide: 18
Subnets
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.
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
Subnet mask: /24
Chapter 4, slide: 19
Subnets
223.1.1.2
How many?
223.1.1.1
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.2.6
223.1.2.1
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
Chapter 4, slide: 20
IP addressing: CIDR
Classful addressing: A, B, C
A: /8 (only 28 subnets, but 224 hosts per subnet)
B: /16 (216 subnets, and 216 hosts per subnet)
C: /24 (224 subnets, but only 28 hosts per subnet)
Problem:
see which class is needed for 300 hosts? Issue?
CIDR: Classless InterDomain Routing
subnet portion of address of arbitrary length
address format: a.b.c.d/x, where x is # bits in subnet
portion of address
subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Chapter 4, slide: 21
IP addresses: how to get one?
Q: How does host get IP address?
hard-coded by system admin in a file
DHCP: Dynamic Host Configuration Protocol:
dynamically get IP address from a server when joining the
network
IP address can be reused by other hosts if released
Can renew IP addresses if stayed connected
Chapter 4, slide: 22
DHCP client-server scenario
A
B
223.1.2.1
DHCP
server
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
223.1.3.27
223.1.3.2
E
arriving DHCP
client needs
address in this
network
Chapter 4, slide: 23
IP addresses: how to get one?
Q: How does network get subnet part of IP
addr?
A: gets allocated portion of its provider ISP’s
address space
ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
Chapter 4, slide: 24
Example
Three subnets
All interfaces in all these
Subnet 1
Subnet 2
subnets are required to have
prefix: 223.1.13.0/24
Subnet 1 is required to
support 125 interfaces
Subnet 2 & 3 are each
required to support 60
interfaces
Question:
Provide 3 network addresses
in the form: a.b.c.d/x for
subnets 1, 2, and 3
Subnet 3
Answer: see board (board
notes will be posted)
Chapter 4, slide: 25
ECE/CS 372 – introduction to computer networks
Lecture 10
Announcements:
Assign 3 is posted and is due next Tuesday
Lab 3 is also posted, and also due next Tuesday
Credit for lecture slides to Professor Bechir Hamdaoui
Adapted from Jim Kurose & Keith Ross (original copyright)
Chapter 4, slide: 26
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 27
NAT: Network Address Translation
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.4
10.0.0.1
10.0.0.2
138.76.29.7
10.0.0.3
All datagrams leaving local
network have same single source
NAT IP address: 138.76.29.7,
different source port numbers
Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
Chapter 4, slide: 28
NAT: Network Address Translation
Motivation:
range of addresses not needed from ISP: just one IP
address for all devices
can change addresses of devices in local network
without notifying outside world
can change ISP without changing addresses of devices
in local network
devices inside local net not explicitly addressable,
visible by outside world (a security plus).
Chapter 4, slide: 29
NAT: Network Address Translation
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
2
NAT translation table
WAN side addr
LAN side addr
1: host 10.0.0.1
sends datagram to
128.119.40.186, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.7
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3: Reply arrives
dest. address:
138.76.29.7, 5001
3
1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
10.0.0.1
10.0.0.2
4
10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
Chapter 4, slide: 30
IPv6
Initial motivation:
32-bit address space soon to be completely allocated (if not
already!)
Additional motivation:
header changes to facilitate QoS
Major changes from IPv4:
Fragmentation: no longer allowed; drop packet if too big;
send an ICMP msg back
Checksum: removed to reduce processing time; already done
at transport and link layers
Chapter 4, slide: 31
Transition From IPv4 To IPv6
Can all routers be upgraded simultaneously ??
Answer: it can’t; no “flag days”
Analogy: (IP for Internet)
~ (foundation for House)
While changing the foundation, you can’t live in the house!!
Solution
gradually incorporate IPv6 (may take few years)
How will the network operate with mixed IPv4 and IPv6
routers?
Tunneling??
Chapter 4, slide: 32
Tunneling
Logical view:
Physical view:
Be aware that:
•
•
IPv6 nodes
have both IPv4
& IPv6
addresses
Nodes know
which nodes are
IPv4 and which
ones are IPv6
(use for e.g.
DNS)
A
B
IPv6
IPv6
A
B
C
IPv6
IPv6
IPv4
Flow: X
Src: A
Dest: F
data
A-to-B:
IPv6
E
F
IPv6
IPv6
D
E
F
IPv4
IPv6
IPv6
tunnel
What is the problem here?
Why can’t B just send an
IPv4 packet to C ?
Problem: D won’t be able to
send an IPv6 packet to
E? Why?
Chapter 4, slide: 33
Tunneling
Logical view:
Physical view:
Be aware that:
•
•
IPv6 nodes
have both IPv4
& IPv6
addresses
Nodes know
which nodes are
IPv4 and which
one are IPv6
(use for e.g.
DNS)
A
B
IPv6
IPv6
A
B
C
IPv6
IPv6
IPv4
Flow: X
Src: A
Dest: F
data
A-to-B:
IPv6
E
F
IPv6
IPv6
D
E
F
IPv4
IPv6
IPv6
tunnel
Src:B
Dest: E
Src:B
Dest: E
Flow: X
Src: A
Dest: F
Flow: X
Src: A
Dest: F
data
data
B-to-C:
IPv6 inside
IPv4
B-to-C:
IPv6 inside
IPv4
Flow: X
Src: A
Dest: F
data
E-to-F:
IPv6
Chapter 4, slide: 34
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 35
Routing versus forwarding
routing algorithm
local forwarding table
header value output link
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
Chapter 4, slide: 36
Graph abstraction
5
2
u
2
1
Graph: G = (N,E)
v
x
3
w
3
1
5
z
1
y
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) }
Chapter 4, slide: 37
Graph abstraction: costs
5
2
u
v
2
1
x
• c(x,x’) = cost of link (x,x’)
3
w
3
1
5
z
1
y
- e.g., c(w,z) = 5
2
• cost could always be 1, or
inversely related to bandwidth,
or inversely related to
congestion
Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
Question: What’s the least-cost path between u and z ?
The routing algorithm’s job is to find this least-cost path
Chapter 4, slide: 38
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 39
A Link-State Routing Algorithm
Dijkstra’s algorithm
Each node computes least
cost paths from it to all
other nodes
Each node knows entire net
topology, all link costs
Each node broadcasts “link
state” of its neighbors
only, but to all
iterative: after k
iterations, know least cost
path to k dest.’s
Notation:
c(x,y): link cost from node
x to y; = ∞ if not direct
neighbors
D(v): current value of cost
of path from source to
dest. v
p(v): predecessor node
along path from source to v
N': set of nodes whose
least cost path definitively
known
Chapter 4, slide: 40
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
D(v),p(v) D(w),p(w)
2,u
5,u
\N’
-
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
1 Initialization:
2 N' = {u}
3 for all nodes b
4
if b adjacent to u
5
then D(b) = c(u,b)
6
else D(b) = ∞
2
Chapter 4, slide: 41
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
\N’
vwy
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
2,x
2
Chapter 4, slide: 42
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
uxy
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
\N’
vwy
wz
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
2
Chapter 4, slide: 43
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
\N’
vwy
wz
w
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
2
Chapter 4, slide: 44
Dijkstra’s algorithm: example
Step
N'
0
u
1
ux
2
uxy
3
uxyv
4 uxyvw
5
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
\N’
vwy
wz
w
z
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
4,y
2
Chapter 4, slide: 45
Dijkstra’s algorithm: example
Step
N'
0
u
1
ux
2
uxy
3
uxyv
4 uxyvw
5 uxyvwz
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y
\N’
vwy
wz
w
z
-
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c & not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
15 until all nodes in N'
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
D(x),p(x) D(y),p(y) D(z),p(z)
∞
∞
1,u
∞
2,x
4,y
4,y
4,y
2
Chapter 4, slide: 46
Dijkstra’s Algorithm
1 Initialization:
2 N' = {a}
3 for all nodes b
4
if b adjacent to a
5
then D(b) = c(a,b)
6
else D(b) = ∞
7
8 Loop
9 find c not in N' such that D(c) is a minimum
10 add c to N'
11 update D(b) for all b adjacent to c and not in N' :
12
D(b) = min( D(b), D(c) + c(c,b) )
13 /* new cost to b is either old cost to b or known
14 shortest path cost to c plus cost from c to b */
15 until all nodes in N'
Chapter 4, slide: 47
Dijkstra’s algorithm: example
Resulting shortest-path tree from u:
v
To remember !
w
u
z
x
y
Resulting forwarding table in u:
destination
link
v
x
(u,v)
(u,x)
y
(u,x)
w
(u,x)
z
(u,x)
Each node must have
complete knowledge of
entire network
Broadcast all link
states
Each node constructs
its own table
Chapter 4, slide: 48
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)
Oscillations possible:
e.g., link cost = amount of carried traffic
Here: D, C, and B all send to A
D
1
1
0
A
0 0
C
e
1+e
e
initially
B
1
2+e
A
0
D 1+e 1 B
0
0
C
… recompute
routing
0
D
1
A
0 0
C
2+e
B
1+e
… recompute
2+e
A
0
D 1+e 1 B
0
0
C
… recompute
Chapter 4, slide: 49
ECE/CS 372 – introduction to computer networks
Lecture 11
Announcements:
Assign 3 due next Tuesday
Lab 3 extended, due next Thursday
Credit for lecture slides to Professor Bechir Hamdaoui
Adapted from Jim Kurose & Keith Ross (original copyright)
Chapter 4, slide: 50
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 51
Distance Vector Algorithm
Bellman-Ford Equation (dynamic programming)
Define
du(z) := cost of least-cost path from u to z
5
Then
du(z) = min {c(u,a) + da(z) }
a
2
u
v
2
1
x
3
w
3
1
5
z
1
y
2
where min is taken over all neighbors a of u
Chapter 4, slide: 52
Bellman-Ford example
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
2
B-F equation says:
du(z) = min { c(u,v) + dv(z),
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path ➜ forwarding table
Chapter 4, slide: 53
Distance Vector (DV) Algorithm
Node x knows cost to each neighbor v: c(x,v)
Node x estimates least cost Dx(y) from it to each
node y
Node x maintains DV Dx = [Dx(y): y є N ] for all nodes
Node x also maintains its neighbors’ DV
For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
Chapter 4, slide: 54
Distance vector (DV) algorithm
Basic idea:
Each node periodically sends its own distance
vector estimate to neighbors
When a node 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
The estimate Dx(y) will eventually converge to the
actual least cost after a number of iterations
Chapter 4, slide: 55
Distance Vector (DV) Algorithm
Iterative, asynchronous:
each local iteration caused
by:
local link cost change
DV update message from
neighbor
Distributed:
each node notifies
neighbors only when its DV
changes
Each node:
wait for (change in local link
cost or msg from neighbor)
recompute estimates
if DV to any dest has
changed, notify neighbors
neighbors then notify their
neighbors if necessary
Chapter 4, slide: 56
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to w x y z
from
node x
table
∞ 0 2 1
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
w
3
cost to w x y z
from
node y
table
3 2 0 5
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
x
2
y
1
5
z
cost to w x y z
from
node z
table
∞ 1 5 0
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
time
Chapter 4, slide: 57
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ ∞ ∞∞
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
y broadcasts DV
to its neighbors x,w,z
time
Chapter 4, slide: 58
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ ∞ ∞∞
y 3 2 0 5
Exchange
w
3
x
2
y
5
1
z
w broadcasts DV
to its neighbors y
time
Chapter 4, slide: 59
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ ∞ ∞∞
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ ∞ ∞∞
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
x broadcasts DV
to its neighbors y,z
time
Chapter 4, slide: 60
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
z broadcasts DV
to its neighbors x,y
time
Chapter 4, slide: 61
w x y z
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
from
node w
table
from
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
∞ 1 5 0
from
cost to w x y z
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w
3
x
2
y
1
5
z
All neighbor DV
broadcasts are done
time
Chapter 4, slide: 62
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
cost to w x y z
from
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
w x y z
cost to
from
w x y z
from
node w
table
from
cost to
0 5 3 8
y 3 2 0 5
Dw(x) = min{c(w,y) + Dy(x)}
= min{3+2} = 5
Dw(y) = min{c(w,y) + Dy(y)}
= min{3+0} = 3
Dw(z) = min{c(w,y) + Dy(z)}
= min{3+5} = 8
w
3
x
2
y
1
5
z
time
Chapter
4, slide: 63
Update
0 ∞ 3 ∞
y ∞ ∞ ∞∞
cost to
w x y z
0 ∞ 3 ∞
y 3 2 0 5
w x y z
cost to
from
w x y z
from
node w
table
from
cost to
0 5 3 8
y 3 2 0 5
∞ 0 2 1
∞ 0 2 1
5 0 2 1
node x
table
y ∞ ∞ ∞∞
z ∞ ∞ ∞∞
y 3 2 0 5
z ∞ 1 5 0
3 2 0 5
3 2 0 5
node y
table
w ∞ ∞ ∞∞
x ∞ ∞ ∞∞
z ∞ ∞ ∞∞
from
cost to w x y z
from
cost to w x y z
w 0 ∞ 3 ∞
x ∞ 0 2 1
z ∞ 1 5 0
∞ 1 5 0
∞ 1 5 0
node z
table
x ∞ ∞ ∞∞
y ∞ ∞ ∞∞
Initialization
from
cost to w x y z
from
cost to w x y z
x ∞ 0 2 1
y 3 2 0 5
Exchange
from
cost to w x y z
from
cost to w x y z
from
cost to w x y z
y 3 2 0 5
z ∞ 1 5 0
Dxx=(z)
= min{c(x,y)
Dyy(z),
(y)
(y),
Dx(w)
min{c(x,y)
+ Dy+(w),
c(x,z)
Dzz(z)}
(y)}
c(x,z)
+ Dz+(w)}
= min{2+5,
} = 12
min{2+0,
55
= min{2+3,
1+∞}1+=0
w
3
x
2
y
1
5
z
time
Chapter
4, slide: 64
Update
Distance Vector: link cost changes
See what happens when link cost changes:
node detects local link cost change
updates routing info, recalculates
distance vector
if DV changes, notify neighbors
“good
news
travels
fast”
1
x
4
y
1
50
z
At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors.
New Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{1,1+5}=1
At time t1, z receives the update from y and updates its DV.
It computes a new least cost to x and sends its neighbors its DV.
New Dz(x) = min{c(z,x), c(z,y)+Dy(x)} = min{50,1+1} = 2
At time t2, y receives z’s update and updates its DV.
New Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{1,1+2}=1 (no change!)
y’s least costs do not change and hence y does not send any
message to z.
Chapter 4, slide: 65
Distance Vector: link cost changes
Suppose link cost changes from 4 to 60
Initially: Dy(x) = 4 and Dz(x) = 5 (focus on distance from y & z to x)
Node y:
60
y
detects the change, computes its DV
4
1
what is the new Dy(x) ?
x
z
50
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+5}=6
sends its new DV to z
Node z:
receives the update from y; w/ new Dy(x) = 6
computes its DV. What is the new Dz(x) ?
Dz(x) = min{c(z,x), c(z,y)+Dy(x)} = min{50,1+6}=7
sends its new DV to y
Node y:
receives the update from z; w/ new Dz(x) = 7
computes its DV. what is the new Dy(x) ?
Dy(x) = min{c(y,x), c(y,z)+Dz(x)} = min{60,1+7}=8
sends its new DV to z again
Dz(x) stored in
y’s DV from a
Previous update
“Dz(x) = 5”
Can you
guess what
will happen?
Chapter 4, slide: 66
Distance Vector: link cost changes
“routing loop” problem
y reaches x thru z; z reaches x thru y
“count to infinity” problem!
60
x
4
y
1
50
z
44 iterations before algorithm stabilizes:
Imagine what happens if c(z,x) has cost of 10000 instead of 50 !
and c(y,x) changes from 4 to 10010
Solution: Poisoned reverse:
If z routes via y to get to x, z tells y its (z’s) distance to x
is infinite (so y won’t route to x via z)
Chapter 4, slide: 67
Comparison of LS and DV algorithms
Message complexity
LS: with n nodes, E links, O(nE) msgs sent;
each link info should be sent to each node
DV: exchange between neighbors only
Speed of Convergence
LS: computation grows at O(n2);
= (n-1) + (n-2) + … + 1 = n(n+1)/2
may have oscillations
DV: computation grows at O(n3);
= iterated n times at most, each iter. done for n-1 nodes,
and for each node minimization must be taken at most over
n-1 alternatives
may be routing loops and count-to-infinity problem
Chapter 4, slide: 68
Chapter 4: Network Layer
Introduction
IP: Internet Protocol
IPv4 addressing
NAT, IPv6
Routing algorithms
Link state
Distance Vector
Routing in the Internet
RIP, OSPF, BGP
Chapter 4, slide: 69
Routing in Internet: Hierarchical Routing
Our routing study thus far - idealization
all routers identical
network “flat”
… not true in practice
scale: with 200 million
destinations:
can’t store all dest’s in
routing tables!
routing table exchange
would swamp links!
administrative autonomy
internet = network of
networks
each network admin may
want to control routing in its
own network
Chapter 4, slide: 70
Hierarchical Routing
aggregate routers into regions, “autonomous
systems” (AS)
3c
3a
3b
AS3
1a
2a
1c
1d
1b
Intra-AS
Routing
algorithm
2c
AS2
2b
AS1
Inter-AS
Routing
algorithm
Forwarding
table
Chapter 4, slide: 71
Hierarchical Routing
Intra-AS routing
routers in same AS run
same routing protocol
Inter-AS routing
Use inter-AS routing
to route across ASes
routers in different
Across different
AS can run different
intra-AS routing
protocol
ASes, routing protocol
must be agreed upon
Chapter 4, slide: 72
Routing in the Internet: protocols
Intra-AS routing protocols:
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)
Inter-AS routing protocols:
BGP (Border Gateway Protocol)
Chapter 4, slide: 73
RIP ( Routing Information Protocol)
Uses Distance Vector routing
distance vectors: exchanged among neighbors every
30 sec via Response Message (also called
advertisement)
each advertisement: list of up to 25 destination nets
within AS
If no advertisement heard after 180 sec -->
neighbor/link will be declared dead
poison reverse used to prevent ping-pong loops
(infinite distance = 16 hops)
Chapter 4, slide: 74
RIP: Example
z
w
A
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B
--
Routing table in D
2
2
7
1
Chapter 4, slide: 75
RIP: Example
Dest
w
x
z
….
Next
C
…
w
hops
1
1
4
...
A
Advertisement
from A to D
z
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B
--
Routing table in D
2
2
7
1
Chapter 4, slide: 76
RIP: Example
Dest
w
x
z
….
Next
C
…
w
hops
1
1
4
...
A
Advertisement
from A to D
z
x
Destination Network
w
y
z
x
….
D
B
C
y
Next Router
Num. of hops to dest.
….
....
A
B
B A
--
Routing table in D
2
2
7 5
1
Chapter 4, slide: 77
OSPF (Open Shortest Path First)
“open”: publicly available
uses Link State algorithm; i.e., Dijkstra’s
algorithm
advertisements disseminated to entire AS via
flooding
OSPF messages carried directly over IP (rather
than TCP or UDP
Chapter 4, slide: 78
Internet inter-AS routing: BGP
BGP (Border Gateway Protocol): the de
facto standard
BGP provides each AS a means to:
1.
2.
3.
Obtain subnet reachability information from
neighboring ASs.
Propagate reachability information to all ASinternal routers.
Determine “good” routes to subnets based on
reachability information and policy.
Chapter 4, slide: 79
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
Chapter 4, slide: 80