02_Routing_2014.pdf

32
7/29/2014 1 Routing Kithsiri M. Liyanage Dept. of Electrical and Electronic Engineering University of Peradeniya Routing Unicast Multicast Involved one source and one destination A router forwards a received packet through only one of its ports Involved one source and many destination A router may forwards a received packet through several of its ports Unicast and Multicast Routing An internet is a combination of networks connected by routers Packets are routed through the network by routers. This process is called routing A metric is a cost assigned for passing through a network. the total metric of a particular route is equal to the sum of the metrics of networks that comprise the route. the router chooses the route with the shortest (smallest) metric Metric RIP (Routing Information Protocol): treating each network equals. The cost of passing through each network is the same. so if a packet passes through 10 networks to reach the destination, the total cost is hop counts. OSPF (Open Shortest Path First) Allowing the administrator to assign a cost for passing through a network based on the type of service required. A route through a chosen. network can have different costs (metrics) BGP (Border Router Protocol) Criterion is the policy, which can be set by the administrator. Policy defines what paths should be An internet can be very large. Therefore one routing protocol cannot handle the task of updating routing tables of all routers. Therefore an internet is divided into autonomous systems. An autonomous system (AS) is a group of networks and routers under the authority of a single administration. Routing inside an autonomous system is called Intradomain routing Routing between autonomous systems is called Interdomain routing Autonomous Systems and Intra and Inter Domain Routing

Transcript of 02_Routing_2014.pdf

Page 1: 02_Routing_2014.pdf

7/29/2014

1

Routing

Kithsiri M. Liyanage

Dept. of Electrical and Electronic Engineering

University of Peradeniya

Routing

Unicast

Multicast

• Involved one source and one destination

• A router forwards a received packet through only

one of its ports

• Involved one source and many destination

• A router may forwards a received packet through

several of its ports

Unicast and Multicast Routing

•An internet is a combination of networks connected by routers

•Packets are routed through the network by routers.

•This process is called routing

A metric is a cost assigned for passing through a network.

the total metric of a particular route is equal to the sum of the metrics of

networks that comprise the route.

the router chooses the route with the shortest (smallest) metric

Metric

RIP (Routing Information Protocol): treating each network equals.

The cost of passing through each network is the same.

so if a packet passes through 10 networks to reach the destination, the

total cost is hop counts.

OSPF (Open Shortest Path First)

Allowing the administrator to assign a cost for passing through a

network based on the type of service required.

A route through a chosen. network can have different costs (metrics)

BGP (Border Router Protocol)

Criterion is the policy, which can be set by the administrator.

Policy defines what paths should be

An internet can be very large. Therefore one routing protocol cannot

handle the task of updating routing tables of all routers.

Therefore an internet is divided into autonomous systems.

An autonomous system (AS) is a group of networks and routers under the

authority of a single administration.

Routing inside an autonomous system is called Intradomain routing

Routing between autonomous systems is called Interdomain routing

Autonomous Systems and Intra and Inter Domain Routing

Page 2: 02_Routing_2014.pdf

7/29/2014

2

Autonomous Systems Intra and Inter Domain Routing

In distance vector routing, the least cost route between any two nodes is the

route with minimum distance. In this protocol each node maintains a vector

(table) of minimum distances to every node

Distance Vector Routing

Each router periodically shares its knowledge about the entire internet

with neighbors

The operational principles of this algorithm

• Sharing knowledge about the entire autonomous system

• Sharing only with neighbors

• Sharing at regular intervals (ex, every 30 seconds)

Distance Vector Routing Distance Vector Routing Tables

Page 3: 02_Routing_2014.pdf

7/29/2014

3

Initialization of Tables in Distance Vector Routing Updating in Distance Vector Routing

In distance vector routing, each node shares its routing table with its

immediate neighbors periodically and when there is a change.

Two-Node Loop Instability Distance Vector Routing - Some Remedies for Instability

