CCIE第十天——BGP(2)

一、BGP宣告
BGP的宣告是依赖路由表的
宣告满足条件:被宣告路由必须在路由表中。被宣告路由必须和路由表中的前缀掩码一致
EBGP建立邻居没有特殊情况一般使用直连建立,如果使用费直连建立需要修改跳数,默认情况下跳数为1(不修改跳数用非直连建邻则会建立不起来)

neighbor 1.1.1.1 ebgp-multihop     ebgp邻居多跳(默认255)

BGP的路由传递传递的是BGP路由表中的路由信息。BGP的路由表收到路由以后需要检验该路由的下一跳是否可达,如果不可达该路由一定不优。
二、BGP属性
1、route-map使用时用in
1)weight:Cisco私有属性,默认该属性不传递,本台路由器产生32768。
2)0:不能传递。适用于一台路由器在多条路径下的选路,无视邻居属性。

neighbor  10.1.34.3  weight      20       //修改该邻居传递过来的所有路由weight20

2、只针对某一个路由修改weight
1)抓取流量

ip prefix-list a permit 10.1.34.3/32

2)做策略

route-map a permit 10
match ip address prefix-list a
set weight 1
route-map  a  permit 20

3)调用

router  bgp 1
neighbor  10.1.34.3  route-map  a  in

weight的值的修改只能影响本路由器,不能影响其他路由器,意味着如果AS只有一个出口路由器。weight选路是适用的,但是有多个出口路由器的情况下weight就不太适应了
3,多个出口路由的情况
1)origin:起源 ,表示该路由是怎么得到的 该属性可以选路,但是一般不用于选路
0表示宣告(i)
1表示EGP学到(E)
3表示其他手段得到
i>E>?选路修改
(1)抓取流量

 ip    prefix-list    a    permit    10.1.34.3/32

(2)做策略

route-map   a     permit 1 0
match    ip    address     prefix-list    a
set     origin     incomplete
route-map   a   permit  20

(3)调用

router  bgp 1
neighbor  10.1.34.3  route-map  a  in   //用in或者out方向均可,适用于任何邻居之间 

2)AS_PATH:路由经过的AS号,顺序是最近经过的AS排在前面。
防环(一个AS中的路由器拒绝接受带有自己AS号的路由) AS_PATH越短越优
修改:

R5(config)#ip prefix-list a permit 10.10.10.10/32
R5(config)#route-map a permit 10
R5(config-route-map)#match ip address prefix-list a
R5(config-route-map)#set as-path prepend 234           //修改参数
R5(config)#route-map a permit 20          //放空
R5(config-route-map)#R5(config)#router bgp 1
R5(config-router)#neighbor 12.1.1.1 route-map a in

我们一般在选路当中添加AS会添加已经历的AS,一般不会添加没有经历的AS使用于任何邻居之间,in和out方向都行。

Neighbor    x.x.x.x   allowas-in  允许和具有自己相同的AS进入本AS    
//本路由器使用
Neighbor    x.x.x.x   as-override    把具有和其他AS相同的AS号的路由放入这个AS

3)next-hop:到达路由的下一跳路由器IP地址。IBGP之间net-hop不变,EBGP之间传路由net-hop修改为更新源地址。
下一跳为0优于其他路径 ·
4)local_pref:与weight一样也是选路属性(管理自己的)不能在EBGP邻居之间传递,可以在IBGP邻居之间传递,值越高越优(默认100)。常用于当本AS有多个出口路由器时,选择拥有local值大的路由器作为出口路由器。也可以是到达一个网段由多个出口路径时,选择local值大的路径。
修改方式:
1,修改路由器的默认local_pref值,该路由器通告给IBGP邻居的路由都会携带修改后的local_pref值

bgp  default  
local-preference     120        //修改路由器默认的local-pref

2,通过route-map修改某路由的local-pref,EBGP只能在in方向,IBGP可以是in也可以是out方向。

R5(config)#ip prefix-list a permit 10.10.10.10/32
R5(config)#route-map a permit 10
R5(config-route-map)#match ip address prefix-list aR5(config-route-map)#set local-preference 120           //修改参数
R5(config)#route-map a permit 20          //放空
R5(config-route-map)#R5(config)#router bgp 1
R5(config-router)#neighbor 12.1.1.1 route-map a in

