BGP3

  1、传播范围
2、默认值
3、值大好还是小好
BGP3
8、Prefer the path through the closest iGP neighbor.
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)
  Not advertised to any peer
  2
    1.1.1.1 (metric 65) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal
  2
    4.4.4.4 (metric 11) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal, best

R3#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
        ia - IS-IS inter area, * - candidate default, U - per-user static route
        o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O         1.1.1.1 [110/65] via 13.1.1.1, 00:33:44, Serial2/0
      2.0.0.0/24 is subnetted, 1 subnets
B        2.2.2.0 [200/0] via 4.4.4.4, 00:06:14
      3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C         3.3.3.0/24 is directly connected, Loopback0
L         3.3.3.3/32 is directly connected, Loopback0
      4.0.0.0/32 is subnetted, 1 subnets
O         4.4.4.4 [110/11] via 34.1.1.4, 00:31:22, Ethernet0/1
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C         13.1.1.0/24 is directly connected, Serial2/0
L         13.1.1.3/32 is directly connected, Serial2/0
      34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
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上走,人为控制选路

BGP3

weight值
默认weight为32768
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,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

    Network           Next Hop             Metric LocPrf Weight Path
*   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,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

    Network           Next Hop             Metric LocPrf Weight Path
*> 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 
BGP3
weight调为1 ,从R1上走

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
  match ip address prefix-list 2
  set weight 3

route-map W permit 20

router bgp 1
  no synchronization
  bgp router-id 3.3.3.3
  bgp log-neighbor-changes
  neighbor 1.1.1.1 remote-as 1
  neighbor 1.1.1.1 update-source Loopback0
  neighbor 1.1.1.1 route-map W in
  neighbor 4.4.4.4 remote-as 1
  neighbor 4.4.4.4 update-source Loopback0
  no auto-summary
结果
BGP3

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上走

BGP3


R1(config-router)#bgp default local-preference 111
BGP3

BGP3


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)
  Not advertised to any peer
  2
    1.1.1.1 (metric 65) from 1.1.1.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 111, valid, internal, best
  2
    4.4.4.4 (metric 11) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal
1、network ???
2、ebgp ???
3、IGBP ???
4、agg ??


做路由分担,2.2.2.0/24从r1上走,9.9.9.0/24从r4上走

R1 上配置

BGP3




BGP3


BGP3

BGP3


BGP3
BGP3
BGP3
R3访问2.2.2.0/24 网络通过r1,设置As path来实现
从出方向设置,R2发给R42.2.2..0/24path增加,

R2
  set as-path prepend 6 7 8 
neighbor 24.1.1.4 route-map AS out
当R2把这条路由发出去之前,已经有了 6 7 8 AS号

BGP3

IN方向

BGP3

BGP3
人为修改AS PATH弊端
容易造成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走
BGP3
设置之前

BGP3
设置之后
BGP3


R1#debug ip bgp updates 

最常用的这两个
local preference
MED

由于水平分割的问题,在IBGP中,R1发给R3的路由,R3,不会发给R4,如下图。
解决IBGP的水平分割:
1、路由反射器
2、联邦
 

BGP3

BGP3


BGP3

R1
router bgp 64512
  no synchronization
  bgp router-id 1.1.1.1
  bgp log-neighbor-changes
  bgp confederation identifier 1
 neighbor 3.3.3.3 remote-as 64512
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
  neighbor 12.1.1.2 remote-as 2
  no auto-summary
R3
!
router bgp 64512
  no synchronization
  bgp router-id 3.3.3.3
  bgp log-neighbor-changes
 bgp confederation identifier 1
 bgp confederation peers 64513 
  neighbor 1.1.1.1 remote-as 64512
  neighbor 1.1.1.1 update-source Loopback0
  neighbor 4.4.4.4 remote-as 64513
 neighbor 4.4.4.4 ebgp-multihop 255
  neighbor 4.4.4.4 update-source Loopback0
  no auto-summary
R4
router bgp 64513
  no synchronization
  bgp router-id 4.4.4.4
  bgp log-neighbor-changes
 bgp confederation identifier 1
 bgp confederation peers 64512 
 neighbor 3.3.3.3 remote-as 64512
 neighbor 3.3.3.3 ebgp-multihop 255
  neighbor 3.3.3.3 update-source Loopback0
  no auto-summary
R4#show ip route bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
        E1 - OSPF external type 1, E2 - OSPF external type 2
        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
        ia - IS-IS inter area, * - candidate default, U - per-user static route
        o - ODR, P - periodic downloaded static route, + - replicated route

Gateway of last resort is not set

      2.0.0.0/24 is subnetted, 1 subnets
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)
  Not advertised to any peer
  (64512) 2
    1.1.1.1 (metric 75) from 3.3.3.3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best

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,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

    Network           Next Hop             Metric LocPrf Weight Path
*> 2.2.2.0/24       1.1.1.1                   0     100       0 (64512) 2 i
_____________________________________________________________________________________
  社团属性:community
可选:路由器可能不识别此属性.(default)
neighbor x.x.x.x. send-community
传递;些属性只在nei的邻居有效
neighbor x.x.x.x send-community

R2
route-map COM permit 10
  set community no-advertise

router bgp 2
  no synchronization
  bgp router-id 2.2.2.2
  bgp log-neighbor-changes
  network 2.2.2.0 mask 255.255.255.0
  neighbor 12.1.1.1 remote-as 1
  neighbor 12.1.1.1 send-community
 neighbor 12.1.1.1 route-map COM out
  neighbor 24.1.1.4 remote-as 1
  neighbor 24.1.1.4 route-map AS out
  no auto-summary

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)
  Not advertised to any peer
  2
    12.1.1.2 from 12.1.1.2 (2.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: no-advertise
no-advertise   , 携带此属性的路由不会通知给任何给BGP邻居。
no-export:携带此属性的路由不会传出大AS
local-AS:携带此属性的路由不会传出小AS.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值