BGP的各類屬性配置


核心提示:Lab 31. Configuring BGP Summarization  實驗目的:    一、掌握使用指向NULL0接口的靜態路由的彙總配置方法。    二、掌握使用聚合屬性的路由彙總配置方法。    R1(config)#ip route 172.16.0.0 255.255.252.0 null 0    R1(config)#router bgp 64512&nb
Lab 31. Configuring BGP Summarization
實驗目的:
    一、掌握使用指向NULL0接口的靜態路由的彙總配置方法。
    二、掌握使用聚合屬性的路由彙總配置方法。
    R1(config)#ip route 172.16.0.0 255.255.252.0 null 0
    R1(config)#router bgp 64512
    R1(config-router)#aggregate-address 172.16.0.0 255.255.252.0 summary-
    only
    Lab 33. BGP Neighbor Authentication
    實驗目的:
    一、掌握其於MD5的BGP對等體認證配置。
    R1(config)#router bgp 64512
    R1(config-router)#neighbor 10.1.255.2 password cisco123
    R2(config)#router bgp 64513
    R2(config-router)#neighbor 10.1.255.1 password cisco123
    Lab 34. Configuring BGP Local Preference
    實驗目的:
    一、理解掌握BGP的本地優選屬性概念和配置方法。
    二、本地優選的屬性默認值爲100,較高值的路徑會被優先選擇。
    三、本地優先屬性,決定離開本自治系統最佳的路徑。
    (BGP在選擇最佳路由時,並不會考具體鏈路的帶寬。爲了解決這一問題,能夠在本地配置「本地優先」來肯定數據流如何流出本自治系統。BGP會優先選擇本地優先屬性值較高的路由。)
 
    R4(config)#router bgp 64513     R4(config-router)#bgp default local-preference 200     R4(config-router)#exit     R4(config)#     (BGP在向IBGP對等體通告路由時,其下一跳不變,這種機制被稱爲BGP的下一跳屬     性.)     R4(config)#router bgp 64513     R4(config-router)#neighbor 10.1.1.1 next-hop-self     Lab 35. Using Route Maps to Configuring BGP Local Preference     實驗目的:     一、掌握基於route-map的本地優先配置方法。     二、使用route-map配置能夠定置基於目標網絡的本地優先。     (本地優先會影響數據流如何流出本地自治系統。BGP的選路規則:EBGP對等體通告     的路由優於IBGP對等體通告的路由。)     R4(config)#access-list 1 permit 130.130.1.0 0.0.0.255     R4(config)#     R4(config)#route-map set_lp permit 10     R4(config-route-map)#match ip address 1     R4(config-route-map)#set local-preference 200     R4(config-route-map)#exit     R4(config)#     R4(config)#route-map set_lp permit 20     R4(config-route-map)#exit     R4(config)#     R4(config)#router bgp 64513     R4(config-router)#neighbor 192.168.2.2 route-map set_lp in     R4(config-router)#exit     R4(config)#exit     R4#     R4#clear ip bgp * soft in     R4#     Lab 36. Configuring BGP Multi-Exit Discriminator     實驗目的:     一、理解MED屬性可以影響,其它的自治系統的數據流如何流入本地自治系統。     二、掌握基於route-map的MED配置方法。     (MED屬性能夠實現:影響其它的自治系統的數據流,如何流入本地自治系統。根據     MED的屬性值越低的哪條路由,會被優先選擇的特性。並且MED值默認爲0。)     R2(config)#access-list 1 permit 130.130.1.0 0.0.0.255     R2(config)#     R2(config)#route-map set_med permit 10     R2(config-route-map)#match ip address 1     R2(config-route-map)#set metric 100     R2(config-route-map)#exit     R2(config)#     R2(config)#route-map set_med permit 20     R2(config-route-map)#exit     R2(config)#     R2(config)#router bgp 64512     R2(config-router)#neighbor 192.168.1.2 route-map set_med out     R2(config-router)#exit     R2(config)#     R2#     R2#clear ip bgp * soft out     R2#     Lab 37. Configuring BGP Weight     實驗目的:     一、當本地出口路由器,有多條外出自治系統的鏈路時,應用權重(Weight)屬性可以     決定數據流從本地路由器哪條出口鏈路流出本地自治系統.     二、權重(Weight)屬性爲Cisco私有屬性。     (BGP的選路規則:一、最早收到路由優先於後收到的路由。二、優先選擇BGP的     Router-ID較低的路由。)     R1(config)#router bgp 64512     R1(config-router)#neighbor 192.168.4.1 weight 100     R1(config-router)#neighbor 192.168.1.2 weight 50     R1(config-router)#exit     R1#clear ip bgp * soft     R1(config)#access-list 1 permit 150.150.1.0 0.0.0.255     R1(config)#     R1(config)#route-map set_weight permit 10     R1(config-route-map)#match ip address 1     R1(config-route-map)#set weight 100     R1(config-route-map)#exit     R1(config)#     R1(config)#     R1(config)#route-map set_weight permit 20     R1(config-route-map)#exit     R1(config)#     R1(config)#router bgp 64512     R1(config-router)#neighbor 192.168.4.1 route-map set_weight in     R1(config-router)#exit     R1(config)#exit     R1#clear ip bgp * soft     R1#     Lab 38. Affects the BGP Routing By Path Prepend     實驗目的:     一、掌握如何配置路徑欺騙影響BGP的路由選擇。     二、理解BGP的路徑欺騙是MED的替代解決方法,可是其適用範圍較小,只能在有限的     網絡環境下配置使用。     (BGP的選路規則:優先選擇AS-PATH最短的路徑。)     R3(config)#access-list 1 permit 150.150.1.0 0.0.0.255     R3(config)#     R3(config)#route-map set_prepend permit 10     R3(config-route-map)#match ip address 1     R3(config-route-map)#set as-path prepend 64514 64514     R3(config-route-map)#exit     R3(config)#     R3(config)#route-map set_prepend permit 20     R3(config-route-map)#exit     R3(config)#     R3(config)#router bgp 64514     R3(config-router)#neighbor 192.168.2.1 route-map set_prepend out     R3(config-router)#exit     R3(config)#exit     R3#     R3#clear ip bgp * soft out     R3#     (須要注意的是:在set as-path prepend後添加的AS號,最好是本地自治系統號,     不然可能會產生無效路由。)     Lab 39. Using Route Tag to Store BGP AS-Path     實驗目的:     一、解決BGP與IGP在作路由重發布時,BGP AS-PATH屬性丟失的問題。     二、掌握使用路由標記存儲BGP路徑屬性配置方法。     R2(config)#router ospf 1     R2(config-router)#redistribute bgp 64513 subnets     R2(config-router)#exit     R2(config)#     R2(config)#router bgp 64513     R2(config-router)#redistribute ospf 1 match external internal     R2(config-router)#     (將OSPF中的內部與外部類型的路由重發布到BGP 64513的自治系統。)     R3(config)#router bgp 64513     R3(config-router)#redistribute ospf 1 match internal external     R3(config-router)#exit     R3(config)#     R3(config)#router ospf 1     R3(config-router)#redistribute bgp 64513 subnets     R3(config-router)#exit     R3(config)#exit     [產生此AS-PATH路徑信息丟失的主要緣由是:因爲R2路由器把BGP路由協議重發布     到OSPF中,而OSPF不可以識別BGP的路由AS-PATH屬性。因此在R4上查看重發布路由     的AS-PATH是不完整。     解決這個問題的關鍵:因爲路由標記能夠被全部的路由協議識別,所以,能夠在重     發佈前將BGP的AS-PATH轉存到路由標記中,而後在R4路由器上再發路由標識中存儲     的AS-PATH取出來還原到BGP的路由中。]     實施路由標記的配置:     R2(config)#route-map SET_TAG permit 10     R2(config-route-map)#set automatic-tag     //(設置自動計算路由標記。主要計算結果爲AS-PATH的屬性值)     R2(config-route-map)#exit     R2(config)#     R2(config)#router bgp 64513     R2(config-router)#table-map SET_TAG     //(配置將BGP的擴展屬性,映射到路由表中。其主要目的是經過SET_TAG的路由圖     的過濾,將AS-PATH將屬性存儲到標記中。)     R3(config)#route-map GET_TAG permit 10     R3(config-route-map)#set as-path tag     //(將AS-PATH屬性從路由標記中取出,並還原到BGP的路由數據庫中。)     R3(config-route-map)#exit     R3(config)#router bgp 64513     R3(config-router)#redistribute ospf 1  match external internal route-map     GET_TAG     //(在路由重發布時,完成AS-PATH的轉存工做。)     解決路由起源信息不完整     R3(config)#route-map SET_ORIGIN permit 10     R3(config-route-map)#set origin igp  //(設置相應的起源屬性爲IGP。)     R3(config-route-map)#exit     R3(config)#     R3(config)#router bgp 64513     R3(config-router)#neighbor 192.168.2.2 route-map SET_ORIGIN out     //(調用相應的route-map設置起源屬性。)     Lab 40. Using Distribute-list to Filtering BGP Routing     實驗目的:     一、掌握使用distribute-list過濾BGP的路由。     R2(config)#access-list 1 deny 172.16.0.0 0.0.0.255     R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255     R2(config)#     R2(config)#router bgp 64512     R2(config-router)#neighbor 10.1.255.2 distribute-list 1 out     Lab 41. Using Route-Map to Filtering BGP Routing     實驗目的:     一、掌握使用Route-Map過濾BGP的路由。     R2(config)#access-list 1 deny 172.16.0.0 0.0.0.255     R2(config)#access-list 1 deny 172.16.1.0 0.0.0.255     R2(config)#access-list 1 permit any     R2(config)#     R2(config)#route-map bgpfilter permit 10     R2(config-route-map)#match ip address 1     R2(config-route-map)#exit     R2(config)#     R2(config)#router bgp 64512     R2(config-router)#neighbor 10.1.255.2 route-map bgpfilter out     Lab 42. Using Prefix-List to Filtering BGP Routing     實驗目的:     一、掌握基於Prefix-List的過濾配置方法。     二、掌握Prefix-List針對路由的子網掩碼長度的選擇性過濾配置。     R2(config)#ip prefix-list bgpfilter seq 5 deny 172.16.0.0/24     R2(config)#ip prefix-list bgpfilter seq 10 deny 172.16.1.0/25     R2(config)#ip prefix-list bgpfilter seq 15 permit 0.0.0.0/0 le 32     R2(config)#     R2(config)#router bgp 64512     R2(config-router)#neighbor 10.1.255.2 prefix-list bgpfilter out     R2(config-router)#exit
相關文章
相關標籤/搜索