BGP集训营:第三天BGP的选路属性

BGP选路属性:

1、 ORIGIN

2、 LOCAL-PREF

3、 MED

4、 Weight

5、 AS-PATH

BGP选路、过滤工具:

1、 route-map:origin local-pref,weight,AS-PATH,MED

下面三种用于过滤使用

2、 distribute-list

3、 prefix-list

4、 AS-PATH ACL

Default-metric不能直接发BGP协议下面使用,如果要让它生效,必须在重分发里面进行使用。如果要使用default-metric它必须使用在IGP路由协议里面才有效果。

R0(config-router)#redistribute connected route-map x metric 200

AS-PATH属性PREPENDING:伪造AS-PATH长度。对于IBGP更新,不生效。对于EBGP更新,可以对进站或出站更新可以进行AS-PATH属性进行伪造。

进站:伪造的AS号是附加在AS-PATH属性的开头。

出站:伪造的AS号码是附加在AS-PATH属性的后面。

尽可能的使用出站方向伪造。

起源属性:

首先把基本配置配置好:

在R1上面查看一下BGP:

R1#sh ip bgp

BGP table version is 4, 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

* 1.1.1.0/24 192.168.2.1 0 0 1 i

*> 192.168.1.1 0 0 1 i

R1#

现在在R1上面配置一个route-map

R1(config)#route-map x

R1(config-route-map)#set origin incomplete

R1(config)#router bgp 2

R1(config-router)#neighbor 192.168.1.1 route-map x in

R1(config-router)#end

R1#clear ip bgp * s

现在查看一下R1上面BGP表:

R1#sh ip bgp

BGP table version is 5, 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

*> 1.1.1.0/24 192.168.2.1 0 0 1 i

* 192.168.1.1 0 0 1 ?

R1#

看看我的的最佳路由的下一跳是不是变成了192.168.2.1

这个如果在对端对也是一样的效果。

现在我将R1上面通过BGP宣告一条2.2.2.0/24的网络出去。

R1#conf t

Enter configuration commands, one per line. End with CNTL/Z.

R1(config)#router bgp

R1(config)#router bgp 2

R1(config-router)#network 2.2.2.0 mask 255.255.255.0

R1(config-router)#end

R1#clear

*Mar 1 00:21:52.667: %SYS-5-CONFIG_I: Configured from console by console

R1#clear ip bgp * s

R1#

现在查看一下R1上面的BGP

你可能感兴趣的:(职场,属性,休闲,集训,BGP)