The Network Layer
UNIT-4
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
By
G. Fayaz Hussain
Assistant Professor
Department of CSE
Ravindra College of Engineering for Women
Kurnool – 518452, Andhra Pradesh, India
Unit 4: Network layer
chapter goals:
Network Layer
4-2
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 IP: Internet Protocol
4.4 routing algorithms
4.5 routing in the Internet
4.6 broadcast and multicast routing
Network Layer
4-3
Unit 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Network layer
Network Layer
4-4
application
transport
network
data link
physical
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
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
network
data link
physical
Two key network-layer functions
Network Layer
4-5
analogy:
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Network Layer
4-6
1
2
3
0111
value in arriving
packet’s header
routing algorithm
local forwarding table
header value
output link
0100
0101
0111
1001
3
2
2
1
Interplay between routing and forwarding
routing algorithm determines
end-end-path through network
forwarding table determines
local forwarding at this router
Connection setup
Network Layer
4-7
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Network service model
example services for individual datagrams:
example services for a flow of datagrams:
Network Layer
4-8
Q: What service model for “channel” transporting datagrams from sender to receiver?
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Network layer service models:
Network Layer
4-9
Network
Architecture
Internet
ATM
ATM
ATM
ATM
Service
Model
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constant
rate
guaranteed
rate
guaranteed
minimum
none
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestion
feedback
no (inferred
via loss)
no
congestion
no
congestion
yes
no
Guarantees ?
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-10
Chapter 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Connection, connection-less service
Network Layer
4-11
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Virtual circuits
“source-to-dest path behaves much like telephone circuit”
Network Layer
4-12
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
VC implementation
a VC consists of:
Network Layer
4-13
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
VC forwarding table
Network Layer
4-14
12
22
32
1
2
3
VC number
interface
number
Incoming interface Incoming VC # Outgoing interface Outgoing VC #
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
forwarding table in
northwest router:
VC routers maintain connection state information!
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Virtual circuits: signaling protocols
Network Layer
4-15
application
transport
network
data link
physical
1. initiate call
2. incoming call
3. accept call
4. call connected
5. data flow begins
6. receive data
application
transport
network
data link
physical
Datagram networks
Network Layer
4-16
1. send datagrams
application
transport
network
data link
physical
application
transport
network
data link
physical
2. receive datagrams
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Datagram forwarding table
Network Layer
4-17
1
2
3
IP destination address in
arriving packet’s header
routing algorithm
local forwarding table
dest address
output link
address-range 1
address-range 2
address-range 3
address-range 4
3
2
2
1
4 billion IP addresses, so rather than list individual destination address
list range of addresses
(aggregate table entries)
Datagram forwarding table
Network Layer
4-18
Destination Address Range
11001000 00010111 00010000 00000000
through
11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000
through
11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000
through
11001000 00010111 00011111 11111111
otherwise
Link Interface
0
1
2
3
Q: but what happens if ranges don’t divide up so nicely?
Longest prefix matching
Network Layer
4-19
Destination Address Range
11001000 00010111 00010*** *********
11001000 00010111 00011000 *********
11001000 00010111 00011*** *********
otherwise
DA: 11001000 00010111 00011000 10101010
examples:
DA: 11001000 00010111 00010110 10100001
which interface?
which interface?
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
longest prefix matching
Link interface
0
1
2
3
Datagram or VC network: why?
Internet (datagram)
ATM (VC)
Network Layer
4-20
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 IP: Internet Protocol
4.4 routing algorithms
4.5 routing in the Internet
4.6 broadcast and multicast routing
Network Layer
4-21
Chapter 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
The Internet network layer
host, router network layer functions:
Network Layer
4-22
forwarding
table
routing protocols
IP protocol
ICMP protocol
transport layer: TCP, UDP
link layer
physical layer
network
layer
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
IP datagram format
Network Layer
4-23
ver
length
32 bits
data
(variable length,
typically a TCP
or UDP segment)
16-bit identifier
header
checksum
time to
live
32 bit source IP address
head.
len
type of
service
flgs
fragment
offset
upper
layer
32 bit destination IP address
options (if any)
IP protocol version
number
header length
(bytes)
upper layer protocol
to deliver payload to
total datagram
length (bytes)
“type” of data
for
fragmentation/
reassembly
max number
remaining hops
(decremented at
each router)
e.g. timestamp,
record route
taken, specify
list of routers
to visit.
how much overhead?
IP fragmentation, reassembly
Network Layer
4-24
fragmentation:
in: one large datagram
out: 3 smaller datagrams
reassembly
…
…
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 IP: Internet Protocol
4.4 routing algorithms
4.5 routing in the Internet
4.6 broadcast and multicast routing
Network Layer
4-25
Chapter 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
IP addressing: introduction
Network Layer
4-26
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
1
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
IP addressing: introduction
Q: how are interfaces actually connected?
A: we’ll learn about that in chapter 5, 6.
Network Layer
4-27
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
A: wired Ethernet interfaces connected by Ethernet switches
A: wireless WiFi interfaces connected by WiFi base station
For now: don’t need to worry about how one interface is connected to another (with no intervening router)
Subnets
Network Layer
4-28
network consisting of 3 subnets
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.9
223.1.3.2
223.1.3.1
subnet
223.1.1.2
223.1.3.27
223.1.2.2
223.1.2.1
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Subnets
recipe
Network Layer
4-29
subnet mask: /24
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.9
223.1.3.2
223.1.3.1
subnet
223.1.1.2
223.1.3.27
223.1.2.2
223.1.2.1
Subnets
how many?
Network Layer
4-30
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2
223.1.2.1
223.1.2.6
223.1.3.2
223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1
223.1.8.0
223.1.8.1
223.1.9.1
223.1.9.2
IP addressing: CIDR
CIDR: Classless InterDomain Routing
Network Layer
4-31
11001000 00010111 00010000 00000000
subnet
part
host
part
200.23.16.0/23
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
IP addresses: how to get one?
Q: How does a host get IP address?
Network Layer
4-32
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
DHCP: Dynamic Host Configuration Protocol
goal: allow host to dynamically obtain its IP address from network server when it joins network
DHCP overview:
Network Layer
4-33
DHCP client-server scenario
Network Layer
4-34
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.9
223.1.3.2
223.1.3.1
223.1.1.2
223.1.3.27
223.1.2.2
223.1.2.1
DHCP
server
arriving DHCP
client needs
address in this
network
DHCP client-server scenario
Network Layer
4-35
DHCP server: 223.1.2.5
arriving
client
DHCP discover
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
lifetime: 3600 secs
Broadcast: is there a DHCP server out there?
Broadcast: I’m a DHCP server! Here’s an IP address you can use
Broadcast: OK. I’ll take that IP address!
Broadcast: OK. You’ve got that IP address!
DHCP: more than IP addresses
DHCP can return more than just allocated IP address on subnet:
Network Layer
4-36
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
DHCP: example
Network Layer
4-37
router with DHCP
server built into
router
168.1.1.1
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP: example
Network Layer
4-38
router with DHCP
server built into
router
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
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
Network Layer
4-39
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20
Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23
Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
Hierarchical addressing: route aggregation
Network Layer
4-40
“Send me anything
with addresses
beginning
200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7
Internet
Organization 1
ISPs-R-Us
“Send me anything
with addresses
beginning
199.31.0.0/16”
200.23.20.0/23
Organization 2
.
.
.
.
.
.
hierarchical addressing allows efficient advertisement of routing
information:
Hierarchical addressing: more specific routes
Network Layer
4-41
ISPs-R-Us has a more specific route to Organization 1
“Send me anything
with addresses
beginning
200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Fly-By-Night-ISP
Organization 0
Organization 7
Internet
Organization 1
ISPs-R-Us
“Send me anything
with addresses
beginning 199.31.0.0/16
or 200.23.18.0/23”
200.23.20.0/23
Organization 2
.
.
.
.
.
.
IP addressing: the last word...
Q: how does an ISP get block of addresses?
A: ICANN: Internet Corporation for Assigned
Names and Numbers http://www.icann.org/
Network Layer
4-42
NAT: network address translation
Network Layer
4-43
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network
(e.g., home network)
10.0.0/24
rest of
Internet
datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)
all datagrams leaving local
network have same single source NAT IP address: 138.76.29.7,different source port numbers
NAT: network address translation
motivation: local network uses just one IP address as far as outside world is concerned:
Network Layer
4-44
NAT: network address translation
implementation: NAT router must:�
. . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr�
Network Layer
4-45
NAT: network address translation
Network Layer
4-46
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
1
10.0.0.4
138.76.29.7
1: host 10.0.0.1
sends datagram to
128.119.40.186, 80
NAT translation table
WAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345
…… ……
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
2
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
S: 128.119.40.186, 80
D: 138.76.29.7, 5001
3
3: reply arrives
dest. address:
138.76.29.7, 5001
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
NAT: network address translation
Network Layer
4-47
NAT traversal problem
Network Layer
4-48
10.0.0.1
10.0.0.4
NAT
router
138.76.29.7
client
?
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
NAT traversal problem
i.e., automate static NAT port map configuration
Network Layer
4-49
10.0.0.1
NAT
router
IGD
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
NAT traversal problem
Network Layer
4-50
138.76.29.7
client
1. connection to
relay initiated
by NATed host
2. connection to
relay initiated
by client
3. relaying
established
NAT
router
10.0.0.1
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-51
Chapter 4: outline
ICMP: internet control message protocol
Network Layer
4-52
Type Code description
0 0 echo reply (ping)
3 0 dest. network unreachable
3 1 dest host unreachable
3 2 dest protocol unreachable
3 3 dest port unreachable
3 6 dest network unknown
3 7 dest host unknown
4 0 source quench (congestion
control - not used)
8 0 echo request (ping)
9 0 route advertisement
10 0 router discovery
11 0 TTL expired
12 0 bad IP header
Traceroute and ICMP
Network Layer
4-53
stopping criteria:
3 probes
3 probes
3 probes
IPv6: motivation
IPv6 datagram format:
Network Layer
4-54
IPv6 datagram format
Network Layer
4-55
priority: identify priority among datagrams in flow
flow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).
next header: identify upper layer protocol for data
data
destination address
(128 bits)
source address
(128 bits)
payload len
next hdr
hop limit
flow label
pri
ver
32 bits
Other changes from IPv4
Network Layer
4-56
Transition from IPv4 to IPv6
Network Layer
4-57
IPv4 source, dest addr
IPv4 header fields
IPv4 datagram
IPv6 datagram
IPv4 payload
UDP/TCP payload
IPv6 source dest addr
IPv6 header fields
Tunneling
Network Layer
4-58
physical view:
IPv4
IPv4
A
B
IPv6
IPv6
E
IPv6
IPv6
F
C
D
logical view:
IPv4 tunnel
connecting IPv6 routers
E
IPv6
IPv6
F
A
B
IPv6
IPv6
Tunneling
Network Layer
4-59
flow: X
src: A
dest: F
data
A-to-B:
IPv6
Flow: X
Src: A
Dest: F
data
src:B
dest: E
B-to-C:
IPv6 inside
IPv4
E-to-F:
IPv6
flow: X
src: A
dest: F
data
B-to-C:
IPv6 inside
IPv4
Flow: X
Src: A
Dest: F
data
src:B
dest: E
physical view:
A
B
IPv6
IPv6
E
IPv6
IPv6
F
C
D
logical view:
IPv4 tunnel
connecting IPv6 routers
E
IPv6
IPv6
F
A
B
IPv6
IPv6
IPv4
IPv4
IPv6: adoption
Network Layer
4-60
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 IP: Internet Protocol
4.4 routing algorithms
4.5 routing in the Internet
4.6 broadcast and multicast routing
Network Layer
4-61
Chapter 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Interplay between routing, forwarding
Network Layer
4-62
1
2
3
IP destination address in
arriving packet’s header
routing algorithm
local forwarding table
dest address
output link
address-range 1
address-range 2
address-range 3
address-range 4
3
2
2
1
routing algorithm determines
end-end-path through network
forwarding table determines
local forwarding at this router
Graph abstraction
Network Layer
4-63
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
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
Graph abstraction: costs
Network Layer
4-64
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
c(x,x’) = cost of link (x,x’)
e.g., c(w,z) = 5
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)
key question: what is the least-cost path between u and z ?
routing algorithm: algorithm that finds that least cost path
Routing algorithm classification
Q: global or decentralized information?
global:
decentralized:
Q: static or dynamic?
static:
dynamic:
Network Layer
4-65
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-66
Chapter 4: outline
A Link-State Routing Algorithm
Dijkstra’s algorithm
notation:
Network Layer
4-67
Dijsktra’s Algorithm
Network Layer
4-68
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
4-69
w
3
4
v
x
u
5
3
7
4
y
8
z
2
7
9
Dijkstra’s algorithm: example
Step
N'
D(v)
p(v)
0
1
2
3
4
5
D(w)
p(w)
D(x)
p(x)
D(y)
p(y)
D(z)
p(z)
u
∞
∞
7,u
3,u
5,u
uw
∞
11,w
6,w
5,u
14,x
11,w
6,w
uwx
uwxv
14,x
10,v
uwxvy
12,y
notes:
uwxvyz
Dijkstra’s algorithm: another example
Network Layer
4-70
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
uxyvw
uxyvwz
D(v),p(v)
2,u
2,u
2,u
D(w),p(w)
5,u
4,x
3,y
3,y
D(x),p(x)
1,u
D(y),p(y)
∞
2,x
D(z),p(z)
∞
∞
4,y
4,y
4,y
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
Dijkstra’s algorithm: example (2)
Network Layer
4-71
u
y
x
w
v
z
resulting shortest-path tree from u:
v
x
y
w
z
(u,v)
(u,x)
(u,x)
(u,x)
(u,x)
destination
link
resulting forwarding table in u:
Dijkstra’s algorithm, discussion
algorithm complexity: n nodes
oscillations possible:
Network Layer
4-72
A
D
C
B
1
1+e
e
0
e
1
1
0
0
initially
A
D
C
B
given these costs,
find new routing….
resulting in new costs
2+e
0
0
0
1+e
1
A
D
C
B
given these costs,
find new routing….
resulting in new costs
0
2+e
1+e
1
0
0
A
D
C
B
given these costs,
find new routing….
resulting in new costs
2+e
0
0
0
1+e
1
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-73
Chapter 4: outline
Distance vector algorithm
Bellman-Ford equation (dynamic programming)
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min {c(x,v) + dv(y) }
Network Layer
4-74
v
cost to neighbor v
min taken over all neighbors v of x
cost from neighbor v to destination y
Bellman-Ford example
Network Layer
4-75
u
y
x
w
v
z
2
2
1
3
1
1
2
5
3
5
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
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 achieving minimum is next
hop in shortest path, used in forwarding table
B-F equation says:
Distance vector algorithm
Network Layer
4-76
Distance vector algorithm
key idea:
Network Layer
4-77
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
Distance vector algorithm
iterative, asynchronous: each local iteration caused by:
distributed:
Network Layer
4-78
wait for (change in local link cost or msg from neighbor)
recompute estimates
if DV to any dest has changed, notify neighbors
each node:
Network Layer
4-79
x y z
x
y
z
0 2 7
∞
∞
∞
∞
∞
∞
from
cost to
from
from
x y z
x
y
z
0
x y z
x
y
z
∞
∞
∞
∞
∞
cost to
x y z
x
y
z
∞
∞
∞
7
1
0
cost to
∞
2 0 1
∞ ∞ ∞
2 0 1
7 1 0
time
x
z
1
2
7
y
node x
table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} � = min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) + � Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
3
2
node y
table
node z
table
cost to
from
Network Layer
4-80
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 7
from
cost to
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 3
from
cost to
x y z
x
y
z
0 2 7
from
cost to
2 0 1
7 1 0
2 0 1
3 1 0
2 0 1
3 1 0
2 0 1
3 1 0
2 0 1
3 1 0
time
x y z
x
y
z
0 2 7
∞
∞
∞
∞
∞
∞
from
cost to
from
from
x y z
x
y
z
0
x y z
x
y
z
∞
∞
∞
∞
∞
cost to
x y z
x
y
z
∞
∞
∞
7
1
0
cost to
∞
2 0 1
∞ ∞ ∞
2 0 1
7 1 0
time
x
z
1
2
7
y
node x
table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} � = min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) + � Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
3
2
node y
table
node z
table
cost to
from
Distance vector: link cost changes
Network Layer
4-81
link cost changes:
“good
news
travels
fast”
x
z
1
4
50
y
1
t0 : y detects link-cost change, updates its DV, informs its neighbors.
t1 : z receives update from y, updates its table, computes new 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.
Distance vector: link cost changes
Network Layer
4-82
link cost changes:
x
z
1
4
50
y
60
poisoned reverse:
Comparison of LS and DV algorithms
message complexity
speed of convergence
robustness: what happens if router malfunctions?
LS:
DV:
Network Layer
4-83
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-84
Chapter 4: outline
Hierarchical routing
scale: with 600 million destinations:
administrative autonomy
Network Layer
4-85
our routing study thus far - idealization
… not true in practice
Hierarchical routing
gateway router:
Network Layer
4-86
Interconnected ASes
Network Layer
4-87
3b
1d
3a
1c
2a
AS3
AS1
AS2
1a
2c
2b
1b
Intra-AS
Routing
algorithm
Inter-AS
Routing
algorithm
Forwarding
table
3c
Inter-AS tasks
AS1 must:
job of inter-AS routing!
Network Layer
4-88
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
Example: setting forwarding table in router 1d
Network Layer
4-89
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
x
…
Example: choosing among multiple ASes
Network Layer
4-90
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
x
……
…
?
Example: choosing among multiple ASes
Network Layer
4-91
learn from inter-AS
protocol that subnet
x is reachable via
multiple gateways
use routing info
from intra-AS
protocol to determine
costs of least-cost
paths to each
of the gateways
hot potato routing:
choose the gateway
that has the
smallest least cost
determine from
forwarding table the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-92
Chapter 4: outline
Intra-AS Routing
Network Layer
4-93
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
RIP ( Routing Information Protocol)
Network Layer
4-94
D
C
B
A
u
v
w
x
y
z
subnet hops
u 1
v 2
w 2
x 3
y 3
z 2
from router A to destination subnets:
RIP: example
Network Layer
4-95
destination subnet next router # hops to dest
w A 2
y B 2
z B 7
x -- 1
…. …. ....
routing table in router D
w
x
y
z
A
C
D
B
RIP: example
Network Layer
4-96
w
x
y
z
A
C
D
B
destination subnet next router # hops to dest
w A 2
y B 2
z B 7
x -- 1
…. …. ....
routing table in router D
A
5
dest next hops
w - 1
x - 1
z C 4
…. … ...
A-to-D advertisement
RIP: link failure, recovery
if no advertisement heard after 180 sec --> neighbor/link declared dead
Network Layer
4-97
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
RIP table processing
Network Layer
4-98
physical
link
network forwarding
(IP) table
transport
(UDP)
routed
physical
link
network
(IP)
transprt
(UDP)
routed
forwarding
table
OSPF (Open Shortest Path First)
Network Layer
4-99
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
OSPF “advanced” features (not in RIP)
Network Layer
4-100
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Hierarchical OSPF
Network Layer
4-101
boundary router
backbone router
area 1
area 2
area 3
backbone
area
border
routers
internal
routers
Hierarchical OSPF
Network Layer
4-102
Internet inter-AS routing: BGP
Network Layer
4-103
BGP basics
Network Layer
4-104
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
BGP
message
BGP basics: distributing path information
Network Layer
4-105
AS3
AS2
3b
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
eBGP session
iBGP session
Path attributes and BGP routes
Network Layer
4-106
BGP route selection
Network Layer
4-107
BGP messages
Network Layer
4-108
Putting it Altogether:�How Does an Entry Get Into a Router’s Forwarding Table?
How does entry get in forwarding table?
1
2
3
Dest IP
routing algorithms
local forwarding table
prefix
output port
138.16.64/22
124.12/16
212/8
…………..
3
2
4
…
entry
Assume prefix is�in another AS.
High-level overview
How does entry get in forwarding table?
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Router becomes aware of prefix
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
BGP
message
Router may receive multiple routes
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
BGP
message
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Select best BGP route to prefix
select
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Find best intra-route to BGP route
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
111.99.86.55
Router identifies port for route
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
router�port
1
2
3
4
Hot Potato Routing
AS3
AS2
3b
3c
3a
AS1
1c
1a
1d
1b
2a
2c
2b
other
networks
other
networks
How does entry get in forwarding table?
Summary
BGP routing policy
Network Layer
4-119
A
B
C
W
X
Y
legend:
customer
network:
provider
network
BGP routing policy (2)
Network Layer
4-120
A
B
C
W
X
Y
legend:
customer
network:
provider
network
Why different Intra-, Inter-AS routing ?
policy:
scale:
performance:
Network Layer
4-121
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-122
Chapter 4: outline
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Broadcast routing
Network Layer
4-123
R1
R2
R3
R4
source�duplication
R1
R2
R3
R4
in-network
duplication
duplicate
creation/transmission
duplicate
duplicate
In-network duplication
Network Layer
4-124
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
Spanning tree
Network Layer
4-125
A
B
G
D
E
c
F
A
B
G
D
E
c
F
(a) broadcast initiated at A
(b) broadcast initiated at D
Spanning tree: creation
Network Layer
4-126
A
B
G
D
E
c
F
1
2
3
4
5
A
B
G
D
E
c
F
(b) constructed spanning tree
Multicast routing: problem statement
goal: find a tree (or trees) connecting routers having local mcast group members
Network Layer
4-127
shared tree
source-based trees
group
member
not group
member
router
with a
group
member
router
without
group
member
legend
Approaches for building mcast trees
approaches:
Network Layer
4-128
…we first look at basic approaches, then specific protocols adopting these approaches
Shortest path tree
Network Layer
4-129
i
router with attached
group member
router with no attached
group member
link used for forwarding,
i indicates order link
added by algorithm
LEGEND
R1
R2
R3
R4
R5
R6
R7
2
1
6
3
4
5
s: source
Reverse path forwarding
if (mcast datagram received on incoming link on shortest path back to center)
then flood datagram onto all outgoing links
else ignore datagram
Network Layer
4-130
Reverse path forwarding: example
Network Layer
4-131
router with attached
group member
router with no attached
group member
datagram will be forwarded
LEGEND
R1
R2
R3
R4
R5
R6
R7
s: source
datagram will not be
forwarded
Reverse path forwarding: pruning
Network Layer
4-132
router with attached
group member
router with no attached
group member
prune message
LEGEND
links with multicast
forwarding
P
R1
R2
R3
R4
R5
R6
R7
s: source
P
P
Shared-tree: steiner tree
Network Layer
4-133
Center-based trees
Network Layer
4-134
Center-based trees: example
Network Layer
4-135
suppose R6 chosen as center:
router with attached
group member
router with no attached
group member
path order in which join messages generated
LEGEND
2
1
3
1
R1
R2
R3
R4
R5
R6
R7
Internet Multicasting Routing: DVMRP
Network Layer
4-136
DVMRP: continued…
Network Layer
4-137
Tunneling
Q: how to connect “islands” of multicast routers in a “sea” of unicast routers?
Network Layer
4-138
physical topology
logical topology
PIM: Protocol Independent Multicast
Network Layer
4-139
dense:
sparse:
Consequences of sparse-dense dichotomy:
dense
sparse:
Network Layer
4-140
PIM- dense mode
Network Layer
4-141
flood-and-prune RPF: similar to DVMRP but…
RCEW, Pasupula (V), Nandikotkur Road,
Near Venkayapalli, KURNOOL
PIM - sparse mode
Network Layer
4-142
all data multicast
from rendezvous
point
rendezvous
point
join
join
join
R1
R2
R3
R4
R5
R6
R7
PIM - sparse mode
sender(s):
Network Layer
4-143
all data multicast
from rendezvous
point
rendezvous
point
join
join
join
R1
R2
R3
R4
R5
R6
R7
4.1 introduction
4.2 virtual circuit and datagram networks
4.3 what’s inside a router
4.4 IP: Internet Protocol
4.5 routing algorithms
4.6 routing in the Internet
4.7 broadcast and multicast routing
Network Layer
4-144
Chapter 4: done!