BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP...

56
BGP V1.1

Transcript of BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP...

Page 1: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP

V1.1

Page 2: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected Commands

Objectives

Page 3: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents

BGP overview BGP terminology BGP packet types and connection status BGP route announcing methods BGP route announcing principles BGP attributes and route selection

Page 4: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS100 AS200

AS300AS400

AS500

Internet development

Till Dec,1969 there is only 4 sites Now it has developed to a global network The whole network is divided into several ASs Easy to manage

Page 5: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

How big is Internet?

A router running BGP in Internet has: The size of the route table is bigger than 30 Mb More than 70,000 routes in the route table More than 6,500 AS numbers

Page 6: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Autonomous Systems

AS(autonomous system ) is a big network that under the same technique management.

IGPs work in the same AS ( autonomous system ) EGPs connect different AS ( autonomous system )

Autonomous System 65000 Autonomous System 65500

IGPs: RIP, IGRP, OSPF, EIGRP

EGPs: BGP

A B

C D

E F

G

H

I

J

Page 7: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS100

AS ( Autonomous Systems )

Every AS has its own AS number Routing policy in each AS is independent AS number : 1 ~ 65535

AB

C D

E

Page 8: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP ( Border Gateway Protocol ) BGP is a kind of EGP BGP is a commonly used standard protocol Version used now : BGPv4 BGP use AS number to avoid route loop Inner routing protocol: RIP/IGRP/OSPF/EIGRP/ISIS

AS100IGRP

AS200OSPF

AS300RIP

BGP BGP

B

A C

Page 9: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP is used among ASs

BGP is used among ASs to ensure that there is no loop in the network

BGP

AS300

AS100

BC C

D

A130.1.0.0/16

AS 400

AS200

130.1.0.0/16AS:100

130.1.0.0/16AS:200 100

130.1.0.0/16AS:200 100

130.1.0.0/16AS:400 200 100

Page 10: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Comparison among some routing protocols

Interior or Exterior

DV or LSHierarchyRequired

OSPF

Protocol

ISIS

Interior

Interior

LS

LS

Yes

Yes

BGP Exterior AdvancedDV

Metric

Cost

Cost

Path vectors or attributesNo

Page 11: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

When to use BGP?

BGP is suitable in these occasions: One AS allow data stream to pass through it to reach

another AS (such as ISP) One AS has several exits to other ASs One AS wants to control the data stream within itself

Of course , you need to be familiar with the operation and function of BGP to make good use of it

Page 12: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

When we don’t use BGP?

BGP is not effective for all occasions. In the following occasions we don’t use BGP : There is only one exit to Internet or other AS Within your AS ,you don’t care about route policy and

route selection If the router is not powerful enough to handle too many

changes and updates in route Limited understanding for route filtering and route

selection Bandwidth between ASs is limited

At this time we can use static route

Page 13: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Static Route review

ZTE(config)#

ip route 10.1.1.0 255.0.0.0 192.168.1.1

Page 14: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Static Route example

ip route 0.0.0.0 0.0.0.0 10.1.1.2

10.1.1.0

ServiceProviderRunning

BGP

ISP

AAS 6500010.1.1.1

10.1.1.2

S0172.16.0.0

A

A

B

Page 15: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents.

BGP overview BGP terminology BGP packet types and connection status BGP route announcing principles BGP route announcing methods BGP attributes and route selection

Page 16: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP features

BGP is a kind of enhanced distance vector routing protocol

Transmission protocol : TCP , port number : 179

Support CIDR ( classless inter domain routing ) Route updates only send added route Rich in route filtering and route policy

configuration

Page 17: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP in IP packet

BGP : Run on TCP Port number is 179 ( port 179 )

TCP Header

Port No.

SegmentPayload

IP Header

Protocol Number

Frame Header

CRC

Packet Payload

Frame Payload

6 - TCP17 - UDP6 - TCP17 - UDP

179 - BGP23 - Telnet25 - SMTP

179 - BGP23 - Telnet25 - SMTP

Page 18: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Peers = Neighbors

Two routers establish TCP connection between each other to

exchange BGP route information , after TCP connection is

established, the relationship between them is peer or neighbor. BGP

neighbors is divided into two types: IBGP and EBGP.

AS 65000

Neighbors

AS 65500

Neighbors

A

C

B1.1.1.1/24

1.1.1.2/242.1.1.1/24

2.1.1.2/24

router bgp 65500neighbor 1.1.1.2 remote-as 65500neighbor 2.1.1.2 remote-as 65000

Router B

Page 19: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

External BGP

Neighbors are in different ASs ( autonomous systems ) Neighbors are usually directly connected

IBGP Neighbors

AS 65000

AS 65500

A

C

B1.1.1.1/24

1.1.1.2/242.1.1.1/24

