利用BGPorigin-code屬性修改BGP選路-創(chuàng)新互聯(lián)

實驗拓撲

公司主營業(yè)務(wù):網(wǎng)站制作、網(wǎng)站建設(shè)、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出阿圖什免費做網(wǎng)站回饋大家。

利用BGP origin-code 屬性修改BGP選路

基本配置:

R1

L0:1.1.1.1/32

L1:11.1.1.1/32

E1/0:10.1.12.1/24

E1/1:10.1.14.1/24

R2

L0:2.2.2.2/32

L1:22.2.2.2/32

E1/0:10.1.12.2/24

E1/1:10.1.24.2/24

R4

L0:4.4.4.4/32

L1:44.4.4.4/32

E1/0:10.1.24.4/24

E1/1:10.1.14.4/24

配置IGP(RIP):

R1

router rip

 version 2

 network 1.0.0.0

 network 10.0.0.0

 no auto-summary

R2

router rip

 version 2

 network 2.0.0.0

 network 10.0.0.0

 no auto-summary

R4

router rip

 version 2

 network 4.0.0.0

 network 10.0.0.0

 no auto-summary

配置BGP:

router bgp 1

 bgp router-id 1.1.1.1

 bgp log-neighbor-changes

 network 1.1.1.1 mask 255.255.255.255

 network 2.2.2.2 mask 255.255.255.255 backdoor

 network 4.4.4.4 mask 255.255.255.255 backdoor

 network 11.1.1.1 mask 255.255.255.255

 neighbor 2.2.2.2 remote-as 23

 neighbor 2.2.2.2 ebgp-multihop 2

 neighbor 2.2.2.2 update-source Loopback0

 neighbor 4.4.4.4 remote-as 23

 neighbor 4.4.4.4 ebgp-multihop 2

 neighbor 4.4.4.4 update-source Loopback0

R2

router bgp 23

 bgp router-id 2.2.2.2

 bgp log-neighbor-changes

 network 1.1.1.1 mask 255.255.255.255 backdoor

 network 2.2.2.2 mask 255.255.255.255

 network 22.2.2.2 mask 255.255.255.255

 neighbor 1.1.1.1 remote-as 1

 neighbor 1.1.1.1 ebgp-multihop 2

 neighbor 1.1.1.1 update-source Loopback0

 neighbor 4.4.4.4 remote-as 23

 neighbor 4.4.4.4 update-source Loopback0

R4

router bgp 23

 bgp router-id 4.4.4.4

 bgp log-neighbor-changes

 network 1.1.1.1 mask 255.255.255.255 backdoor

 network 4.4.4.4 mask 255.255.255.255

 network 44.4.4.4 mask 255.255.255.255

 neighbor 1.1.1.1 remote-as 1

 neighbor 1.1.1.1 ebgp-multihop 2

 neighbor 1.1.1.1 update-source Loopback0

 neighbor 2.2.2.2 remote-as 23

 neighbor 2.2.2.2 update-source Loopback0

查看R1路由表:origin 為i,表示從IGP 學(xué)來的路由。

R1#sh ip bgp

BGP table version is 5, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

       r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,

       x best-external, a additional-path, c RIB-compressed,

Origin codes: i - IGP, e - EGP, ? - incomplete

RPKI validation codes: V valid, I invalid, N Not found

   Network      Next Hop       Metric LocPrf Weight Path

 r  2.2.2.2/32    4.4.4.4                 0 23 i

 r>          2.2.2.2          0       0 23 i

 r  4.4.4.4/32    4.4.4.4          0       0 23 i

 r>          2.2.2.2                 0 23 i

 *  22.2.2.2/32    4.4.4.4                 0 23 i

 *>          2.2.2.2          0       0 23 i

 *  44.4.4.4/32    4.4.4.4          0       0 23 i

 *>          2.2.2.2                 0 23 i

查看22.2.2.2 44.4.4.4的路由表:

R1#sh ip bgp 22.2.2.2

BGP routing table entry for 22.2.2.2/32, version 4