4)MED:本质上metric默认为0,一般只能用于自同一个AS发出路由的不同路径MED值比较。只能在两个AS之间传递,不能传给第三个AS。
一般用于影响对方AS,如果在本AS使用和local-pref等同(注意MED不能在路由器上修改默认值)。

R5(config)#ip prefix-list a permit 10.10.10.10/32
R5(config)#route-map a permit 10
R5(config-route-map)#match ip address prefix-list a
R5(config-route-map)#set metric 20           //修改参数
R5(config)#route-map a permit 20          //放空
R5(config-route-map)#R5(config)#router bgp 1
R5(config-router)#neighbor 12.1.1.1 route-map a in
R5(config-router)bgp always-compare-med        //开启比较不同的MED

5)· Atomic-aggregate:用来警告下游路由器路由聚合产生as-set命令会使得该属性消失。

R1(config)#router bgp 1
R1(config-router)#aggregate-address 10.0.4.0 255.255.255.0 ?  
advertise-map  Set condition to advertise attribute                     通告属性  
as-confed-set  Generate AS confed set path information  
as-set    Generate AS set path information  attribute-map  Set attributes of aggregate                       设置聚合后的属性  
route-map      Set parameters of aggregate  
summary-only   Filter more specific routes from updates           聚合后公布聚合后的路由  
suppress-map   Conditionally filter more specific routes from updates       只公布明细

6)aggregate:用来通告汇总路由的汇聚路由器BGP_ID公布汇总者的BGP_ID
7)community:团体属性:为了更好的标识BGP路由,标识格式为x:y
standard(做路由标识) expanded(MPLS VPN),可读性好
团体值的设置不能在EBGP之间,它的传递可以在IBGP之间也可以在EBGP之间。
neighbor 100.1.24.0 send-community both团题属性需要传递必须开其该指令
show ip bgp community 查看所有具体团体值的路由设置:

R5(config)#ip prefix-list a permit 10.10.10.10/32
R5(config)#route-map a permit 10
R5(config-route-map)#match ip address prefix-list a
R5(config-route-map)#set community 20           //修改参数
R5(config)#route-map a permit 20          //放空
R5(config)#router bgp 1
R5(config-router)#neighbor 12.1.1.1 route-map a in
R5(config)ip bgp-community  new-format           //开启格式匹配

注:设置必须在IBGP之间可以用in也可以用out
3、匹配:

R1(config)#ip community-list standard ww permit ?        //专用匹配工具  
<1-4294967295>  community number  
aa:nn           community number  
gshut           Graceful Shutdown (well-known community)  
internet        Internet (well-known community)  
local-AS        Do not send outside local AS (well-known community)  
no-advertise    Do not advertise to any peer (well-known community)  
no-export       Do not export to next AS (well-known community)  <cr>
R1(config)#ip community-list standard ww permit *:1 用community-list匹配完成之后route-map调用即可

子属性:
internt默认属性,可以给任何bgp发送,不携带团体值的路由做任何限制
no_export只能在一个AS内传递,也可以在联盟内传递,不能传递给EBGP邻居。
no_advertise不再IBGP和EBGP邻居间传递local-as不想任何EBGP邻居发送包括联盟的EBGP邻居
三、反射器
反射器不能反射非客户端和非客户端缺点:反射器反射收到两个或两个以上达到统一目标路径时会判断出最优的路由然后反射给你客户端与非客户端路由器,这样一来这些设备就丧失了多条路径的最优判断。

R1(config-router)#neighbor 10.3.3.3 route-reflector-client       //在服务器上指客户端

originator_id:路由反射使用,是路由发起者产生的一个32比特的值,该值是本地路由发起者的RID,如果路由器发起者从属性看到自己的RID,说明有环路就忽略该路由。
cluster_list:路由反射器使用,是路由进过反射器簇ID的一个序号。入股在反射器属性里看到自己的簇ID,就说明有环路,忽略该路由

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值