2.1.1.2/24

router bgp 65000neighbor 2.1.1.1 remote-as 65500

Router A

EBGP Neighbors

router bgp 65500neighbor 2.1.1.2 remote-as 65000

Router B

Page 20: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Internal BGP

Neighbors are in the same AS Neighbors do not need to be directly connected

IBGP Neighbors

AS 65000

AS 65500

A

C

B1.1.1.1/24

1.1.1.2/242.1.1.1/24

2.1.1.2/24

router bgp 65500neighbor 1.1.1.2 remote-as 65500

Router B

EBGP Neighbors

router bgp 65500neighbor 1.1.1.1 remote-as 65500

Router C

Page 21: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Internal BGP There can be several non-BGP routers between

peers BGP messages can be passed through non-BGP

topology

AS100

IBGP

OSPF OSPFOSPF

R1loopback201.7.108.2/32

R2loopback201.7.108.1/32

EBGP EBGP

router bgp 100neighbor 201.7.108.1 remote-as 100 update-source loopback1

Router R1router bgp 100neighbor 201.7.108.2 remote-as 100update-source loopback1

Router R2 Ensure two peersare reachable

Page 22: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents.

BGP overview BGP terminology BGP packet types and connection status BGP route announcing principles BGP route announcing methods BGP attributes and route selection

Page 23: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP message types

BGP has four kinds of messages: OPEN – used to establish BGP connection KEEPALIVE – used to keep BGP connection UPDATE – used to update or withdraw BGP

route NOTIFICATION – BGP error notification

Page 24: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

OPEN Messages

OPEN message is used to establish BGP connection , It includes following contents: Version number: AS number Keep time BGP identification Optional parameters

AS100 AS200

OPEN

OPEN

Page 25: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP KEEPALIVE Message

By default keepalive message are sent every 60 seconds(between peers)

Hold time interval is 180 seconds Keepalive message will reset Hold timer to 0 If Hold timer

expires, the peer will be regarded as dead Keepalive and Hold timer can be changed When

establishing BGP ,the two parts will use the less value of hold time

Keepalive message is 19 bytes long

AS100 AS200

KEEPALIVES

BGP

Page 26: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP UPDATE Messages

The route with same attributes can be sent out in one update message

Update message can also be used to withdraw those unreachable routes

If the route is stable there is no update message Update can only be aimed at the attributes of the routes Update packets have the same function as keepalive

packets to reset hold timer

AS100 AS20012.0.0.0/813.0.0.0/8

14.0.0.0/815.0.0.0/8

Route updates12.0.0.0/813.0.0.0/8

Withdrawn routes15.0.0.0/8

Page 27: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP NOTIFICATION Messages

When error is detected, Notification message is sent out

Notification message will close BGP session Possible error information : certification failure,

route loop etc.

AS100 AS200

NOTIFICATIONAuthentication failure

Page 28: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP connection status

Idle : This is the first status when BGP initiates Connect : the status when BGP is waiting for the success

of TCP connection Active : the status when BGP restart to establish TCP

connection Open sent : when TCP establishing succeeds , BGP

begin to send OPEN message and wait for OPEN message from counterpart

Open confirm : after receiving OPEN message from neighbor, BGP waits for Keepalive message or Notification message

Established : this is the last stage or stable status for the neighbors to negotiate , BGP begin to exchange Update packets between each other

Page 29: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents.

BGP overview BGP terminology BGP packet types and connection status BGP route announcing methods BGP route announcing principles BGP attributes and route selection

Page 30: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP route announcing method 1—Network command

18.0.0.1/8

RTB

AS200

OSPF

RTB(config)#router bgp 200RTB(config-router-bgp)#network 18.0.0.0 mask 255.0.0.0

OSPF finds route18.0.0.1/8 。How to announce this route to the BGP route table of RTB ?

Page 31: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP route announcing method 2—route redistribution

18.0.0.1/8

OSPFRTB

AS200

RTB (config) # router bgp 200RTB (config-router-bgp) # redistribute ospf-int

OSPF finds route18.0.0.1/8 。How to announce this route to the BGP route table of RTB ?

Page 32: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents

BGP overview BGP terminology BGP packet types and connection status BGP route announcing methods BGP route announcing principles BGP attributes and route selection

Page 33: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP route announcing principles

When there are multiple paths, BGP Speaker will use the best one for itself;

BGP Speaker will only announce the routes that it is using to their neighbors;

BGP Speaker will announce the routes that it gets from EBGP neighbor to all the BGP neighbors, including EBGP and IBGP neighbors;

BGP Speaker will not announce the routes that it gets from IBGP neighbor to all the other IBGP neighbors;

If the BGP Speaker will announce the routes that it learns from IBGP neighbor to its EBGP neighbor depends on the synchronous status of IGP and BGP