Split Horizons

Page 4: 02_Routing_2014.pdf

7/29/2014

4

Distance Vector Routing - Some Remedies for Instability

Poison Reverse : a variation of split horizons

Three-Node Instability

The Routing Information Protocol (RIP) is an intradomain

routing protocol used inside an autonomous system. It is a

very simple protocol based on distance vector routing.

The destination in a routing table is a network, which means

the first column defines a network address.

A metric in RIP is called a hop count; distance; defined as

the number of links (networks) that have to be used to reach

the destination.

Routing Information Protocol - RIP

RIP adheres to the following Distance Vector characteristics:

RIP sends out periodic routing updates (every 30 seconds)

RIP sends out the full routing table every periodic update

RIP uses a form of distance as its metric (in this case, hopcount)

RIP uses the Bellman-Ford Distance Vector algorithm to determine the

best “path” to a particular destination

Other characteristics of RIP include:

RIP supports IP and IPX routing.

RIP utilizes UDP port 520

RIP routes have an administrative distance of 120.(Administrative

distance defines the reliability of a routing protocol. Each routing protocol

is prioritized in order of most to least reliable (believable) with the help of

an administrative distance value.)

RIP has a maximum hopcount of 15 hops.

Routing Information Protocol - RIP

Page 5: 02_Routing_2014.pdf

7/29/2014

5

Any network that is 16 hops away or more is considered unreachable to

RIP, thus the maximum diameter of the network is 15 hops. A metric of 16

hops in RIP is considered a poison route or infinity metric.

If multiple paths exist to a particular destination, RIP will load balance

between those paths (by default, up to 4) only if the metric (hopcount) is

equal. RIP uses a round-robin system of load-balancing between equal

metric routes, which can lead to pinhole congestion.

For example, two paths might exist to a particular destination, one

going through a 9600 baud link, the other via a T1. If the metric

(hopcount) is equal, RIP will load-balance, sending an equal amount

of traffic down the 9600 baud link and the T1. This will (obviously)

cause the slower link to become congested.

Routing Information Protocol - RIP Example of a Domain Using RIP

Command : request (1) or response (2)

Version RIP 1 or RIP 2 (support classless routing)

Family : For TCP/IP the value is 2

Address : destination network address

Distance : defining the hop count from the advertising router to the

destination network

* Part of the message (entry) is repeated for each

RIP Message Format

Route Tag : carrying information such as the autonomous system number

Subnet mask : carrying the subnet mask

Next-hop address : showing the next hop

In case that shares a network backbone by two ASes, the message can

define the router to which the packet should go next

RIP Version 2

Page 6: 02_Routing_2014.pdf

7/29/2014

6

as the 10.1.0.0 and 192.168.123.0 networks do

not belong to the same major network. Router A

will summarize the 10.1.0.0/16 network to its

classful boundary of 10.0.0.0/8

Because the 10.3.0.0 network is in the same

major network as the 10.1.0.0 network, it will

not summarize the address.

RIP Version 1- Issue

Requests and Response

Request messages :

sent by a router that has just come up or by a router that has

some time-out entries.

RIP Messages . . .

Response

solicited response is

sent only in answer to a request

containing information about the destination specified in the

corresponding request

unsolicited response is

sent periodically, every 30 seconds

containing information covering the whole routing table

RIP Messages . . . RIP Message Example

Page 7: 02_Routing_2014.pdf

7/29/2014

7

RIP Timers

RIP has four basic timers:

Update Timer

Invalid Timer

Hold-down Timer

Flush Timer

Update Timer (default 30 seconds)

Indicates how often the router will send out a routing table update.

Invalid Timer (default 180 seconds)

Indicates how long a route will remain in a routing table before being marked

as invalid, if no new updates are heard about this route.

The invalid timer will be reset if an update is received for that particular route

before the timer expires.

A route marked as invalid is not immediately removed from the routing table.

