配置BGP本地优先级
生活随笔
收集整理的這篇文章主要介紹了
配置BGP本地优先级
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
一、拓?fù)鋱D:
二、配置基本的BGP。以R1為例:| R1(config)#router bgp 64512 R1(config-router)#net 172.16.1.0 mask 255.255.255.0 R1(config-router)#net 192.168.2.0????????? R1(config-router)#net 130.130.1.0 mask 255.255.255.0 R1(config-router)#nei 172.16.1.2 remote 64512 R1(config-router)#nei 192.168.2.1 remote 64513 |
1、查看一下R3和R4的路由表:
| R3#sh ip route ……………… 172.16.0.0/24 is subnetted, 1 subnets B???????172.16.1.0 [20/0] via 192.168.1.1, 00:02:55 10.0.0.0/24 is subnetted, 1 subnets C???????10.1.1.0 is directly connected, Serial1/1 130.130.0.0/24 is subnetted, 1 subnets B???????130.130.1.0 [20/0] via 192.168.1.1, 00:00:13??(R3到130.130.1.1通過192.168.1.1走) C????192.168.1.0/24 is directly connected, Serial1/0 B????192.168.2.0/24 [200/0] via 10.1.1.2, 00:02:59 ? R4#sh ip route ……………… 172.16.0.0/24 is subnetted, 1 subnets B???????172.16.1.0 [20/0] via 192.168.2.2, 00:03:57 10.0.0.0/24 is subnetted, 1 subnets C???????10.1.1.0 is directly connected, Serial1/0 130.130.0.0/24 is subnetted, 1 subnets B???????130.130.1.0 [20/0] via 192.168.2.2, 00:00:56?(R4到130.130.1.0通過192.168.2.2走) B????192.168.1.0/24 [200/0] via 10.1.1.1, 00:03:57 C????192.168.2.0/24 is directly connected, FastEthernet0/0 |
| R3#sh ip bgp BGP table version is 9, local router ID is 192.168.1.2 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 * i10.1.1.0/24??????10.1.1.2?????????????????0????100??????0 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *> 130.130.1.0/24???192.168.1.1????????????????????????????0 64512 i * i?????????????????192.168.2.2??????????????0????100??????0 64512 i * i172.16.1.0/24????192.168.2.2??????????????0????100??????0 64512 i *>??????????????????192.168.1.1??????????????0?????????????0 64512 i *??192.168.1.0??????192.168.1.1??????????????0?????????????0 64512 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *>i192.168.2.0??????10.1.1.2?????????????????0????100??????0 i *???????????????????192.168.1.1????????????????????????????0 64512 i R4#sh ip bgp Network??????????Next Hop????????????Metric LocPrf Weight Path *> 10.1.1.0/24??????0.0.0.0??????????????????0?????????32768 i * i?????????????????10.1.1.1?????????????????0????100??????0 i *?i130.130.1.0/24???192.168.1.1??????????????0????100??????0 64512 i *>??????????????????192.168.2.2??????????????0?????????????0 64512 i * i172.16.1.0/24????192.168.1.1??????????????0????100??????0 64512 i *>??????????????????192.168.2.2??????????????0?????????????0 64512 i *??192.168.1.0??????192.168.2.2????????????????????????????0 64512 i *>i?????????????????10.1.1.1?????????????????0????100??????0 i *> 192.168.2.0??????0.0.0.0??????????????????0?????????32768 i *???????????????????192.168.2.2??????????????0?????????????0 64512 i R4# |
1、把R4的優(yōu)先級提高,因為BGP會優(yōu)先選擇本地優(yōu)先級值較高的路由。
| R4(config)#router bgp 64513 R4(config-router)#bgp default local-preference?150??(配置一個高出50的優(yōu)先級) |
| R3#sh ip route 172.16.0.0/24 is subnetted, 1 subnets B???????172.16.1.0 [200/0] via 192.168.2.2, 00:01:09 10.0.0.0/24 is subnetted, 1 subnets C???????10.1.1.0 is directly connected, Serial1/1 130.130.0.0/24 is subnetted, 1 subnets B???????130.130.1.0 [200/0] via 192.168.2.2, 00:01:09?(現(xiàn)在下一跳變?yōu)?192.168.2.2) C????192.168.1.0/24 is directly connected, Serial1/0 B????192.168.2.0/24 [200/0] via 10.1.1.2, 00:58:57 R3#sh ip bgp? Network??????????Next Hop????????????Metric LocPrf Weight Path * i10.1.1.0/24??????10.1.1.2?????????????????0????150??????0 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *??130.130.1.0/24???192.168.1.1????????????????????????????0 64512 i *>i?????????????????192.168.2.2??????????????0????150??????0 64512 i (最佳路徑為192.168.2.2) *>i172.16.1.0/24????192.168.2.2??????????????0????150??????0 64512 i *???????????????????192.168.1.1??????????????0?????????????0 64512 i * i192.168.1.0??????192.168.2.2??????????????0????150??????0 64512 i *???????????????????192.168.1.1??????????????0?????????????0 64512 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *>i192.168.2.0??????10.1.1.2?????????????????0????150??????0 i *???????????????????192.168.1.1????????????????????????????0 64512 i R3# |
1、為了能夠在R3上能看到路由變化,可以在R4上指定下一跳為自己,配置通告給R3的路由:
| R4(config)#router bgp 64513 R4(config-router)#nei 10.1.1.1 next-hop-self |
| R3#sh ip route ……………… 172.16.0.0/24 is subnetted, 1 subnets B???????172.16.1.0 [200/0] via 10.1.1.2, 00:01:32 10.0.0.0/24 is subnetted, 1 subnets C???????10.1.1.0 is directly connected, Serial1/1 130.130.0.0/24 is subnetted, 1 subnets B???????130.130.1.0 [200/0] via 10.1.1.2, 00:01:32 C????192.168.1.0/24 is directly connected, Serial1/0 B????192.168.2.0/24 [200/0] via 10.1.1.2, 01:47:43 R3#sh ip bgp? Network??????????Next Hop????????????Metric LocPrf Weight Path * i10.1.1.0/24??????10.1.1.2?????????????????0????150??????0 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *??130.130.1.0/24???192.168.1.1????????????????????????????0 64512 i *>i?????????????????10.1.1.2?????????????????0????150??????0 64512 i *>i172.16.1.0/24????10.1.1.2?????????????????0????150??????0 64512 i *???????????????????192.168.1.1??????????????0?????????????0 64512 i * i192.168.1.0??????10.1.1.2?????????????????0????150??????0 64512 i *???????????????????192.168.1.1??????????????0?????????????0 64512 i *>??????????????????0.0.0.0??????????????????0?????????32768 i *>i192.168.2.0??????10.1.1.2?????????????????0????150??????0 i *???????????????????192.168.1.1????????????????????????????0 64512 i |
總結(jié)
以上是生活随笔為你收集整理的配置BGP本地优先级的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 开源分布式平台-mooon系统结构
- 下一篇: 从无到有写一个运维APP(二)