IP address - Computer Science and Engineering

Download Report

Transcript IP address - Computer Science and Engineering

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
[email protected]
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
[email protected]
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
[email protected]
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
[email protected]
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
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 15
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
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-71
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-72
Hierarchical OSPF
boundary router
backbone router
backbone
area
border
routers
area 3
internal
routers
area 1
area 2
Network Layer 4-73
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-74
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:
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
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
[K,G,C,S] K
D
RREP
N
RREQ
Z
Route Reply Storm!
© 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
IP address: Subnetting
Introduction 2-98
IP addressing: Subnetting


IP address: 32-bit identifier for host, router interface
interface: connection between host/router and physical link
 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

What is a subnet?
Network Layer 4-99
Subnet Example
Network address 172.19.0.0 with /16 network mask
Network Network
172
19
Host
Host
0
0
• Why would you want to subnet?
– Divide larger network into smaller networks
– Limit layer 2 and layer 3 broadcasts to their subnet.
– Better management of traffic.
Subnet Example
Network address 172.19.0.0 with /16 network mask
Network Network
Host
Host
172
19
0
0
Using Subnets: subnet mask 255.255.255.0 or /24
Network Network
Subnet
Host
Network Mask:
255.255.0.0 or /16
11111111
11111111
00000000
00000000
Subnet Mask:
255.255.255.0 or /24
11111111
11111111
11111111
00000000
• Applying a mask which is larger than the default subnet mask,
will divide your network into subnets.
• Subnet mask used here is 255.255.255.0 or /24
Subnet Example
Network address 172.19.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0 or /24
Network Network
Subnet
Host
172
172
19
19
0
1
Host
Host
172
172
172
172
19
19
19
19
2
3
etc.
254
Host
Host
Host
Host
172
19
255
Host
Subnets
255
Subnets
28 - 1
Cannot use last
subnet as it
contains broadcast
address
Subnet Example
Network address 172.19.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0 or /24
Network Network
Subnet
Host
172
172
19
19
0
1
0
0
172
172
172
172
19
19
19
19
2
3
etc.
254
0
0
0
0
172
19
255
0
Subnets
Addresses
255
Subnets
28 - 1
Cannot use last
subnet as it
contains broadcast
address
Subnet Example
Class B address 172.19.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0 or /24
Network Network
Subnet
Hosts
Hosts
Addresses
172
172
19
19
0
1
1
1
254
254
172
172
172
172
19
19
19
19
2
3
etc.
254
1
1
1
1
254
254
254
172
19
255
Host
254
Each subnet has
254 hosts, 28 – 2
Subnet Example
Network address 172.19.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0 or /24
Network Network
Subnet
Host
172
172
19
19
0
1
255
255
172
172
172
172
19
19
19
19
2
3
etc.
254
255
255
255
255
172
19
255
255
Broadcast
Addresses
255
Subnets
28 - 1
Cannot use last
subnet as it
contains broadcast
address
Subnet Example
Network address 172.19.0.0 with /16 network mask
Using Subnets: subnet mask 255.255.255.0 or /24
172.19.0.0/24
172.19.5.0/24
172.19.10.0/24
172.19.25.0/24
Important things to remember about Subnetting



You can only subnet the host portion, you do not have control of the
network portion.
Subnetting does not give you more hosts, it only allows you to divide
your larger network into smaller networks.
When subnetting, you will actually lose host addresses:
 For each subnet you lose the address of that subnet
 For each subnet you lose the broadcast address of that subnet
 You “may” lose the first and last subnets
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 16
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
Subnetting – Example



Host IP Address: 138.101.114.250
Network Mask: 255.255.0.0 (or /16)
Subnet Mask: 255.255.255.192 (or /26)
Given the following Host IP Address, Network Mask and Subnet mask find the following
information:
 Major Network Information
 Major Network Address
 Major Network Broadcast Address
 Range of Hosts if not subnetted
 Subnet Information
 Subnet Address
 Range of Host Addresses (first host and last host)
 Broadcast Address
 Other Subnet Information
 Total number of subnets
 Number of hosts per subnet
Major Network Information