Instead, the route is marked (and advertised) with a metric of 16, indicating it is

unreachable, and placed in a hold-down state.

RIP Timers – Update and Invalid Timers

Hold-down Timer (default 180 seconds)

Indicates how long RIP will “suppress” a route that it has placed in a

hold-down state. RIP will not accept any new updates for routes in a

hold-down state, until the hold-down timer expires. A route will enter

a hold-down state for one of three reasons:

The invalid timer has expired.

An update has been received from another router, marking that

route with a metric of 16 (or unreachable).

An update has been received from another router, marking that

route with a higher metric than what is currently in the routing

table. This is to prevent loops.

RIP Timers – Hold-down Timers

Flush Timer (default 240 seconds)

Indicates how long a route can remain in a routing table

before being flushed, if no new updates are heard about this

route. The flush timer runs concurrently with the invalid timer,

and thus will flush out a route 60 seconds after it has been

marked invalid.

RIP timers must be identical on all routers on the RIP network,

otherwise massive instability will occur.

RIP Timers – Flush Timersc

Page 8: 02_Routing_2014.pdf

7/29/2014

8

Example

A routing table has 20 entries. It does not receive

information about five routes for 200 seconds. How many

timers are running at this time?

The timers are listed below:

Update timer: 1

Invalid timer: 20 - 5 = 15

Hold down timer: 5

Flush timer: 20

The presence of authentication is

indicated by setting the Address Family

Identifier field to all ones (0xFFFF).

The Authentication Type for simple

password authentication is two

(0×0002), and

the remaining 16 octets carry an

alphanumeric password of up to 16

characters.

The password is left-justified in the field,

and if the password is less than 16

octets, the unused bits of the field are

set to zero.

RIP Authnetication

Example 2

A routing table has 20 entries. It does not

receive information about five routes for

200 seconds. How many timers are

running at this time?

Link State Routing

In link state routing, if each node in the domain has

the entire topology of the domain, the node can use

Dijkstra’s algorithm to build a routing table.

Concept of Link State Routing

Page 9: 02_Routing_2014.pdf

7/29/2014

9

Link State Knowledge Building Routing Tables

1. Creation of the states of the links by each node, called the

link state packet or LSP

2. Dissemination of LSPs to every other router, called

flooding, in an efficient and reliable way

3. Formation of a shortest path tree for each node

4. Calculation of a routing table based on the shortest path

tree

Creation of LSP

• When there is a change in the topology of the domain

• On a periodic basis

– 60 minutes or 2 hours

Formation of Shortest Path Tree

• Dijkstra Algorithm

Page 10: 02_Routing_2014.pdf

7/29/2014

10

Example of formation of Shortest Path Tree Calculating of Routing Table from Shortest Path Tree

Routing table for node A

OSPF (Open Shortest Path First)

• The Open Shortest Path First (OSPF) protocol is an intradomain

routing protocol based on link state routing. Its domain is also an

autonomous system

• Dividing an AS into areas

– to handle routing efficiently and in a timely manner

OSPF (cont’d)

• Areas

– Is a collection of networks, hosts, and routers in AS

– AS can be divided into many different areas.

– All networks inside an area must be connected.

– Routers inside an area flood the area with routing information.

• Area Border Router

– Summarizes the information about the area and sends it to other

areas

• Backbone

– All of the areas inside an AS must be connected to the backbone

– Serving as a primary area

– Consisting of backbone routers

– Back bone routers can be an area border router

Page 11: 02_Routing_2014.pdf

7/29/2014

11

OSPF (cont’d)

• Areas in an AS

OSPF (cont’d)

• Metric

– OSPF protocol allows the administrator to assign a cost, called the metric, to each route

– Based on a type of service (minimum delay, maximum throughput, and so on)

– A router can have multiple routing tables, each based on a different type of service.

• Link State Routing

– OSPF uses Link State Routing to update the routing tables in an area

