Download Document

Document related concepts

Peering wikipedia , lookup

AppleTalk wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Net bias wikipedia , lookup

Deep packet inspection wikipedia , lookup

Network tap wikipedia , lookup

Serial digital interface wikipedia , lookup

Zero-configuration networking wikipedia , lookup

CAN bus wikipedia , lookup

Computer network wikipedia , lookup

Backpressure routing wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Airborne Networking wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

IEEE 1355 wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
4.2 Routing
4.2.1 Network as a Graph
4.2.2 Distance Vector (RIP)
4.2.3 Link State (OSPF)
4.2.4 Metrics
4.2.5 Routing for Mobile Hosts
1
 Route
 a way or course taken in getting from a starting point to a
destination
 send or direct along a specified course
 Routing
 find the path or course of forwarding according to
information contained in packet (destination)
 Difference between network-layer and link-layer
 format of forwarding table
 way of updating the table
2
Link-layer
 Forwarding table
 mapping from destination physical address (MAC
address) to port of forwarding
 Update of the table
 manually configured
3
IP (Network) Layer
 Forwarding table
 mapping from destination network id (NetNum) to next-hop (or
interface) of forwarding
 Update the table
 manually configured (static route)
 dynamically learned from routing protocol
4
Forwarding vs. Routing
Forwarding
taking a packet  looking at its destination
address  consulting a table  sending the packet
in a direction determined by that table
locally done at a node
Routing
the process by which forwarding tables are built
depends on a distributed algorithm
5
Forwarding Table vs. Routing Table
 Forwarding table
 used when a packet is being forwarded and so must
contain enough information to accomplish the
forwarding function
 a row in the forwarding table contains the mapping
from a network number to an outgoing interface and
some MAC information, such as the Ethernet
address of the next hop
6
 Routing table
 the table that is built up by the routing algorithms as
a precursor to building the forwarding table
 it contains mappings from network numbers to
next-hops (IP addresses)
7
 Example, in the following tables
 the routing table tells us that network number 10 is
to be reached by a next hop router with the IP
address 171.69.245.10
 the forwarding table contains the information about
exactly how to forward a packet to that next hop
 send it out interface number 0 with a MAC address of
8:0:2b:e4:b:l:2 (the last piece of information is
provided by the Address Resolution Protocol)
8
Network Number
Next Hop
Network
Number
Interface
MAC address
10
171.69.245.10
10
if0
8:0:2b:e4:b:1:2
(a)
(b)
Example rows from (a) routing and (b) forwarding tables
9
4.2.1 Network as a Graph
A
1
3
4
C
6
2
1
B
9
E
F
1
D
10
 Basic problem of routing
 find the lowest-cost path between any two nodes, where
the cost of a path equals the sum of the costs of all the
edges that make up the path
A
1
3
4
C
6
2
1
B
9
E
F
1
D
11
 Solution
 routing is achieved in most practical networks by running
routing protocols among the nodes
 these protocols provide a distributed, dynamic way to solve
the problem of finding the lowest-cost path in the presence of
 node or link failure
 addition of new node or new link
 changes of link cost
 it is difficult to make centralized solutions scalable, so all the
widely used routing protocols use distributed algorithms
12
4.2.2 Distance Vector (RIP)
 Distance-Vector Algorithm (Bellman-Ford Algorithm)
 each node constructs a one-dimensional array (a vector)
containing the "distances" (costs) to all other nodes and
distributes that vector to its immediate neighbors
 response when receiving an announcement from a neighbor
for every entry in the announcement, store it if
the announced distance is shorter than what in the table
 a better route is found
otherwise discard it
13
 assumption
 initially, each node knows the cost of the link to each
of its directly connected neighbors
 broken links are assigned an infinite cost, ∞
14
 Local data structure
 routing table
 destination
 cost to the destination
 corresponding next-hop
15
Distance Vector Algorithm
 In this example
 the cost of each link is set to 1
 a least-cost path is simply the one with the fewest