Host IP Address: 138.101.114.250
Network Mask: 255.255.0.0
Subnet Mask: 255.255.255.192
Major Network Address: 138.101.0.0
Major Network Broadcast Address: 138.101.255.255
Range of Hosts if not Subnetted: 138.101.0.1 to
138.101.255.254
Subnet information?
Introduction 2-111
Step 1: Find the Subnet Address
IP Address
Mask
Network
138.
10001010
11111111
10001010
138
101.
01100101
11111111
01100101
101
114.
01110010
11111111
01110010
114
250
11111010
11000000
11000000
192
Determine the Network (or Subnet) where this Host address lives:
1. Perform a bit-wise AND operation on the IP Address and the Subnet Mask
Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
2. Express the result in Dotted Decimal Notation
3. The result is the Subnet Address of this Subnet or “Wire” which is
138.101.114.192
Step 2: Subnet Range / Host
G.D.
Range
IP Address
Mask
Network
10001010
11111111
10001010
01100101
11111111
01100101
S.D.
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
Step 2:
Determine which bits in the address contain Network (subnet)
information and which contain Host information:
 Use the Network Mask: 255.255.0.0 and divide (Great Divide) the
network from the rest of the address.
 Use Subnet Mask: 255.255.255.192 and divide (Small Divide) the subnet
from the hosts between the last “1” and the first “0” in the subnet mask.
Step 3: First Host / Last Host
G.D.
S.D.
IP Address
Mask
Network
10001010
11111111
10001010
01100101
11111111
01100101
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
First Host
10001010
138
01100101
101
01110010
114
11
000001
193
Last Host
10001010
138
01100101
101
01110010
114
11
111110
254
Broadcast
10001010
138
01100101
101
01110010
114
11
111111
255
Host Portion
 Subnet Address: all 0’s
 First Host: all 0’s and a 1
 Last Host: all 1’s and a 0
 Broadcast: all 1’s
Step 4: Total Number of Subnets
G.D.
IP Address
Mask
Network

10001010
11111111
10001010
TotalFirstnumber
of10001010
subnets
Host
138
 Number of subnet
bits 10
Last
 210
= Host
1,024 10001010
138
 1,024 total subnets
S.D.
01100101
11111111
01100101
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
01100101
101
01110010
114
11
000001
193
01100101
101
01110010
114
11
111110
254
10001010
01100101
01110010
•Broadcast
Subtract one
“if” all-zeros
subnet cannot
be used11 111111
138
101
114
255
• Subtract one “if” all-ones subnet cannot be used
Step 5: Total Number of Hosts
per Subnet
G.D.
IP Address
Mask
Network

10001010
11111111
10001010
01100101
11111111
01100101
TotalFirstnumber
of10001010
hosts per01100101
subnet
Host
S.D.
01110010
11 111010
11111111
11 000000
01110010
11 000000
 subnet
  host 
counting range
counting
range
11
101
01110010
114
000001
193
01100101
101
01110010
114
11
111110
254
10001010
01100101
•Broadcast
Subtract one
for the subnet
address 01110010
138
101
114
• Subtract one for the broadcast address
11
111111
255
 Number of host 138
bits 6
10001010
Host
 26Last
= 64
138
 64 host per subnets
 62 hosts per subnet
Example #1

191.54.38.15
 10111111. 00110110. 00100110. 00001111


Network mask: 255.255.0.0
Subnet mask: 255.255.255.0
Given the following Host IP Address, Network Mask and Subnet mask find the following
information:
 Major Network Information
 Major Network Address
 Major Network Broadcast Address
 Range of Hosts if not subnetted
 Subnet Information
 Subnet Address
 Range of Host Addresses (first host and last host)
 Broadcast Address
 Other Subnet Information
 Total number of subnets
 Number of hosts per subnet
Introduction 2-117
Example #2

191.54.38.207
 ???


Network mask: 255.255.255.0
Subnet mask: 255.255.255.224
Given the following Host IP Address, Network Mask and Subnet mask find the following
information:
 Major Network Information
 Major Network Address
 Major Network Broadcast Address
 Range of Hosts if not subnetted
 Subnet Information
 Subnet Address
 Range of Host Addresses (first host and last host)
 Broadcast Address
 Other Subnet Information
 Total number of subnets
 Number of hosts per subnet
Introduction 2-118
IPv6
Introduction 2-119
IPv6: motivation


initial motivation: 32-bit address space soon to be
completely allocated.
additional motivation:
 header format helps speed processing/forwarding
 header changes to facilitate QoS
