2、默认值
3、值大好还是小好
11,65,环回口
R3#show ip bgp 2.2.2.0/24
BGP routing table entry for 2.2.2.0/24, version 3
Paths: (2 available, best #2, table default)
R3#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
Gateway of last resort is not set
O
1.1.1.1 [110/65] via 13.1.1.1, 00:33:44, Serial2/0
B 2.2.2.0 [200/0] via 4.4.4.4, 00:06:14
C
3.3.3.0/24 is directly connected, Loopback0
L
3.3.3.3/32 is directly connected, Loopback0
O
4.4.4.4 [110/11] via 34.1.1.4, 00:31:22, Ethernet0/1
C
13.1.1.0/24 is directly connected, Serial2/0
L
13.1.1.3/32 is directly connected, Serial2/0
C
34.1.1.0/24 is directly connected, Ethernet0/1
L
34.1.1.3/32 is directly connected, Ethernet0/1
R2再增加一条路由,9.9.9.0/24, R3 访问2.2.20/24 和9.9.9.9 从R1 上走, 默认从R4上走,人为控制选路
weight值
默认weight为32768
r RIB-failure, S Stale
Network
Next Hop
Metric LocPrf Weight Path
R2#show ip bgp
BGP table version is 1, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Origin codes: i - IGP, e - EGP, ? - incomplete
*
2.2.2.0/24
0.0.0.0
0
32768 i
*
9.9.9.0/24
0.0.0.0
0
32768 i
R1#show ip bgp
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Origin codes: i - IGP, e - EGP, ? - incomplete
*> 2.2.2.0/24
12.1.1.2
0
0 2 i
*> 9.9.9.0/24
12.1.1.2
0
0 2 i
R3(config-router)#neighbor 1.1.1.1 weight 1 //默认in方向
R3#clear ip bgp
* soft
2.2.2.0/24从r1走,9.9.9.0/24从r4走
R3上的配置
ip prefix-list 2 seq 5 permit 2.2.2.0/24
route-map W permit 10
route-map W permit 20
router bgp 1
结果
Weight Attribute(Cisco Only)
Local Preference Attribute
Path with highest local preference value are preferred:
- Local preference is used to advertise to IBGP neighbors about how to leave their AS.
- The local preference is sent to IBGP neighbors only (that is ,within the AS only).
- The local preference attribute is well-known and discretionary.
- Default value is 100
默认路由从R4上走,通过设置R1的local preference attribute,使路由从r1上走
R1(config-router)#bgp default local-preference 111
R3#show ip bgp 2.2.2.0/24
BGP routing table entry for 2.2.2.0/24, version 4
Paths: (2 available, best #1, table default)
1、network ???
2、ebgp ???
3、IGBP ???
4、agg ??
做路由分担,2.2.2.0/24从r1上走,9.9.9.0/24从r4上走
R1 上配置
从出方向设置,R2发给R42.2.2..0/24path增加,
R2
neighbor 24.1.1.4 route-map AS out
当R2把这条路由发出去之前,已经有了 6 7 8 AS号
IN方向
容易造成EBGP环路。
prepend 自己的AS号
MED Attribute
The path with the lowest MED (also called the metric) value are the most desirable
-MED is used t advertise to EBGP neighbors how to exit their AS to reach networks owned by this AS.
The MED attribute is optional and nontransitive.
通过设置MED属性,使R2去8.8.8.0/24,通过R4走。
R1上通过设置MED属性大于0,则可以使远端EBGP R2 去往8.8.8.0/24通过r4走
R1#debug ip bgp updates
最常用的这两个
local preference
MED
由于水平分割的问题,在IBGP中,R1发给R3的路由,R3,不会发给R4,如下图。
解决IBGP的水平分割:
1、路由反射器
2、联邦
R1
router bgp 64512
R3
!
router bgp 64512
R4
router bgp 64513
R4#show ip route bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
Gateway of last resort is not set
B
2.2.2.0 [200/0] via 1.1.1.1, 00:03:54
R4#show ip bgp 2.2.2.2/24
BGP routing table entry for 2.2.2.0/24, version 2
Paths: (1 available, best #1, table default)
R4#show ip bgp
BGP table version is 2, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
Origin codes: i - IGP, e - EGP, ? - incomplete
*> 2.2.2.0/24
1.1.1.1
0
100
0
(64512) 2 i
_____________________________________________________________________________________
可选:路由器可能不识别此属性.(default)
neighbor x.x.x.x. send-community
传递;些属性只在nei的邻居有效
neighbor x.x.x.x send-community
R2
route-map COM permit 10
router bgp 2
R1#show ip bgp 2.2.2.2/24
BGP routing table entry for 2.2.2.0/24, version 3
Paths: (1 available, best #1, table default, not advertised to any peer)
no-advertise
, 携带此属性的路由不会通知给任何给BGP邻居。
no-export:携带此属性的路由不会传出大AS
local-AS:携带此属性的路由不会传出小AS.