– Each router shares its knowledge about its neighborhood with every router in the area.

OSPF (cont’d)

1. Sharing knowledge about the neighborhood

2. Sharing with every other router by flooding

3. Sharing when there is a change

– cf. Distance Vector Routing : sending the information at regular intervals

regardless of change

• So, every router can calculate the shortest path between itself and

each network

OSPF (cont’d)

• Types of Links

– In OSPF terminology, a connection is called a link.

Page 12: 02_Routing_2014.pdf

7/29/2014

12

OSPF (cont’d)

• Point-to-point Link

– Routers are represented by nodes and the link is represented by a

bidirectional edge connecting the nodes.

– Each router has only one neighbor at the other side of the link.

OSPF (cont’d)

• Transient Link

– is a network with several routers attached to transient Link

(network)

OSPF (cont’d)

• Stub Link

– is a network that is connected to only one router

– is a special case of transient network

– The link is only one-directional, from the router to the network.

OSPF (cont’d)

• Virtual Link

– When the link between two routers is broken, the administration

may create a virtual link between them using a longer path

• Graphical Representation

– An internet with 5 networks and 6 routers

Page 13: 02_Routing_2014.pdf

7/29/2014

13

AS and its Graphical Representation in OSPF AS and its Graphical Representation in OSPF

• Graphical Representation (cont’d)

– N1 : transient, N2 : Stub

– using square nodes for the routers and ovals for the networks

OSPF Packets

• Types of OSPF Packets

OSPF (cont’d)

• OSPF Common Header

- authentication type : 0 for none, 1 for password

- packet type : five types

or 64 bits

Page 14: 02_Routing_2014.pdf

7/29/2014

14

Link State Update Packet

• Used by a router to advertise the states of its links

LSA General Header

• LS age: The time in seconds since the link state advertisement was originated.

• E flag : 1 means that the area is a stub area

• T flag : 1 means that the router can handle multiple types of service

• Link state type : 1) router link, 2) network link, 3) summary link to network, 4) summary link

to AS boundary router 5) AS external link

• Link State ID: This field identifies the portion of the internet environment that is being

described by the advertisement. The contents of this field depend on the advertisement's LS

type.

• Advertising Router: The Router ID of the router that originated the link state advertisement.

For example, in network links advertisements this field is set to the Router ID of the network's

Designated Router.

• LS sequence number: Detects old or duplicate link state advertisements.

LS Type Link State ID .

1 The originating router's Router ID.

2 The IP interface address of the network's Designated Router.

3 The destination network's IP address.

4 The Router ID of the described AS boundary router.

5 The destination network's IP address.

LSA

• Link State Advertisements

– to share information about neighbors, each router distributes link

state advertisements (LSAs)

Router Link LSA

• Router Link

– defining the links of a true router

– A true router uses the advertisement to announce information about

all of its links and what is at the other side of the link (neighbors)

Page 15: 02_Routing_2014.pdf

7/29/2014

15

Router Link LSA (cont’d) Router Link LSA (cont’d)

Link types, link identification, and link data

Example

• Give the router link LSA sent by router 10.24.7.9 in the following Figure

Example : Solution

Page 16: 02_Routing_2014.pdf

7/29/2014

16

Network LINK LSA

• Network Link

– defines the links of a network

– A designated router distributes this type of LSA packet.

– The packet announces the existence of all of the routers connected

to the network.

Network LINK LSA

• Network Link Advertisement Format

Example

• Give the network link LSA in the following Figure.

Example : Solution

Page 17: 02_Routing_2014.pdf

7/29/2014

17

Example

• In the following Figure, which router(s) sends out router link

LSAs?

Example: In the same Figure, which router (s) sends out

Network link LSAs?

Example: Solution

All routers advertise router link LSAs.

a. R1 has two links, N1 and N2.

b. R2 has one link, N1.

c. R3 has two links, N2 and N3.

Example: Solution

– All three network must advertise network links:

