CCNP试验手册BGP单人版.docx
《CCNP试验手册BGP单人版.docx》由会员分享,可在线阅读,更多相关《CCNP试验手册BGP单人版.docx(14页珍藏版)》请在冰豆网上搜索。
CCNP试验手册BGP单人版
路由协议,AS(自治系统)角度来区分成:
1.IGP内部网关路由协议
RIP(路由信息协议)-----udp520端口
EIGRP(增强型内部网关路由协议)
OSPF(开放式最短路径优先路由协议)
ISIS(中间系统到中间系统路由协议)
2.EGP外部网关路由协议
BGP(边界网关路由协议)----tcp/ip卷2(人邮)
特点:
1.稳定性强
1)使用tcp协议传输,端口号179。
2)基于TLV(类型,长度,字符串)开发。
3)定期有keepalive来保持连接状态。
4)Bgp都是通过单播手动方式建立邻居关系。
2.选路比较精准
13条选路原则
3.路由的控制能力很强
丰富的命令和工具来实现路由的控制
4.维护的路由条目数量最多,internet(30万条)
Bgp的应用领域
1.运营商之间的核心设备的路由传递
2.企业和企业之间也可能采用bgp,为了实现稳定和控制
3.多宿主的企业要实现专线的负载均衡
BGP的前身叫EGP,EGP被BGP所取代的原因在于不能防环。
BGP选路也是可以看跳数(一个AS),它也是距离矢量,又叫路径向量。
在计算跳数是,路由里传递时会携带所经过的as的as号,并且详细标注是哪些as,此属性我们叫AS-path属性,此属性既可以计算跳数,又可以用来防环。
当路由器收到bgp路由里边as-path属性中,包含了自身的as号,就可以判断为环路路由,置为无效路由。
AS1-R3(config)#routerbgp1建立bgp进程,后边指定AS号,一个路由器只能配置一个bgp进程。
AS1-R1(config-router)#neighbor11.1.31.2remote-as2手动指定对方地址和as号
AS2-r3(config-router)#doshowipbgpneighbor
看established
AS1-R1(config-router)#doshowipbgpsummary
BGProuteridentifier1.1.1.1,localASnumber1
BGPtableversionis1,mainroutingtableversion1
NeighborV版本ASMsgRcvdMsgSentTblVerInQOutQUp/DownState/PfxRcd
11.1.31.2424410000:
00:
360(表示从邻居那学到了几条路由,0表示没学到任何路由,但邻居正常)
不同AS的路由器的邻居关系叫EBGP
相同AS的路由器的邻居关系叫IBGP
1难点:
路由黑洞:
由于中间路由器没有运行BGP,所以导致数据无法传递。
1).把bgp路由重分布到IGP路由,但用的不多,因为只能重分布少量路由。
2).全部运行BGP
3).内部运行MPLS(多协议标签交换)
邻居关系最好基于loopback接口建立,在具备多条物理线路可以实现冗余备份。
AS1-R1(config-router)#neighbor1.2.2.2remote-as1建立IBGP邻居关系
AS1-R1(config-router)#neighbor1.2.2.2update-sourceloopback0指定R1使用自己的lo0和对方建立邻居关系,指定和某个邻居的更新源接口
AS1-R2(config-router)#bgprouter-id1.2.2.2配置bgp的router-id
AS1-R2(config)#intlo1
AS1-R2(config-if)#ipadd111.1.1.1255.255.255.0
AS1-R2(config-if)#routerbgp1
AS1-R2(config-router)#network111.1.1.0mask255.255.255.0通告路由,它会准确的匹配路由表里的相应路由,然后通过bgp邻居宣告;可以宣告非自身的路由。
Bgp会有三张表
邻居表:
存储所有的邻居
Showipbgpneighbor
Showipbgpsummary
Bgp拓扑表:
存储所有的路径
Showipbgp
路由表:
最佳路径放置到路由表,又叫转发表
Showiproutebgp
AS1-R2(config-router)#doshowipbgp
BGPtableversionis2,localrouterIDis1.2.2.2
Statuscodes:
ssuppressed,ddamped,hhistory,*valid,>best,i-internal,
rRIB-failure,SStale
Origincodes:
i-IGP,e-EGP,?
-incomplete
NetworkNextHopMetricLocPrfWeightPath
*>111.1.1.0/240.0.0.0032768i
*i222.2.2.011.1.13.2010002i
*i11.1.31.2010002i
2难点:
bgp路由的下一条不可达
1.通过IGP通告边界网段
2.修改路由的下一跳为自身,改成可达的下一跳。
AS1-R1(config-router)#routerbgp1
AS1-R1(config-router)#nei1.2.2.2next-hop-self修改传递路由的下一跳自身
AS1-R3(config)#routerbgp1
AS1-R3(config-router)#nei1.2.2.2next-hop-self修改传递路由的下一跳自身
3难点:
bgp的水平分割,bgp的路由器不会把从ibgp邻居学到的路由再传递给另外一个ibgp邻居。
1.full-mesh(全互联)的ibgp邻居关系
2.路由反射器,可以把hub路由器作为一个反射器,把从ibgp邻居学到的最好的路由反射给另外一个ibgp邻居。
AS1-R2(config-router)#nei1.1.1.1route-reflector-client
AS1-R2(config-router)#nei1.3.3.3route-reflector-client
3.联盟
Showipbgp
NetworkNextHopMetricLocPrfWeightPath
*>111.1.1.0/240.0.0.0032768i
*i222.2.2.011.1.13.2010002i(起源属性)
*i11.1.31.2010002i
Aspath属性后边的表示起源属性,表示此路由怎么出现的,可以是bgp通告i,也可以是egp通告e,也可以其他路由协议重分布到bgp?
。
i>e>?
EBGP管理距离20
IBGP管理距离200
MED多出口离开属性:
可以影响自身AS和邻居AS(对比前提需要多条路径通过的as是一致的,否则不会对比此属性)。
LocalPRF本地优先权:
可以影响本AS。
Weight权重:
只能影响自身。
•Permit850
任何包含850的字符串(850,6850,…)的as-path
•Permit_850$
起源于850的路由as-path
•Permit^850$
只能包含唯一的850字符串的as-path
•Permit^$
一个空的as-path,表示只能通告本as始发的bgp路由
•Permit.*
表示任何字符串,permitany
Router(config)#ipas-pathaccess-list10permit_65020$
Router(config)#route-mapfrom65020permit1
Router(config-route-map)#matchas-path10
Router(config-route-map)#setweight10
Router(config-route-map)#exit
Router(config)#route-mapfrom65020permit2
Router(config-route-map)#routerbgp1
Router(config-router)#nei1.1.1.1route-mapfrom65020in
第一步:
初始配置
Router(config)#hostnameAS1-r1(根据路由器适当调整)
AS1-r1(config)#noipdomain-lookup
AS1-r1(config)#linecon0
AS1-r1(config-line)#noexec-timeout
AS1-r1(config-line)#loggsy
第二步:
地址配置
AS1-r1(config)#intlo0
AS1-r1(config-if)#ipadd1.1.1.1255.255.255.0
AS1-r1(config-if)#ipospfnetworkpoint-to-point
AS1-r1(config-if)#ints1/1
AS1-r1(config-if)#ipadd10.1.12.1255.255.255.0
AS1-r1(config-if)#noshu
AS1-r1(config-if)#intf0/0
AS1-r1(config-if)#ipadd11.1.21.1255.255.255.0
AS1-r1(config-if)#noshu
AS1-r2(config)#intlo0
AS1-r2(config-if)#ipadd1.2.2.2255.255.255.0
AS1-r2(config-if)#ipospfnetworkpoint-to-point
AS1-r2(config-if)#ints1/0
AS1-r2(config-if)#ipadd10.1.12.2255.255.255.0
AS1-r2(config-if)#noshu
AS1-r2(config-if)#ints1/1
AS1-r2(config-if)#ipadd10.1.23.2255.255.255.0
AS1-r2(config-if)#noshu
AS1-r3(config)#intlo0
AS1-r3(config-if)#ipadd1.3.3.3255.255.255.0
AS1-r3(config-if)#ipospfnetworkpoint-to-point
AS1-r3(config-if)#ints1/0
AS1-r3(config-if)#ipadd10.1.23.3255.255.255.0
AS1-r3(config-if)#noshu
AS1-r3(config-if)#intf0/0
AS1-r3(config-if)#ipadd11.1.12.1255.255.255.0
AS1-r3(config-if)#noshu
AS2-r1(config)#intlo0
AS2-r1(config-if)#ipadd2.1.1.1255.255.255.0
AS2-r1(config-if)#ipospfnetworkpoint-to-point
AS2-r1(config-if)#ints1/1
AS2-r1(config-if)#ipadd10.2.12.1255.255.255.0
AS2-r1(config-if)#noshu
AS2-r1(config-if)#intf0/0
AS2-r1(config-if)#ipadd11.1.21.2255.255.255.0
AS2-r1(config-if)#noshu
AS2-r2(config)#intlo0
AS2-r2(config-if)#ipadd2.2.2.2255.255.255.0
AS2-r2(config-if)#ipospfnetworkpoint-to-point
AS2-r2(config-if)#ints1/0
AS2-r2(config-if)#ipadd10.2.12.2255.255.255.0
AS2-r2(config-if)#noshu
AS2-r2(config-if)#ints1/1
AS2-r2(config-if)#ipadd10.2.23.2255.255.255.0
AS2-r2(config-if)#noshu
AS2-r3(config)#intlo0
AS2-r3(config-if)#ipadd2.3.3.3255.255.255.0
AS2-r3(config-if)#ipospfnetworkpoint-to-point
AS2-r3(config-if)#ints1/0
AS2-r3(config-if)#ipadd10.2.23.3255.255.255.0
AS2-r3(config-if)#noshu
AS2-r3(config-if)#intf0/0
AS2-r3(config-if)#ipadd11.1.12.2255.255.255.0
AS2-r3(config-if)#noshu
第三步:
配置IGP---OSPF
AS1-r1(config)#routerospf1
AS1-r1(config-router)#net10.1.12.00.0.0.255area0
AS1-r1(config-router)#net1.1.1.00.0.0.255area0
AS1-r2(config-if)#routerospf1
AS1-r2(config-router)#net10.1.0.00.0.255.255area0
AS1-r2(config-router)#net1.2.2.00.0.0.255area0
AS1-r3(config-if)#routerospf1
AS1-r3(config-router)#net10.1.23.00.0.0.255area0
AS1-r3(config-router)#net1.3.3.00.0.0.255area0
AS2-r1(config-if)#routerospf1
AS2-r1(config-router)#net10.2.12.00.0.0.255area0
AS2-r1(config-router)#net2.1.1.00.0.0.255area0
AS2-r2(config-if)#routerospf1
AS2-r2(config-router)#net10.2.0.00.0.255.255area0
AS2-r2(config-router)#net2.2.2.00.0.0.255area0
AS2-r3(config-if)#routerospf1
AS2-r3(config-router)#net10.2.23.00.0.0.255area0
AS2-r3(config-router)#net2.3.3.00.0.0.255area0
第三步:
配置BGP
3.1建立BGP邻居
建立EBGP邻居
AS1-r1(config)#routerbgp1
AS1-r1(config-router)#neighbor11.1.21.2remote-as2
AS2-r1(config-router)#routerbgp2
AS2-r1(config-router)#nei11.1.21.1remote-as1
AS2-r3(config-router)#routerbgp2
AS2-r3(config-router)#neighbor11.1.12.1remote-as1
AS1-r3(config-router)#routerbgp1
AS1-r3(config-router)#neighbor11.1.12.2remote-as2
察看邻居关系
*Apr2220:
38:
54.155:
%BGP-5-ADJCHANGE:
neighbor11.1.21.1Up
AS2-r1(config-router)#doshipbgpsummary
BGProuteridentifier2.1.1.1,localASnumber2
BGPtableversionis1,mainroutingtableversion1
NeighborVASMsgRcvdMsgSentTblVerInQOutQUp/DownState/PfxRcd
11.1.21.1414410000:
00:
580
AS2-r1(config-router)#doshipbgpnei
BGPneighboris11.1.21.1,remoteAS1,externallink
BGPversion4,remoterouterID1.1.1.1
BGPstate=Established,upfor00:
02:
15
建立IBGP邻居
AS1-r3(config-router)#routerbgp1
AS1-r3(config-router)#neighbor11.1.12.2remote-as2
AS2-r3(config-router)#routerbgp2
AS2-r3(config-router)#neighbor11.1.12.1remote-as1
AS1-r2(config-router)#routerbgp1
AS1-r1(config-router)#neighbor1.2.2.2remote-as1
AS1-r1(config-router)#neighbor1.2.2.2update-sourceloopback0
AS1-r2(config-router)#routerbgp1
AS1-r2(config-router)#neighbor1.1.1.1remote-as1
AS1-r2(config-router)#neighbor1.1.1.1update-sourceloopback0
AS1-r2(config-router)#neighbor1.3.3.3remote-as1
AS1-r2(config-router)#neighbor1.3.3.3update-sourceloopback0
AS1-r3(config)#routerbgp1
AS1-r3(config-router)#neighbor1.2.2.2remote-as1
AS1-r3(config-router)#neighbor1.2.2.2update-sourceloopback0
AS2-r1(config)#routerbgp2
AS2-r1(config-router)#neighbor2.2.2.2remote-as2
AS2-r1(config-router)#neighbor2.2.2.2update-sourceloopback0
AS2-r2(config)#routerbgp2
AS2-r2(config-router)#neighbor2.1.1.1remote-as2
AS2-r2(config-router)#neighbor2.1.1.1update-sourceloopback0
AS2-r2(config-router)#neighbor2.3.3.3remote-as2
AS2-r2(config-router)#neighbor2.3.3.3update-sourceloopback0
AS2-r3(config-router)#routerbgp2
AS2-r3(config-router)#nei2.2.2.2remote-as2
AS2-r3(config-router)#nei2.2.2.2update-sourceloopback0
第四步:
通告路由
AS1-r2(config)#intlo1
AS1-r2(config-if)#ipadd20.1.1.1255.255.255.0
AS1-r2(config-if)#routerbgp1
AS1-r2(config-router)#network20.1.1.0mask255.255.255.0
AS2-r2(config)#intlo1
AS2-r2(config-if)#ipadd20.2.1.1255.255.255.0
AS2-r2(config)#routerbgp2
AS2-r2(config-router)#net20.2.1.0mask255.255.255.0
在r2上发现路由下一跳不可达问题
AS1-r2#shipbgp
BGPtableversionis2,localrouterIDis1.2.2.2
Statuscodes:
ssuppressed,ddamped,hhistory,*valid,>best,i-internal,
rRIB-failure,SStale
Origincodes:
i-IGP,e-EGP,?
-incomplete
NetworkNextHopMetricLocPrfWeightPath
*>20.1.1.0/240.0.0.0032768i
*i20.2.1.0/2411.1.12.2010002i
*i11.1.21.2010002i
解决方案一:
重分布边界网络
AS1-r3(config)#routerospf1
AS1-r3(config-router)#redistributeconnectedsubnets
AS2-r3(config)#routerospf1
AS2-r3(config-router)#redistributeconnectedsubnets
AS1-r2#shipbgp
BGPtableversionis3,localrouterIDis1.2.2.2
Statuscodes:
ssuppressed,ddamped,hhistory,