1、BGP实验手册Lab 1. Configuring Basic BGP实验目的:1、掌握BGP的基本配置方法。2、掌握如何查看BGP的各种配置信息。实验拓扑图:实验步骤及要求:1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。2、在R1、R2和R3配置BGP路由协议,具体配置如下:R1(config)#router bgp 64512R1(config-router)#neighbor 172.16.255.2 remote-as 64512R1(config-router)#R1(config-router)#network 172.16.255.0 mask
2、255.255.255.252R1(config-router)#network 172.16.0.0 mask 255.255.255.0R1(config-router)#network 172.16.1.0 mask 255.255.255.0R1(config-router)#network 172.16.2.0 mask 255.255.255.0R1(config-router)#network 172.16.3.0 mask 255.255.255.0R1(config-router)#exitR1(config)#R2(config)#router bgp 64512R2(co
3、nfig-router)#neighbor 172.16.255.1 remote-as 64512R2(config-router)#neighbor 10.1.255.2 remote-as 64513R2(config-router)#R2(config-router)#network 172.16.255.0 mask 255.255.255.252R2(config-router)#network 10.1.255.0 mask 255.255.255.252R2(config-router)#exitR2(config)#exitR2#R3(config)#router bgp 6
4、4513R3(config-router)#neighbor 10.1.255.1 remote-as 64512R3(config-router)#R3(config-router)#network 10.1.255.0 mask 255.255.255.252R3(config-router)#network 192.168.0.0R3(config-router)#network 192.168.1.0R3(config-router)#network 192.168.2.0R3(config-router)#network 192.168.3.0R3(config-router)#ex
5、itR3(config)#3、查看BGP的邻居关系:R1#show ip bgp neighbors BGP neighbor is 172.16.255.2, remote AS 64512, internal link BGP version 4, remote router ID 172.16.255.2 BGP state = Established, up for 00:29:25 Last read 00:00:24, hold time is 180, keepalive interval is 60 seconds Neighbor capabilities: Route re
6、fresh: advertised and received(old & new) Address family IPv4 Unicast: advertised and received Message statistics: InQ depth is 0 OutQ depth is 0 Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 1 4 Keepalives: 32 32 Route Refresh: 0 0 Total: 34 37 Default minimum time between advertisement runs is
7、5 seconds4、查看简洁BGP汇总信息:R2#show ip bgp summary BGP router identifier 172.16.255.2, local AS number 64512BGP table version is 19, main routing table version 1910 network entries using 1010 bytes of memory11 path entries using 528 bytes of memory3 BGP path attribute entries using 180 bytes of memory1 B
8、GP AS-PATH entries using 24 bytes of memory0 BGP route-map cache entries using 0 bytes of memory0 BGP filter-list cache entries using 0 bytes of memoryBGP using 1742 total bytes of memoryBGP activity 14/4 prefixes, 16/5 paths, scan interval 60 secsNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Dow
9、n State/PfxRcd10.1.255.2 4 64513 47 49 19 0 0 00:10:15 5172.16.255.1 4 64512 42 45 19 0 0 00:37:53 4R2#5、查看R1的路由表:R1#show ip route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masksC 172.16.255.0/30 is directly connected, FastEthernet0/0C 172.16.0.0/24 is direc
10、tly connected, Loopback0C 172.16.1.0/24 is directly connected, Loopback0C 172.16.2.0/24 is directly connected, Loopback0C 172.16.3.0/24 is directly connected, Loopback0 10.0.0.0/30 is subnetted, 1 subnetsB 10.1.255.0 200/0 via 172.16.255.2, 00:48:22B 192.168.0.0/24 200/0 via 10.1.255.2, 00:22:27B 19
11、2.168.1.0/24 200/0 via 10.1.255.2, 00:22:27B 192.168.2.0/24 200/0 via 10.1.255.2, 00:22:27B 192.168.3.0/24 200/0 via 10.1.255.2, 00:22:27R1#6、另外一些命令:R1#clear ip bgp *R1#clear ip bgp 172.16.255.2R1#clear ip bgp * soft7、实验完成。Lab 2. Configuring BGP Using Loopback Addresses实验目的:1、掌握基于回环口的BGP的邻居关系建立的配置方法
12、。2、理解需要使用回环口为目的。实验拓扑图:实验步骤及要求:1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。2、配置AS 64512自治系统的RIPv2路由协议。R1(config)#router rip R1(config-router)#network 172.16.0.0R1(config-router)#version 2R1(config-router)#no auto-summaryR1(config-router)#exitR2(config)#router rip R2(config-router)#no auto-summary R2(conf
13、ig-router)#version 2R2(config-router)#network 172.16.0.0R2(config-router)#exit3、首先在R1和R2上使用回环口创建邻居关系,配置如下:R1(config)#router bgp 64512R1(config-router)#network 172.16.0.0 mask 255.255.255.0R1(config-router)#network 172.16.1.0 mask 255.255.255.0 R1(config-router)#neighbor 172.16.16.1 remote-as 64512R1
14、(config-router)#exitR2(config)#router bgp 64512R2(config-router)#network 172.16.255.0 mask 255.255.255.252R2(config-router)#network 10.1.255.0 mask 255.255.255.252R2(config-router)#R2(config-router)#neighbor 172.16.0.1 remote-as 64512R2(config-router)#exit4、由于BGP在创建对等体时,需要时间较长。所以,需要等待一段时间。然后再查看R1和R2
15、的BGP Summary信息。R1#show ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd172.16.16.1 4 64512 0 0 0 0 0 never ActiveR1#R2#show ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd172.16.0.1 4 64512 0 0 0 0 0 never ActiveR2#5、在R1路由器开启对BGP的调试:
16、R1#debug ip bgp in*Mar 30 11:42:34.607: BGP: 172.16.16.1 multihop open delayed 19731ms (no route)*Mar 30 11:42:54.339: BGP: 172.16.16.1 multihop open delayed 17735ms (no route)*Mar 30 11:43:12.075: BGP: 172.16.16.1 multihop open delayed 17459ms (no route)*Mar 30 11:43:29.535: BGP: 172.16.16.1 multih
17、op open delayed 14687ms (no route)6、由于R1和R2是同一个自治系统,所以我们使用RIPv2协议来解决路由不可达的问题,同时还要在BGP协议中指出使用回环口配置邻居关系,具体配置如下:R1(config)#router rip R1(config-router)#version 2R1(config-router)#no auto-summary R1(config-router)#R1(config-router)#network 172.16.0.0R1(config-router)#exitR1(config)#R1(config)#router bgp
18、 64512R1(config-router)#neighbor 172.16.16.1 update-source loopback 0R1(config-router)#exitR2(config)#router rip R2(config-router)#version 2R2(config-router)#no auto-summary R2(config-router)#network 172.16.0.0R2(config-router)#exitR2(config)#R2(config)#router bgp 64512R2(config-router)#neighbor 172
19、.16.0.1 update-source loopback 0R2(config-router)#exit7、稍等片刻或是直接clear ip bgp *后,再次查看R1的BGP summary信息:R1#sh ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd172.16.16.1 4 64512 5 5 6 0 0 00:00:20 2R1#8、再次配置R2与R3使用回环口创建eBGP邻居关系:R2(config)#router bgp 64512R2(config-route
20、r)#neighbor 192.168.0.1 remote-as 64513R2(config-router)#neighbor 192.168.0.1 update-source loopback 0R2(config-router)#neighbor 192.168.0.1 ebgp-multihop 2R2(config-router)#exitR2(config)#ip route 192.168.0.1 255.255.255.255 10.1.255.2R3(config)#router bgp 64513R3(config-router)#neighbor 172.16.16.
21、1 remote-as 64512R3(config-router)#neighbor 172.16.16.1 update-source loopback 0R3(config-router)#neighbor 172.16.16.1 ebgp-multihop 2R3(config-router)#R3(config-router)#network 192.168.0.0R3(config-router)#network 192.168.1.0R3(config-router)#network 10.1.255.0 mask 255.255.255.252R3(config-router)
22、#exitR3(config)#ip route 172.16.16.1 255.255.255.255 10.1.255.19、在R2上观察BGP的邻居关系状态:R2#show ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd172.16.0.1 4 64512 19 20 9 0 0 00:14:11 2192.168.0.1 4 64513 5 6 9 0 0 00:00:10 3R2#10、实验完成。Lab 3. Understand BGP Auto-Summary实验目
23、的:1、理解BGP的自动汇总特性。实验拓扑图:实验步骤及要求:1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。2、首先配置各路由器的邻居关系,并通过相关命令确认邻居关系的状态。配置如下: R1(config)#router bgp 64512R1(config-router)#neighbor 172.16.255.2 remote-as 64512R1(config-router)#exitR2(config)#router bgp 64512 R2(config-router)#neighbor 172.16.255.1 remote-as 64512R2(
24、config-router)#neighbor 10.1.255.2 remote-as 64513R2(config-router)#exitR3(config)#router bgp 64513R3(config-router)#neighbor 10.1.255.1 remote-as 64512R3(config-router)#exit9、在R2上观察BGP的邻居关系状态:R2#sh ip bgp summary BGP router identifier 172.16.16.1, local AS number 64512BGP table version is 1, main r
25、outing table version 1Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.1.255.2 4 64513 5 5 1 0 0 00:01:01 0172.16.255.1 4 64512 5 5 1 0 0 00:01:46 0R2#4、查看R1的BGP的协议属性:R1#show ip protocols Routing Protocol is bgp 64512 Outgoing update filter list for all interfaces is not set Inco
26、ming update filter list for all interfaces is not set IGP synchronization is disabled Automatic route summarization is disabled Neighbor(s): Address FiltIn FiltOut DistIn DistOut Weight RouteMap 172.16.255.2 Maximum path: 1 Routing Information Sources: Gateway Distance Last Update Distance: external
27、 20 internal 200 local 200R1#5、在R1作如下配置:R1(config)#router bgp 64512R1(config-router)#network 172.16.0.0R1(config-router)#exit6、在R2上使用clear ip bgp * soft命令,加快BGP的收敛后,查看R2的路由表和summary信息:R2#show ip bgp summary BGP router identifier 172.16.16.1, local AS number 64512BGP table version is 1, main routing
28、table version 1Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.1.255.2 4 64513 12 12 1 0 0 00:08:29 0172.16.255.1 4 64512 13 13 1 0 0 00:09:14 0R2#R2#show ip route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.255.0/30 is direc
29、tly connected, FastEthernet0/0C 172.16.16.0/24 is directly connected, Loopback0 10.0.0.0/30 is subnetted, 1 subnetsC 10.1.255.0 is directly connected, Serial1/1R2#7、问题分析:BGP协议在将某路由通告给自己的邻居对等体时,会检查路由是否同步和本地路由表中是否已经存在此条路由。本实验中R2没有学习到R1的路由的主要问题并不是同步,而是R1的路由表中没有关于172.16.0.0/16子网的路由。8、在R1上查看BGP对172.16.0.
30、0/16网络路由描述:R1#show ip bgp 172.16.0.0% Network not in tableR1#9、在R1作如下配置:R1(config)#router bgp 64512R1(config-router)#auto-summary R1(config-router)#exitR1(config)#exit10、再次查看R2路由表:R2#show ip route Gateway of last resort is not set 172.16.0.0/16 is variably subnetted, 3 subnets, 3 masksC 172.16.255.0
31、/30 is directly connected, FastEthernet0/0C 172.16.16.0/24 is directly connected, Loopback0B 172.16.0.0/16 200/0 via 172.16.255.1, 00:01:23 10.0.0.0/30 is subnetted, 1 subnetsC 10.1.255.0 is directly connected, Serial1/1R2#R2#show ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.1.255.2 4 64
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1