您的位置:首页 > 其它

BGP的各种属性配置

2010-08-19 08:26 519 查看
核心提示:Lab 31. Configuring BGP Summarization 实验目的: 1、掌握使用指向NULL0接口的静态路由的汇总配置方法。 2、掌握使用聚合属性的路由汇总配置方法。 R1(config)#ip route 172.16.0.0 255.255.252.0 null 0 R1(config)#router bgp 64512&nb

Lab 31. Configuring BGP Summarization

实验目的:

1、掌握使用指向NULL0接口的静态路由的汇总配置方法。

2、掌握使用聚合属性的路由汇总配置方法。

R1(config)#ip route 172.16.0.0 255.255.252.0 null 0

R1(config)#router bgp 64512

R1(config-router)#aggregate-address 172.16.0.0 255.255.252.0 summary-

only

Lab 33. BGP Neighbor Authentication

实验目的:

1、掌握其于MD5的BGP对等体认证配置。

R1(config)#router bgp 64512

R1(config-router)#neighbor 10.1.255.2 password cisco123

R2(config)#router bgp 64513

R2(config-router)#neighbor 10.1.255.1 password cisco123

Lab 34. Configuring BGP Local Preference

实验目的:

1、理解掌握BGP的本地优选属性概念和配置方法。

2、本地优选的属性默认值为100,较高值的路径会被优先选择。

3、本地优先属性,决定离开本自治系统最佳的路径。

(BGP在选择最佳路由时,并不会考具体链路的带宽。为了解决这一问题,可以在本地配置“本地优先”来确定数据流如何流出本自治系统。BGP会优先选择本地优先属性值较高的路由。)

R4(config)#router bgp 64513

R4(config-router)#bgp default local-preference 200

R4(config-router)#exit

R4(config)#

(BGP在向IBGP对等体通告路由时,其下一跳不变,这种机制被称为BGP的下一跳属

性.)

R4(config)#router bgp 64513

R4(config-router)#neighbor 10.1.1.1 next-hop-self

Lab 35. Using Route Maps to Configuring BGP Local Preference

实验目的:

1、掌握基于route-map的本地优先配置方法。

2、使用route-map配置可以定置基于目标网络的本地优先。

(本地优先会影响数据流如何流出本地自治系统。BGP的选路规则:EBGP对等体通告

的路由优于IBGP对等体通告的路由。)

R4(config)#access-list 1 permit 130.130.1.0 0.0.0.255

R4(config)#

R4(config)#route-map set_lp permit 10

R4(config-route-map)#match ip address 1

R4(config-route-map)#set local-preference 200

R4(config-route-map)#exit

R4(config)#

R4(config)#route-map set_lp permit 20

R4(config-route-map)#exit

R4(config)#

R4(config)#router bgp 64513

R4(config-router)#neighbor 192.168.2.2 route-map set_lp in

R4(config-router)#exit

R4(config)#exit

R4#

R4#clear ip bgp * soft in

R4#

Lab 36. Configuring BGP Multi-Exit Discriminator

实验目的:

1、理解MED属性能够影响,其它的自治系统的数据流如何流入本地自治系统。

2、掌握基于route-map的MED配置方法。

(MED属性可以实现:影响其它的自治系统的数据流,如何流入本地自治系统。根据

MED的属性值越低的哪条路由,会被优先选择的特性。而且MED值默认为0。)

R2(config)#access-list 1 permit 130.130.1.0 0.0.0.255

R2(config)#

R2(config)#route-map set_med permit 10

R2(config-route-map)#match ip address 1

R2(config-route-map)#set metric 100

R2(config-route-map)#exit

R2(config)#

R2(config)#route-map set_med permit 20

R2(config-route-map)#exit

R2(config)#

R2(config)#router bgp 64512

R2(config-router)#neighbor 192.168.1.2 route-map set_med out

R2(config-router)#exit

R2(config)#

R2#

R2#clear ip bgp * soft out

R2#

Lab 37. Configuring BGP Weight

实验目的:

1、当本地出口路由器,有多条外出自治系统的链路时,应用权重(Weight)属性能够

决定数据流从本地路由器哪条出口链路流出本地自治系统.

2、权重(Weight)属性为Cisco私有属性。

(BGP的选路规则:1、最先收到路由优先于后收到的路由。2、优先选择BGP的

Router-ID较低的路由。)

R1(config)#router bgp 64512

R1(config-router)#neighbor 192.168.4.1 weight 100

R1(config-router)#neighbor 192.168.1.2 weight 50

R1(config-router)#exit

R1#clear ip bgp * soft

R1(config)#access-list 1 permit 150.150.1.0 0.0.0.255

R1(config)#

R1(config)#route-map set_weight permit 10

R1(config-route-map)#match ip address 1

R1(config-route-map)#set weight 100

R1(config-route-map)#exit

R1(config)#

R1(config)#

R1(config)#route-map set_weight permit 20

R1(config-route-map)#exit

R1(config)#

R1(config)#router bgp 64512

R1(config-router)#neighbor 192.168.4.1 route-map set_weight in

R1(config-router)#exit

R1(config)#exit

R1#clear ip bgp * soft

R1#

Lab 38. Affects the BGP Routing By Path Prepend

实验目的:

1、掌握如何配置路径欺骗影响BGP的路由选择。

