Você está na página 1de 31

Network Layer

Routing

IS250 Spring 2010 chuang@ischool.berkeley.edu

Outline
Introduction
- Router operation - Metric vs. policy based routing - Shortest path computation - Distance vector and link-state algorithms and protocols - Border Gateway Protocol (BGP)

Metric-based routing

Policy-based routing

John Chuang

Two Basic Functions in Packet Switching


Routing
- Learn the best route to (or best next-hop for) any given destination
- Exchange local link status or destination reachability information - Compute best path to destinations

Packet forwarding

- Update the routing table

Algorithms for computing shortest paths (e.g., Dijkstras) Policies that reflect business agreements (use BGP)

- For each packet received on an incoming link, forward it to an outgoing link according to the routing table
3

John Chuang

Routing of Atoms

John Chuang

Routing of Bits
Backbone

MAN

Local loop

Ethernet

Host A

Host B

12.2.14.60
John Chuang

128.32.226.87
5

Packet Switch (Router)


Special-purpose computer system
CPU Memory I/O interfaces Software

Connects to
- Other packet switches - End hosts

Store-and-forward paradigm
Stores packet in memory Examines packets destination address Looks up next-hop in routing table Forwards packets toward destination (hop-by-hop)
6

John Chuang

Packet Switch in Action


Incoming links Packet Outgoing links

Data Plane
Destination Outgoing Address Link

w.x.y.z

C
Control Plane

Routing table
John Chuang

Control plane of a router communicates with its counterparts at other routers using routing protocols (e.g., RIP, OSPF, BGP)

What is the Best Route?


Route selection may be based on:
Latency/hop-count Bandwidth capacity Loss rate Cost Security requirements Business relationships (e.g., transit or peering agreements) -

Two flavors of routing: metric-based and policybased


John Chuang 8

Metric-Based Routing and Policy-Based Routing


Both used in practice for routing on the Internet
- Metric-based routing typically employed within a network domain - Policy-based routing typically employed across network domains

A network domain, also known as an autonomous system (AS), is a collection of IP networks and routers, usually under the control of a single administrative entity, that presents a common routing policy to the Internet
- Examples: ISPs, corporations, universities

John Chuang

Outline
Introduction
- Router operation - Metric vs. policy based routing - Shortest path computation - Distance vector and link-state algorithms and protocols - Border Gateway Protocol (BGP)

Metric-based routing

Policy-based routing

John Chuang

10

Routing: A Graph Theoretic Perspective

Note that each node has different view of the network, and therefore different routing table
John Chuang 11

Shortest Path Computation


Algorithm from graph theory Distributed computation (no central authority) A switch
- Must learn route to all destinations - While communicating only with directly connected neighbors

Example:

John Chuang

12

Shortest Path Algorithms


Distance vector
- Switches exchange routing table info

Link state
- Switches exchange link status info

Both used in practice


- e.g., RIP (RFC 1058, 1388, 1723) is a distance vector routing protocol, OSPF (RFC 1131, 1247) is a link state routing protocol
John Chuang 13

Link-State Routing
Pair of switches periodically
- Test link between them - Broadcast link status message to all switches in network

Switch
- Receives link status messages - Computes new routes (using Dijkstras algorithm)

John Chuang

14

Dijkstras Algorithm
Shortest Path First (SPF) algorithm Greedy algorithm Input: graph with nodes and weighted edges Output: shortest paths from source node i to every other node; cost of each path

John Chuang

15

Dijkstras Algorithm

John Chuang

Source: Doug Comer 16

Algorithm Intuition
Start at source node Move outward At each step:
- Find node u that
- has not been considered before; and - is closest to source

- Compute:
- Distance from u to each neighbor v - If distance shorter, make path to v go through u

John Chuang

17

Dijkstras Algorithm Example

Distance Predecessor

John Chuang

18

Node As Routing Table


Destination Address B C Next Hop (Cost) B (2) D (3)

D
E

D (1)
D (2)

F
John Chuang

D (4)
19