a. Advertisement for N1 is done by R1 because it is the only attached

router and therefore the designated router.

b. Advertisement for N2 can be done by either R1, R2, or R3,

depending on which one is chosen as the designated router.

c. Advertisement for N3 is done by R3 because it is the only

attached router and therefore the designated router.

Summary Link to Network LSA

• An border router is active in more than one area and

creates routing table for each area.

– Router R1 floods area 1 with information about how to reach a network located in area 0.

Summary Link to Network LSA (cont’d)

Page 18: 02_Routing_2014.pdf

7/29/2014

18

Summary Link to AS Boundary Router

• providing the information of the route to an autonomous

boundary router

– used for a router that sends a packet outside the autonomous

system

Summary Link to AS Boundary Router (cont’d)

External Link

• used to know which networks are available outside the

autonomous system

External Link (cont’d)

Page 19: 02_Routing_2014.pdf

7/29/2014

19

Other Packets

• Hello message

– uses to create neighborhood relationships and to test the reach-

ability of neighbors

– is the first step in link state routing

Network mask : The network mask associated with this interface.

HelloInterval: The number of seconds between this router's Hello packets.

Rtr Pri: This router's Router Priority. Used in (Backup) Designated Router election. If set

to 0, the router will be ineligible to become (Backup) Designated Router.

RouterDeadInterval: The number of seconds before declaring a silent router down.

Designated Router: The identity of the Designated Router for this network, in the view

of the advertising router. The Designated Router is identified here by its IP interface

address on the network. Set to 0.0.0.0 if there is no Designated Router.

Backup Designated Router: The identity of the Backup Designated Router for this

network, in the view of the advertising router. The Backup Designated Router is identified

here by its IP interface address on the network. Set to 0.0.0.0 if there is no Backup

Designated Router.

Neighbor: The Router IDs of each router from whom valid Hello packets have been seen

recently on the network. Recently means in the last RouterDeadInterval seconds.

Other Packets (cont’d)

• Database description message

– When router is connected to the system for the first time or after a failure, it needs the complete link state database immediately

– used when a router is connected to the system for the first time or after a failure

• After a router is connected to the system, the router sends hello packets to greet

its neighbor.

• If it is first time that neighbors hear from the router, they send a database description packet.

– The packet does not contain complete database information

• Then, the router sends one or more link state request packets to get full information about that particular link

• Link State Request Packet

– Is sent by a router that needs information about a specific route or routes

– It is answered with a link state update packet.

Other Packets (cont’d)

• Link state acknowledgment packet

– OSPF makes routing more reliable by forcing every router to

acknowledge the receipt of every link state update packet.

• Link State Update Packet

– used by a router to advertise the states of its links

Page 20: 02_Routing_2014.pdf

7/29/2014

20

Encapsulation of OSPF Packets

• Encapsulation

– OSPF packets are encapsulated in IP datagram

• These packets contain the acknowledgment mechanism for flow

and error control

• Do not need a transport layer protocol to provide these services

3b

1d

3a

1c 2a AS3

AS1

AS2 1a

2c

2b

1b

Intra-AS

Routing

algorithm

Inter-AS

Routing

algorithm

Forwarding

table

3c

Interconnected ASes

• 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

3b

1d

3a

1c 2a AS3

AS1

AS2 1a

2c

2b

1b

3c

Inter-AS tasks

• suppose router in AS1

receives datagram dest

outside of AS1

– router should forward

packet to gateway

router, but which

one?

AS1 must:

1. learn which dests

reachable through

AS2, which through

AS3

2. propagate this

reachability info to all

routers in AS1

Job of inter-AS routing!

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)

3b

1d

3a

1c 2a AS3

AS1

AS2 1a

2c

2b

1b

3c

x

Page 21: 02_Routing_2014.pdf

7/29/2014

21

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!

3b

1d

3a

1c 2a AS3

AS1

AS2 1a

