Download l4 - Heyook Lab

Document related concepts

Point-to-Point Protocol over Ethernet wikipedia , lookup

Zero-configuration networking wikipedia , lookup

AppleTalk wikipedia , lookup

Internet protocol suite wikipedia , lookup

Net neutrality law wikipedia , lookup

Net bias wikipedia , lookup

CAN bus wikipedia , lookup

Computer network wikipedia , lookup

Peering wikipedia , lookup

Backpressure routing wikipedia , lookup

Serial digital interface wikipedia , lookup

Airborne Networking wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

IEEE 1355 wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
Lecture 4: Dynamic routing protocols
Today:
1. Overview of router architecture
2. RIP, OSPF, BGP
3. Notes on Lab 4
4. Midterm review
Router Architectures
An overview of router architectures.
Two key router functions
routing
protocol
Routing
functions
routing
protocol
routing table
updates
routing protocols (RIP,
OSPF, BGP)
routing
table
Data plane: forwarding
routing table
lookup
incoming IP
datagrams
IP
Forwarding
Control plane: run
packets from incoming to
outgoing link
outgoing IP
datagrams
3
Routing and Forwarding
Routing functions include:
– route calculation
– maintenance of the routing table
– execution of routing protocols
• On commercial routers handled by a single general purpose
processor, called route processor
IP forwarding is per-packet processing
• On high-end commercial routers, IP forwarding is distributed
• Most work is done on the interface cards
4
Router Hardware Components
• Hardware components of a
router:
– Network interfaces
– Switching fabrics
– Processor with a memory
and CPU
Processor
Memory
CPU
Switching fabric
Interface Card
Interface Card
Interface Card
5
PC Router versus commercial router
• On a PC router:
– Switching fabric is the (PCI)
bus
– Interface cards are NICs (e.g.,
Ethernet cards)
– All forwarding and routing is
done on central processor
• On Commercial routers:
– Switching fabrics and
interface cards can be
sophisticated
– Central processor is the route
processor (only responsible
for control functions)
Processor
Memory
CPU
Switching fabric
Interface Card
Interface Card
Interface Card
6
Basic Architectural Components
Per-packet processing
7
Evolution of Router Architectures
• Early routers were essentially general purpose computers
• Today, high-performance routers resemble supercomputers
• Exploit parallelism
• Special hardware components
•
•
•
•
Until 1980s (1st generation): standard computer
Early 1990s (2nd generation): delegate to interfaces
Late 1990s (3rd generation): Distributed architecture
Today: Distributed over multiple racks
8
1st Generation Routers (switching via memory)
• This architecture is still used
in low end routers
• Arriving packets are copied to
main memory via direct memory
access (DMA)
• Switching fabric is a backplane
(shared bus)
• All IP forwarding functions are
performed in the central
processor.
• Routing cache at processor can
accelerate the routing table
lookup.
Route Processor
CPU
Cache
Memory
Shared Bus
DMA
DMA
DMA
Interface
Card
Interface
Card
Interface
Card
MAC
MAC
MAC
9
Drawbacks of 1st Generation Routers
• Forwarding Performance is limited by memory and
CPU
• Capacity of shared bus limits the number of interface
cards that can be connected
Input
Port
Memory
Output
Port
System Bus
10
2nd Generation Routers (switching via a shared bus)
• Keeps shared bus
architecture,
but offloads most IP
forwarding to interface cards
• Interface cards have local route
cache and processing elements
Fast path: If routing entry is found in
local cache, forward packet
directly to outgoing interface
Slow path: If routing table entry is
not in cache, packet must be
handled by central CPU
Route Processor
CPU
Cache
Memory
Shared
Bus
slow path
fast path
DMA
DMA
DMA
Route Cache
Route Cache
Route Cache
Memory
Memory
Memory
MAC
MAC
MAC
Interface
Cards
11
Another 2nd Generation Architecture
•
IP forwarding is done by
separate components
(Forwarding Engines)
Forwarding operations:
1. Packet received on interface:
Store the packet in local
memory. Extracts IP header
and sent to one forwarding
engine
2. Forwarding engine does
lookup, updates IP header,
and sends it back to
incoming interface
3. Packet is reconstructed and
sent to outgoing interface.
Control Bus
Forwarding Bus
(IP headers only)
Data Bus
Interface
Cards
Forwarding
Engine
Forwarding
Engine
Route Processor
CPU
CPU
CPU
Cache
Cache
Memory
Memory
Memory
IP header
IP datagram
Memory
Memory
Memory
MAC
MAC
MAC
12
Drawbacks of 2nd Generation Routers
Route Processor
CPU
Cache
Memory
Shared
Bus
DMA
DMA
DMA
Route Cache
Route Cache
Route Cache
Memory
Memory
Memory
MAC
MAC
MAC
Bus contention
limits throughput
Interface
Cards
13
3rd Generation Architecture
• Switching fabric is an
interconnection network (e.g., a
crossbar switch)
• Distributed architecture:
– Interface cards operate
independent of each other
– No centralized processing for
IP forwarding
• These routers can be scaled to
many hundred interface cards and
to aggregate capacity of > 1 Terabit
per second
Switch
Fabric
Switch
Fabric
Interface
Switch
Fabric
Interface
Route
Processor
Route
Processing
Route
Processing
CPU
Memory
Memory
Memory
MAC
MAC
14
Slotted Chassis
R
Pr o u t
oc e
(C esso
PU r
)
e cards
Interfac
• Large routers are built as a slotted chassis
– Interface cards are inserted in the slots
– Route processor is also inserted as a slot
• This simplifies repairs and upgrades of components
15
Dynamic Routing Protocols
Part 1: RIP
Relates to Lab 4.
The first module on dynamic routing protocols. This module introduces
RIP.
Routing
• Recall: There are two parts to routing IP packets:
1. How to pass a packet from an input interface to the output
interface of a router (packet forwarding) ?
2. How to find and setup a route ?
• We already discussed the packet forwarding part
– Longest prefix match
• There are two approaches for calculating the routing tables:
– Static Routing (Lab 3)
– Dynamic Routing: Routes are calculated by a routing protocol
17
Routing protocols versus routing algorithms
• Routing protocols establish routing tables at routers.
• A routing protocol specifies
– What messages are sent between routers
– Under what conditions the messages are sent
– How messages are processed to compute routing
tables
• At the heart of any routing protocol is a routing algorithm
that determines the path from a source to a destination
18
What routing algorithms common routing protocols
use
Routing protocol
Routing algorithm
Routing information protocol (RIP)
Distance vector
Interior Gateway routing protocol
(IGRP, cisco proprietary)
Distance vector
Open shortest path first (OSPF)
Link state
Intermediate System-to-Intermediate
System (IS-IS
Link state
Border gateway protocol (BGP)
Path vector
19
Intra-domain routing versus inter-domain routing
• Recall Internet is a network of networks.
• Administrative autonomy
– internet = network of networks
– each network admin may want to control routing in its own
network
• Scale: with 200 million destinations:
– can’t store all dest’s in routing tables!
– routing table exchange would swamp links
20
Autonomous systems
Ethernet
Router
Ethernet
Ethernet
Autonomous
System 1
Router
Router
Router
Ethernet
Router
Ethernet
Autonomous
System 2
Router
Ethernet
• aggregate routers into regions, “autonomous systems” (AS) or domain
• routers in the same AS run the same routing protocol
– “intra-AS” or intra-domain routing protocol
– routers in different AS can run different intra-AS routing protocol
21
Autonomous Systems
• An autonomous system is a region of the Internet that is
administered by a single entity.
• Examples of autonomous regions are:
• UCI’s campus network
• MCI’s backbone network
• Regional Internet Service Provider
• Routing is done differently within an autonomous system
(intradomain routing) and between autonomous system
(interdomain routing).
• RIP, OSPF, IGRP, and IS-IS are intra-domain routing
protocols.
• BGP is the only inter-domain routing protocol.
22
RIP and OSPF computes shortest paths
3
b
a
1
2
c
d
6
• Shortest path routing algorithms
• Goal: Given a network where each link is assigned a
cost. Find the path with the least cost between two
nodes.
23
Distance vector algorithm
• A decentralized algorithm
– A router knows physically-connected neighbors and link
costs to neighbors
– A router does not have a global view of the network
• Path computation is iterative and mutually dependent.
– A router sends its known distances to each destination
(distance vector) to its neighbors.
– A router updates the distance to a destination from all its
neighbors’ distance vectors
– A router sends its updated distance vector to its neighbors.
– The process repeats until all routers’ distance vectors do
not change (this condition is called convergence).
24
A router updates its distance vectors using
bellman-ford equation
Bellman-Ford Equation
Define
dx(y) := cost of the least-cost path from x to y
Then
• dx(y) = minv{c(x,v) + dv(y) }, where min is taken over all
neighbors of node x
25
Distance vector algorithm: initialization
• Let Dx(y) be the estimate of least cost from x to y
• Initialization:
– Each node x knows the cost to each neighbor: c(x,v). For
each neighbor v of x, Dx(v) = c(x,v)
– Dx(y) to other nodes are initialized as infinity.
• Each node x maintains a distance vector (DV):
– Dx = [Dx(y): y 2 N ]
26
Distance vector algorithm: updates
• Each node x sends its distance vector to its neighbors,
either periodically, or triggered by a change in its DV.
• When a node x receives a new DV estimate from a neighbor
v, it updates its own DV using B-F equation:
– If c(x,v) + Dv(y) < Dx(y) then
• Dx(y) = c(x,v) + Dv(y)
• Sets the next hop to reach the destination y to the
neighbor v
• Notify neighbors of the change
• The estimate Dx(y) will converge to the actual least cost dx(y)
27
Distance vector algorithm: an example
3
b
1
a
2
c
d
6
•
•
•
•
•
t=0
a = ((a, 0), (b, 3), (c, 6))
b = ((a, 3), (b, 0), (c,1))
c = ((a, 6), (b, 1), (c, 0) (d, 2))
d = ((c, 2), (d, 0))
•
•
•
•
•
t=2
a = ((a, 0), (b, 3), (c, 4), (d, 6))
b = ((a, 3), (b, 0), (c,1), (d, 3))
c = ((a, 4), (b, 1), (c, 0), (d, 2))
d = ((a, 6), (b, 3), (c, 2), (d,0))
•
•
•
•
•
t=1
a = ((a, 0), (b, 3), (c, 4), (d, 8))
b = ((a, 3), (b, 0), (c,1), (d, 3))
c = ((a, 4), (b, 1), (c, 0), (d, 2))
d = ((a, 8), (b, 3), (c, 2), (d,0))
28
How to map the abstract graph to the physical
network
c(v,w)
Net(v,w)
w
v
Net
c(v,n)
Net(v,n)
n
• Nodes (e.g., v, w, n) are routers, identified by IP addresses, e.g. 10.0.0.1
• Nodes are connected by either a directed link or a broadcast link
(Ethernet)
• Destinations are IP networks, represented by the network prefixes, e.g.,
10.0.0.0/16
– Net(v,n) is the network directly connected to router v and n.
• Costs (e.g. c(v,n)) are associated with network interfaces.
– Router1(config)# router rip
– Router1(config-router)# offset-list 0 out 10 Ethernet0/0
– Router1(config-router)# offset-list 0 out 10 Ethernet0/1
29
Distance vector routing protocol: Routing Table
c(v,w): cost to transmit on the
interface to network Net(v,w)
Net(v,w): Network address of the network between v
and w
RoutingTable of node v
Dest
v
Net(v,w)
c(v,w)
Net(v,n)
c(v,n)
via
(next hop)
D(v,net) is v’s cost
cost
to Net
w
Net
Net
n
D(v,Net)
n
30
Distance vector routing protocol: Messages
RoutingTable of node v
Dest
Net
v
via
(next hop)
n
cost
D(v,Net)
[Net , D(v,Net)]
n
• Nodes send messages to their neighbors which contain
distance vectors
• A message has the format: [Net , D(v,Net)] means“My cost to
go to Net is D (v,Net)”
31
Distance vector routing algorithm: Sending
Updates
RoutingTable of node v
Dest
via
(next hop)
cost
Net1
m
D(v,Net 1)
Net2
n
D(v,Net 2)
NetN
w
D(v,Net N)
Periodically, each node v
sends the content of its routing
table to its neighbors:
m
[Net1,D(v,Net1)]
[Net1,D(v,Net1)]
[NetN,D(v,NetN)]
[NetN,D(v,NetN)]
v
w
[Net1,D(v,Net1)]
[NetN,D(v,NetN)]
n
32
Initiating Routing Table I
• Suppose a new node v becomes active.
• The cost to access directly connected networks is zero:
– D (v, Net(v,m)) = 0
– D (v, Net(v,w)) = 0
– D (v, Net(v,n)) = 0
RoutingTable
c(v,m)
Net(v,m)
m
c (v,w)
Net(v,w)
v
Dest
via
(next hop)
cost
w
c(v,n)
Net(v,n)
Net(v,m)
m
0
Net(v,w)
w
0
Net(v,n)
n
0
n
33
Initiating Routing Table II
RoutingTable
Dest
•
via
(next hop)
cost
Net(v,m)
m
0
Net(v,w)
w
0
Net(v,n)
n
0
Node v sends the routing table entry to all its neighbors:
[n,0]
[Net(v,n),0]
[w,0]
[Net(v,w),0]
m
[n,0]
[Net(v,n),0]
[m,0]
[Net(v,m),0]
v
w
[m,0]
[Net(v,m),0]
[w,0]
[Net(v,w),0]
n
34
Initiating Routing Table III
• Node v receives the routing tables from other nodes and
builds up its routing table
[Net1,D(m,Net1)]
[Net1,D(w,Net1)]
[NetN,D(m,NetN)]
[NetN,D(w,NetN)]
m
v
w
[Net1,D(n,Net1)]
[NetN,D(n,NetN)]
n
35
Updating Routing Tables I
• Suppose node v receives a message from node m: [Net,D(m,Net)]
[Net,D(m,Net)]
Net
m
c(v,m)
Net(v,m)
v
w
n
Node v updates its routing table and sends out further
messages if the message reduces the cost of a route:
if ( D(m,Net) + c (v,m) < D (v,Net) ) {
Dnew (v,Net) := D (m,Net) + c (v,m);
Update routing table;
send message [Net, Dnew (v,Net)] to all neighbors
}
36
Updating Routing Tables II
• Before receiving the message:
RoutingTable
[Net,D(m,Net)]
Net
m
c(v,m)
Net(v,m)
Dest
v
w
via
(next hop)
Net
??
cost
D(v,Net)
n
• Suppose D (m,Net) + c (v,m) < D (v,Net):
RoutingTable
Dest
[Net,Dnew (v,Net)]
Net
m
c(v,m)
Net(v,m)
v
w
Net
via
(next hop)
m
cost
Dnew(v,Net)
[Net,Dnew (v,Net)]
n
37
Assume: - link cost is 1, i.e., c(v,w) = 1
- all updates, updates occur simultaneously
- Initially, each router only knows the cost of
connected interfaces
10.0.3.0/24
10.0.4.0/24
.1
.1
.1
.2
Net
via
cost
Router A
t=0:
10.0.1.0 10.0.2.0 -
0
0
t=1:
10.0.1.0 10.0.2.0 10.0.3.0 10.0.2.2
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.2.2
10.0.2.2
.2
Router B
Net
via
Router C
Net
via
0
0
t=0:
10.0.3.0 10.0.4.0 -
0
0
0
0
1
t=1:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
1
0
0
1
t=1:
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
1
0
0
1
0
0
1
2
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
1
0
0
1
2
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
10.0.2.1
10.0.3.2
10.0.3.2
10.0.3.1
10.0.4.2
10.0.3.1
10.0.3.1
10.0.4.2
.1
Router D
t=0:
10.0.2.0 10.0.3.0 -
10.0.2.1
10.0.3.2
10.0.5.0/24
.2
cost
.2
10.0.2.0/24
cost
10.0.1.0/24
2
1
0
0
1
Net
via
cost
Example
t=0:
10.0.4.0 10.0.5.0 -
0
0
t=1:
10.0.3.0 10.0.4.1
10.0.4.0 10.0.5.0 -
1
0
0
t=2:
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
2
1
0
0
10.0.4.1
10.0.4.1
-
38
Example
10.0.3.0/24
10.0.4.0/24
.1
.1
.1
Net
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
t=3:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
via
10.0.2.2
10.0.2.2
10.0.2.2
10.0.2.2
10.0.2.2
Router B
cost
Router A
.2
Net
0
0
1
2
0
0
1
2
3
via
.2
Router C
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
10.0.2.1
10.0.3.2
10.0.3.2
1
0
0
1
2
t=3:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
10.0.2.1
10.0.3.2
10.0.3.2
1
0
0
1
2
Net
t=2:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
t=3:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
via
10.0.3.1
10.0.3.1
10.0.4.2
10.0.3.1
10.0.3.1
10.0.4.2
Now, routing tables have converged !
10.0.5.0/24
.1
Router D
2
1
0
0
1
2
1
0
0
1
Net
via
cost
.2
cost
.2
10.0.2.0/24
cost
10.0.1.0/24
t=2:
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
10.0.4.1
10.0.4.1
-
2
1
0
0
t=3:
10.0.1.0
10.0.2.0
10.0.3.0
10.0.4.0
10.0.5.0
10.0.4.1
10.0.4.1
10.0.4.1
-
3
2
1
0
0
39
Characteristics of Distance Vector Routing
Protocols
• Periodic Updates: Updates to the routing tables are sent at
the end of a certain time period. A typical value is 30 seconds.
• Triggered Updates: If a metric changes on a link, a router
immediately sends out an update without waiting for the end
of the update period.
• Full Routing Table Update: Most distance vector routing
protocol send their neighbors the entire routing table (not only
entries which change).
• Route invalidation timers: Routing table entries are invalid if
they are not refreshed. A typical value is to invalidate an entry
if no update is received after 3-6 update periods.
40
The Count-to-Infinity Problem
1
A
A's Routing Table
to
C
via
(next hop)
C
B's Routing Table
cost
B
1
B
via
to
2
(next hop)
cost
C
C
1
C
-
1
A
3
-
1
now link B-C goes down
C
B
2
C
C
-
C
1
C
C
2
B
C
1
C
4
C
1
3
C
4
C
1
41
Count-to-Infinity
• The reason for the count-to-infinity problem is that each node
only has a “next-hop-view”
• For example, in the first step, A did not realize that its route
(with cost 2) to C went through node B
• How can the Count-to-Infinity problem be solved?
42
Count-to-Infinity
• The reason for the count-to-infinity problem is that each node
only has a “next-hop-view”
• For example, in the first step, A did not realize that its route
(with cost 2) to C went through node B
• How can the Count-to-Infinity problem be solved?
• Solution 1: Always advertise the entire path in an update
message to avoid loops (Path vectors)
– BGP uses this solution
43
Count-to-Infinity
• The reason for the count-to-infinity problem is that each node
only has a “next-hop-view”
• For example, in the first step, A did not realize that its route
(with cost 2) to C went through node B
• How can the Count-to-Infinity problem be solved?
• Solution 2: Never advertise the cost to a neighbor if this
neighbor is the next hop on the current path (Split Horizon)
– Example: A would not send the first routing update to B, since B
is the next hop on A’s current route to C
– Split Horizon does not solve count-to-infinity in all cases!
» You can produce the count-to-infinity problem in Lab 4.
44
RIP - Routing Information Protocol
• A simple intradomain protocol
• Straightforward implementation of Distance Vector Routing
• Each router advertises its distance vector every 30 seconds
(or whenever its routing table changes) to all of its neighbors
• RIP always uses 1 as link metric
• Maximum hop count is 15, with “16” equal to “”
• Routes are timeout (set to 16) after 3 minutes if they are not
updated
45
RIP - History
• Late 1960s : Distance Vector protocols were used in the
ARPANET
• Mid-1970s: XNS (Xerox Network system) routing protocol is
the ancestor of RIP in IP (and Novell’s IPX RIP
and Apple’s routing protocol)
• 1982
Release of routed for BSD Unix
• 1988
RIPv1 (RFC 1058)
- classful routing
• 1993
RIPv2 (RFC 1388)
- adds subnet masks with each route entry
- allows classless routing
• 1998
Current version of RIPv2 (RFC 2453)
46
RIPv1 Packet Format
IP header UDP header
RIP Message
1: RIPv1
2: for IP
Command Version
Set to 00...0
address family
Set to 00.00
32-bit address
Unused (Set to 00...0)
Address of destination
Cost (measured in hops)
One RIP message can
have up to 25 route entries
Unused (Set to 00...0)
one route entry
(20 bytes)
1: request
2: response
metric (1-16)
Up to 24 more routes (each 20 bytes)
32 bits
47
RIPv2
• RIPv2 is an extends RIPv1:
– Subnet masks are carried in the route information
– Authentication of routing messages
– Route information carries next-hop address
– Uses IP multicasting
• Extensions of RIPv2 are carried in unused fields of RIPv1
messages
48
RIPv2 Packet Format
IP header UDP header
RIP Message
2: RIPv2
2: for IP
Command Version
Set to 00...0
address family
Set to 00.00
32-bit address
Unused (Set to 00...0)
Address of destination
Cost (measured in hops)
One RIP message can
have up to 25 route entries
Unused (Set to 00...0)
metric (1-16)
one route entry
(20 bytes)
1: request
2: response
Up to 24 more routes (each 20 bytes)
32 bits
49
RIPv2 Packet Format
Used to provide a
method of separating
"internal" RIP routes
(routes for networks
within the RIP routing
domain) from "external"
RIP routes
Subnet mask for IP
address
Identifies a better next-hop
address on the same
subnet than the advertising
router, if one exists
(otherwise 0….0)
RIPv2 Message
Command Version
Set to 00.00
address family
route tag
IP address
Subnet Mask
Next-Hop IP address
metric (1-16)
2: RIPv2
one route entry
(20 bytes)
IP header UDP header
Up to 24 more routes (each 20 bytes)
32 bits
50
RIP Messages
• This is the operation of RIP in routed. Dedicated port for
RIP is UDP port 520.
• Two types of messages:
– Request messages
• used to ask neighboring nodes for an update
– Response messages
• contains an update
51
Routing with RIP
• Initialization: Send a request packet (command = 1, address
family=0..0) on all interfaces:
• RIPv1 uses broadcast if possible,
• RIPv2 uses multicast address 224.0.0.9, if possible
requesting routing tables from neighboring routers
• Request received: Routers that receive above request send their entire
routing table
• Response received: Update the routing table
• Regular routing updates: Every 30 seconds, send all or part of the
routing tables to every neighbor in an response message
• Triggered Updates: Whenever the metric for a route change, send entire
routing table.
52
RIP Security
• Issue: Sending bogus routing updates to a router
• RIPv1: No protection
• RIPv2: Simple authentication scheme
RIPv2 Message
Command Version
Set to 00.00
0xffff
Authentication Type
Password (Bytes 0 - 3)
Password (Bytes 4 - 7)
Password (Bytes 8- 11)
Password (Bytes 12 - 15)
2: plaintext
password
Authetication
IP header UDP header
Up to 24 more routes (each 20 bytes)
32 bits
53
RIP Problems
• RIP takes a long time to stabilize
– Even for a small network, it takes several minutes until the
routing tables have settled after a change
• RIP has all the problems of distance vector algorithms, e.g.,
count-to-Infinity
» RIP uses split horizon to avoid count-to-infinity
• The maximum path in RIP is 15 hops
54
Dynamic Routing Protocols II
OSPF
Relates to Lab 4. This module covers link state
routing and the Open Shortest Path First (OSPF)
routing protocol.
Distance Vector vs. Link State Routing
• With distance vector routing, each node has information only
about the next hop:
•
•
•
•
Node A: to reach F go to B
Node B: to reach F go to D
Node D: to reach F go to E
Node E: go directly to F
• Distance vector routing makes
poor routing decisions if
directions are not completely
correct
(e.g., because a node is down).
A
B
C
D
E
F
• If parts of the directions incorrect, the routing may be incorrect until the
routing algorithms has re-converged.
56
Distance Vector vs. Link State Routing
• In link state routing, each node has a complete map of the
topology
A
• If a node fails, each
node can calculate
the new route
B
C
D
E
A
F
A
• Difficulty: All nodes need to
have a consistent view of the
network
B
C
D
E
A
F
B
C
D
E
C
D
E
B
C
D
E
A
A
B
B
F
C
A
D
F
F
E
B
C
D
E
F
F
57
Link State Routing: Properties
• Each node requires complete topology information
• Link state information must be flooded to all nodes
• Guaranteed to converge
58
Link State Routing: Basic principles
1. Each router establishes a relationship (“adjacency”) with its neighbors
2. Each router generates link state advertisements (LSAs) which are
distributed to all routers
LSA = (link id, state of the link, cost, neighbors of the link)
Each router sends its LSA to all routers in the network (using a method
called reliable flooding)
3. Each router maintains a database of all received LSAs (topological
database or link state database), which describes the network has a
graph with weighted edges
4. Each router uses its link state database to run a shortest path
algorithm (Dijikstra’s algorithm) to produce the shortest path to each
network
59
Link state routing: graphical illustration
b
3
1
a
c
6
a’s view
b’s view 3
6
b
c
d’s view
1
a
c’s view
d
Collecting all pieces yield
a complete view of the network!
b
3
a
2
2
c
c
b
a
1
c
6
d
d
60
Operation of a Link State Routing protocol
Received
LSAs
Link State
Database
Dijkstra’s
Algorithm
IP Routing
Table
LSAs are flooded
to other interfaces
61
Dijkstra’s Shortest Path Algorithm for a Graph
Input: Graph (N,E) with
N the set of nodes and E the set of edges
cvw
link cost (cvw = 1 if (v,w)  E, cvv = 0)
s
source node.
Output: Dn
cost of the least-cost path from node s to node n
M = {s};
for each n  M
Dn = csn;
while (M  all nodes) do
Find w  M for which Dw = min{Dj ; j  M};
Add w to M;
for each neighbor n of w and n  M
Dn = min[ Dn, Dw + cwn ];
Update route;
enddo
62
OSPF
• OSPF = Open Shortest Path First
• The OSPF routing protocol is the most important link state
routing protocol on the Internet (another link state routing
protocol is IS-IS (intermediate system to intermediate system)
• The complexity of OSPF is significant
– RIP (RFC 2453 ~ 40 pages)
– OSPF (RFC 2328 ~ 250 pages)
• History:
–
–
–
–
–
1989: RFC 1131 OSPF Version 1
1991: RFC1247 OSPF Version 2
1994: RFC 1583 OSPF Version 2 (revised)
1997: RFC 2178 OSPF Version 2 (revised)
1998: RFC 2328 OSPF Version 2 (current version)
63
Features of OSPF
• Provides authentication of routing messages
• Enables load balancing by allowing traffic to be split evenly
across routes with equal cost
• Type-of-Service routing allows to setup different routes
dependent on the TOS field
• Supports subnetting
• Supports multicasting
• Allows hierarchical routing
64
Hierarchical OSPF
65
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.
66
Example Network
Router IDs can be
selected
independent of
interface addresses,
but usually chosen to
be the smallest
interface address
4
.2
.2
3
2
3
.6
1
.5
.3
5
.5
.5
10.1.5.0/24
10.1.2.3
.6
10.1.7.0 / 24
.4
.3
•Link costs are called Metric
1
.4
.2
.3
• Metric is in the range [0 ,
.4
10.1.4.0 / 24
10.1.1.0 / 24
.1
2
10.1.7.6
10.1.4.4
10.1.6.0 / 24
.1
10.1.1.2
10.1.3.0 / 24
10.1.1.1
10.1.5.5
216]
• Metric can be asymmetric
67
Link State Advertisement (LSA)
.1
.2
.2
10.1.1.0 / 24
3
2
.2
10.1.7.6
10.1.4.4
.4
10.1.4.0 / 24
.3
.4
10.1.6.0 / 24
4
.1
10.1.1.2
10.1.3.0 / 24
10.1.1.1
.6
10.1.7.0 / 24
.4
.6
.5
.3
.5
•
.5
10.1.5.0/24
10.1.5.5
10.1.2.3
The LSA of router 10.1.1.1 is as follows:
•
Link State ID:
10.1.1.1
•
•
Advertising Router:
Number of links:
10.1.1.1 = Router ID
3 = 2 links plus router itself
•
•
•
Description of Link 1:
Description of Link 2:
Description of Link 3:
Link ID = 10.1.1.2, Metric = 4
Link ID = 10.1.2.2, Metric = 3
Link ID = 10.1.1.1, Metric = 0
.3
= Router ID
68
Network and Link State Database
.1
.2
10.1.1.0 / 24
Each router has a
database which
contains the LSAs
from all other routers
.2
10.1.3.0 / 24
.1
10.1.1.2
.2
.4
10.1.4.0 / 24
.3
.4
.6
10.1.7.0 / 24
.4
.6
.5
.3
.3
10.1.7.6
10.1.4.4
10.1.6.0 / 24
10.1.1.1
.5
.5
10.1.5.0/24
10.1.5.5
10.1.2.3
LS Type
Link StateID
Adv. Router
Checksum
LS SeqNo
LS Age
Router-LSA
10.1.1.1
10.1.1.1
0x9b47
0x80000006
0
Router-LSA
10.1.1.2
10.1.1.2
0x219e
0x80000007
1618
Router-LSA
10.1.2.3
10.1.2.3
0x6b53
0x80000003
1712
Router-LSA
10.1.4.4
10.1.4.4
0xe39a
0x8000003a
20
Router-LSA
10.1.5.5
10.1.5.5
0xd2a6
0x80000038
18
Router-LSA
10.1.7.6
10.1.7.6
0x05c3
0x80000005
1680
69
Link State Database
• The collection of all LSAs is called the link-state database
• Each router has an identical link-state database
– Useful for debugging: Each router has a complete description of
the network
• If neighboring routers discover each other for the first time,
they will exchange their link-state databases
• The link-state databases are synchronized using reliable
flooding
70
OSPF Packet Format
OSPF Message
IP header
OSPF packets are not
carried as UDP payload!
OSPF has its own IP
protocol number: 89
OSPF Message
Header
Body of OSPF Message
Message Type
Specific Data
LSA
LSA
... ...
LSA
TTL: set to 1 (in most cases)
LSA
Header
LSA
Data
Destination IP: neighbor’s IP address or 224.0.0.5
(ALLSPFRouters) or 224.0.0.6 (AllDRouters)
71
OSPF Packet Format
OSPF Message
Header
2: current version
is OSPF V2
version
Message types:
1: Hello (tests reachability)
2: Database description
3: Link Status request
4: Link state update
5: Link state acknowledgement
Standard IP checksum taken
over entire packet
Authentication passwd = 1:
Authentication passwd = 2:
Body of OSPF Message
type
message length
source router IP address
ID of the Area
from which the
packet originated
Area ID
checksum
authentication type
authentication
authentication
32 bits
64 cleartext password
0x0000 (16 bits)
KeyID (8 bits)
Length of MD5 checksum (8 bits)
Nondecreasing sequence number (32 bits)
0: no authentication
1: Cleartext
password
2: MD5 checksum
(added to end
packet)
Prevents replay
attacks
72
OSPF LSA Format
LSA
Link Age
LSA
Header
LSA
Header
LSA
Data
Link Type
Link State ID
advertising router
link sequence number
checksum
length
Link ID
Link 1
Link Data
Link Type #TOS metrics
Metric
Link ID
Link 2
Link Data
Link Type #TOS metrics
Metric
73
Discovery of Neighbors
• Routers multicasts OSPF Hello packets on all OSPF-enabled
interfaces.
• If two routers share a link, they can become neighbors, and
establish an adjacency
10.1.10.1
10.1.10.2
Scenario:
Router 10.1.10.2 restarts
OSPF Hello
OSPF Hello: I heard 10.1.10.2
• After becoming a neighbor, routers exchange their link state
databases
74
Neighbor discovery and
database synchronization
10.1.10.1
Discovery of
adjacency
Scenario:
Router 10.1.10.2 restarts
10.1.10.2
OSPF Hello
OSPF Hello: I heard 10.1.10.2
After neighbors are discovered the nodes exchange their databases
Database Description: Sequence = X
Sends database
description.
(description only
contains LSA
headers)
Acknowledges
receipt of
description
Database Description: Sequence = X, 5 LSA headers =
Router-LSA, 10.1.10.1, 0x80000006
Router-LSA,
10.1.10.2, 0x80000007
Router-LSA,
10.1.10.3, 0x80000003
Router-LSA,
10.1.10.4, 0x8000003a
Router-LSA,
10.1.10.5, 0x80000038
Router-LSA,
10.1.10.6, 0x80000005
Database Description: Sequence = X+1, 1 LSA header=
Router-LSA,
10.1.10.2, 0x80000005
Sends empty
database
description
Database
description of
10.1.10.2
Database Description: Sequence = X+1
75
Regular LSA exchanges
10.1.10.1
Link State Request packets, LSAs =
Router-LSA, 10.1.10.1,
Router-LSA, 10.1.10.2,
Router-LSA, 10.1.10.3,
Router-LSA, 10.1.10.4,
Router-LSA, 10.1.10.5,
Router-LSA, 10.1.10.6,
10.1.10.1 sends
requested LSAs
10.1.10.2
10.1.10.2 explicitly
requests each LSA
from 10.1.10.1
Link State Update Packet, LSAs =
Router-LSA, 10.1.10.1,
0x80000006
Router-LSA, 10.1.10.2, 0x80000007
Router-LSA, 10.1.10.3, 0x80000003
Router-LSA, 10.1.10.4, 0x8000003a
Router-LSA, 10.1.10.5, 0x80000038
Router-LSA, 10.1.10.6, 0x80000005
76
Routing Data Distribution
• LSA-Updates are distributed to all other routers via Reliable
Flooding
• Example: Flooding of LSA from 10.10.10.1
10.1.1.1
10.1.2.2
LSA
ACK
10.1.3.4
LSA
Update
database
Update
database
10.1.1.2
Update
database
LSA
10.1.7.6
LSA
ACK
Update
database
Update
database
10.1.4.5
77
Dissemination of LSA-Update
• A router sends and refloods LSA-Updates, whenever the
topology or link cost changes. (If a received LSA does not
contain new information, the router will not flood the packet)
• Exception: Infrequently (every 30 minutes), a router will flood
LSAs even if there are not new changes.
• Acknowledgements of LSA-updates:
• explicit ACK, or
• implicit via reception of an LSA-Update
• Question: If a new node comes up, it could build the
database from regular LSA-Updates (rather than exchange of
database description). What role do the database description
packets play?
78
Border Gateway protocol (BGP)
BGP
• BGP = Border Gateway Protocol . Currently in version 4,
specified in RFC 1771. (~ 60 pages)
• Note: In the context of BGP, a gateway is nothing else but an
IP router that connects autonomous systems.
• Interdomain routing protocol for routing between autonomous
systems
• Uses TCP to establish a BGP session and to send routing
messages over the BGP session
• BGP is a path vector protocol. Routing messages in BGP
contain complete routes.
• Network administrators can specify routing policies
80
BGP policy routing
• BGP’s goal is to find any path (not an optimal one). Since the
internals of the AS are never revealed, finding an optimal path
is not feasible.
• Network administrator sets BGP’s policies to determine the
best path to reach a destination network.
81
BGP basics
• A route is defined as a unit of information that pairs a
destination with the attributes of a path to that destination.
• EBGP session is a BGP session between two routers in
different ASes.
• IBGP session is a BGP session between internal routers of an
AS.
82
EBGP and IBGP
128.195.0.0/16 0
128.195.0.0/16 0
R2
R3
AS 1
R1
AS 0
128.195.0.0/16 1 0
R4
R6
R5
AS 2
128.195.0.0/16 2 1 0
R8
•
R7
AS 3
IBGP is organized into a full mesh topology, or IBGP sessions are
relayed using a route reflector.
83
Commonly BGP attributes
•
•
•
•
Origin: whether it is an internal prefix or an prefix learned from BGP peers
AS path
Next hop
Multi_Exit_Disc (MED, multiple exit discriminator): used to distinguish
routes learned from different peers of the same neighboring AS
• Local_pref
• Community: group routes to communities
84
BGP route selection process
Routes sent
to peers
Routes recved from peers
Input
Decision
Policy
process
Engine
Best
routes
Out
Policy
Enigne
• Input/output engine may filter routes or
manipulate their attributes
85
Best path selection algorithm
1. If next hop is inaccessible, ignore routes
2. Prefer the route with the largest local preference value.
3. If local prefs are the same, prefer route with the shortest AS
path
4. If AS_path is the same, prefer route with lowest origin (IGP <
EGP < incomplete)
5. If origin is the same, prefer the route with lowest MED
6. IF MEDs are the same, prefer EBGP paths to IBGP paths
7. If all the above are the same, prefer the route that can be
reached via the closest IGP neighbor.
8. If the IGP costs are the same, prefer the router with lowest
router id.
86
Example of BGP route selection
AS1
•Accept 0/0 from AS2
•Use AS1 to reach
128.195.0.0/16
Input
Decision
Policy
process
Engine
AS2
Best
AS 5
routes
0/0 AS2
128.195.0.0/16 AS1
•Deny 0/0 from AS1
•Give 128.195.0.0/16
•From AS1 higher
•Local_pref
•Accept other routes
AS3
Out
Policy
Enigne
AS4
•Do not propagate 0/0 .
87
Summary
• Router architectures
• Dynamic routing protocols: RIP, OSPF, BGP
• RIP uses distance vector algorithm, and converges slow (the
count-to-infinity problem)
• OSPF uses link state algorithm, and converges fast. But it is
more complicated than RIP.
• Both RIP and OSPF finds lowest-cost path.
• BGP uses path vector algorithm, and its path selection
algorithm is complicated, and is influenced by policies.
88
Lab 4: dynamic routing protocols
Exercise (4B): count-to-infinity is optional
1
Router3
1
1
1
10
1 Router2
Router1
Router4
• Time consuming to reproduce, but interesting.
• Why does count-to-infinity still exist with split horizon?
• Lab report due after midterm
90
Why does count-to-infinity still exist with split
horizon?
Router3
1
1
1
Router4
PC3
10.0.1.0/24
1
X
Router1
10
1 Router2
Router3’s routing table:
10.0.1.0/24 ?? 1
Suppose updates happen in the following sequence:
1. The update from PC3 arrives at Router
2. The update from Router 3 arrives at Router 2
3. The update from Router 4 arrives at Router 2
Router2’s routing table:
10.0.1.0/24 ?? 1
Router4’s routing table:
10.0.1.0/24 Router3 3
Router2 is not Router4’s next hop.
Router4 sends to router2 the routing update
Router2’s routing table:
10.0.1.0/24 Router 4 4
This lie will be told to Router3 and
Circulates in the system  count-to-infinity
91
Midterm review
What you’ll be tested on
• Basic lab commands
– E.g., ping, traceroute, tcpdump, ethereal, ifconfig, how to
copy a file, how to list a directory
• Basic trouble shooting
– E.g., I cannot ping 128.195.1.150, why?
• Basic networking concepts
– E.g., layering principle, multiplexing, and encapsulation
• Protocols we’ve covered so far
– ARP
– ICMP
– IP
93
Address translation protocol
• What is it used for?
• What is an ARP cache used for?
94
ICMP
• What is it used for?
– E.g. error reporting, route redirect
• When will an ICMP message be triggered?
95
IP
•
•
•
•
•
Network order versus host order
CIDR addressing
Route aggregation
Longest prefix match
Fragmentation
96