weight属性
1.传播范围,只在本台路由器上起效。
2.默认值
3.越大越好
实验:
r2:
router bgp 2
no syn
no au
bgp router-id 2.2.2.2
neighbor 12.1.1.1 remote-as 1
neighbor 24.1.1.4 remote-as 1
r1:
router bgp 1
bgp router-id 1.1.1.1
neighbor 12.1.1.2 remote-as 2
neighbor 3.3.3.3 remote-as 1
neighbor 3.3.3.3 update-source lo0
r3:
router bgp 1
bgp router-d 3.3.3.3
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 up lo0
neighbor 4.4.4.4 remote-as 1
neighbor 4.4.4.4 up lo0
r4:
router bgp 1
bgp router-id 4.4.4.4
neighbor 3.3.3.3 remote-as 1
neighbor 3.3.3.3 up lo0
neighbor 24.1.1.2 remote-as 2
r3:
show ip bgp 2.2.2.0/24
使用环回口建立邻居metric比直连建立邻居metric多1
r2:
interface lo9
ip add 9.9.9.9 255.255.255.0
router bgp 2
network 9.9.9.0 mask 255.255.255.0
在本台路由器通告的weight值较高32768
r3:
router bgp 1
neighbor 1.1.1.1 weight 1 (当1.1.1.1邻居发送过来的任何路由都调成1,默认是in方向)
ip prefix-list 2 permit 2.2.2.0/24
route-map w
match ip address prefix-list 2
set wight 3
route-map w permit 20
router bgp 1
neighbor 1.1.1.1 route-map w in
local prefence本地优先级属性
1.范围:只能发送给ibgp邻居,as内
2.默认值100,越大越优。
使用范围:
一般被用来通告给ibgp邻居怎么离开他的as。
实验:
r1:
router bgp 1
bgp default local-preference 111 (show ip bgp看不到只能show ip bgp 2.2.2.0/24详细才能看到)
bgp default local-preference 111
1.对自己network的路由是否起效
2.对ebgp路由是否起效 可以。
3.对ibgp路由是否起效
4.对agg聚合的路由是否起效。
access-list 2 permit 2.2.2.0
route-map l
match ip address 2
set local-preference 123
route-map l permit 20
router bgp 1
neighbor 3.3.3.3 route-map l out
as-path
越短越好
实验:
r3:
router bgp 1
neighbor 35.1.1.5 remote-as 5
r5:
router bgp 5
bgp router-id 5.5.5.5
neighbor 35.1.1.3 remote-as 1
out:
in:
r2:
ip prefix-list 2 permit 2.2.2.0/24
route-map as
match ip address prefix-list 2
set as-patch prepend 6 7 8(在之前加入6 7 8)
route-map as permit 20
router bgp 2
neighbor 24.1.1.4 route-map as out
r3:
show ip bgp
r4:
ip prefix-list 2 permit 2.2.2.0/24
route-map as
match ip address prefix-list 2
set as-patch prepend 7 8 9
route-map as permit 20
router bgp 1
neighbor 24.1.1.2 route-map as in
show ip bgp
route-map as
match ip address prefix-list 2
set as-path prepend 2 2 2 2(设置自己的as比较好,不会出现问题)
router-map as permit 20
origin更改起源属性
set origin (igp>egp>incomplete)
med属性(多出口鉴别属性)
1.传播范围,仅仅只能穿一个as
2.默认值:0
3.越小越好
通常告知ebgp邻居如何进入我的as。
r3:
int lo8
ip add 8.8.8.8 255.255.255.0
router bgp 1
network 8.8.8.0 mask 255.255.255.0
show ip bgp
r1:
route-map
set metric 8 router bgp 1
neighbor 12.1.1.2 route-map med out
debug ip bgp updates(使用debug检测或扩展ping)
解决ibgp的水平分割:
1.路由反射器
c/s server叫做rr,仅仅只是对ibgp来说,
rr和client构成的一个组叫一个簇
1.rr从ebgp收到的路由会反射给我的客户端和非客户端。
2.rr从客户端收到的路由会反射给我客户端和非客户端和ebgp邻居
3.rr从非客户端收到路由只会反射给客户端和ebgp邻居
实验:
r3:
router bgp 1
neighbor 1.1.1.1 route-reflector-client
neighbor 4.4.4.4 route-reflector-client
2.联邦
把大as人为划分小as号,小as就变成ebgp关系
1.router bgp 小as号(私有as号)
2.声明所在的大as号
3.小as号之间互指peer
r1:
router bgp 64512
bgp route-id 1.1.1.1
neighbor 12.1.1.2 remote-as 2
neighbor 3.3.3.3 remote-as 64512
neighbor 3.3.3.3 update-source lo0
r3:
router bgp 64512
bgp router-id 3.3.3.3
neighbor 1.1.1.1 remote-as 64512
neighbor 1.1.1.1 up lo0
neighbor 4.4.4.4 remote-as 64513
neighbro 4.4.4.4 up lo0
neighbor 4.4.4.4 ebgp-multihop
r4:
router bgp 64513
bgp router-id 4.4.4.4
neighbor 3.3.3.3 remote-as 64512
neighbor 3.3.3.3 up lo0
neighbor 3.3.3.3 ebgp-multihop
r1:
bgp confederation identifier 1(声明大as号)
r3:
bgp confederation identifier 1
r4:
bgp confederation identifier 1
r3:
bgp confederation peers 64513(互值peer)
r4:
bgp confederation peers 64512
r1:
router bgp 64512
neighbor 3.3.3.3 next-hop-self
联邦的小as号不做选路的比较的。
社团属性:community
1.可选的:路由器有可能不识别此属性。(默认)
neighbor x.x.x.x send-community
2.传递性:社团属性只在neighbor x.x.x.x send-community邻居有效。
no-advertise:携带此属性的路由不会通告给任何bgp邻居。
no-export:携带此属性的路由不会传出大as
local-as:携带此属性的路由不会传出小as
实验:r2:
route-map com
set community no-advertise (不通告,携带此属性的路由不会通告任何的bgp邻居)
router bgp 2
neighbor 12.1.1.1 route-map com out
neighbor 12.1.1.1 send-community
route-map com
set community no-export(携带此属性的路由不会传出大as)
route-map com
set community local-as(携带此属性的路由不会传出小as)
标签:bgp,1.1,route,BGP,3.3,neighbor,3.1,router From: https://www.cnblogs.com/smoke520/p/18354113