IPv6 datagram format:
 fixed-length 40 byte header
 no fragmentation allowed
Network Layer 4-120
IPv6 datagram format
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
ver
pri
flow label
hop limit
payload len
next hdr
source address
(128 bits)
destination address
(128 bits)
data
32 bits
Network Layer 4-121
Transition from IPv4 to IPv6


not all routers can be upgraded simultaneously
 no “flag days”
 how will network operate with mixed IPv4 and
IPv6 routers?
tunneling: IPv6 datagram carried as payload in IPv4
datagram among IPv4 routers
IPv4 header fields
IPv4 source, dest addr
IPv6 header fields
IPv6 source dest addr
IPv4 payload
UDP/TCP payload
IPv6 datagram
IPv4 datagram
Network Layer 4-122
Tunneling
IPv4 tunnel
connecting IPv6 routers
A
B
IPv6
IPv6
A
B
C
IPv6
IPv6
IPv4
logical view:
E
F
IPv6
IPv6
D
E
F
IPv4
IPv6
IPv6
physical view:
Network Layer 4-123
Tunneling
IPv4 tunnel
connecting IPv6 routers
A
B
IPv6
IPv6
A
B
C
IPv6
IPv6
IPv4
logical view:
E
F
IPv6
IPv6
D
E
F
IPv4
IPv6
IPv6
physical view:
flow: X
src: A
dest: F
data
A-to-B:
IPv6
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
Network Layer 4-124
ICMP
Introduction 2-125
ICMP: internet control message protocol

used by hosts & routers
to communicate networklevel information
 error reporting:
unreachable host, network,
port, protocol
 echo request/reply (used by
ping)

network-layer “above” IP:
 ICMP msgs carried in IP
datagrams

ICMP message: type, code
plus first 8 bytes of IP
datagram causing error
Type
0
3
3
3
3
3
3
4
Code
0
0
1
2
3
6
7
0
8
9
10
11
12
0
0
0
0
0
description
echo reply (ping)
dest. network unreachable
dest host unreachable
dest protocol unreachable
dest port unreachable
dest network unknown
dest host unknown
source quench (congestion
control - not used)
echo request (ping)
route advertisement
router discovery
TTL expired
bad IP header
Network Layer 4-126
Traceroute and ICMP

source sends series of
UDP segments to dest
 first set has TTL =1
 second set has TTL=2, etc.
 unlikely port number

when nth set of datagrams
arrives to nth router:
 router discards datagrams
 and sends source ICMP
messages (type 11, code 0)
 ICMP messages includes
name of router & IP address
3 probes

when ICMP messages
arrives, source records
RTTs
stopping criteria:
 UDP segment eventually
arrives at destination host
 destination returns ICMP
“port unreachable”
message (type 3, code 3)
 source stops
3 probes
3 probes
Network Layer 4-127
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 17
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
Midterm Preview
Introduction 2-129
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 18
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
Midterm
Introduction 2-131
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 19
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
BGP
Network Layer 4-133
BGP routing (RFC 4271)

BGP (Border Gateway Protocol): the de facto
routing protocol for the Internet


allows subnet to advertise its existence to rest of
Internet: “I am here”
BGP provides each AS a means to:
1. Obtain subnet reachability information from neighboring
ASs.
2. Propagate reachability information to all ASs and
internal routers.
3. Determine “good” routes to subnets based on
reachability information and policy.
BGP basics


pairs of routers (BGP peers) exchange routing info
over TCP connections: BGP sessions
 BGP sessions need not correspond to physical
links.
when AS2 advertises a subnet to AS1:
 AS2 promises it will forward datagrams towards
that subnet.
eBGP session
3c
iBGP session
3a
3b
AS3
1a
AS1
2c
2a
1c
1d
2b
AS2
1b
Distributing reachability info


using eBGP session between 3a and 1c, AS3 sends
reachability info to AS1.
 1c can then use iBGP to distribute new
reachability info to all routers in AS1
 1b can then re-advertise new reachability info
to AS2 over 1b-to-2a eBGP session
when router learns of new info, it creates entry in
its forwarding table.
eBGP session
3c
iBGP session
3a
3b
AS3
1a
AS1
2c
2a
1c
1d
2b
AS2
1b
BGP basics