hops
B
C
A
D
E
F
G
16
B
A
Initial State
C
E
D
F
Destination
Y
G
Node X’s Routing Table: Cost / Next-Hop
A’s
B’s
C’s
D’s
E’s
F’s
G’s
A
0
1/A
1/A
∞
1/A
1/A
∞
B
1/B
0
1/B
∞
∞
∞
∞
C
1/C
1/C
0
1/C
∞
∞
∞
D
∞
∞
1/D
0
∞
∞
1/D
E
1/E
∞
∞
∞
0
∞
∞
F
1/F
∞
∞
∞
∞
0
1/F
G
∞
∞
∞
1/G
∞
1/G
0
17
A’s routing table
Destination
Y
A
B
C
D
E
F
G
Cost/
Next-Hop
0/
1/B
1/C
2/C
1/E
1/F
2/F
B
A
C
E
F
D
G
Distance Vector sent by A
18
B
A
After One Step
C
E
D
F
Destination
Y
G
Node X’s Routing Table: Cost / Next-Hop
A’s
B’s
C’s
D’s
E’s
F’s
G’s
A
0
1/A
1/A
2/C
1/A
1/A
2/F
B
1/B
0
1/B
2/C
2/A
2/A
∞
C
1/C
1/C
0
1/C
2/A
2/A
2/D
D
2/C
2/C
1/D
0
∞
2/G
1/D
E
1/E
2/A
2/A
∞
0
2/A
∞
F
1/F
2/A
2/A
2/G
2/A
0
1/F
G
2/F
∞
2/D
1/G
∞
1/G
0
19
After Two
Steps
B
A
C
E
convergence: no more changes when
getting further announcement
Destination
Y
F
D
G
Node X’s Routing Table: Cost / Next-Hop
A
A’s
0
B’s
1/A
C’s
1/A
D’s
2/C
E’s
1/A
F’s
1/A
G’s
2/F
B
1/B
0
1/B
2/C
2/A
2/A
3/F
C
1/C
1/C
0
1/C
2/A
2/A
2/D
D
2/C
2/C
1/D
0
3/A
2/G
1/D
E
1/E
2/A
2/A
3/C
0
2/A
3/F
F
1/F
2/A
2/A
2/G
2/A
0
1/F
G
2/F
3/C
2/D
1/G
3/A
1/G
0
20
 Two different circumstances for a node to send a routing update
to its neighbors
 periodic update
 each node automatically sends an update message every so
often, even if nothing has changed
 triggered update
 happens whenever a node receives an update from one of its
neighbors that causes it to change one of the routes in its
routing table
 i.e., whenever a node's routing table changes, it sends an update
to its neighbors, which may lead to a change in their tables,
causing them to send an update to their neighbors
21
Link Failures
 Example 1 (stable)
Pattern:(Dest, Cost, NextHop)
 F detects that link to G has failed
 F sets distance to G to infinity and sends update to A
[F:(G, ∞, G)]
 A sets distance to G to infinity since it uses F to reach G
[A:(G, ∞, F)]
------------------------------------------------------------------------ A receives periodic update from C with 2-hop path to G
 A sets distance to G to 3 and sends update to F
[A:(G, 3, C)]
 F decides it can reach G in 4 hops via A
[F:(G, 4, A)]
22
∞
 Example 2 (count to infinity)
 link from A to E fails
 A advertises distance of infinity to E [A:(E, ∞, E)]
 B and C advertise a distance of 2 to E
[B:(E, 2, A)] ,[C:(E, 2, A)]
 B hears that E can be reached in 2 hops from C
 B decides it can reach E in 3 hops; advertises this to A
[B:(E, 3, C)]
 A decides it can reach E in 4 hops; advertises this to C
[A:(E, 4, B)]
 C decides that it can reach E in 5 hops… [C:(E, 5, A)]
23
 Loop-breaking heuristics (partial solutions)
 set infinity to 16
 split horizon
 split horizon with poison reverse
24
 Solution-1 (set infinity to 16)
 use some relatively small number as an approximation
of infinity, which at least bounds the amount of time
that it takes to count to infinity
 example, set the maximum number of hops to get across
a certain network is never going to be more than 16 (set
16 to be infinity value)
 drawback
 problem occurs if our network grew to a point where
some nodes were separated by more than 16 hops
25
 Solution-2 (split horizon)
 when a node sends a routing update to its neighbors, it