2、理解BGP的路径欺骗是MED的替代解决方法,但是其适用范围较小,只能在有限的

网络环境下配置使用。

(BGP的选路规则:优先选择AS-PATH最短的路径。)

R3(config)#access-list 1 permit 150.150.1.0 0.0.0.255

R3(config)#

R3(config)#route-map set_prepend permit 10

R3(config-route-map)#match ip address 1

R3(config-route-map)#set as-path prepend 64514 64514

R3(config-route-map)#exit

R3(config)#

R3(config)#route-map set_prepend permit 20

R3(config-route-map)#exit

R3(config)#

R3(config)#router bgp 64514

R3(config-router)#neighbor 192.168.2.1 route-map set_prepend out

R3(config-router)#exit

R3(config)#exit

R3#

R3#clear ip bgp * soft out

R3#

(需要注意的是:在set as-path prepend后添加的AS号,最好是本地自治系统号,

否则可能会产生无效路由。)

Lab 39. Using Route Tag to Store BGP AS-Path

实验目的:

1、解决BGP与IGP在做路由重发布时,BGP AS-PATH属性丢失的问题。

2、掌握使用路由标记存储BGP路径属性配置方法。

R2(config)#router ospf 1

R2(config-router)#redistribute bgp 64513 subnets

R2(config-router)#exit

R2(config)#

R2(config)#router bgp 64513

R2(config-router)#redistribute ospf 1 match external internal

R2(config-router)#

(将OSPF中的内部与外部类型的路由重发布到BGP 64513的自治系统。)

R3(config)#router bgp 64513

R3(config-router)#redistribute ospf 1 match internal external

R3(config-router)#exit

R3(config)#

R3(config)#router ospf 1

R3(config-router)#redistribute bgp 64513 subnets

R3(config-router)#exit

R3(config)#exit

[产生此AS-PATH路径信息丢失的主要原因是:由于R2路由器把BGP路由协议重发布

到OSPF中,而OSPF不能够识别BGP的路由AS-PATH属性。所以在R4上查看重发布路由

的AS-PATH是不完整。

解决这个问题的关键:由于路由标记可以被所有的路由协议识别,因此,可以在重

发布前将BGP的AS-PATH转存到路由标记中,然后在R4路由器上再发路由标识中存储

的AS-PATH取出来还原到BGP的路由中。]

实施路由标记的配置:

R2(config)#route-map SET_TAG permit 10

R2(config-route-map)#set automatic-tag

//(设置自动计算路由标记。主要计算结果为AS-PATH的属性值)

R2(config-route-map)#exit

R2(config)#

R2(config)#router bgp 64513

R2(config-router)#table-map SET_TAG

//(配置将BGP的扩展属性,映射到路由表中。其主要目的是通过SET_TAG的路由图

的过滤,将AS-PATH将属性存储到标记中。)

R3(config)#route-map GET_TAG permit 10

R3(config-route-map)#set as-path tag

//(将AS-PATH属性从路由标记中取出,并还原到BGP的路由数据库中。)

R3(config-route-map)#exit

R3(config)#router bgp 64513

R3(config-router)#redistribute ospf 1 match external internal route-map

GET_TAG

//(在路由重发布时,完成AS-PATH的转存工作。)

解决路由起源信息不完整

R3(config)#route-map SET_ORIGIN permit 10

R3(config-route-map)#set origin igp //(设置相应的起源属性为IGP。)

R3(config-route-map)#exit

R3(config)#

R3(config)#router bgp 64513

R3(config-router)#neighbor 192.168.2.2 route-map SET_ORIGIN out

//(调用相应的route-map设置起源属性。)

Lab 40. Using Distribute-list to Filtering BGP Routing

实验目的:

1、掌握使用distribute-list过滤BGP的路由。

R2(config)#access-list 1 deny 172.16.0.0 0.0.0.255

R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255

R2(config)#

R2(config)#router bgp 64512

R2(config-router)#neighbor 10.1.255.2 distribute-list 1 out

Lab 41. Using Route-Map to Filtering BGP Routing

实验目的:

1、掌握使用Route-Map过滤BGP的路由。

R2(config)#access-list 1 deny 172.16.0.0 0.0.0.255

R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255

R2(config)#access-list 1 permit any

R2(config)#

R2(config)#route-map bgpfilter permit 10

R2(config-route-map)#match ip address 1

R2(config-route-map)#exit

R2(config)#

R2(config)#router bgp 64512

R2(config-router)#neighbor 10.1.255.2 route-map bgpfilter out

Lab 42. Using Prefix-List to Filtering BGP Routing

实验目的:

1、掌握基于Prefix-List的过滤配置方法。

2、掌握Prefix-List针对路由的子网掩码长度的选择性过滤配置。

R2(config)#ip prefix-list bgpfilter seq 5 deny 172.16.0.0/24

R2(config)#ip prefix-list bgpfilter seq 10 deny 172.16.1.0/25

R2(config)#ip prefix-list bgpfilter seq 15 permit 0.0.0.0/0 le 32

R2(config)#

R2(config)#router bgp 64512

R2(config-router)#neighbor 10.1.255.2 prefix-list bgpfilter out

R2(config-router)#exit

本文出自 51CTO.COM技术博客
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: