CCNP-33 BGP 3
2007-12-08 21:57
736 查看
CCNP-33 BGP 3
实验拓扑:实验要求:按照拓扑图将三台路由器分别放置在AS 100/200/300中,首先配置R1与R2 R3成为EBGP PEER,观察BGP路由表中的AS PATH属性,然后再将R2与R3也配置为EBGP PEER,再观察BGP路由表中的AS PATH属性,看看有什么变化。
试验目的:掌握AS PATH属性在BGP路由选择中的作用。
试验配置:
R1:
R1(config)#int f0/0
R1(config-if)#ip add 192.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int loop0
R1(config-if)#ip add 1.1.1.1
255.255.255.0
R1(config-if)#exit
R1(config-if)#ip add 10.1.1.1
255.255.255.0
R1(config-if)#exit
R1(config)#router bgp 100
R1(config-router)#nei
R1(config-router)#neighbor
192.1.1.2 remote-as 200
R1(config-router)#network
10.1.1.0 mask 255.255.255.0
R1(config-router)#exit
R2:
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int f1/0
R2(config-if)#ip add 193.1.1.1
255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int loop0
R2(config-if)#ip add 2.2.2.2
255.255.255.0
R2(config-if)#exit
R2(config)#router bgp 200
R2(config-router)#neighbor
192.1.1.1 remote-as 100
R2(config-router)#neighbor
193.1.1.2 remote-as 300
R2(config-router)#network
192.1.1.0
R2(config-router)#network
193.1.1.0
R2(config-router)#exit
R3:
R3(config)#int f1/0
R3(config-if)#ip add 193.1.1.2 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int loop0
R3(config-if)#ip add 3.3.3.3
255.255.255.0
R3(config-if)#exit
R3(config)#router bgp 300
R3(config-router)#neighbor
193.1.1.1 remote-as 200
R3(config-router)#exit
好了,配置完成,然后我们在R3上查看BGP路由表:
R3#show ip bgp
BGP table version is 5, 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
*> 10.1.1.0/24 193.1.1.1 0 200 100 i
*> 192.1.1.0 193.1.1.1 0 0 200 i
r> 193.1.1.0 193.1.1.1 0 0 200 i
观察第一行我们发现在Path这一列有200 100的标示,说明学习这条路由的路径是 AS 100----AS 200----AS 300
通过AS PATH属性,明白的表示出一条路由传播路径,这也是BGP预防环路发生的一种
法,如果发现传播过来的路由的AS
PATH属性里面列出了本地的AS号,路由器就认为这条路由已经学习过了,并且形成了一个环,然后这条路由信息将被丢弃。
上面第三行有”r”标志的路由信息说明这条路又没有被写入路由表,原因可以通过命令
show ip bgp rib-failure来查看:
R3#show ip bgp rib-failure
Network Next Hop RIB-failure RIB-NH Matches
193.1.1.0 193.1.1.1 Higher admin distance n/a
Higher admin distance表示较高的管理距离,因为193.1.1.0这个网段是直连网段,管理距离为0,而EBGP的管理距离为20,在路由表选择写入的路由的时候如果有两种路由协议都有到达某个网段的信息,那么选择管理距离较低的写入路由表,这里是将直连路由写入了路由表,R3的路由表为:
R3#show ip route
Codes: C - connected, S - static, R - RIP,
M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA -
OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
3.0.0.0/24
is subnetted, 1 subnets
C
3.3.3.0 is directly connected,
Loopback0
10.0.0.0/24
is subnetted, 1 subnets
B 10.1.1.0
[20/0] via 193.1.1.1, 00:02:02
C
193.1.1.0/24 is directly connected, FastEthernet1/0
B 192.1.1.0/24 [20/0] via 193.1.1.1, 00:00:59
有两条以B表示的路由,这表示是从BGP学习到的,我们可以ping测试一下:
R3#p 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1,
timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5),
round-trip min/avg/max = 96/182/276 ms
好的,通了。
下面我们配置R1,R3,使之也成为EBGP PEER:
R1(config)#int f1/0
R1(config-if)#ip add 194.1.1.1
255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#router bgp 100
R1(config-router)#neighbor 194.1.1.2
remote-as 300
R1(config-router)#exit
R3(config)#int f0/0
R3(config-if)#ip add 194.1.1.2
255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#router bgp 300
R3(config-router)#neighbor 194.1.1.1
remote-as 100
R3(config-router)#exit
好了,我们clear ip
bgp *强制重起一下BGP进程,再观察R3上的BGP路由表:
R3#show ip bgp
BGP table version is 6, 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
*> 10.1.1.0/24 194.1.1.1 0 0 100 i
* 193.1.1.1 0 200 100 i
*
192.1.1.0 194.1.1.1 0 100 200 i
*> 193.1.1.1 0 0 200 i
r
193.1.1.0 194.1.1.1 0 100 200 i
r> 193.1.1.1 0 0 200 i
看到变化了吧!我们来逐条进行分析:
*> 10.1.1.0/24 194.1.1.1 0 0 100 i * 193.1.1.1 0 200 100 i |
* 192.1.1.0 194.1.1.1 0 100 200 i *> 193.1.1.1 0 0 200 i |
r 193.1.1.0 194.1.1.1 0 100 200 i r> 193.1.1.1 0 0 200 i |
我们再来看一下R1的BGP路由表和IP路由表:
R1#show ip bgp
BGP table version is 5, local router ID is 10.1.1.1
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
*> 10.1.1.0/24 0.0.0.0 0 32768 i
r
192.1.1.0 194.1.1.2 0 300 200 i
r> 192.1.1.2 0 0 200 i
* 193.1.1.0
194.1.1.2 0 300 200 i
*> 192.1.1.2 0 0 200 i
R1#show ip route
Codes: C - connected, S - static, R - RIP,
M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA -
OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24
is subnetted, 1 subnets
C
1.1.1.0 is directly connected,
Loopback0
10.0.0.0/24
is subnetted, 1 subnets
C
10.1.1.0 is directly connected,
Loopback1
B 193.1.1.0/24 [20/0] via 192.1.1.2, 00:37:21
C
192.1.1.0/24 is directly connected, FastEthernet0/0
C
194.1.1.0/24 is directly connected, FastEthernet1/0
我们只看最后到193.1.1.0这个网段的路由,下一条属性为192.1.1.2,这是因为我们向BGP通告193.1.1.0这个网段是在R2上做的,如果我们取消这条路由在R2上的通告,而在R3上通告这条路由的话,R1的BGP路由表和IP路由表又会是什么样子的呢?
我们可以根据BGP选路的特点来假想一下,如果在R3上通告193.1.1.0/24这条路由的话,那么R1的BGP路由表有关这条路由的下一跳属性将会变为194.1.1.2,AS PATH属性AS 300,并且路由表也将随之变化,还有R2上的BGP路由表也将发生变化,会有一条到193.1.1.0被标记为”r”的路由,AS PATH属性为AS 300我们可以来做一下试验,验证一下我们的猜测是否正确:
作更改前R2的BGP路由表:
R2#show ip bgp
BGP table version is 4, 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
*> 10.1.1.0/24 192.1.1.1 0 0 100 i
*> 192.1.1.0 0.0.0.0 0 32768 i
*> 193.1.1.0 0.0.0.0 0 32768 i
193.1.1.0是自己产生的路由,然后开始更改R2与R3的配置:
R1#show ip bgp
BGP table version is 8, local router ID is 10.1.1.1
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
*> 10.1.1.0/24 0.0.0.0 0 32768 i
r
192.1.1.0 194.1.1.2 0 300 200 i
r>
192.1.1.2 0 0 200 i
*
193.1.1.0 192.1.1.2 0 200 300 i
*> 194.1.1.2 0 0 300 i
以上为R1的BGP路由表;
R1#show ip route
Codes: C - connected, S - static, R - RIP,
M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA -
OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24
is subnetted, 1 subnets
C
1.1.1.0 is directly connected,
Loopback0
10.0.0.0/24
is subnetted, 1 subnets
C
10.1.1.0 is directly connected,
Loopback1
B 193.1.1.0/24 [20/0] via 194.1.1.2, 00:04:59
C
192.1.1.0/24 is directly connected, FastEthernet0/0
C 194.1.1.0/24 is directly connected,
FastEthernet1/0
以上为R1的路由表;
R2#show ip bgp
BGP table version is 5, 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
* 10.1.1.0/24 193.1.1.2 0 300 100 i
*> 192.1.1.1 0 0 100 i
*> 192.1.1.0 0.0.0.0 0 32768 i
r> 193.1.1.0 193.1.1.2 0 0 300 i
r 192.1.1.1 0 100 300 i
以上为R2的BGP路由表。
上面的输出显示和我们根据BGP选路的条件推断出来的是一样的。
实验总结:掌握AS PATH属性在BGP路由选择时的作用。
本文出自 “★Beckham~23” 博客,请务必保留此出处http://loveme23.blog.51cto.com/7891/54224
相关文章推荐
- CCNP路由-19 BGP路径属性详解(下)
- CCNP精粹系列之二十四--BGP的水平分隔,推荐
- CCNP精粹系列之三十二--BGP下一跳问题,推荐
- CCNP路由-30 BGP 移除私有AS Dual-AS Policy-accouting
- CCNP路由-18 BGP路径属性详解(上)
- CCNP-BGP基本配置 理解IBGP和EBGP 学会IBGP全互联 学会用环回口建立EBGP邻居
- ccnp-bgp基本配置
- CCNP精粹系列之二十五--BGP的水平分隔,推荐
- CCNP-34 BGP 4
- CCNP路由-26 BGP选路规则详解(上)
- CCNP学习笔记10-路由部分--BGP 前缀列表
- CCNP精粹系列之二十六--BGP不同自治系统间通信,推荐
- CCNP系列三十四--- Bgp的本地优先属性
- CCNP实验精选之BGP大综合
- SYBEX的CCNP指南中BGP实验的总结
- CCNP-BGP选路,BGP属性:公认必选之Origin、Next-hop
- CCNP学习笔记8-路由部分--BGP
- CCNP精粹系列之二十七--挑战BGP,推荐
- CCNP实验:BGP抖动惩罚 二