Routing Dynamics
Dijkstras Algorithm has a run-time of O(|V|2+|E|), but the routers run the algorithm continuously to keep their routing tables updated Link states constantly updated
- New links can be added to network - Latency can change continuously - if link goes down, cost = infinity

Routing tables may have transient inconsistency


- Link state messages take time to propagate across network - Routers not synchronized in running route computation algorithm - Transient routing loops or routing black-holes
John Chuang 20

Outline
Introduction
- Router operation - Metric vs. policy based routing - Shortest path computation - Distance vector and link-state algorithms and protocols - Border Gateway Protocol (BGP)

Metric-based routing

Policy-based routing

John Chuang

21

Internet Routing Protocols

Interior Gateway Protocols (IGPs)


-

Exterior Gateway Protocols (EGPs)

Intra-AS or intra-domain Metric-based routing (e.g., hops, latency, cost) AS free to choose IGP and metric Examples: RIP, OSPF, IBGP

- Inter-AS or inter-domain - Policy-based routing - All ASs have to use the same EGP (currently BGP v4)
22

John Chuang

Route Advertisement
Instead of computing shortest paths based on DV or LS information, inter-domain routing is based on advertisements of routes

Example: ISP1 sends route advertisement to ISP2


- ISP1 is willing to receive packets, destined to end-hosts within its domain, from ISP2 - ISP2 will enter this information into its routing table
John Chuang 23

Network Interconnection
transit
Backbone A AS 1 Backbone C AS 3

AS3 is a transitprovider of AS1:

AS 2 Backbone B

peering Transit

AS2 and AS3 are peers:


- Exchange route advertisements (without any payments)

- For a payment, AS3 agrees to advertise route to AS1 to rest of Internet

John Chuang

24

Stub, Transit, and Multi-homed


Three different types of AS:
- Stub AS - Transit AS Backbone A Backbone A - Multi-homed AS
Backbone C

Backbone A Backbone C Backbone C

AS 3 Backbone B

Backbone A

AS 4 Backbone B
Transit

AS 5 Backbone B
Transit

Backbone A
Transit

Backbone C

AS 1 Backbone B
Transit

AS 2 Backbone B
25

John Chuang

Border Gateway Protocol (BGP)


Version 4: RFC 1771 (March 1995) Routing among Autonomous Systems No routing metrics Provisions for policies
- Individual ASs control advertisement of routes

Facilities for transit routing


- transit vs. stub domains - Multi-homing

Reliable transport
- Two BGP peers establish TCP session
John Chuang 26

BGP Attributes
Community attribute (no-advertise, no-export, internet) controls propagation of advertisement

John Chuang

27

Community Attribute
No Advertise

No Export

Internet
John Chuang 28

BGP Attributes
Community attribute (no-export, no-advertise, internet) controls propagation of advertisement Other attributes used for selecting best path among multiple paths to same destination:
Weight (local to a router) Local preference (propagated throughout AS) Multi-exit discriminator (suggestion to external AS) Origin (IGP, EGP, Incomplete) AS_Path (AS hop count, loop detection) Next hop (IP Address)
29

John Chuang

BGP Path Selection


1. 2. 3. 4. 5. 6. 7. 8. 9. 10. If the path specifies a next hop that is inaccessible, drop the update. Prefer the path with the largest weight. If the weights are same, prefer the path with largest local preference. If the local preferences are same, prefer the path originated by BGP running on this router. If no route was originated, prefer the route that with shortest AS_path. If all paths have the same AS_path length, prefer the path with the lowest origin type (where IGP < EGP < incomplete). If the origin codes are same, prefer the path with lowest MED attribute. If the paths have same MED, prefer external over internal path. If the paths are same, prefer path through the closest IGP neighbor. Prefer path with lowest IP address, as specified by the BGP router ID.

John Chuang

30

Summary
Packet switching as key network layer responsibility Packet switching = routing + packet forwarding Internet uses combination of metric-based routing (intra-domain) and policy-based routing (inter-domain)
- Metric-based routing: shortest path computation based on distance vector or link state algorithms - Policy-based routing: route advertisements
John Chuang 31

Você também pode gostar