2c

2b

1b

3c x

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

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.

Why different Intra- and Inter-AS routing ?

Policy:

• Inter-AS: admin wants control over how its traffic routed,

who routes through its net.

• Intra-AS: single admin, so no policy decisions needed

Scale:

• hierarchical routing saves table size, reduced update

traffic

Performance:

• Intra-AS: can focus on performance

• Inter-AS: policy may dominate over performance

Why path vector routing is needed?

• Distance vector routing is subject to instability if there is more than a few hops in the domain of operation

• Link state routing needs a huge amount of resources to calculate routing tables. It also creates heavy traffic because of flooding

• There is a need for a third protocol which we call path vector routing

Page 22: 02_Routing_2014.pdf

7/29/2014

22

Path Vector Routing

• The principle of path vector routing is similar to distance vector routing

• In path vector routing, we assume that there is one node (in practice there can be more) in each autonomous system that acts on behalf of the entire autonomous system. Let us call it the speaker node

• The speaker node in an AS creates a routing table and advertises it to speaker nodes in the neighboring Ass

• A speaker node advertises the path, not the metric of the nodes, in its AS or other ASs

Initialization

• At the beginning, each speaker node can know

only the reachability of nodes inside its

autonomous system

Sharing

• A speaker in an AS shares its table with

immediate neighbors

Updating

• When a speaker node receives information from a neighbor, it updates its own table by adding the nodes that are not in its routing table and adding its own AS and the AS that sent the table

• After a while each speaker has a table and knows how to reach each node in other ASs

Page 23: 02_Routing_2014.pdf

7/29/2014

23

Loop Prevention

• The instability of distance vector routing

and the creation of loops can be avoided

in path vector routing

• When a router receives a message, it

checks to see if its AS is in the path list to

the destination

• If it is, looping is involved and the

message is ignored

Aggregation

• The path vector routing protocols normally support CIDR notation and the aggregation of addresses

• Note that a range may also include a block that may not be in the corresponding AS

• However, if this network exists in some other Ass, it eventually becomes part of the routing table due to the longest prefix principle

For example, consider this IPv4 routing table (CIDR

notation is used):

192.168.20.16/28

192.168.0.0/16

When the address 192.168.20.19 needs to be looked up,

both entries in the routing table "match". That is, both

entries contain the looked up address. In this case, the

longest prefix of the candidate routes is 192.168.20.16/28,

since its subnet mask (/28) is higher than the other entry's

mask (/16), making the route more specific.

Policy Routing

• Policy routing can be easily implemented through path vector routing

• When a router receives a message, it can check the path

• If one of the AS listed in the path is against its policy, it can ignore that path and that destination

• It does not update its routing table with this path, and it does not send this message to its neighbors

Page 24: 02_Routing_2014.pdf

7/29/2014

24

Optimum Path

• We definitely cannot include metrics in a route because each AS that is included in the path may use a different criteria for the metric

• One system may use, internally, RIP, which defines hop count as the metric; another may use OSPF with minimum delay defined as the metric

• The optimum path is the path that fits the organization

• In the example figure, each AS may have more than one path to a destination. For the table, we chose the one that had the smaller number of Ass, but this is not always the case

• Other criteria such as security and safety, and reliability can also be applied

Internet inter-AS routing: BGP

• BGP (Border Gateway Protocol): the de facto standard

• BGP provides each AS a means to: 1. Obtain subnet reachability information from

neighboring ASs.

2. Propagate reachability information to all AS-internal routers.

3. Determine “good” routes to subnets based on reachability information and policy.

• allows subnet to advertise its existence to rest of Internet: “I am here”

Types of Autonomous Systems

• Stub AS. A stub AS has only one connection to

another AS

• Multihomed AS. A multihomed AS has more

than one connection to other ASs, but it is still

only a source or sink for data traffic. It can

send/receive data traffic from more than one AS,

but there is no transient traffic