BGP Internet standard specified in
 RFC 4271 (about the protocol)
 RFC 4274 (protocol analysis)


Currently version 4 of the protocol widely in use
BGP is so popular because of its simplicity despite
providing no performance or security guarantees
Understanding BGP



Internet consists of
thousands of ASes today
ASes use BGP to
exchange routing
information
BGP is an incremental
protocol - a BGPspeaking router sends an
announcement message
when a new route is
available
AS 3
AS 4
AS 7
AS 5
AS 2
AS 1
AS 6
BGP Message Types

Four message types specified
 Open message - opens a BGP communications session between peers
and is the first message sent by each side after a transport-protocol
connection is established.
 Update message - used to provide routing updates to other BGP
systems, allowing routers to construct a consistent view of the
network topology.
 Notification message - used to close an active session or when an
error condition is detected
 Keep-alive message - notifies BGP peers that a device is active.
BGP Packet formats

Basic header fields
 Each message has a fixed-size header. There may or may not be a data
portion following the header, depending on the message type.
 Marker: 16 byte field for compatibility; set to all 1’s
 Length: 2 byte field; total length of the message including the header
•
Min: 19 bytes; Max: 4096 bytes
•
•
•
•
1: Open
2: Update
3: Notification
4: Keepalive
 Type: 1 byte field;
BGP Packet formats

Open message format
Bytes
variable

After a TCP connection is established, the first message sent by each side is an
OPEN message. If the OPEN message is acceptable, a KEEPALIVE message
confirming the OPEN is sent back.



Version: protocol version; current version 4
AS: AS number of the sender (sender router’s AS)
Hold-time: Time between the receipt of successive KEEPALIVE and/or UPDATE
messages from the sender.
BGP Identifier: IP address of the BGP router
Optional Parameters: This field contains a list of optional parameters, in which
each parameter is encoded as a <Parameter Type, Parameter Length, Parameter
Value> triplet.


•
<1 byte, 1byte, variable length>
BGP Packet formats

Update message format
BGP Packet formats


Keepalive message format
KEEPALIVE messages MUST NOT be sent more frequently than
one per second. Up to implementation and hold-timer…
BGP Packet formats

Notification message format
Understanding BGP

1.
2.
3.
4.
Four MORE important
things to understand in BGP
IP prefixes
AS-PATH (Path vector
protocol) and AS numbers
Route selection
Import/export policy
AS 3
AS 4
AS 7
AS 5
AS 2
AS 1
AS 6
1. IP prefixes

Every device in the Internet known by IP
 But difficult to advertise every IP address
 Too much overhead


How to simplify that?
Remember, addresses are assigned to institutions in
blocks of contiguous addresses
 BGP takes advantage of that by advertising in CIDR mode
 E.g., 208.65.150.0/24

IP prefixing lead to smaller routing tables and fewer
route advertisements
2. AS-PATH and AS number

BGP announcement carries another additional item
 AS-PATH
 prefix + AS-PATH = “route”

AS-PATH is a path vector of AS numbers (ASNs)
 ICANN serving as the ultimate authority for delegating ASNs
• Internet Corporation for Assigned Names and Numbers (ICANN)

ASNs are 16 bit numbers ranging from 1 – 65535
 1-64511 are public and used by provider ASes
 64512 – 65534 for consumer ASes
 0 and 65535 are reserved
An example address
delegation
3. Route Selection
AS 3
AS 4
10.0.1.0/24;
AS 6,5
AS 2
AS 7
AS 1
AS 5
10.0.1.0/24;
AS 6
10.0.1.0/24;
AS 6,5
AS 6

Route Announcement and propagation
10.0.1.0/24
Starting a new company
10.0.1.1 –
10.0.1.254
IP prefixing – “longest match rule”
AS 3
AS 4
10.0.1.0/24;
AS 6,5
AS 2
AS 7
AS 1

10.0.1.0/24;
AS 6
10.0.1.0/24;
AS 6,5
What would AS4 BGP router do when it gets a
request for 10.0.1.1?




AS 5
Routing table may have 10.0.0.0/16 and 10.0.1.0/24
Both entries in the routing table match
Longest match rule will be taken
Router identifies the longest prefix that matches the
destination IP address
AS 6
10.0.1.0/24
Starting a new company
10.0.1.1 –
10.0.1.254
4. Routing Policy & Route Attributes