Paths: (2 available, best #2, table default)

 Advertised to update-groups:

   18

 Refresh Epoch 1

 23

  4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

   Origin IGP, localpref 100, valid, external

   rx pathid: 0, tx pathid: 0

 Refresh Epoch 1

 23

  2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

   Origin IGP, metric 0, localpref 100, valid, external, best

   rx pathid: 0, tx pathid: 0x0

R1#sh ip bgp 44.4.4.4

BGP routing table entry for 44.4.4.4/32, version 5

Paths: (2 available, best #2, table default)

 Advertised to update-groups:

   18

 Refresh Epoch 1

 23

  4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

   Origin IGP, metric 0, localpref 100, valid, external

   rx pathid: 0, tx pathid: 0

 Refresh Epoch 1

 23

  2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

   Origin IGP, localpref 100, valid, external, best

   rx pathid: 0, tx pathid: 0x0

origin皆為IGP。修改 bgp origin-clde 屬性,使R1到R2的22.2.2.2 永久的從R4走,到R4的44.4.4.4永久的從R2走。

在R1上配置:

第一步:配置prefix-list

ip prefix-list 22 seq 5 permit 22.2.2.2/32

ip prefix-list 44 seq 5 permit 44.4.4.4/32

第二步:配置route-map

route-map ori-r2 permit 10

 match ip address prefix-list 22

 set origin incomplete

route-map ori-r2 permit 20

route-map ori-r4 permit 10

 match ip address prefix-list 44

 set origin incomplete

route-map ori-r4 permit 20

第三步:在BGP中,對相應(yīng)的鄰居in方向調(diào)用route-map。

neighbor 2.2.2.2 route-map ori-r2 in

neighbor 4.4.4.4 route-map ori-r4 in

第四步:重置BGP鄰居,重新學(xué)習(xí)路由

clea ip bgp *

查看R1 BGP路由表:

R1#sh ip bgp

BGP table version is 16, local router ID is 1.1.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

       r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,

       x best-external, a additional-path, c RIB-compressed,

Origin codes: i - IGP, e - EGP, ? - incomplete

RPKI validation codes: V valid, I invalid, N Not found

   Network      Next Hop       Metric LocPrf Weight Path

 *>  1.1.1.1/32    0.0.0.0          0     32768 i

 r  2.2.2.2/32    4.4.4.4                 0 23 i

 r>          2.2.2.2          0       0 23 i

 r  4.4.4.4/32    4.4.4.4          0       0 23 i

 r>          2.2.2.2                 0 23 i

 *>  11.1.1.1/32    0.0.0.0          0     32768 i

 *>  22.2.2.2/32    4.4.4.4                 0 23 i

 *           2.2.2.2          0       0 23 ?

 *  44.4.4.4/32    4.4.4.4          0       0 23 ?

 *>          2.2.2.2                 0 23 i

此是,BGP表顯示從R2學(xué)來的22.2.2.2路由,origin-code屬性已改為?(incomplete),從R4學(xué)來的44.4.4.4路由,屬性也改為?(incomplete),優(yōu)先選擇origin-clde為i的路由。

IGP(i)優(yōu)于EGP(e)優(yōu)于incomplete(?)的路由。

R1#sh ip bgp 22.2.2.2

BGP routing table entry for 22.2.2.2/32, version 16

Paths: (2 available, best #1, table default)

 Advertised to update-groups:

   18

 Refresh Epoch 1

 23

  4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

   Origin IGP, localpref 100, valid, external, best

   rx pathid: 0, tx pathid: 0x0

 Refresh Epoch 1

 23

  2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

   Origin incomplete, metric 0, localpref 100, valid, external

   rx pathid: 0, tx pathid: 0

R1#sh ip bgp 44.4.4.4

BGP routing table entry for 44.4.4.4/32, version 15

Paths: (2 available, best #2, table default)

 Advertised to update-groups:

   18

 Refresh Epoch 1

 23

  4.4.4.4 (metric 1) from 4.4.4.4 (4.4.4.4)

   Origin incomplete, metric 0, localpref 100, valid, external

   rx pathid: 0, tx pathid: 0

 Refresh Epoch 1

 23

  2.2.2.2 (metric 1) from 2.2.2.2 (2.2.2.2)

   Origin IGP, localpref 100, valid, external, best

   rx pathid: 0, tx pathid: 0x0

實驗完成。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)頁標題:利用BGPorigin-code屬性修改BGP選路-創(chuàng)新互聯(lián)
分享地址:http://muchs.cn/article46/dieehg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)小程序開發(fā)、企業(yè)網(wǎng)站制作、自適應(yīng)網(wǎng)站、網(wǎng)站內(nèi)鏈、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)