Once the connection is established, BGP Speaker will announce all the BGP routes to the neighbors

Page 34: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP routes take effect condition

BGP routes take effect condition : nexthop of route is reachable

AS 64500

172.20.0.0

172.16.0.0

AS 6500010.10.10.1

10.10.10.3

172.20.10.1 172.20.10.2

B

A

C

172.16.0.0Next-hop :10.10.10.3

Router B10.10.10.0/24 int1 direct172.20.0.0/16 int2 direct172.16.0.0/16 int1 bgp

Router C10.10.10.0/24 int1 ospf172.20.0.0/16 int1 direct172.16.0.0/16 int1 bgp

172.16.0.0Next-hop:10.10.10.3

Page 35: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP synchronization

Because IBGP neighbors may be not directly connected, so these non-BGP routers will take part in the process of packets forwarding based on BGP routes , it is required that IGP routers also have related BGP routes

Routes learned from IBGP neighbor that is also learned from IGP can be announced to EBGP neighbor, this is called BGP and IGP synchronization. This function is turned on by default, it needs to be turned off manually

172.20.20.2AS 65000

10.10.10.1

172.20.10.1

172.20.10.2

D

AS 64500

172.16.0.010.10.10.3

A

B

C172.20.20.1

IBGPDIP:172.16.0.1

All the routers inside AS have to learn BGP routes?

Router D10.10.10.0/24 int1 ospf172.20.20.0/24 int1 direct172.20.10.0/24 int1 ospf172.16.0.0/16 int1 bgp

Router C10.10.10.0/24 int1 ospf172.20.10.0/24 int1 direct172.20.20.0/24 int2 direct172.16.0.0/24 int1 ospf

EBGP

Page 36: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

IBGP full mesh

Inside AS, all the routers which BGP routes pass through should establish IBGP neighbor between each other, to ensure that packets still have route guide after disabling BGP synchronization

172.20.20.2AS 65000 10.10.10.1

172.20.10.1

172.20.10.2

D

AS 64500

172.16.0.010.10.10.3

A

B

C172.20.20.1

IBGP

EBGP

IBGP IBGP

Page 37: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Contents

BGP overview BGP terminology BGP packet types and connection status BGP route announcing methods BGP route announcing principles BGP attributes and route selection

Page 38: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP Attributes

BGP attributes describe the features of BGP route BGP attributes are a series parameters BGP attributes are sent out in BGP UPDATE

messages BGP attributes are used for BGP route filtering

and route deciding policy BGP attributes are divided into Well-known and

optional

Page 39: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

HQ

Well-known Attributes

BGP well-known attributes : all the BGP routers must recognize

BGP well-known attributes are divided into “well-know mandatory” and “well-known Discretionary ” two types

“well-known mandatory” attributes : must appear in all the update messages

“well-known Discretionary ” attributes : may appear in the update messages and may not

Page 40: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Optional Attributes

BGP optional attributes : BGP routers may or may not support attributes

BGP optional attributes are divided into “ Transitive ” and “nontransitive ” two types

“optional transitive” attributes : if accepted will be labeled as “global” and then sent out ; if not accepted will be labeled as “local” and then sent out

“optional nontransitive ” attributes : if accepted will handle by itself and will not be forwarded to the neighbors ; if not accepted will be discarded

Page 41: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP commonly used Attributes

well-know mandatory : AS-path Next-hop Origin

well-known Discretionary : Local preference

optional transitive : Community

optional nontransitive : Multi-exit-discriminator (MED)

Page 42: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS_Path attribute AS_path is a kind of mandatory attribute It traces the AS the packet passes New AS number will be placed at the beginning of

AS_Path AS_Path is used to avoid loop AS number is managed by InterNIC private AS number is : 64512 ~ 65535 Private AS number must be filtered in Internet

AS100130.1.0.0/16

AS200 AS300

130.1.0.0/16AS:100

130.1.0.0/16AS:200 100

Page 43: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS100130.1.0.0/16

AS200 AS300

130.1.0.0/16AS:100

130.1.0.0/16AS:200 100

AS400130.1.0.0/16

AS:400 100 100

130.1.0.0/16AS:100 100

r1

r2 r3

r4

r5 r6

Example: R4 will select AS200 to pass

AS_Path used for route selection

AS_Path is updated by BGP automatically AS_Path is used to select route in BGP The route with the shortest AS_Path will be selected first AS_Path can be increased

Page 44: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Next-Hop Attribute

“next-hop” attribute signify the IP address of next hop for this route , it

is usually the Loopback address of the neighbor

“next-hop” attribute is generated by EBGP or IBGP

“next-hop” attribute generated by EBGP will be kept in the process of

IBGP route forwarding

IBGP peer must have the valid route to the next hop address,