ASes are not just bound by physical relationships but also by
business and SLA
 Provider, consumer relationships
 Stub, transit ASes relationships

“Best” path chosen by a BGP router not necessarily the shortest
route in the physical topology
 There are various policies (import & export)
 Specified using “route attributes”
BGP routing policy
legend:
B
W
provider
network
X
A
customer
network:
C
Y



A,B,C are provider networks
X,W,Y are customer (of provider networks)
X is dual-homed: attached to two networks
 X does not want to route from B via X to C
 .. so X will not advertise to B a route to C
Network Layer 4-152
BGP routing policy (2)
legend:
B
W
provider
network
X
A
customer
network:
C
Y



A advertises path AW to B
B advertises path BAW to X
Should B advertise path BAW to C?
 No way! B gets no “revenue” for routing CBAW since neither W nor
C are B’s customers
 B wants to force C to route to w via A
 B wants to route only to/from its customers!
Network Layer 4-153
Is everything fine?

At first glance, the protocol looks simple and efficient

However, there are problems

Let’s look at the vulnerability/ threat models …
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 20
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
BGP problems and stories…
“Routing
1997.
2008
causes Internet outage”, Interactive Week, April 25,
saw the biggest of the incidents
 Youtube hijacking
Followed
by
 “Routing Snafu Causes Downtime for Web Hosts,”
http://www.datacenterknowledge.com/archives/2009/02/16/routing-snafucauses-downtime-for-web-hosts/

and thousands of other incidents reported…
Fraudulent Origin Attacks
10.0.1.0/24;
AS 1,2
AS 3
AS 4
10.0.1.0/24;
AS 6,5
AS 2
AS 7
10.0.1.0/24;
AS 1

AS 1
AS 5
10.0.1.0/24;
AS 6
10.0.1.0/24;
AS 6,5
Victim ASes will now start directing traffic
toward wrong AS
 If the malicious AS chooses to drop all the
packets, the effect is called a black hole
 Makes the desired addresses unavailable =>
network outage
 Looks like any other kind of outage => very
difficult to diagnose
AS 6
10.0.1.0/24
Starting a new company
10.0.1.1 –
10.0.1.254
Fraudulent Origin Attacks (2)
10.0.1.0/24;
AS 1,2
AS 3
AS 4
10.0.1.0/24;
AS 6,5
AS 2
AS 7
10.0.1.0/24;
AS 1
AS 1
AS 5
10.0.1.0/24;
AS 6
10.0.1.0/24;
AS 6,5
 The malicious AS may not choose to drop all the
packets
 Analyze and eventually forward => man-in-themiddle attack
AS 6
10.0.1.0/24
Starting a new company
10.0.1.1 –
10.0.1.254
Prefix Hijacking
AS 3
AS 4
My IP addresses:
208.65.153.238
208.65.153.251
208.65.153.253
AS 2
AS 7
AS 5
AS 1
208.65.153.0/24
AS 6
208.65.152.0/22

208.65.152.0 = 11010000 . 01000001 . 10011000 . 00000000

208.65.153.0 = 11010000 . 01000001 . 10011001 . 00000000

208.65.153.238
= 11010000 . 01000001 . 10011001 . 11101110
Prefix Hijacking
AS 3
AS 4
AS 2
AS 7
AS 5
AS 1
208.65.153.0/24



AS 6
208.65.152.0/22
The infamous case of youtube hijacking
Also known as “deaggregation” attack
Deaggregation harms the performance of BGP and indirectly
the network by increasing the size of BGP tables
Prefix Hijacking

Prefix Hijacking can also result in multiple
other actions




Black holing – destination seems unreachable
Impersonator
Traffic analyzer
Interceptor (man-in-the-middle)
Subversion of Path Attributes
AS 3
AS 4
10.0.1.0/24;
AS 6,5
AS 2
AS 7
AS 1
AS 5
10.0.1.0/24;
AS 6
10.0.1.0/24;
AS 6,5
AS 6
10.0.1.0/24
Starting a new company
10.0.1.1 – 10.0.1.254

Malicious AS can tamper Path attributes to manipulate routes
and can create various attacks
Attacks on Attributes

Inserting AS-PATH
 Create routing delays
 Allow malicious to change traffic pattern

