BGP第二天

BGP属性
Path-attribute
一共10种属性(Cisco11种)分为4类 well-known mandatory ,well-known discretionary,optional transitive,optional nontransitive
11条属性,weight,origin,as-path,next-hop,local-pref,atomic-aggregate,aggregator,community,MED,originator-id,cluster-list
1.公认必尊
所有BGP路由器必须识别遵守的原则有origin,as-path,next-hop
2.公认可尊
所有路由器都能识别但是不一定遵守,local-pref,atomic-aggregate
3.可选传递
不是所有BGP路由器都能识别,但是所有BGP都能传递,aggregate和community
4.可选非传递
不是所有路由器都被识别,不能识别的BGP路由器就丢弃它,MED,originator-id和cluster-id
Weight
Cisco私有属性,对于离开AS的路由在路由器选择那一条最优,本台路由器产生为32768,学习的为0,不能传递,适用一台路由器在多条路径下选路,无视邻居属性。
修改方式:
1.
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 weight 1 //修改该邻居所有传递过来的路由weight为1。
2.
Router(config)#ip prefix-list a permit 10.1.4.1/24
Router(config)#route-map a permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set weight 1
Router(config-route-map)#exit
Router(config)#route-map a permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map a in //只针对某一个路由器修改weight,注意只能用in方向。
Weight值的修改只能影响本路由器,不能影响其他路由器,意味着如果AS只有一个出口路由器
Weight选路是适用的,但是有多个出口的路由器的情况下weight

Origin
起源属性,标识该路由的来源方式
0表示宣告1表示EGP学到(E),2表示其他手段得到(重发部)用i>E>?选路
该属性可用于选路(但一般不用于选路)
Router(config)#ip prefix-list a permit 10.1.4.1/24
Router(config)#route-map org permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set origin incomplete
Router(config-route-map)#exit
Router(config)#route-map org permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map org in //用in和out方向都行,适用于任何邻居之间
AS path
一条路由在传输过程经历了哪些AS(除了自己)顺序是最近经过的AS排前面,一个AS的路由去拒绝接收携带有自己AS号的路由,可防环,也可用于选路,AS-path短的优先
修改方式:
Router(config)#ip prefix-list a permit 10.1.4.1/24
Router(config)#route-map cisco permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set as-path prepend 2 3 4
Router(config-route-map)#exit
Router(config)#route-map cisco permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map cisco in

一般在选路当中添加AS会重复添加自己经历的AS号,不会添加自己没有经历的AS号,适用于邻居之间,in和out方向都行。
Nei x.x.x.x allowas-in 允许和具有自己相同的 AS路由进入本AS//打破防环(本路由器使用)
Nei x.x.x.x as-override 把具有和其他AS相同AS号的路由放入这个AS(邻居路由器使用)

next-hop
到达路由的下一跳路由器IP地址,IBGP之间传递路由next-hop不变,为0的时候
Router(config)#ip prefix-list a permit 10.1.4.1/24
Router(config)#route-map ccna permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set ip next-hop 1.1.1.1
Router(config-route-map)#exit
Router(config)#route-map ccna permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map ccna in
方向无所谓,邻居无所谓。
Local-pref
与weight一样也是选路属性
不能在EBGP邻居之间传递,可以在IBGP邻居之间传递,值越高越优,常用于当本地AS有多个出口路由时,选择拥有local值大的路由器作为出口路由器,也可以是到达一个网段有多个出口路径时,选择local值大的路径。
修改方式:
1.修改路由器的默认值local-pref值,该路由器通告给IBGP邻居的路由都会携带修改后的local值
Router(config)#router bgp 2
Router(config-router)#bgp default local-preference 120 //修改默认路由的local值
2.通过route-map修改某路由器的local-pref值,EBGP只能在in方向,IBGP既可以在in方向也可以在out方向
Router(config)#ip prefix-list a permit 10.1.4.1/24
Router(config)#route-map ccnp permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set local-preference 120
Router(config-route-map)#exit
Router(config)#route-map ccnp permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map ccnp in

MED
选路属性, 本质就是metric默认为0,一般只用于自同一个AS发出的路由的不同路径MED值的比较。
用于选择流入AS的入口路由器,只能在两个AS之间传递,默认越低越好
一般用于影响对方AS,如果在本AS使用和local-pref等同(注意MED不在在路由器上修改默认值)

Router(config)#route-map ccie permit 10
Router(config-route-map)#match ip address prefix-list a
Router(config-route-map)#set metric 10
Router(config-route-map)#exit
Router(config)#route-map ccie permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor 10.1.4.2 route-map ccie in
BGP的汇总
as-set 会使得该属性消失
Router(config-router)#aggregate-address 10.1.4.0 255.255.255.0 //明细和粗略都公布
Router(config-router)#aggregate-address 10.1.4.0 255.255.255.0 suppress-map //只公布明细
Router(config-router)#$ddress 10.1.4.0 255.255.255.0 summary-only as-set //只公布没有重叠的AS-path
Router(config-router)#aggregate-address 10.1.4.0 255.255.255.0 summary-only //聚合后公布聚合后的路由
Aggregator
用来通告汇总路由的汇总路由器 BGP-ID(Cisco私有)方便寻找汇总者
Community 社团属性,为了更好的表示BGP路由,表示格式为x:y
团体值的设置不能在EBGP之间(只能在IBGP之间),它的传递既可以在IBGP之间也可以在EBGP之间;
设置:
Router(config)#route-map p permit 10
Router(config-route-map)# match ip address prefix-list p
Router(config-route-map)#set community 111
Router(config-route-map)#exit
Router(config)#route-map p permit 20
Router(config-route-map)#exit
Router(config)#router bgp 2
Router(config-router)#neighbor kkk route-map p out
设置必须在IBGP之间可以用in也可以用out
传递设置:
Router(config-router)#neighbor 10.1.4.2 send-community
both/standard/extended//团体属性需要传递必须开启该指令。
查看:
Show ip bgp 10.1.4.1 //查看路由详情可以查看到团体值
Show ip bgp community //该指令可以查看具有所有团体值的路由
Show ip bgp community 111 //查看某团体值的所有路由
Standard (做路由标识)extend(MPLS VPN),可读性好
1.internet默认属性,可以给任何BGP发送,不对携带团体值的路由做任何限制
2.no-export 只能在一个AS内传递,可以在联盟内传递,该属性就是限制携带团体值的路由传递给EBGP邻居,联盟的EBGP除外
3.no-advertise不在IBGP邻居间传递
4.Local-as 不向任何EBGP邻居发送包括 联盟的EBGP邻居
反射器
Router(config-router)#neighbor 10.1.4.2 route-reflector-client //在反射服务端上指定反射客户端,未指定的就是为非客户端
反射器可以反射客户端之前,客户端与非客户端的路由,但是不能反射非客户端的之间的路由。
缺点:

Originator id
路由器反射使用,是路由发起者产生的一个32比特的值,该值是本地路由发起者RID,如果路由发起者从属性上看到自己的RID,说明有环路就忽略
Cluster-list
路由反射器使用,是路由过反射器簇id的一个序号,如果反射器在属性里看到自己的簇ID就说明没有环路,忽略

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值