otherwise this route is invalid

The next hop address of BGP route is searched recursively in IGP to

find the next hop address of the neighbor router

Page 45: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Next-Hop Attribute

Router A announce the network 172.16.0.0 to Router B by means of EBGP, the next hop is 10.10.10.3

Router B announce the network 172.16.0.0 to Router C by means of IBGP, keeping the next-hop address as 10.10.10.3

AS 64500

172.20.0.0

172.16.0.0

AS 6500010.10.10.1

10.10.10.3

172.20.10.1 172.20.10.2

B C

A

Page 46: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS100130.1.0.0/16

AS200AS300

ip address 201.1.100.1 255.255.255.0

130.1.0.0/16Next-hop: 201.1.100.1

r1

r2 r4

r5

130.1.0.0/16Next-hop: 100.1.1.1

IBGP

r3

Modifying next-hop

IBGP peer may not have the route to the next-hop EBGP neighbor

In this circumstances, it is required that IBGP neighbor modify Next-hop address as local address.

Page 47: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Next-Hop Attribute Example

AS100AS100

AS200AS200

AS300AS300

RA RB

RC

RD

RE RF

EBGP

EBGPIBGP

IBGP

1.1.3.1/24

1.1.1.1/241.1.2.1/24

8.0.0.0

D=8.0.0.0Next_Hop=1.1.3.1

D=8.0.0.0Next_Hop=1.1.1.1

D=8.0.0.0Next_Hop=1.1.2.1

D=8.0.0.0Next_Hop=1.1.2.1

Page 48: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Local Preference Attribute

Local Preference is used for BGP route decision During the process of route decision in

BGP , Local Preference has the highest priority Local Preference is transmitted within the local

AS by IBGP The higher the Local Preference ,the higher the

priority By default ,the Local Preference is set to 100

Page 49: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Local Preference Attribute r2 and r3 can all access AS400 The AS_path from r2 and r3 is the same At this time, Local Preference can be used to

break the balance

AS100 AS200 AS300

120.1.0.0/16AS:100 400

120.1.0.0/16AS:300 400

AS400120.1.0.0/16 120.1.0.0/16

AS:400120.1.0.0/16

AS:400

r1

r2 r3

r4

r5 r6

Page 50: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

AS100AS200IBGP AS300

120.1.0.0/16AS:100 400

120.1.0.0/16AS:300 400

AS400120.1.0.0/16 120.1.0.0/16

AS:400120.1.0.0/16

AS:400

r1

r2 r3

r4

r5 r6

120.1.0.0/16Local Pref:300

120.1.0.0/16Local Pref:100

Local Preference Attribute

Page 51: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Local Preference Attribute Example

AS10AS10

AS20AS20

EBGP

EBGPIBGP

IBGP

IBGPRA

RB

RC

RD

8.0.0.0

2.1.1.1

3.1.1.1

Local_Pref=200

Local_Pref=100

D=8.0.0.0Next_Hop=2.1.1.1Local_Pref=100

>D=8.0.0.0Next_Hop=3.1.1.1Local_Pref=200

Page 52: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

MED Attribute Example

AS10AS10

AS20AS20

EBGP

EBGPIBGP

IBGP

IBGPRA

RB

RC

RD

8.0.0.0

2.1.1.1

3.1.1.1

MED=100

MED=0

> D=8.0.0.0Next_Hop=2.1.1.1MED=0

D=8.0.0.0Next_Hop=3.1.1.1MED=100

Page 53: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Origin Attribute

IGP (i) the routes announced by command “Network” must be

in IGP

EGP (e) EGP Redistribute , now the EGP protocol almost

disappear

Incomplete (?) Coming from IGP or static route redistribution

When BGP selects the best route , route origin with I has highest priority ; then EGP , and the last is Incomplete 。

Page 54: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

BGP Route Selection Decision Process

At first , accept those routes without AS loop and has valid next-hop address , then :1. Select the route with highest local preference ;2. Select the route generated by local routers such as routes

generated by route aggregation;

3. Select the route with shortest AS-path ;4. Select the route with lowest origin code (IGP < EGP < Incomplete)

5. Select the route with lowest MED; (MED is set by EBGP neighbor)

6. If MED is the same, and they are both announced from IBGP and EBGP, then the route from EBGP will be selected first ;

7. Choose the path to the next hop from the nearest IGP neighbor ;8. Choose the route with the lowest neighbor Router-ID ;9. Choose the route with the lowest neighbor interface address.

Page 55: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.

Summary

BGP basic concept BGP commonly used attributes Method to select the best route in BGP

Page 56: BGP V1.1. When is BGP Applicable Basic BGP Peer Configuration Troubleshooting BGP Connections BGP Operation and Path Attributes Route Import/Export Selected.