Lab1.ConfiguringBasicBGP实验目的:1、掌握BGP的基本配置方法。2、掌握如何查看BGP的各种配置信息。实验拓扑图:实验步骤及要求:1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。2、在R1、R2和R3配置BGP路由协议,具体配置如下:R1(config)#routerbgp64512R1(config-router)#neighbor172.16.255.2remote-as64512R1(config-router)#R1(config-router)#network172.16.255.0mask255.255.255.252R1(config-router)#network172.16.0.0mask255.255.255.0R1(config-router)#network172.16.1.0mask255.255.255.0R1(config-router)#network172.16.2.0mask255.255.255.0R1(config-router)#network172.16.3.0mask255.255.255.0R1(config-router)#exitR1(config)#R2(config)#routerbgp64512R2(config-router)#neighbor172.16.255.1remote-as64512R2(config-router)#neighbor10.1.255.2remote-as64513R2(config-router)#R2(config-router)#network172.16.255.0mask255.255.255.252R2(config-router)#network10.1.255.0mask255.255.255.252R2(config-router)#exitR2(config)#exitR2#R3(config)#routerbgp64513R3(config-router)#neighbor10.1.255.1remote-as64512R3(config-router)#R3(config-router)#network10.1.255.0mask255.255.255.252R3(config-router)#network192.168.0.0R3(config-router)#network192.168.1.0R3(config-router)#network192.168.2.0R3(config-router)#network192.168.3.0R3(config-router)#exitR3(config)#3、查看BGP的邻居关系:R1#showipbgpneighborsBGPneighboris172.16.255.2,remoteAS64512,internallinkBGPversion4,remoterouterID172.16.255.2BGPstate=Established,upfor00:29:25Lastread00:00:24,holdtimeis180,keepaliveintervalis60secondsNeighborcapabilities:Routerefresh:advertisedandreceived(old&new)AddressfamilyIPv4Unicast:advertisedandreceivedMessagestatistics:InQdepthis0OutQdepthis0SentRcvdOpens:11Notifications:00Updates:14Keepalives:3232RouteRefresh:00Total:3437Defaultminimumtimebetweenadvertisementrunsis5seconds…………4、查看简洁BGP汇总信息:R2#showipbgpsummaryBGProuteridentifier172.16.255.2,localASnumber64512BGPtableversionis19,mainroutingtableversion1910networkentriesusing1010bytesofmemory11pathentriesusing528bytesofmemory3BGPpathattributeentriesusing180bytesofmemory1BGPAS-PATHentriesusing24bytesofmemory0BGProute-mapcacheentriesusing0bytesofmemory0BGPfilter-listcacheentriesusing0bytesofmemoryBGPusing1742totalbytesofmemoryBGPactivity14/4prefixes,16/5paths,scaninterval60secsNeighborVASMsgRcvdMsgSentTblVerInQOutQUp/DownState/PfxRcd10.1.255.24645134749190000:10:155172.16.255.14645124245190000:37:534R2#5、查看R1的路由表:R1#showiprouteGatewayoflastresortisnotset172.16.0.0/16isvariablysubnetted,5subnets,2masksC172.16.255.0/30isdirectlyconnected,FastEthernet0/0C172.16.0.0/24isdirectlyconnected,Loopback0C172.16.1.0/24isdirectlyconnected,Loopback0C172.16.2.0/24isdirectlyconnected,Loopback0C172.16.3.0/24isdirectlyconnected,Loopback010.0.0.0/30issubnetted,1subnetsB10.1.255.0[200/0]via172.16.255.2,00:48:22B192.168.0.0/24[200/0]via10.1.255.2,00:22:27B192.168.1.0/24[200/0]via10.1.255.2,00:22:27B192.168.2.0/24[200/0]via10.1.255.2,00:22:27B192.168.3.0/24[200/0]via10.1.255.2,00:22:27R1#6、另外一些命令:R1#clearipbgp*R1#clearipbgp172.16.255.2R1#clearipbgp*soft7、实验完成。Lab2.ConfiguringBGPUsingLoopbackAddresses实验目的:1、掌握基于回环口的BGP的邻居关系建立的配置方法。2、理解需要使用回环口为目的。实验拓扑图:实验步骤及要求:1、配置各台路由器的IP地址,并且使用Ping命令确认各路由器的直连口的互通性。2、配置AS64512自治系统的RIPv2路由协议。R1(config)#routerripR1(config-router)#network172.16.0.0R1(config-router)#version2R1(config-router)#noauto-summaryR1(config-router)#exitR2(config)#routerripR2(config-router)#noauto-summaryR2(config-router)#version2R2(config-router)#network172.16.0.0R2(config-router)#exit3、首先在R1和R2上使用回环口创建邻居关系,配置如下:R1(config)#routerbgp64512R1(config-router)#network172.16.0.0mask255.255.255.0R1(config-router)#network172.16.1.0mask255.255.255.0R1(config-router)#neighbor172.16.16.1remote-as64512R1(config-router)#exitR2(config)#routerbgp64512R2(config-router)#network172.16.255.0mask255.255.255.252R2(config-router)#network10.1.255.0mask255.255.255.252R2(config-router)#R2(config-router)#neighbor172.16.0.1remote-as64512R2(config-router)#exit4、由于BGP在创建对等体时,需要时间较长。所以,需要等待一段时间。然后再查看R1和R2的BGPSummary信息。R1#showipbgpsummaryNeighborVASMsgRcvdMsgSentTblVerInQOutQUp/DownState/PfxRcd172.16.16.146451200000neverActiveR1#R2#showipbgpsummaryNeighborVASMsgRcvdMsgSentTblVerInQOutQUp/DownState/PfxRcd172.16.0.146451200000neverActiveR2#5、在R1路由器开启对BGP的调试:R1#debugipbgpin*Mar3011:42:34.607:BGP:172.16.16.1multihopopendelayed19731ms(noroute)*Mar3011:42:54.339:BGP:172.16.16.1multihopopendelayed17735ms(noroute)*Mar3011:43:12.075:BGP:172.16.16.1multihopopendelayed17459ms(noroute)*Mar3011:43:29.535:BGP:172.16.16.1multihopopendelayed14687ms(noroute)6、由于R1和R2是同一个自治系统,所以我们使用RIPv2协议来解决路由不可达的问题,同时还要在BGP协议中指出使用回环口配置邻居关系,具体配置如下:R1(config)#routerripR1(config-router)#version2R1(config-router)#noauto-summaryR1(config-router)#R1(config-router)#network172.16.0.0R1(config-router)#exitR1(config)#R1(config)#routerbgp64512R1(config-router)#neighbor172.16.16.1update-sourceloopback0R1(config-router)#exitR2(config)#routerripR2(config-router)#version2R2(config-router)#noauto-summaryR2(config-router)#network172.16.0.0R2(config-router)#exitR2(config)#R2(config)#routerbgp64512R2(config-router)#neighbor172.16.0.1update-sourceloopback0R2(config-router)#exit7、稍等片刻或是直接clearipbgp*后,再次查看R1