Truncating AS-PATH
 Deleting certain ASes from AS-PATH
 Enticing consumers with “artificial” shorter routes

Creating Loops in AS-PATH

Changing the order of AS-PATH
BGP Vulnerabilities
Limitations of BGP…

There is no relationship between IP prefix and ASNs

BGP does not ensure anything


A router can be configured to advertise routes into
BGP with any AS number
Every router’s objective is to reach the destination
using shortest path, i.e., reducing delays
BGP Security

Potential defense:
 Cryptographic Techniques
 Defensive Filtering
 Routing Registries

Cryptographic Techniques:
 Two existing categories
• Symmetric keying
• Asymmetric keying
Defensive Filtering of Suspicious
BGP Announcements

Very much under open research issue and still
developing
 BGP speakers commonly filter based on policies and previously
proved corrupt routes
 Some of the recently proposed policy
• Filter announcements containing private AS
• Filter exceptionally long AS paths
• Impose a hard limit on the number of prefixes a
neighboring router can announce
• Cross-check neighboring routers’ updates before taking
decisions
Routing Registry




A route registry is a centralized repository of routing policy
information
ASes using a registry service insert details of their policy
and topological information into the repository for other
ASes to query
Routers query this data to validate received routes and
policy
Limitations?
Protecting the BGP





One of the biggest challenges
One of the high payoff open research today
United States government aims BGP security as part
of the national strategy to secure cyberspace
Internet Engineering Task Force (IETF) working
groups focusing on Routing Protocol Security
Requirements
One of the top agenda in Cybersecurity now
Broadcast and Multicast routing
Network Layer 4-169
Broadcast routing

deliver packets from source to all other nodes
duplicate
duplicate
creation/transmission
R1
R1
duplicate
R2
R2
R3
R4
source
duplication

R3
R4
in-network
duplication
Source duplication is inefficient
Network Layer 4-170
In-network duplication


flooding: when node receives broadcast packet, sends
copy to all neighbors
problems: cycles & broadcast storm
Network Layer 4-171
In-network duplication


controlled flooding: node only broadcasts pkt if it
hasn’t broadcast same packet before
Multiple mechanisms existing:
 Sequence number controlled flooding (SNCF):
• node keeps track of packet ids already broadcasted
• Peer-to-peer: Gnutella Project
• Link state advertisement in OSPF routing algorithm
 Reverse path forwarding (RPF):
• only forward packet if it arrived on shortest path between node
and source
• Ethernet learning switches use reverse-path forwarding

spanning tree:
 no redundant packets received by any node
Network Layer 4-172
Reverse Path Forwarding
 rely on router’s knowledge of unicast shortest
path from it to sender
 each router has simple forwarding behavior:
if (broadcast datagram received on incoming link on
shortest path back to source)
then flood datagram onto all outgoing links
else ignore datagram
Reverse Path Forwarding: example
S: source
R1
LEGEND
R4
datagram will be
forwarded
R2
R5
R3
R6
R7
datagram will not be
forwarded
Spanning trees

Suppose you have a connected undirected graph
 Connected: every node is reachable from every other node
 Undirected: edges do not have an associated direction

...then a spanning tree of the graph is a connected
subgraph in which there are no cycles
A connected,
undirected graph
175
Four of the spanning trees of the graph
Finding a spanning tree

To find a spanning tree of a graph,
pick an initial node and call it part of the spanning tree
do a search from the initial node:
each time you find a node that is not in the spanning tree, add to the
spanning tree both the new node and the edge you followed to get to
it
An undirected graph
176
One possible
result of a BFS
starting from top
One possible
result of a DFS
starting from top
Spanning tree


first construct a spanning tree
nodes then forward/make copies only along
spanning tree
A
A
B
B
c
c
D
F
D
E
F
G
(a) Network Topology
E
G
(b) BFS Spanning Tree
Network Layer 4-177
Spanning tree


first construct a spanning tree
nodes then forward/make copies only along
spanning tree
A
A
B
B
c
c
D
F
D
E
F
G
(a) broadcast initiated at A
E
G
(b) broadcast initiated at D
Network Layer 4-178
Multicast
Network Layer 4-179
Multicast routing challenges

How to identify the receivers of multicast packets
 Through IGMP protocol

How to address a packet sent to those receivers
 Class D multicast IP address
