日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

router3 BGP2 属性及选路

發布時間:2025/3/20 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 router3 BGP2 属性及选路 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

1、介紹BGP屬性 1)分類 1)知名 VS 可選--->認識 2)強制 VS 自決--->攜帶 3)傳輸 VS 不傳輸 4)部分 2組合 1公認必遵as-path next-hop origin 2公認自決local-preference 3可選傳遞 community 4)可選非傳遞:MED 3)每種屬性掌握 1)作用 2)傳播范圍 3)默認值:大?小? 4如何調整 2、調整工具---->三步曲prefix---->route-map---->應用 1匹配路由 (1)acl: 192.168.1.0/24 acl 1 permit 192.168.1.0 0.0.0.255/24 /25 /26 .... acl 100 permit ip 192.168.1.0 0.0.0.0 255.255.255.0 0.0.0.0 (2)prefix-list 精確匹配及范圍匹配 ip prefix-list chuyue100 per 192.168.1.0/24 ge le 缺省路由:ip prefix-list a permit 0.0.0.0/0 所有路由:ip prefix-list b permit 0.0.0.0/0 le 32 2)設置屬性 route-map chuyue100 permit 10 match ip add prefix-list a set route-map chuyue100 permit 20--->空語句 3)應用到鄰居 nei x.x.x.x route-map chuyue100 in/out 3AS-PATH 1)作用:BGP路由經過AS的一個列表。起到防止環路作用 2)傳播范圍:整個BGP 3)默認值:比較長短,短則優 4)調整:只能加長 R1(config)#router bgp 134 R1(config-router)#bgp router-id 1.1.1.1 R1(config-router)#nei 12.1.1.2 remote-as 2 R1(config-router)#nei 3.3.3.3 remote-as 134 R1(config-router)#nei 3.3.3.3 up lo 0 R1(config-router)#nei 3.3.3.3 next-hop-self R1(config-router)#nei 4.4.4.4 remote-as 134 R1(config-router)#nei 4.4.4.4 up lo 0 R1(config-router)#nei 4.4.4.4 next-hop-self R2(config)#router bgp 2 R2(config-router)#nei 12.1.1.1 remote-as 134 R2(config-router)#nei 24.1.1.4 remote-as 134 R2(config-router)#net 2.2.2.0mask 255.255.255.0 R3(config)#router bgp 134 R3(config-router)#nei 1.1.1.1 remote-as 134 R3(config-router)#nei 1.1.1.1 up lo 0 R3(config-router)#nei 1.1.1.1 next-hop-self R3(config-router)#nei 4.4.4.4 remote-as 134 R3(config-router)#nei 4.4.4.4 up lo 0 R3(config-router)#nei 4.4.4.4 next-hop-self R4(config)#router bgp 134 R4(config-router)#nei 24.1.1.2 remote-as 2 R4(config-router)#nei 1.1.1.1 remote-as 134 R4(config-router)#nei 1.1.1.1 up lo 0 R4(config-router)#nei 1.1.1.1 next-hop-self R4(config-router)#nei 3.3.3.3 remote-as 134 R4(config-router)#nei 3.3.3.3 next-hop-self R4(config-router)#nei 3.3.3.3 up lo 0 1、匹配流量 R2(config)#ip prefix-list as-path per 2.2.2.0/24 2route-map R2(config)#route-map as-path per 10 R2(config-route-map)#match ip add prefix-list as-path R2(config-route-map)#set as-path pre 7 8 9//out方向:先加這幾個AS,再加本來的ASIn:先加本來的AS再加這幾個 R2(config)#route-map as-path per 20 3、應用 R2(config-route-map)#router bgp 2 R2(config-router)#nei 12.1.1.1 route-map as-path out 4、查看 R1(config-router)#do clear ip bgp * s R1(config-router)#do sh ip bgp 也可以在in操作 R1(config-router)#ip prefix-list as-path seq 5 permit 2.2.2.0/24 R1(config)#route-map as-path permit 10 R1(config-route-map)# match ip address prefix-list as-path R1(config-route-map)# set as-path prepend 7 8 9 R1(config-route-map)#! R1(config-route-map)#route-map as-path permit 20 R1(config-route-map)#router bgp 134 R1(config-router)#nei 12.1.1.2 route-map as-path in 4、orgin 1)作用:起源 i:通過network發布 e:通過EGP發布 ?:通過重發布,不完整 i>e>? 是一種公認必遵守 2)傳播范圍:整個BGP 3)默認值:i>e>? 4)調整 R1(config)#ip pre origin per 2.2.2.0/24 R1(config)#route-map origin per 10 R1(config-route-map)#match ip add pre origin R1(config-route-map)#set origin in R1(config)#route-map origin per 20 R1(config-route-map)#router bgp 134 R1(config-router)#nei 4.4.4.4 route-map origin in R1(config-router)#do clear ip bgp * s R1(config-router)#do sh ip bgp 5local-preference 1)作用:本AS數據出口 2)傳播范圍:本AS有效 3)默認值:100 大則優 4)調整 R1(config-router)#bgp default local-preference 200//可直接在路由協議上全局啟用 使用三步曲 R1(config)#ip pre local per 2.2.2.0/24 R1(config)#route-map local per 10 R1(config-route-map)#match ip add pre local R1(config-route-map)#set local 150 R1(config)#route-map local per 20 R1(config-router)#nei 12.1.1.2 route-map local in R1(config-router)#do clear ip bgp * s 對于route-map使用:對1peer1個方向只能應用1route-map 6weight---->Cisco私有 1)作用:控制本路由器選擇出口 2)傳播范圍:本路由器有效 3)默認值:本路由器產生 32768,從別的路由器接收的=0 4)調整: R1(config-router)#neighbor 4.4.4.4 weight 1//可直接改 三步曲: R1(config)#ip pre wei per 2.2.2.0/24 R1(config)#route-map wei per 10 R1(config-route-map)#match ip add pre wei R1(config-route-map)#set wei 2 R1(config)#route-map wei per 20 R1(config)#router bgp 134 R1(config-router)#nei 12.1.1.2 route-map wei in 7MED=metric 1)作用: 2)傳播范圍:只能影響鄰居AS,不能跨AS傳遞 3)默認值:0 小則優 4)調整 R1(config)#ip pre med per 2.2.2.0/24 R1(config)#route-map med per 10 R1(config-route-map)#match ip add pre med R1(config-route-map)#set metric 1000 R1(config)#route-map med per 20 R1(config)#router bgp 134 R1(config-router)#nei 12.1.1.2 route-map med in 以上的例子作用和local-preference功能類似 R2(config)#ip pre med per 2.2.2.0/24 R2(config)#route-map med per 10 R2(config-route-map)#match ip add pre med R2(config-route-map)#set metric 10000 R2(config)#route-map med per 20 R2(config)#router bgp 2 R2(config-router)#nei 12.1.1.1 route-map med out pingrecord功能 注意:默認情況下,只能比較來自相同ASMED 要想比較來自不同ASMED R2(config-router)#bgp always-compare-med

