* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download ppt - Computer Science & Engineering
Deep packet inspection wikipedia , lookup
Distributed firewall wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Computer network wikipedia , lookup
Network tap wikipedia , lookup
Internet protocol suite wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Dynamic Host Configuration Protocol wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Airborne Networking wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Chapter 4
Network Layer
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only
ask the following:
If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
If you post any slides on a www site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
material.
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
Thanks and enjoy! JFK/KWR
All material copyright 1996-2013
J.F Kurose and K.W. Ross, All Rights Reserved
Network Layer 4-1
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 11
(Contd.)
Prof. Shamik Sengupta
Office SEM 204
ssengupta@unr.edu
http://www.cse.unr.edu/~shamik/
Network Layer
Network Layer 4-3
The Internet network layer
host, router network layer functions:
transport layer: TCP, UDP
IP protocol
routing protocols
network
layer
• addressing conventions
• datagram format
• packet handling conventions
• path selection
• RIP, OSPF, BGP
forwarding
table
ICMP protocol
• error reporting
• router “signaling”
link layer
physical layer
Network Layer 4-4
IP datagram format
IP protocol version
number
header length
(bytes)
max number
remaining hops
(decremented at
each router)
upper layer protocol
to deliver payload to
how much overhead?
20+ bytes of TCP
8 bytes for UDP
20 bytes of IP
= 40 bytes + app
layer overhead
32 bits
total datagram
length (bytes)
ver head. type of
len service
length
16-bit identifier
upper
time to
layer
live
fragment
flgs
offset
header
checksum
for
fragmentation/
reassembly
32 bit source IP address
32 bit destination IP address
options (if any)
data
(variable length,
typically a TCP
or UDP segment)
e.g. timestamp,
record route
taken, specify
list of routers
to visit.
Network Layer 4-5
IP fragmentation, reassembly
fragmentation:
in: one large datagram
out: 3 smaller datagrams
…
reassembly
…
network links have MTU
(max. transfer size) largest possible link-level
frame
different link types,
different MTUs
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
Network Layer 4-6
IP fragmentation, reassembly
example:
4000 byte datagram
MTU = 1500 bytes
1480 bytes in
data field
offset =
1480/8
length ID fragflag
=4000 =x
=0
offset
=0
one large datagram becomes
several smaller datagrams
length ID fragflag
=1500 =x
=1
offset
=0
length ID fragflag
=1500 =x
=1
offset
=185
length ID fragflag
=1040 =x
=0
offset
=370
Why divide by 8?
Network Layer 4-7
IP addressing: introduction
IP address: 32-bit
223.1.1.1
identifier for host, router
interface
223.1.1.2
interface: connection
between host/router and
physical link
223.1.2.1
223.1.1.4
223.1.3.27
223.1.1.3
223.1.2.2
router’s typically have
multiple interfaces
host typically has one or
two interfaces (e.g., wired
Ethernet, wireless 802.11)
IP addresses associated
with each interface
223.1.2.9
223.1.3.1
223.1.3.2
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
1
Network Layer 4-8
Subnets
IP
address:
subnet part
• high order bits
host part
• low order bits
what
’s a subnet ?
device interfaces with
same subnet part of IP
address
can physically reach each
other without intervening
router
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.1
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.27
subnet
223.1.3.1
223.1.3.2
network consisting of 3 subnets
Network Layer 4-9
Subnets
223.1.1.0/24
223.1.2.0/24
recipe
to determine the
subnets, detach each
interface from its
host or router,
creating islands of
isolated networks
223.1.1.1
223.1.1.2
223.1.1.4
each isolated network
is called a subnet
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.27
subnet
223.1.3.1
223.1.2.1
223.1.3.2
223.1.3.0/24
subnet mask: /24
Network Layer 4-10
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
Network Layer 4-11
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 12
Prof. Shamik Sengupta
Office SEM 204
ssengupta@unr.edu
http://www.cse.unr.edu/~shamik/
Announcements
Assignment 2 uploaded, Due by Wednesday, Oct 13th
Quiz 2 on Wednesday, Oct 7th
Introduction 1-13
IP Address classes
Address Class
Range of IP addresses
Class A
1.0.0.0
127.255.255.255
Class B
128.0.0.0
191.255.255.255
Class C
192.0.0.0
223.255.255.255
Class D
224.0.0.0
239.255.255.255
Some special IP addresses
0.0.0.0 – lowest IP address
Not used for a host connected to the Internet
Used for hosts when they start (boot)
255.255.255.255 – highest IP address
Not used for a host
Used for broadcasting
“Classful” IP addressing
problem
Suppose you have a company with 200 hosts. Which IP address
class would you choose and why?
Suppose you have a company with 300 hosts. Which IP address
class would you choose and why?
IP addressing: CIDR
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
Network Layer 4-17
IP addresses: how to get one?
Q: How does a host get IP address?
hard-coded by system admin in a file
DHCP: Dynamic Host Configuration Protocol:
dynamically get address from a server
“plug-and-play”
Network Layer 4-18
DHCP: Dynamic Host Configuration Protocol
goal: allow host to dynamically obtain its IP address from network
server when it joins network
can renew its lease on address in use
allows reuse of addresses
• only hold address while connected
support for mobile users who want to join network
DHCP overview:
host broadcasts “DHCP discover” msg
DHCP server responds with “DHCP offer” msg
host requests IP address: “DHCP request” msg
DHCP server sends address: “DHCP ack” msg
Network Layer 4-19
DHCP client-server scenario
DHCP
server
223.1.1.0/24
223.1.2.1
223.1.1.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
arriving DHCP
client needs
address in this
network
223.1.2.0/24
223.1.3.2
223.1.3.1
223.1.3.0/24
Network Layer 4-20
DHCP client-server scenario
DHCP server: 223.1.2.5
DHCP discover
src : 0.0.0.0, 68
dest.: 255.255.255.255, 67
yiaddr: 0.0.0.0
transaction ID: 654
arriving
client
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
Network Layer 4-21
DHCP: more than IP addresses
DHCP can return more than just allocated IP
address on subnet:
address of first-hop router for client
name and IP address of DNS sever
network mask
indicating network versus host portion of address
Network Layer 4-22
DHCP: example
its IP address,
addr of first-hop router,
addr of DNS server
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
connecting laptop needs
168.1.1.1
router with DHCP
server built into
router
use DHCP
DHCP request
encapsulated in UDP,
encapsulated in IP,
encapsulated in
802.3 Ethernet
Ethernet frame broadcast on
LAN,
received at router
running DHCP server
Ethernet
to IP
to UDP
to DHCP
4-23
DHCP: example
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
client’s IP address,
IP address of first-hop router
for client,
name & IP address of DNS
server
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
DCP server formulates
DHCP ACK containing
router with DHCP
server built into
router
encapsulation of DHCP server,
frame forwarded to client,
up to DHCP at client
client now knows
its IP address,
name and IP address of
DNS server,
IP address of its firsthop router
Network Layer 4-24
DHCP not enough!
NAT
Network Layer 4-25
NAT: network address translation
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.1
10.0.0.4
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)
Network Layer 4-26
NAT: network address translation
motivation: local network uses just one IP address as far
as outside world is concerned:
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
Network Layer 4-27
NAT: network address translation
implementation: NAT router must:
outgoing datagrams: replace (source IP address, port #) of
every outgoing datagram to (NAT IP address, new port #)
. . . remote clients/servers will respond using
(NAT IP address, new port #) as destination addr
remember (in NAT translation table) every (source IP address,
port #) to (NAT IP address, new port #) translation pair
incoming datagrams: replace (NAT IP address, new port #) in
dest fields of every incoming datagram with corresponding
(source IP address, port #) stored in NAT table
Network Layer 4-28
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
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
10.0.0.1
1
2
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
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
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
Network Layer 4-29
NAT: network address translation
NAT is controversial:
routers should only process up to layer 3
violates end-to-end argument
address shortage should instead be solved by IPv6
Network Layer 4-30
NAT traversal problem
client wants to connect to server with
address 10.0.0.1
10.0.0.1
server address 10.0.0.1 local to LAN
• client can’t use it as destination addr
only one externally visible NATed address:
138.76.29.7
client
?
138.76.29.7
10.0.0.4
NAT
router
solution: Port forwarding: statically configure
NAT to forward incoming connection requests
at given port to server
e.g., (123.76.29.7, port 2500) always forwarded
to 10.0.0.1 port 25000
Network Layer 4-31
NAT traversal problem
Solution 2: relaying (used in Skype)
NATed client establishes connection to relay
external client connects to relay
relay bridges packets between two connections
2. connection to
relay initiated
by client
client
3. relaying
established
1. connection to
relay initiated
by NATed host
138.76.29.7
10.0.0.1
NAT
router
Network Layer 4-32
Sample Project Topics
CPE 400
CPE 600
Simulation
WiFi Medium access control
ARP and ARP spoofing
Statistical multiplexing in flow
control of routers in a network
Optimized Link State Routing
(OLSR) Protocol
Better Approach To Mobile Adhoc
Networking (B.A.T.M.A.N.)
Routing in VANET/FANET
Multicasting and group management
Research Survey Topics
D2D Communication for future 5G
networks
Platoon-Based Vehicular CyberPhysical Systems
• Architecture and Challenges
Internet-of-Things (IoT)
• Self-organization
• Security and privacy issues
Software Defined Networks
Interference mitigation in Femtocells
Crowdsourcing in Heterogeneous
Networked Environments
Introduction 2-33
Some more sample project topics
CPE 400
Simulation
Transmission power/sleep control in sensor networks for extended lifetime
Data aggregation at routers/sensors for bandwidth conservation
Performance of existing routing protocols under error prone networks
Experimenting with positioning technologies for mobile networks
Any kind of system development based on networking
Introduction 2-34
CPE 400 Requirements
Basic requirement
The program is running, compiling
and giving output
The program is able to simulate
the protocol/application scenario
well as explained in the
documentation
You are able to capture the basic
functionalities of the
protocol/application
There are results (performance
results)
Some explanations of the results
Advanced requirement
You are able to handle ALL the
format / functionalities of the
protocol/ application
You are able to handle the error use
case scenarios
You are able to tweak the existing
platform/mechanism to come up with
something else that are focused on
something extra
Able to compare with another similar
protocol
Able to get some results on your
proposed idea
And explanations…
Introduction 2-35
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 13
Prof. Shamik Sengupta
Office SEM 204
ssengupta@unr.edu
http://www.cse.unr.edu/~shamik/
Announcements
Quiz #2
Midterm: Monday, Oct 26th
Previous Wednesday, Oct 21st Midterm discussion
Network Layer 4-37
Routing
Network Layer 4-38
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) }
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 4-39
Graph abstraction: costs
5
2
u
v
2
1
x
3
w
3
1
c(x,x’) = cost of link (x,x’)
e.g., c(w,z) = 5
5
z
1
y
2
cost could always be 1, or
inversely related to bandwidth, or
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
Network Layer 4-40
Routing algorithm classification
Q: global or decentralized
information?
global:
all routers have complete
topology, link cost info
“link state” algorithms
decentralized:
router knows physicallyconnected neighbors, link
costs to neighbors
iterative process of
computation, exchange of
info with neighbors
“distance vector” algorithms
Q: static or dynamic?
static:
routes change slowly over
time
dynamic:
routes change more
quickly
periodic update
in response to link
cost changes
Network Layer 4-41
A Link-State Routing Algorithm
Dijkstra’s algorithm
net topology, link costs
known to all nodes
accomplished via “link state
broadcast”
all nodes have same info
computes least cost paths
from one node (“source”)
to all other nodes
gives forwarding table for
that node
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
Network Layer 4-42
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 4-43
Dijkstra’s algorithm: example
D(v) D(w) D(x) D(y) D(z)
Step
0
1
2
3
4
5
N'
p(v)
p(w)
p(x)
u
uw
uwx
uwxv
uwxvy
uwxvyz
7,u
6,w
6,w
3,u
∞
∞
5,u
∞
5,u 14,w
12,w 14,x
10,v 14,x
12,y
p(y)
p(z)
x
notes:
construct shortest path tree by
tracing predecessor nodes
ties can exist
can be broken arbitrarily
5
9
7
4
11
3
u
w
y
2
z
3
4
7
v
Network Layer 4-44
Dijkstra’s algorithm: example
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
uxyvw
uxyvwz
D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
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
5
2
u
v
2
1
x
3
w
3
1
5
z
1
y
2
Network Layer 4-45
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
x
(u,v)
(u,x)
y
(u,x)
w
(u,x)
z
(u,x)
Network Layer 4-46
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 14
Prof. Shamik Sengupta
Office SEM 204
ssengupta@unr.edu
http://www.cse.unr.edu/~shamik/
Distance vector algorithm
Decentralized:
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min
{c(x,v)
+
d
(y)
}
v
v
cost from neighbor v to destination y
cost to neighbor v
min taken over all neighbors v of x
Network Layer 4-48
Bellman-Ford example
5
2
u
v
2
1
x
3
w
3
1
dv(z) = 5, dx(z) = 3, dw(z) = 3
5
z
1
y
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 looking for shortest path, used in forwarding table
Network Layer 4-49
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 4-50
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 4-51
Distance vector algorithm
iterative, asynchronous:
each local iteration caused by:
local link cost change
DV update message from neighbor
each node:
wait for (change in local link
cost or msg from neighbor)
distributed:
each node notifies neighbors
only when its DV changes
neighbors then notify their
neighbors if necessary
recompute estimates
if DV to any dest has
changed, notify neighbors
Network Layer 4-52
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
x y z
x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
x 0 2 3
y 2 0 1
z 7 1 0
cost to
from
from
node x
cost to
table x y z
Dx(z) = min{c(x,y) + Dy(z),
c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
from
node y cost to
table x y z
2
x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
x
y
7
1
z
from
node z cost to
table x y z
x ∞∞ ∞
y ∞∞ ∞
z 7 1 0
time
Network Layer 4-53
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
x y z
x y z
x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
x 0 2 3
y 2 0 1
z 7 1 0
x 0 2 3
y 2 0 1
z 3 1 0
cost to
cost to
from
from
from
node x
cost to
table x y z
x y z
x y z
x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
x 0 2 7
y 2 0 1
z 7 1 0
x 0 2 3
y 2 0 1
z 3 1 0
cost to
cost to
x ∞∞ ∞
y ∞∞ ∞
z 7 1 0
x 0 2 7
y 2 0 1
z 3 1 0
2
x
y
7
1
z
cost to
x y z
from
x y z
from
node z cost to
table x y z
from
cost to
from
from
from
node y cost to
table x y z
x 0 2 3
y 2 0 1
z 3 1 0
time
Network Layer 4-54
Distance vector: link cost changes
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
50
1
z
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.
Network Layer 4-55
Distance vector: link cost changes
link cost changes:
60
node detects local link cost change
bad news travels slow
x
“count to infinity” problem!
44 iterations before algorithm stabilizes
4
y
50
1
z
poisoned reverse:
If Z routes through 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
Network Layer 4-56
Hierarchical routing
our routing study thus far - idealization
all routers identical
network “flat”
… not true in practice
scale: with 600 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
Network Layer 4-57
Hierarchical routing
aggregate routers into
regions, “autonomous
systems” (AS)
gateway router:
at “edge” of its own AS
has link to router in
another AS
routers in same AS run
same routing protocol
“intra-AS” routing protocol
routers in different AS can
run different intra-AS
routing protocol
Network Layer 4-58
Interconnected ASes
3c
3a
3b
AS3
2a
1c
1a
1d
2c
2b
AS2
1b AS1
Intra-AS
Routing
algorithm
Inter-AS
Routing
algorithm
Forwarding
table
forwarding table configured
by both intra- and inter-AS
routing algorithm
intra-AS sets entries for
internal dests
inter-AS & intra-AS sets
entries for external
dests
Network Layer 4-59
Inter-AS tasks
suppose router in AS1
receives datagram
destined outside of AS1:
router should forward
packet to gateway
router, but which one?
AS1 must:
1.
learn which dests are
reachable through AS2,
which through AS3
2.
propagate this reachability
info to all routers in AS1
job of inter-AS routing!
3c
3b
other
networks
3a
AS3
2c
1c
1a
AS1
1d
2a
1b
2b
other
networks
AS2
Network Layer 4-60
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)
x
3c
3b
other
networks
3a
AS3
2c
1c
1a
AS1
1d
2a
1b
2b
other
networks
AS2
Network Layer 4-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
which gateway it should forward packets towards for dest x
this is also job of inter-AS routing protocol!
x
3c
3b
other
networks
3a
AS3
2c
1c
1a
AS1
1d
2a
1b
2b
other
networks
AS2
?
Network Layer 4-62
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.
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
Network Layer 4-63
Routing in the Internet
RIP
OSPF
BGP
Network Layer 4-64
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
Network Layer 4-65
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)
u
v
A
z
C
B
w
x
D
y
from router A to destination subnets:
subnet hops
u
1
v
2
w
2
x
3
y
3
z
2
Network Layer 4-66
RIP: example
z
w
A
x
y
B
D
C
routing table in router D
destination subnet
next router
# hops to dest
w
y
z
x
A
B
B
--
2
2
7
1
….
….
....
Network Layer 4-67
RIP: example
dest
w
x
z
….
w
A
A-to-D advertisement
next hops
1
1
C
4
… ...
x
z
y
B
D
C
routing table in router D
destination subnet
next router
# hops to dest
w
y
z
x
A
B
A
B
--
2
2
5
7
1
….
….
....
Network Layer 4-68
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 4-69
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
Network Layer 4-70
OSPF “advanced” features (not in RIP)
multiple same-cost paths allowed
only one path in RIP
for each link, multiple cost metrics for different 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-71
Hierarchical OSPF
boundary router
backbone router
backbone
area
border
routers
area 3
internal
routers
area 1
area 2
Network Layer 4-72
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-73
Routing in
Mobile Ad hoc Networks
Why is Ad hoc Routing challenging?
– No infrastructure network facility
– Changing network conditions at a faster scale
– Host mobility
– Energy consumption
– Traditional routing algorithms assume relatively stable network
topology, few router failures
Tradeoff: Proactive vs. Reactive Routing Protocol
Proactive Protocols
• have lower latency due to maintenance of routes at all times
• can result in much higher overhead due to frequent route updates
Reactive Protocols may have
• higher latency since the routes have to be discovered when the source
node initiates a route request
• lower overhead since routes are maintained only on-demand basis
Which approach achieves a better tradeoff depends
on the traffic and mobility patterns
Reactive protocol: Dynamic
Source Routing (DSR)
When node S wants to send a packet to node D,
but does not know a route to D, node S initiates
a route discovery
Source node S floods Route Request (RREQ)
Each node appends own identifier when
forwarding RREQ
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Z
S
E
F
B
C
M
J
A
L
G
H
K
I
D
N
Represents a node that has received RREQ for D from S
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Broadcast transmission
[S]
S
Z
E
F
B
C
M
J
A
L
G
H
K
D
I
N
Represents transmission of RREQ
[X,Y]
Represents list of identifiers appended to RREQ
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Z
S
E
[S,E]
F
B
C
A
M
J
[S,C]
H
L
G
K
I
D
N
• Node H receives packet RREQ from two neighbors:
potential for collision
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Z
S
E
F
B
[S,E,F]
C
M
J
A
L
G
H
I
[S,C,G] K
D
N
• Node C receives RREQ from G and H, but does not forward
it again, because node C has already forwarded RREQ once
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Z
S
E
[S,E,F,J]
F
B
C
M
J
A
L
G
H
D
K
I
[S,C,G,K]
N
• Nodes J and K both broadcast RREQ to node D
• Since nodes J and K are hidden from each other, their
transmissions may collide
© 2001 Nitin Vaidya
Route Discovery in DSR
Y
Z
S
E
[S,E,F,J,M]
F
B
C
M
J
A
L
G
H
K
I
D
N
• Node D does not forward RREQ, because node D
is the intended target of the route discovery
© 2001 Nitin Vaidya
Route Discovery in DSR
Destination D on receiving the first RREQ, sends
a Route Reply (RREP)
RREP is sent on a route obtained by reversing the
route appended to received RREQ
RREP includes the route from S to D on which
RREQ was received by node D
© 2001 Nitin Vaidya
Route Reply in DSR
Y
Z
S
E
RREP [S,E,F,J,D]
F
B
C
M
J
A
L
G
H
K
I
D
N
Represents RREP control message
© 2001 Nitin Vaidya
Route Reply in DSR
Route Reply can be sent by reversing the route in Route Request (RREQ)
only if links are guaranteed to be bi-directional
To ensure this, RREQ should be forwarded only if it received on a link
that is known to be bi-directional
If unidirectional (asymmetric) links are allowed, then RREP may need a route
discovery for S from node D
Unless node D already knows a route to node S
If a route discovery is initiated by D for a route to S, then the Route
Reply is piggybacked on the Route Request from D.
If IEEE 802.11 MAC is used to send data, then links have to be bi-directional
(since Ack is used)
© 2001 Nitin Vaidya
Dynamic Source Routing (DSR)
Node S on receiving RREP, caches the route
included in the RREP
When node S sends a data packet to D, the
entire route is included in the packet header
hence the name source routing
Intermediate nodes use the source route included
in a packet to determine to whom a packet
should be forwarded
© 2001 Nitin Vaidya
Data Delivery in DSR
Y
DATA [S,E,F,J,D]
S
Z
E
F
B
C
M
J
A
L
G
H
K
I
D
N
Packet header size grows with route length
© 2001 Nitin Vaidya
When to Perform a Route
Discovery
When node S wants to send data to node D, but
does not know a valid route node D
© 2001 Nitin Vaidya
DSR Optimization:
Route Caching
Each node caches a new route it learns by any means
When node S finds route [S,E,F,J,D] to node D, node S also learns route
[S,E,F] to node F
When node K receives Route Request [S,C,G] destined for node, node K
learns route [K,G,C,S] to node S
When node F forwards Route Reply RREP [S,E,F,J,D], node F learns route
[F,J,D] to node D
When node E forwards Data [S,E,F,J,D] it learns route [E,F,J,D] to node D
A node may also learn a route when it overhears Data packets
© 2001 Nitin Vaidya
Use of Route Caching
When node S learns that a route to node D is broken, it
uses another route from its local cache, if such a route to
D exists in its cache. Otherwise, node S initiates route
discovery by sending a route request
Node X on receiving a Route Request for some node D
can send a Route Reply if node X knows a route to node
D
Use of route cache
can speed up route discovery
can reduce propagation of route requests
© 2001 Nitin Vaidya
Use of Route Caching
[S,E,F,J,D]
[E,F,J,D]
S
[F,J,D],[F,E,S]
E
F
B
[J,F,E,S]
C
J
[C,S]
A
M
L
G
H
[G,C,S]
D
K
I
N
Z
[P,Q,R] Represents cached route at a node
(DSR maintains the cached routes in a tree format)
© 2001 Nitin Vaidya
Use of Route Caching:
Can Speed up Route Discovery
[S,E,F,J,D]
[E,F,J,D]
S
[F,J,D],[F,E,S]
E
F
B
C
[G,C,S]
[C,S]
A
[J,F,E,S]
M
J
L
G
H
I
[K,G,C,S] K
D
RREP
N
RREQ
When node Z sends a route request
for node C, node K sends back a route
reply [Z,K,G,C] to node Z using a locally
cached route
Z
© 2001 Nitin Vaidya
Route Error (RERR)
Y
RERR [J-D]
S
Z
E
F
B
C
M
J
A
L
G
H
K
D
I
N
J sends a route error to S along route J-F-E-S when its attempt to forward the
data packet S (with route SEFJD) on J-D fails
Nodes hearing RERR update their route cache to remove link J-D
© 2001 Nitin Vaidya
Route Caching: Beware!
Stale caches can adversely affect performance
With passage of time and host mobility, cached
routes may become invalid
A sender host may try several stale routes
(obtained from local cache, or replied from cache
by other nodes), before finding a good route
© 2001 Nitin Vaidya
Dynamic Source Routing:
Advantages
Routes maintained only between nodes who need
to communicate
reduces overhead of route maintenance
Route caching can further reduce route discovery
overhead
A single route discovery may yield many routes
to the destination, due to intermediate nodes
replying from local caches
© 2001 Nitin Vaidya
Dynamic Source Routing:
Disadvantages
Packet header size grows with route length due to source routing
Care must be taken to avoid collisions between route requests propagated by
neighboring nodes
Soln: insertion of random delays before forwarding RREQ
Increased contention if too many route replies come back due to nodes
replying using their local cache
Route Reply Storm problem
Reply storm may be eased by preventing a node from sending RREP if it
hears another RREP with a shorter route
© 2001 Nitin Vaidya
Dynamic Source Routing:
Disadvantages
An intermediate node may send Route Reply
using a stale cached route, thus polluting other
caches
© 2001 Nitin Vaidya