用 BGP ORIGIN 屬性控制選路
拓撲結構
實驗拓撲如圖所示。
.實驗步驟
本實驗是在路由器 R4 上配置“
“
“
(1)步驟 1:配置路由器 R1
R1(config)#router eigrp 1
R1(config-router)#network
R1(config-router)#network
R1(config-router)#no auto-summary R1(config)#router bgp 100
R1(config-router)#no synchronization
R1(config-router)#no auto-summary
R1(config-router)#bgp router-id
R1(config-router)#neighbor
R1(config-router)#neighbor
R1(config-router)#neighbor
R1(config-router)#neighbor
R1(config-router)#neighbor
R1(config-router)#neighbor
R1(config-router)#neighbor
(2)步驟 2:配置路由器 R2
R2(config)#router eigrp 1
R2(config-router)#network
R2(config-router)#network
R2(config-router)#network
R2(config-router)#no auto-summary
R2(config)#router bgp 100
R2(config-router)#no synchronization
R2(config-router)#no auto-summary
R2(config-router)#bgp router-id
R2(config-router)#neighbor
R2(config-router)#neighbor
R2(config-router)#neighbor
R2(config-router)#neighbor
(3)步驟 3:配置路由器 R3
R3(config)#router eigrp 1
R3(config-router)#network
R3(config-router)#network
R3(config-router)#no auto-summary
R3(config)#router bgp 100
R3(config-router)#no synchronization
R3(config-router)#no auto-summary
R3(config-router)#bgp router-id
R3(config-router)#neighbor
R3(config-router)#neighbor
R3(config-router)#neighbor
R3(config-router)#neighbor
R3(config-router)#neighbor
R3(config-router)#neighbor
R3(config-router)#neighbor 34.34.34.4 remote-as 200
(4)步驟 4:配置路由器 R4
R4(config-router)#ip prefix-list 1 permit
R4(config)#route-map egp permit 10 R4(config-route-map)#match ip address prefix-list 1
R4(config-route-map)#set origin egp 900 //設置起源代碼
R4(config)#router bgp 200
R4(config-router)#no synchronization
R4(config-router)#no auto-summary
R4(config-router)#bgp router-id
R4(config-router)#network
R4(config-router)#neighbor
R4(config-router)#neighbor
//在出方向爲去往鄰居
R4(config-router)#neighbor 34.34.34.3 remote-as 100
4.實驗調試
在路由器 R1、R2和 R3 上查看 BGP 表:
R1#show ip bgp
BGP table version is 6, local router ID is
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i
*
R2#show ip bgp
BGP table version is 5, local router ID is
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i
R3#show ip bgp
BGP table version is 4, local router ID is
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>
以上輸出表明路由器 R1學到兩條關於“
優先於“e” ,所以從路由器 R3 學到的路由被優化,而從鄰居路由器 R4 學到的路由不能被優
化(路由代碼只爲“*” ,沒有“>” ) ,不能繼續通告給路由器 R2 和 R3,所以路由器 R2 和 R3
只有一條關於“