1. 程式人生 > >BGP-MED

BGP-MED

ipv 三方 process 處理 nat add 條件 ron mod

BGP-MED屬性:
MED(Multi-Exit Discriminator)屬性用於判斷流量進入AS時的最佳路由,當一個運行BGP的設備通過不同的EBGP對等體得到目的地址相同但下一跳不同的多條路由時,在其它條件相同的情況下,將優先選擇MED值較小者作為最佳路由。

MED屬性僅在相鄰兩個AS之間傳遞,收到此屬性的AS一方不會再將其通告給任何其他第三方AS。MED屬性可以手動配置,如果路由沒有配置MED屬性,BGP選路時將該路由的MED值按缺省值0來處理。

如圖:實現10的網絡走上,60的網絡走下面效果!

技術分享圖片

R1的配置

interface GigabitEthernet0/0/0
ip address 12.12.12.1 255.255.255.0

interface GigabitEthernet0/0/1
ip address 13.13.13.1 255.255.255.0

interface NULL0

interface LoopBack0
ip address 1.1.1.1 255.255.255.0

interface LoopBack100
ip address 100.1.1.1 255.255.255.0

bgp 100
peer 2.2.2.2 as-number 200
peer 2.2.2.2 ebgp-max-hop 255
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200

peer 3.3.3.3 ebgp-max-hop 255
peer 3.3.3.3 connect-interface LoopBack0
group as200 internal

ipv4-family unicast
undo synchronization
network 100.1.1.0 255.255.255.0
peer 2.2.2.2 enable
peer 3.3.3.3 enable
peer as200 enable

ip route-static 2.2.2.0 255.255.255.0 12.12.12.2
ip route-static 3.3.3.0 255.255.255.0 13.13.13.3

user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20

wlan ac

return
<R1>

R2的配置

bgp 200
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 255
peer 1.1.1.1 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 200
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 1.1.1.1 route-policy 10 export
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local

route-policy 10 permit node 10
if-match acl 2000
apply cost 100

acl number 2000
rule 5 permit source 10.10.10.0 0.0.0.255
rule 10 deny

R3的配置

bgp 200
peer 1.1.1.1 as-number 100
peer 1.1.1.1 ebgp-max-hop 255
peer 1.1.1.1 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 5.5.5.5 as-number 200
#
ipv4-family unicast
undo synchronization
peer 1.1.1.1 enable
peer 1.1.1.1 route-policy 10 export
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local

acl number 2000
rule 5 permit source 60.1.1.0 0.0.0.255
rule 10 permit source 60.1.2.0 0.0.0.255
rule 15 permit source 60.1.3.0 0.0.0.255
rule 20 deny

route-policy 10 permit node 10
if-match acl 2000
apply cost 100

R1的路由表技術分享圖片

BGP-MED