does not send those routes it learned from each neighbor
back to that neighbor
 example, if B has the route (E, 2, A) in its table, then it
knows it must have learned this route from A, and so
whenever B sends a routing update to A, it does not
include the route (E, 2, A) in that update
26
 Solution-3 (split horizon with poison reverse)
 (B actually sends that route back to A, but it puts
negative information in the route to ensure that A will
not eventually use B to get to E)
 Let B be a neighbor of A
 if in the routing table of B, the next hop entry for
destination Z is A, B informs A that its distance to Z
is infinite
[B:(Z, cost, A) → A:(Z, ∞, B)]
27
 Solution 2 & 3 only work for routing loops that involve two
nodes
 example, for larger routing loops
 if B and C had waited for a while after hearing of the
link failure from A before advertising routes to E
 they would have found that neither of them really
had a route to E
28
Routing Information Protocol (RIP)
 One of the most widely used routing protocols in IP networks
 A DV (Distance Vector) routing protocol
 Rather than advertising the cost of reaching other routers, the
routers advertise the cost of reaching networks
 example, in the following figure, router C would
advertise to router A the fact that it can reach
 networks 2 and 3 at cost 0
[C:(Net2, 0, Net2),C:(Net3, 0, Net3)]
 networks 5 and 6 at cost 1
[C:(Net5, 1, Net3),C:(Net6, 1, Net3)]
 network 4 at cost 2
[C:(Net4, 2, Net3)]
29
1
4
A
B
2
5
C
3
D
6
Example network running RIP
30
0
8
Command
16
Version
Family of net 1
31
Must be zero
Address of net 1
Address of net 1
Distance to net 1
Family of net 2
Address of net 2
Address of net 2
 RIP packet format
Distance to net 2
 the majority of the packets is taken up with
(network-address, distance) pairs
 example
 if router A learns from router B that network X can be
reached at a lower cost via B than via the existing next
hop in the routing table
 A updates the cost and next hop information for the
network number accordingly
31
0
8
Command
16
Version
Family of net 1
31
Must be zero
Address of net 1
Address of net 1
Distance to net 1
Family of net 2
Address of net 2
Address of net 2
Distance to net 2
RIP packet format
32
 RIP
 a fairly straightforward implementation of distancevector routing
 routers running RIP send their advertisements every 30
seconds
 a router also sends an update message whenever an
update from another router causes it to change its
routing table
33
 metrics or costs for routing
 all link costs being equal to 1
 always tries to find the minimum hop route
 valid distances are 1 through 15, with 16 representing
infinity (this limits RIP to running on fairly small
networks-those with no paths longer than 15 hops)
34
4.2.3 Link State (OSPF)
 Distance-Vector approach
 “tell neighbors where I can go, and how far”
 Link-State approach
 “tell all which neighbors I have”
35
 Link-state routing
 the second major class of intradomain routing protocol
 assumptions
 each node is assumed to be capable of finding out the
state of the link to its neighbors (up or down) and the
cost of each link
 Intradomain
 An internetwork in which all the routers are under the
same administrative control (e.g., a single university
campus, or the network of a single Internet service
provider)
36
 basic idea
 every node knows how to reach its directly
connected neighbors, and if we make sure that the
totality of this knowledge is disseminated to
every node, then every node will have enough
knowledge of the network to build a complete
map of the network
 link-state routing protocols rely on two mechanisms
 reliable dissemination of link-state information
 calculation of routes from the sum of all the
accumulated link-state knowledge
37
Link-State Message Data Structure
 LSP (Link-State Packet)
 an update packet created by each node
 information for route calculation
 the ID of the node that created the LSP
 a list of directly connected neighbors of the node, with
the cost of the link to each one
38
 information for reliability
 a sequence number
 ensure having the most recent copy
 reset to zero when routing process restarted
 a time to live (TTL) for this packet
 Too old packets are discarded
39
Reliable Flooding
 Send local LSP out on all of its directly connected
links
 Each node receiving the LSP forwards it out on all
of its links
 stores each node’s recent LSP
 forwards LSP to neighbors except the sender
itself
40
 The following figure shows an LSP being
flooded in a small network
 each node becomes shaded as it stores the new LSP
