修改weight
router bgp 1
nrighbor [Address] weight 10
修改单条
access-list 6 permit 6.6.6.6
router-map xxx permit 10
match ip address 6
set weight 20
router-map xxx permit 20
router bap 1
neihgbor [address] router-map xxx in
2.local_preference:AS内有效,AS内传递,默认值是100,比较的是其他AS
修改local_preference
route-map xxx permit 10
set local-preference 110
router bgp 1
neighbor [address] route-map xxx out
发给邻居时携带local-preference属性
neighbor [address] route-map xxx in
从邻居学到的路由携带local-preference属性
3。本地优先
路由汇聚
router bgp 1
aggregate-address 汇聚后的网段 汇聚后的掩码 summary-only as-set
summary only:抑制明细,只发汇聚路由
as-set:汇聚后携带原有AS_PATH信息
4.as_path
bgp bestpath as-path ignore 忽略AS_PATH选路,隐藏命令。
抑制列表
suppress-map
会向邻居发送汇总路由和明细路由,被抑制的路由除外
router bgp [AS]
aggregate-address 汇聚后的网段 汇聚后的掩码 suppress-map xxx
route-map xxx
match ip address abc
4.as_path
route-map xxx permit 10
set as-path prepend 5
router bgp 1
neighbor 邻居地址 route-map xxx in
5.路由来源:IGP>EGP>INCOMPLETE i>e>?
bgp bestpath as-path ignore
忽略PA_PATH选路,隐藏命令,必须手工输入
Prefer the path with the lowest multi-exit discriminator(MED)
MED:传递到别的AS中,供别的AS选路使用。默认0.
修改MED:
route-map xxx permit 10
set metric 119
router bgp 2
neighbor 邻居地址 route-map xxx out
-----------------------------------------------------------------------------------------------------------
如果收到的BGP路由的AS_PATH含有自身的AS号,则拒收该路由
解决方案1:allowas-in
router bgp AS号
neighbor [address] allowas-in
*allow-in 允许携带自己AS号的路由进入
解决方案2:as-override
PE-CE之间:
router bgp AS号
neighbor [address] as-override
*asoverride
发送者处理,发送的时候检查AS_PATH,如果有AS号和对端AS号一样,则改成自己的AS号。
AS_PATH
ip as-path access-list 1 permit _2$ 允许源为2的路由
ip as-path access-list 2 permit ^2$
联邦(联盟):64512-65535
bgp confederation identifier AS号
bgp confederation peer0 AS号
community属性
local-AS 仅传一个AS
no-advertise 仅传一跳
no-export 仅传一个公有AS
需要neighbor BGP邻居地址 send-community 配合
aa:nn传递comunity
需要ip bgp-community new-format命令才能显示正确格式
router bgp AS号
neighbor BGP邻居地址 route-map xxx out
neighbor BGP邻居地址 send-community
route-map xxx permit 10