加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

BGP local preference 属性实例

(2006-11-18 21:12:53)
分类: ~~~ BGP ~~~

Unlike the weight attribute, which is relevant only to the local router, local preference is an attribute that is exchanged among routers in the same AS.

Local preference is set via the bgp default local-preference command or with route maps, as illustrated in the following example:

 BGP <wbr>local <wbr>preference <wbr>属性实例

 

The bgp default local-preference command will set the local preference on the updates out of the router going to peers in the same AS. In the above diagram, AS256 is receiving updates about 170.10.0.0 from two different sides of the organization. Local preference will help us determine which way to exit AS256 in order to reach that network. Let us assume that Router D (RTD) is the preferred exit point. The following configuration sets the local preference for updates coming from AS300 to 200, and those coming from AS100 to 150.

RTC#

router bgp 256
neighbor 1.1.1.1 remote-as 100
neighbor 128.213.11.2 remote-as 256
bgp default local-preference 150

RTD#

router bgp 256
neighbor 3.3.3.4 remote-as 300
neighbor 128.213.11.1 remote-as 256
bgp default local-preference 200

In the above configuration, RTC sets the local preference of all updates to 150. RTD sets the local preference of all updates to 200. Because local preference is exchanged within AS256, both RTC and RTD will realize that network 170.10.0.0 has a higher local preference when coming from AS300 rather than when coming from AS100. All traffic in AS256 addressed to that network is sent to RTD as an exit point.

More flexibility is provided by using route maps. In the above example, all updates received by RTD are tagged with local preference 200 when they reach RTD. This means that updates coming from AS34 will also be tagged with the local preference of 200. This might not be needed. This is why we can use route maps to specify what specific updates need to be tagged with a specific local preference, as shown below:

RTD#

router bgp 256 
neighbor 3.3.3.4 remote-as 300 
neighbor 3.3.3.4 route-map setlocalin in 
neighbor 128.213.11.1 remote-as 256 
.... 
ip as-path access-list 7 permit ^300$ 
... 
route-map setlocalin permit 10 
match as-path 7 
set local-preference 200 
route-map setlocalin permit 20 
set local-preference 150 
With this configuration, any update coming from AS300 will be set with a local preference of 200. Any other updates such as those coming from AS34 will be set with a value of 150. 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有