(a) the LSP arrives at node X, which sends it to neighbors
A and C
(b) A and C do not send it back to X, but send it on to B
(c) B receives two identical copies of the LSP, it will
accept whichever arrived first and ignore the second as
a duplicate
(d) B passes the LSP onto D, who has no neighbors to
flood it to, and the process is complete
41
X
A
C
B
D
X
A
C
B
(a)
X
A
C
B
(c)
D
(b)
D
X
A
C
B
D
(d)
42
New LSP Generation
 Two circumstances to generate new LSP
 expiry of a periodic timer
 change in topology
 directly connected links go down
 detected by link-layer protocols
 immediate neighbors go down
 detected by periodic “hello” message
43
Calculation of Route
 Dijkstra’s Shortest Path Algorithm
 Notations
 N: vertex set of the graph
 l: l(i, j) is the (non-negative) cost of the edge (i, j)
 s: current vertex
 M: set of ever calculated vertices
B
5
 C(n): cost of path from s to n
A
3
10
C
11
2
D
44
 Calculate a minimum-cost tree from s
M = {s}
for each n in N-{s}
C(n) = l(s,n)
while (N != M)
M = M union {w} such that C(w) is the minimum for
all w in (N-M)
for each n in (N-M)
C(n) = MIN(C(n),C(w)+l(w,n))
B
5
A
3
10
C
11
2
D
45
 In practice, each switch computes its routing table directly
from the LSPs it has collected using a forward search
approach for Dijkstris algorithm
 each switch maintains two lists, known as Tentative
and Confirmed.
 each of these lists contains a set of entries of the form
(Destination, Cost, NextHop)
B
5
A
3
10
C
11
2
D
46
B
5
Forward Search Approach for
Dijkstra Algorithm
A
3
10
C
11
2
D
1. Initialize the Confirmed list with an entry for myself; this entry has a cost of 0.
2. For the node just added to the Confirmed list in the previous step, call it node
Next, select its LSP.
3. For each neighbor (Neighbor) of Next, calculate the cost (Cost) to reach this
Neighbor as the sum of the cost from myself to Next and from Next to
Neighbor.
 (a) If Neighbor is currently not on either the Confirmed or the Tentative
list, then add (Neighbor, Cost, NextHop) to the Tentative list, where
NextHop is the direction I go to reach Next.
 (b) If Neighbor is currently on the Tentative list, and the Cost is less than
the currently listed cost for Neighbor, then replace the current entry with
(Neighbor, Cost, NextHop), where NextHop is the direction I go to reach
Next.
4. If the Tentative list is empty, stop. Otherwise, pick the entry from the Tentative
list with the lowest cost, move it to the Confirmed list, and return to step 2.
47
Example
B
5
A
3
10
C
11
2
D
Link-state routing: an example network
48
B
5
A
3
10
C
11
2
D
(B, 11, B) → (C, 2, C)
(B, 5, C) → (A, 12, C)
(A, 10, C)
Open Shortest Path First Protocol
(OSPF)
 OSPF
 one of the most widely used link-state routing protocols
 Open: refers to the fact that it is an open,
nonproprietary standard, created under the auspices
of the IETF
 SPF: comes from an alternative name for link-state
routing
50
 OSPF adds the following features to the basic link-state
algorithm
 authentication of routing messages
 additional hierarchy
 OSPF introduces another layer of hierarchy into routing
by allowing a domain to be partitioned into areas
 a router within a domain does not necessarily need to
know how to reach every network within that domain, but
know only how to get to the right area
 this reduces the amount of information that must be
transmitted to and stored in each node
51
 load balancing
 OSPF allows multiple routes to the same place to be
assigned the same cost and will cause traffic to be
distributed evenly over those routes
52
 There are several different types of OSPF messages, but all begin
with the same header
 OSPF header format
 Version: 2
 Type: 1 through 5
 SourceAddr: identifies the sender of the message
 AreaId: a 32-bit identifier of the area in which the node is
located
0
8
Version
16
Type
Message length
SourceAddr
AreaId
Checksum
Authentication type
Authentication
53
31
 Authentication type
 the entire packet, except the authentication data, is