• (224.0.0.0 to 239.255.255.255)

How to send the packet
 Multicast routing tree
Network Layer 4-180
Special Multicast Addresses



224.0.0.0 is reserved
224.0.0.1 – 224.0.0.255: used for special purpose, topology discovery and
maintenance
224.0.1.0 – 239.255.255.255: assigned to various multicast applications or
unassigned
 239.0.0.0 – 239.255.255.255: reserved for site-local admin jobs
 224.0.0.1: all systems on this subnet
 224.0.0.2: all routers on this subnet
Network Layer 4-181
University of Nevada – Reno
Computer Science & Engineering Department
Fall 2015
CPE 400 / 600
Computer Communication Networks
Lecture 21
Prof. Shamik Sengupta
Office SEM 204
[email protected]
http://www.cse.unr.edu/~shamik/
Announcement:

Assignment 3 will be uploaded on Mon, Nov. 9
 Will be due by following Monday, Nov. 16
 Based on Network Layer

Quiz 3: Monday, Nov 16
 BGP
 Broadcasting
 Multicasting
3-183
Internet Group
Management Protocol
IGMP


IGMP is a protocol that manages group membership. The IGMP protocol
gives the multicast routers information about the membership status of
hosts (routers) connected to the network.
IGMP has three types of messages: the query, the membership report, and
the leave report.
Network Layer 4-185
Type
Value
General or Special Query
0x11 or 00010001
Membership Report
0x16 or 00010110
Leave Report
0x17 or 00010111
Format of the messages
Network Layer 4-187
Format of the messages
Network Layer 4-188
Example of IGMP
Imagine there are three hosts in a network as shown in next slide.
A query message was received at time 0; the random delay time
for each group is shown next to the group address. Show the
sequence of report messages.
189
Example of IGMP
190
Example of
IGMP
a. Time 12: The timer for 228.42.0.0 in host A expires and a
membership report is sent, which is received by the router and every
host including host B which cancels its timer for 228.42.0.0.
b. Time 30: The timer for 225.14.0.0 in host A expires and a
membership report is sent, which is received by the router and every
host including host C which cancels its timer for 225.14.0.0.
c. Time 50: The timer for 238.71.0.0 in host B expires and a
membership report is sent, which is received by the router and every
host.
d. Time 70: The timer for 230.43.0.0 in host C expires and a
membership report is sent, which is received by the router and every
host including host A which cancels its timer for 230.43.0.0.
Example of IGMP
Note that if each host had sent a report for every group in its list,
there would have been seven reports; with this strategy only four
reports are sent.
192
Multicast Routing
Multicast routing: problem statement
goal: find a tree (or trees) connecting routers having
local mcast group members
legend



tree: not all paths between routers used
shared-tree: same tree used by all group members
source-based: different tree from each sender to rcvrs
group
member
not group
member
router
with a
group
member
router
without
group
member
shared tree
source-based trees
Network Layer 4-194
Approaches for building mcast trees
approaches:
 source-based tree: one tree per source
 shortest path trees
 reverse path forwarding

group-shared tree: group uses one tree
 spanning trees
 center-based trees
…we first look at basic approaches, then specific protocols
adopting these approaches
Network Layer 4-195
Shortest path tree

mcast forwarding tree: tree of shortest path
routes from source to all receivers
 Dijkstra’s algorithm
LEGEND
s: source
R1
1
2
R2
3
router with attached
group member
R4
5
4
R5
6
R3
R6
router with no attached
group member
i
R7
link used for forwarding,
i indicates order link
added by algorithm
Network Layer 4-196
Reverse path forwarding
rely on router’s knowledge of unicast shortest
path from it to sender
 each router has simple forwarding behavior:

if (mcast datagram received on incoming link on
shortest path back to source)
then flood datagram onto all outgoing links
else ignore datagram
Network Layer 4-197
Reverse path forwarding: example
s: source
LEGEND
R1
R4
router with attached
group member
R2
R5
router with no attached
group member
datagram will be forwarded
R3
R6
R7
datagram will not be
forwarded

result is a source-specific reverse Shortest Path Tree
Network Layer 4-198
Reverse path forwarding: pruning

forwarding tree contains subtrees with no mcast group
members
 no need to forward datagrams down subtree
 “prune” msgs sent upstream by router with no
