BGP路由选择实验
2012-06-08 07:36
337 查看
实验拓扑:
R1与R2之间是EBGP
R1与R3之间是EBGP
R2与R3之间是IBGP
然后做如下配置
在R1上通告1.1.1.0 网络
R1:
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.12.1 255.255.255.0
clock rate 64000
!
interface Serial0/1
ip address 172.16.13.1 255.255.255.0
clock rate 64000
!
router bgp 1
network 1.1.1.0 mask 255.255.255.0
neighbor 172.16.12.2 remote-as 2
neighbor 172.16.13.3 remote-as 2
!
R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.23.2 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 172.16.12.2 255.255.255.0
clock rate 2000000
!
router bgp 2
neighbor 172.16.12.1 remote-as 1
neighbor 172.16.23.3 remote-as 2
R3:
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.23.3 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 172.16.13.3 255.255.255.0
clock rate 2000000
!
router bgp 2
neighbor 172.16.13.1 remote-as 1
neighbor 172.16.23.2 remote-as 2
实验验证
在R2上查看BGP路由表,注意show ip bgp结果,
【问题1】通过R2到R1的1.1.1.0 网络为什么选择172.16.12.1?
R2#show ip bgp
BGP table version is 2, local router ID is 2.2.2.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
* i1.1.1.0/24 172.16.13.1 0 100 0 1 i
*> 172.16.12.1 0 0 1 i
【答案1】原因是172.16.13.1 不可达,如下面命令所示
R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
2
1
172.16.13.1 (inaccessible) from 172.16.23.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
1
172.16.12.1 from 172.16.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
【问题2】如何配置,才能让172.16.13.1 可达?
【答案2】按照下面配置
R2:
R2(config)#router bgp 2
R2(config-router)#neighbor 172.16.23.3 next-hop-self
R3(config)#router b 2
R3(config-router)#neighbor 172.16.23.2 next-hop-self
此时再查看BGP路由
R2#clear ip bgp * soft
R2#show ip bgp
BGP table version is 2, local router ID is 2.2.2.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
* i1.1.1.0/24 172.16.23.3 0 100 0 1 i
*> 172.16.12.1 0 0 1 i
R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
2
1
172.16.23.3 from 172.16.23.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
1
172.16.12.1 from 172.16.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
【问题4】此时为什么还是选择172.16.23.3 ?
【答案4】原因是 EBGP优于IBGP
【实验2】在R2上,如何修改AS-Path ,使到达1.1.1.0 网络的选择172.16.12.1
R2(config)#ip prefix-list 1 permit 1.1.1.0/24
R2(config)#route-map as
R2(config-route-map)#match ip address prefix-list 1
R2(config-route-map)#set as-path prepend 65000 65001
R2(config-route-map)#router bgp 2
R2(config-router)#neighbor 172.16.12.1 route-map as in
R2(config-router)#end
R2#clear ip bgp * soft
R2#show ip b
BGP table version is 3, local router ID is 2.2.2.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
*>i1.1.1.0/24 172.16.23.3 0 100 0 1 i 变成了上面这条路由
* 172.16.12.1 0 0 65000 65001 1 i
此时在R2上查看到R3的路由已经没有了
R2#show ip bgp neighbors 172.16.23.3 advertised-routes
Total number of prefixes 0
在R3上查看bgp路由,也只剩余1条
R3#show ip bgp
BGP table version is 2, local router ID is 3.3.3.3
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
*> 1.1.1.0/24 172.16.13.1 0 0 1 i
R3#
R1与R2之间是EBGP
R1与R3之间是EBGP
R2与R3之间是IBGP
然后做如下配置
在R1上通告1.1.1.0 网络
R1:
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.12.1 255.255.255.0
clock rate 64000
!
interface Serial0/1
ip address 172.16.13.1 255.255.255.0
clock rate 64000
!
router bgp 1
network 1.1.1.0 mask 255.255.255.0
neighbor 172.16.12.2 remote-as 2
neighbor 172.16.13.3 remote-as 2
!
R2:
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.23.2 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 172.16.12.2 255.255.255.0
clock rate 2000000
!
router bgp 2
neighbor 172.16.12.1 remote-as 1
neighbor 172.16.23.3 remote-as 2
R3:
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.23.3 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 172.16.13.3 255.255.255.0
clock rate 2000000
!
router bgp 2
neighbor 172.16.13.1 remote-as 1
neighbor 172.16.23.2 remote-as 2
实验验证
在R2上查看BGP路由表,注意show ip bgp结果,
【问题1】通过R2到R1的1.1.1.0 网络为什么选择172.16.12.1?
R2#show ip bgp
BGP table version is 2, local router ID is 2.2.2.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
* i1.1.1.0/24 172.16.13.1 0 100 0 1 i
*> 172.16.12.1 0 0 1 i
【答案1】原因是172.16.13.1 不可达,如下面命令所示
R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
2
1
172.16.13.1 (inaccessible) from 172.16.23.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
1
172.16.12.1 from 172.16.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
【问题2】如何配置,才能让172.16.13.1 可达?
【答案2】按照下面配置
R2:
R2(config)#router bgp 2
R2(config-router)#neighbor 172.16.23.3 next-hop-self
R3(config)#router b 2
R3(config-router)#neighbor 172.16.23.2 next-hop-self
此时再查看BGP路由
R2#clear ip bgp * soft
R2#show ip bgp
BGP table version is 2, local router ID is 2.2.2.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
* i1.1.1.0/24 172.16.23.3 0 100 0 1 i
*> 172.16.12.1 0 0 1 i
R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Advertised to update-groups:
2
1
172.16.23.3 from 172.16.23.3 (3.3.3.3)
Origin IGP, metric 0, localpref 100, valid, internal
1
172.16.12.1 from 172.16.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
【问题4】此时为什么还是选择172.16.23.3 ?
【答案4】原因是 EBGP优于IBGP
【实验2】在R2上,如何修改AS-Path ,使到达1.1.1.0 网络的选择172.16.12.1
R2(config)#ip prefix-list 1 permit 1.1.1.0/24
R2(config)#route-map as
R2(config-route-map)#match ip address prefix-list 1
R2(config-route-map)#set as-path prepend 65000 65001
R2(config-route-map)#router bgp 2
R2(config-router)#neighbor 172.16.12.1 route-map as in
R2(config-router)#end
R2#clear ip bgp * soft
R2#show ip b
BGP table version is 3, local router ID is 2.2.2.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
*>i1.1.1.0/24 172.16.23.3 0 100 0 1 i 变成了上面这条路由
* 172.16.12.1 0 0 65000 65001 1 i
此时在R2上查看到R3的路由已经没有了
R2#show ip bgp neighbors 172.16.23.3 advertised-routes
Total number of prefixes 0
在R3上查看bgp路由,也只剩余1条
R3#show ip bgp
BGP table version is 2, local router ID is 3.3.3.3
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
*> 1.1.1.0/24 172.16.13.1 0 0 1 i
R3#
相关文章推荐
- 实验指南:BGP路由汇聚(下)
- 实验指南:BGP路径选择
- BGP路由选择中MED值修改
- BGP路径属性详解及路由选择判定过程学习笔记
- BGP的消息类型、路由选择和配置命令
- 按需路由选择(ODR)原理及实验
- CCIE路由实验(1) -- BGP的基本配置
- BGP协议的路由选择原则
- BGP发布路由和选择路由的机制
- 【实验9.11.1】 配置BGP的缺省路由【IEEEnjoy.L.ZH】
- BGP邻居建立+BGP路由传递解决方案之BGP反射器(Route-Reflector)+BGP联邦综合实验2
- BGP路由选择十一步!!!
- 实验指南:BGP路由过滤 推荐
- 乾颐堂军哥HCIE12-BGP的对等体组和BGP的路由操控理论和实验
- BGP路由过滤实验
- BGP的路由选择过程
- BGP选择路由的策略