• Transit AS. A transit AS is a multihomed AS

that also allows transient traffic

BGP Sessions

• The exchange of routing information between 2

routers using BGP takes place in a session

• A session is a connection that is established

between 2 BGP routers only for the sake of

exchange routing information

• The create a reliable environment, BGP uses the

service of TCP. In other words, a session at the

BGP level, as an application program, is a

connection at the TCP level

Page 25: 02_Routing_2014.pdf

7/29/2014

25

BGP Sessions (cont.)

• When a TCP connection is created for BGP, it

can last for a long time, until something unusual

happens.

• For this reason, BGP sessions are sometimes

referred to as semi-permanent connections

BGP uses the services of TCP

on port 179.

Note:

External and Internal BGP

• BGP can have 2 types of session: external BGP (E-BGP) and internal BGP (I-BGP) sessions

• The E-BGP session is used to exchange information between 2 speaker nodes belonging to 2 different Ass

• The I-BGP session is used to exchange routing information between 2 routers inside an AS

Distributing reachability info

• using eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1.

– 1c can then use iBGP do distribute new prefix 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 prefix, creates entry for prefix in its forwarding table.

3b

1d

3a

1c 2a

AS3

AS1

AS2 1a

2c

2b

1b

3c eBGP session

iBGP session

Path Attributes

• The path presents in a list of ASs in the previous example, in fact, it is a list of attributes

• Each attribute gives some information about the path. The list of attributes helps the receiving router make a better decision when applying its policy

• Attributes are divided into 2 broad categories: well-known and optional. A well known attribute is one that every BGP router must recognize. An optional attributes is one that needs not be recognized by every router

Page 26: 02_Routing_2014.pdf

7/29/2014

26

Path Attributes (cont.)

• Well-known attributes are themselves divided into 2 categories: mandatory and discretionary

• A well-known mandatory attribute is one that must appear in the description of a route

• A well-known discretionary attribute is one that must be recognized by each router, but is not required to be included in every update message

• Two important attributes: – AS-PATH: contains ASs through which prefix advertisement has

passed

– NEXT-HOP: is the router interface that begins the AS-PATH

Why AS-PATH is needed?

• AS1 and AS2 are connected by 2 peering links.

A router in AS1 could learn about 2 different

routes to the same prefix x. These 2 routes

could have the same AS-PATH to x, but could

have different NEXT-HOP values corresponding

to the different peering link. Using the AS-PATH

values and the intra-AS routing algorithm, the

router can determine the cost of the path to each

peering link, and then apply hot potato routing to

determine the appropriate interface

BGP route selection

• router may learn about more than 1 route

to some prefix. Router must select route.

• elimination rules:

1. local preference value attribute: policy

decision

2. shortest AS-PATH

3. closest NEXT-HOP router: hot potato routing

4. additional criteria

Page 27: 02_Routing_2014.pdf

7/29/2014

27

BGP routing policy

• 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

A

B

C

W X

Y

legend:

customer network:

provider network

BGP routing policy (2)

• 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!

A

B

C

W X

Y

legend:

customer network:

provider network

Types of Packets

• BGP uses 4 different type of messages: open, update, keepalive, and notification – OPEN: opens TCP connection to peer and authenticates sender

– UPDATE: advertises new path (or withdraws old)

– KEEPALIVE keeps connection alive in absence of UPDATES; also ACKs OPEN request

– NOTIFICATION: reports errors in previous msg; also used to close connection

Packet Format

• All BGP packets share the same common header. The fields of this header are as follows: – Marker. The 16-byte marker field is reserved for authentication

– Length. The 2-byte field defines the length of the total message including the header

– Type. This 1-byte field defines the type of the packet

Page 28: 02_Routing_2014.pdf

7/29/2014

28

Open Message

• To create a neighborhood relationship, a router running BGP opens a TCP connection with a neighbor and sends an open message

