BGP本地优先和MED属性配置的一点心得
该文章转自 联信软件
网络环境:
AS300--------AS500
具体环境描述:
AS300内包括4台路由器,运行ospf协议进行本AS内部的路由,以便BGP建立起邻居。两条出口连接AS500。AS500内2台运行BGP,并且使用IBGP在本AS内部进行路由学习。
BPG的MED以及LOCAL-PRI的属性实验,2种属性的配置均在边界路由器中配置。在AS300内部配置了O SPF 来代替IBGP,关闭iBGP与IGP的同步,在BGP中并且通告相直链网络。使用本地优先属性,此属性只在本AS内传递,在配置此属性时使用route -map来控制感兴趣数据包,此数据是包括在边界路由器的BGP路由表中的路由条目。此条目选择是通过ACL来控制,使用标准的和扩展的都可以,只要达到目的。
r3#sh run 
Building configuration...
Current configuration : 1416 bytes
!
version 12.2
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname r3
!
logging rate-limit console 10 except errors
!
ip subnet-zero
no ip finger
!
no ip dhcp-client network-discovery
!
!
!
!
interface Loopback0
ip address 30.1.1.3 255.255.255.0
!        
interface Ethernet0
ip address 34.1.1.3 255.255.255.0
!
interface Serial0
ip address 13.1.1.3 255.255.255.0
clockrate 64000
!
interface Serial1
no ip address
shutdown
!
interface BRI0
no ip address
shutdown
isdn x25 static-tei 0
cdapi buffers regular 0
cdapi buffers raw 0
cdapi buffers large 0
!
router ospf 1
log-adjacency-changes
network 34.1.1.0 0.0.0.255 area 0
!        
router bgp 300
no synchronization
bgp log-neighbor-changes
network 3.3.3.3 mask 255.255.255.255
network 13.1.1.0 mask 255.255.255.0
network 34.1.1.0 mask 255.255.255.0
neighbor 13.1.1.1 remote-as 500
neighbor 24.1.1.2 remote-as 300
neighbor 26.1.1.6 remote-as 300
neighbor 34.1.1.4 remote-as 300
neighbor 34.1.1.4 route-map Local out
!
ip kerberos source-interface any
ip classless
no ip http server
!
access-list 1 permit 10.10.10.0 0.0.0.255
route-map Local permit 10
match ip address 1
set local-preference 200
!
route-map Local permit 20
set local-preference 100
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
transport input none
line aux 0
line vty 0 4
login
!
end
r3#

------------------------------------------------
以上为一台边界路由器的配置。
------------------------------------------------
r3#sh ip b
BGP table version is 16, local router ID is 30.1.1.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network          Next Hop            Metric LocPrf Weight Path
*> 10.10.10.0/24    13.1.1.1                 0             0 500 i
*> 13.1.1.0/24      0.0.0.0                  0         32768 i
*                   13.1.1.1                 0             0 500 i
* i15.1.1.0/24      45.1.1.5                 0    100      0 500 i
*>                  13.1.1.1                 0             0 500 i
* i20.20.20.0/24    45.1.1.5                      100      0 500 i
*>                  13.1.1.1                 0             0 500 i
* i24.1.1.0/24      24.1.1.2                 0    100      0 i
*>i                 34.1.1.4                 0    100      0 i
*>i26.1.1.0/24      24.1.1.2                 0    100      0 i
* i                 26.1.1.6                 0    100      0 i
*> 34.1.1.0/24      0.0.0.0                  0         32768 i
*  45.1.1.0/24      13.1.1.1                               0 500 i
*>i                 34.1.1.4                 0    100      0 i
*>i60.1.1.0/24      26.1.1.6                 0    100      0 i
*>i200.200.200.0    24.1.1.2                 0    100      0 i
r3#

--------------------------------------------------------------
以上BGP路由表
---------------------------------------------------------------
笔者认为BGP的MED,LOCAL-PRI属性,只是控制本AS与外界AS相连接2条线路的忙碌情况。MED属性只在AS外界传递,应用给eBGP邻居。意为告诉邻居,“此条线路比较繁忙,请选择本AS的另外出口。”关于本地优先属性应用给iBGP邻居,同理,“达到XXXXXXX网络本路由器优先,请从本路由器到达XX网络。”本地优先的属性是在希望出口的路由器中配置,并且通告给AS内的另外一边界路由器;MED属性则是在不希望对方AS通过的路径上的边界路由器中配置,并且通告给对方AS邻居路由器。以上为作者的理解,不足之处,敬请各位读者,谅解并指出。
发布人:bigi
发布时间:2007年11月12日