protected by a 16-bit checksum using the same algorithm
as the IP header
 0: no authentication is used
 1: a simple password is used
 2: a cryptographic authentication checksum is used
0
8
Version
16
Type
31
Message length
SourceAddr
AreaId
Checksum
Authentication type
Authentication
54
0
8
Version
16
Type
31
Message length
SourceAddr
AreaId
Checksum
Authentication type
Authentication
OSPF header format
55
0
8
Version
16
Type
31
Message length
SourceAddr
AreaId
Checksum
Authentication type
Authentication
 Five OSPF message types
 Type 1: "hello" message, which a router sends to its
peers to notify them that it is still alive and connected
 Type 2~5: used to request, send, and acknowledge the
receipt of link-state messages
 Basic building block of link-state messages in OSPF is linkstate advertisement (LSA)
 one message may contain many LSAs
56
LS Age
Options
Link-state ID
Advertising router
Type=1
LS sequence number
LS checksum
Length
0 Flags
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
More links
OSPF packet format for link-state advertisement (Type 1)
57
LS Age
Options
Link-state ID
Advertising router
Type=1
LS sequence number
LS checksum
Length
0 Flags
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
 OSPF link-state advertisement
More links
 Type 1 LSAs: advertise the cost of links between
routers
 Type 2 LSAs: advertise networks to which the
advertising router is connected
 LS Age
 the equivalent of a time to live, except that it counts
up and the LSA expires when the age reaches a
defined maximum value
 Type
 tells us that this is a type 1 LSA
58
LS Age
Options
Link-state ID
Advertising router
Type=1
LS sequence number
LS checksum
Length
0 Flags
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
 Link-state ID & Advertising router
More links
 in a type 1 LSA, these two fields are identical
 each carries a 32-bit identifier for the router that
created this LSA
 LS sequence number
 detect old or duplicate LSAs
 LS checksum
 verify that data has not been corrupted
 it covers all fields in the packet except LS Age
59
LS Age
Options
Link-state ID
Advertising router
Type=1
LS sequence number
LS checksum
Length
0 Flags
0
Number of links
Link ID
Link data
Link type
Num_TOS
Metric
Optional TOS information
 Length
More links
 the length in bytes of the complete LSA
 Link ID, Link Data, & metric
 each link in the LSA is represented by a Link ID,
some Link Data, and a metric
 TOS
 allow OSPF to choose different routes for IP packets
based on the value in their TOS field
60
Metrics
 Original ARPANET metric
 measures number of packets queued on each link
 took neither latency nor bandwidth into consideration
 New ARPANET metric
 stamp each incoming packet with its arrival time (AT)
 record departure time (DT)
 when link-level ACK arrives, the node compute the packet
delay
Delay = (DT-AT) + Transmit + Latency
 if timeout (ACK did not arrive), DT is reset to the time the
packet was retransmitted
 link cost = average delay over some time period
61
4.2.5 Routing for Mobile Hosts
 Mobility issues in IP Networks
 once a mobile terminal moves to a new subnet, a
correspondent node needs to use the mobile’s new
IP address
 it is difficult to force every possible
correspondent node to keep track when a mobile
terminal may change its IP address and what the
mobile’s new address will be
62
Mobile IPv4
Sending host
Home agent
(10.0.0.3)
Foreign agent
(12.0.0.6)
Internetw ork
Home netw ork
(netw ork 10)
Mobile host
(10.0.0.9)
63
64
Home Network
 Home address
 a globally unique and routable IP address
 preconfigured or dynamically assigned
 Home network
 the network whose network address prefix matches that of the
mobile terminal’s home address
 Home agent (HA)
 maintain up-to-date location information for the mobile
 intercept packets addressed to the mobile’s home address
 tunnel packets to the mobile’s current location
Foreign Network
 Care-of Address (CoA)
 assigned to the mobile by the foreign network
 a mobile uses its CoA to receive IP packets in the
foreign network
 Foreign agent (FA)
 provides CoAs and other necessary configuration
information (e.g., address of default IP router) to
visiting mobiles
 de-tunnels packets from the tunnel sent from a visiting
mobile’s HA and then delivers the packets to the
visiting mobile
 acts as the IP default router for packets sent by visiting
mobile terminals