downstream group members
s: source
LEGEND
R1
R4
R2
router with attached
group member
P
R5
R3
P
R6
R7
router with no attached
group member
P
prune message
links with multicast
forwarding
Network Layer 4-199
Center-based trees



single delivery tree shared by all
one router identified as “center” of tree
to join:
 edge router sends unicast join-msg addressed to center
router
 join-msg “processed” by intermediate routers and
forwarded towards center
 join-msg either hits existing tree branch for this center,
or arrives at center
 path taken by join-msg becomes new branch of tree for
this router
Network Layer 4-200
Center-based trees: example
suppose R6 chosen as center:
LEGEND
R1
3
R2
router with attached
group member
R4
router with no attached
group member
2
R5
R3
1
1
path order in which join
messages generated
R6
R7
Network Layer 4-201
Mobile IP
Intro to mobile IP
Operation
Problems with mobility
One last IP topic…

Already covered lots of things about IP
 Forwarding, routing, multicast, etc…

One last IP topic: mobile networking
 Examples of mobile networking today?
Mobility and Standard IP Routing


IP assumes end hosts are in fixed physical locations
IP addresses enable IP routing algorithms to get packets
to the correct network
 IP address has network part and host part
 Host part should not be in routing tables

What if a user roams between networks?
 Want transparency
 Routing information becomes invalid
 Why can’t mobile users change IP when running an
application?
Mobile IP







Developed as a means for transparently dealing
with problems of mobile users
Enables hosts to stay connected to the Internet
regardless of their location and without changing IP
addresses
Requires no changes to software of non-mobile
hosts/routers
Requires addition of some infrastructure
Has no geographical limitations
Requires no modifications to IP addresses
RFC 5944
Mobile IP Entities

Mobile Node (MN)
 The entity that moves from network to network
 Assigned a permanent IP called its home address to which
other hosts send packets regardless of MN’s location

Home Agent (HA)




Router with additional functionality
Located on home network of MN
Mobility binding of MN’s IP with its Care of Address (COA)
Forwards packets to appropriate network when MN is away –
uses encapsulation
Mobile IP Entities contd.

Foreign Agent (FA)
 Another router with enhanced functionality
 Used to send/receive data between MN and HA
 Advertises itself periodically

Care-of-address (COA)
 Address which identifies MN’s current location
 Sent by FA to HA when MN attaches
 Usually the IP address of the FA

Correspondent Node (CN)
 End host to which MN is corresponding (eg. a web server)
Mobile IP Support Services

Agent Discovery
 HA’s and FA’s broadcast their presence on each network to
which they are attached
 MN’s listen for advertisement and then initiate registration

Registration
 When MN is away, it registers its COA with its HA, via FA
 Registration control messages sent via UDP to well known
port

Encapsulation/decapsulation – just like standard IP only
with COA
Registration Process
Mobile IP Operation

A MN listens for agent advertisement and then initiates
registration
 If responding agent is the HA, then mobile IP is not necessary

After receiving the registration request from a MN, the HA
acknowledges and registration is complete
 Registration happens as often as MN changes networks

HA intercepts all packets destined for MN
 This is simple unless sending application is on or near the same network as
the MN
 HA masquerades as MN
 There is a specific lifetime for service before a MN must re-register
 There is also a de-registration process with HA if an MN returns home
Tables maintained on routers

Mobility Binding Table
 Maintained on HA of MN
 Maps MN’s home address with
its current COA

Visitor List
 Maintained on FA serving an MN
 Maps MN’s home address to its
MAC address and HA address
Mobile IP Operation contd.

HA then encapsulates all packets addressed to MN and
forwards them to FA
 IP tunneling



FA decapsulates all packets addressed to MN and
forwards them via hardware address (learned as part of
registration process)
NOTE that the MN can perform FA functions if it
acquires an IP address eg. via DHCP
Bidirectional communications require tunneling in each
direction
Mobile IP Tunneling
Across Internet
Problems with Mobile IP

Suboptimal “triangle” routing
 What if MN is in same subnetwork as the node to which it is
communicating and HA is on the other side of the world?
• It would be nice if we could directly route packets
 Solution: Let the CN know the COA of MN
• Then the CN can create its own tunnel to MN
• CN must be equipped with software to enable it to learn the
COA
• Initiated by HA who notifies CN via “binding update”