BGP Decicion Algorithm

AS_path Attribute 当有更新信息通过AS 时,BGP将在前面加上自己的AS号。
Origin Attribute
路由的Origin属性有以下三种:

IGP---
路由起源于同一AS域内,用show ip bgp时由I代表

EGP---
路由通过Exterior Gateway Protocol学得,用show ip bgp时由e代表。



Incomplete---
路由起源未知或通过其他方式学得,用?表示

1. External BGP peering

:
Router A in AS100
interface ethernet 5/0
ip address 222.222.10.2 255.255.255.240
router bgp 100
network 220.220.8.0 mask 255.255.255.0
neighbor 222.222.10.1 remote-as 101
neighbor 222.222.10.1 distribute-list 180 in
neighbor 222.222.10.1 distribute-list 181 out

Router B in AS101
interface ethernet 1/0/0
ip address 222.222.10.1 255.255.255.240
router bgp 101
network 220.220.16.0 mask 255.255.240.0
neighbor 222.222.10.2 remote-as 100
neighbor 222.222.10.2 distribute-list 150 in
neighbor 222.222.10.2 distribute-list 151 out

2. stable iBGP peering(peering to loopback address)
.peer with loopback address
.iBGP session is not dependent on a single interface
.loopback interface does not go down ever
:
router A:
interface loopback 0
ip address 215.10.7.1 255.255.255.255
router bgp 100
network 220.220.1.0
neighbor 215.10.7.2 remote-as 100
neighbor 215.10.7.2 update-source loopback 0
neighbor 215.10.7.3 remote-as 100
neighbor 215.10.7.3 update-source loopback 0

router B:
interface loopback 0
ip address 215.10.7.2 255.255.255.255
router bgp 100
network 220.220.5.0
neighbor 215.10.7.1 remote-as 100
neighbor 215.10.7.1 update-source loopback 0
neighbor 215.10.7.3 remote-as 100
neighbor 215.10.7.3 update-source loopback 0

3. local preference
. default: 100
选用local preference 高的路由
.local to AS
. used to influence BGP path selection
.path with highest local preference selection
:
router bgp 400
neighbor 220.5.1.1 remote-as 300
neighbor 220.5.1.1 route-map local-pref in
route-map local-pref permit 10
match ip address 1
set local preference 800
access-list 1 permit 160.10.0.0 0.0.255.255
access-list 1 deny any

Example:
autonomous-system 200
定义AS

router bgp 100
network 200.200.4.0 mask 255.255.252.0
neighbor 200.200.7.224 remote-as 100
neighbor 200.200.7.224 update-source loopback 0

sh ip bgp summary
sh ip bgp
no router bgp 100