• If the neighbor accepts the neighborhood relationship, it responds with a keepalive message, which means that a relationship has been established between the 2 routers

Open Message (cont.)

• My autonomous system. This defines the AS number

• Hold time. This defines the maximum number of seconds that can elapse until one of the parties receives a keepalive or update message from the other. If a router does not receive one of these message during the hold time period, it considers the other party dead

• BGP identifiers. This defines the IP address of the router that sends the open message

Update Message

• The update message is the heart of the BGP protocol. It is used by a router to withdraw destination that have been advertised previously, announce a route to a new destination, or both

Update Message (cont.)

• The update message fields are listed below: – Unfeasible routes length. This defines the length of

the next field

– Withdrawn routes. This fields lists all the routes that must be deleted from the previously advertised list

– Path attributes length. This defines the length of the next field

– Path attributes. This defines the attributes of the path to the network whose reachability is being announced in this message

– Network layer reachability information (NLRI). This defines the network that is actually advertised by this message

Page 29: 02_Routing_2014.pdf

7/29/2014

29

Keepalive Message

• The routers (called peers in BGP parlance)

running the BGP protocols exchnage keepalive

messages regularly (before their hold time

expires) to tell each other that they are alive

Notification Message

• A notification message is sent by a router

whenever an error condition is detected or a

router wants to close the connection

Notification Message (cont.)

• The fields making up the notification message

follow:

– Error code, Error subcode, and error data

Page 30: 02_Routing_2014.pdf

7/29/2014

30

Path Vector Routing

• is similar to distance vector routing

• Assuming that there is one node in each AS that acts as on

behalf of the entire AS: Speaker Node

• Speaker node creates a routing table and advertises it

speaker nodes in the neighboring ASs

– advertising the path, not the metric of the nodes

Path Vector Routing (cont’d)

• Initialization

– Each speaker node can know only the reach-ability of nodes inside

its AS

Page 31: 02_Routing_2014.pdf

7/29/2014

31

Path Vector Routing (cont’d)

• Sharing and Updating

14.7 BGP

• Border Gateway Protocol is an interdomain routing protocol using path

vector routing

• Distance vector routing and link state routing

– distance vector routing : just considering the number of hops

– link state routing : requiring each router to have a huge link state database

• Path Vector Routing

– Each entry in the routing table contains the destination network, the next router, and

the path to reach the destination

– The path is usually defined as an ordered list of autonomous systems that a packet

should travel through to reach the destination

BGP (cont’d)

• Stub AS

– has only one connection to another AS

• Multihomed AS

– has more than one connection to other AS

• Transit AS

– is a multihomed AS that also allows transient traffic.

• ex) national and international ISPs

BGP (cont’d)

• Path attributes

– Well-known attributes

• well-known mandatory : ORIGIN (RIP, OSPF, and so on), AS-PATH,

NEXT_HOP

• well-known discretionary

– Optional attributes

• Optional transitive : must be passed to the next router by the router has

not implemented this attribute

• Optional nontransitive : must be discarded if the receiving router has

not implemented this attribute

Page 32: 02_Routing_2014.pdf

7/29/2014

32

BGP (cont’d)

• BGP Session

– Use of services of TCP

– Referred to as semi-permanent connections

• External and Internal BGP

BGP (cont’d)

• Types of Packets

• Packet Format (common header)

Reserved for authentication

Total message

including the header

BGP (cont’d)

• Open message

– To create a neighborhood relationship, a router running BGP

opens a TCP connection with a neighbor and sends an open

message

• Update message

– used by a router to withdraw destinations that have been

advertised previously, announce a route to a new destination,

or both

• Keepalive message

– exchange keepalive messages regularly (before their hold time

expires) to tell each other that routers are alive

• Notification message

– sent by a router whenever an error condition is detected or a

router wants to close the connection

BGP (cont’d)

• Encapsulation

– BGP messages are encapsulated in TCP segments using the well-

known port 179