?

1、BGP路由選擇條件: 1)同步 2)無環 3)下一跳可達 2、選路順序 1)最高權重------------>c 2)最高local preference?---->L 3)本地產生比宣告要優 4)最短as-path?--->a 5)最小的origin code i>e>?----->o 6)最小的med?--->m 7)EBGP>IBGP?--->e 8)最近的IGP鄰居---->n 9)最老的EBGP路由 10)最小的BGP RID 11)最小鄰居IP c laomen 3、比較最小的鄰居IP R1(config-router)#int s1/1 R1(config-if)#ip add 11.1.1.1 255.255.255.0 sec R1(config-if)#router bgp 1 R1(config-router)#nei 11.1.1.3 remote-as 345 R3(config)#int s1/1 R3(config-if)#ip add 11.1.1.3 255.255.255.0 sec R3(config-if)#router bgp 345 R3(config-router)#nei 11.1.1.1 remote-as 1 ?? Network????????? Next Hop??????????? Metric LocPrf Weight Path *> 1.1.1.0/24?????? 11.1.1.1???????????????? 0???????????? 0 1 i *?????????????????? 13.1.1.1???????????????? 0???????? ????0 1 i 4、比較最小的BGP RID *>i1.1.1.0/24?????? 3.3.3.3????????????????? 0??? 100????? 0 1 i * i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i R3(config-router)# bgp router-id 6.6.6.6 * i1.1.1.0/24?????? 3.3.3.3????????????????? 0??? 100????? 0 1 i *>i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i 5、比較最近的IGP鄰居 * i1.1.1.0/24?????? 3.3.3.3????????????????? 0??? 100????? 0 1 i *>i???????????????? 4.4.4.4????????????????? 0???100????? 0 1 i R5(config)#int s1/3 R5(config-if)#ip ospf cost 100 *>i1.1.1.0/24?????? 3.3.3.3????????????????? 0??? 100????? 0 1 i * i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i 6EBGP>IBGP *> 1.1.1.0/24?????? 13.1.1.1???????????????? 0???????????? 0 1 i * i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i 7、比較最小的MED *> 1.1.1.0/24?????? 13.1.1.1???????????????? 0???????????? 0 1 i * i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i R3(config)#ip prefix-list med per 1.1.1.0/24 R3(config)#route-map med per 10 R3(config-route-map)#match ip add pre med R3(config-route-map)#set metric 1 R3(config)#route-map med per 20 R3(config-route-map)#router bgp 345 R3(config-router)#nei 13.1.1.1 route-map med in R3(config-router)#do clear ip bgp * s R3(config-router)#do sh ip bgp *?1.1.1.0/24?????? 13.1.1.1???????????????? 1???????????? 0 1 i *>i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 i 8、最小的origin code R3(config)#ip prefix-list origin per 1.1.1.0/24 R3(config)#route-map origin per 10 R3(config-route-map)#match ip add prefix origin R3(config-route-map)#set origin egp 1 R3(config)#route-map origin per 20 R3(config)#router bgp 345 R3(config-router)#nei 4.4.4.4 route-map origin in R3(config-router)#do clear ip bgp * s R3(config-router)#do sh ip bgp *> 1.1.1.0/24?????? 13.1.1.1???????????????? 1???????????? 0 1 i * i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 e 9、最短as-path R3(config)#route-map med per 10 R3(config-route-map)#set as-path pre last 3 R3(config-route-map)#do clear ip bgp * s R3(config-route-map)#do sh ip bgp *?1.1.1.0/24?????? 13.1.1.1???????????????? 1???????????? 0 1 1 1 1 i *>i???????????????? 4.4.4.4????????????????? 0??? 100????? 0 1 e 10、比較最大的local-preference R3(config)#route-map med per 10 R3(config-route-map)#set local 101 *> 1.1.1.0/24?????? 13.1.1.1???????????????? 1??? 101????? 0 1 1 1 1 i 11、比較最大的weight R3(config-router)#nei 4.4.4.4 wei 1 *>i1.1.1.0/24?????? 4.4.4.4????????????????? 0??? 100????? 1 1 e *?????????????????? 13.1.1.1???????????????? 1??? 101????? 0 1 1 1 1 i 12、BGP 負載均衡 IBGP R5(config-router)#maximum-paths ibgp 2 EBGP R1(config-router)#maximum-paths 3

轉載于:https://blog.51cto.com/nppstudy/729061

總結

以上是生活随笔為你收集整理的router3 BGP2 属性及选路的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。