IBGP水平分割:从一个IBGP学到的BGP路由不会传到另一个IBGP
IBGP水平分割:从一个IBGP学到的BGP路由不会传到另一个IBGP解决办法RR(路由反射器)可以指定他的客户1、如果一条路由通过客户学习到,那么会反射到客户、非客户、EBGP邻居2、如果一条路由通过EBGP邻居学习到,那么会反射给客户、非客户、EBGP邻居3、如果一条路由通过非客户学习到,那么会反射给客户和EBGP邻居,不会反射给非客户R1(config)#int s2/1R1(config-if)#ip add 12.0.0.1 255.255.255.0R1(config-if)#no shuR1(config-if)#int lo0R1(config-if)#ip add 1.1.1.1 255.255.255.0R1(config-if)#do ping 12.0.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 24/58/96 msR1(config-if)#router bgp 100R1(config-router)#bgp router-id 1.1.1.1R1(config-router)#nei 12.0.0.2 remote-as 234R1(config-router)#net 1.1.1.0 mask 255.255.255.0R1(config-router)#*Sep 12 19:39:51.659: %BGP-5-ADJCHANGE: neighbor 12.0.0.2 UpR1(config-router)#do sh ip bgpBGP table version is 3, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 0.0.0.0 0 32768 i*> 5.5.5.0/24 12.0.0.2 0 234 500 iR1(config-router)#do sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback05.0.0.0/24 is subnetted, 1 subnetsB 5.5.5.0 [20/0] via 12.0.0.2, 00:05:0612.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial2/1R2(config)#int s2/1R2(config-if)#ip add 12.0.0.2 255.255.255.0R2(config-if)#no shuR2(config-if)#int s2/2R2(config-if)#ip add 23.0.0.2 255.255.255.0R2(config-if)#no shuR2(config-if)#do ping 23.0.0.3Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/65/144 msR2(config)#router eigrp 90R2(config-router)#no auR2(config-router)#net 23.0.0.0 0.0.0.255R2(config-router)#net 2.2.2.2 0.0.0.0R2(config-router)#int lo0R2(config-if)#ip add 2.2.2.2 255.255.255.255R2(config)#router bgp 234R2(config-router)#bgp router-id 2.2.2.2R2(config-router)#no synR2(config-router)#no auR2(config-router)#nei 3.3.3.3 remote-as 234R2(config-router)#nei 3.3.3.3 up lo0R2(config-router)#nei 12.0.0.1 remote-as 100R2(config-router)#*Sep 12 19:39:54.599: %BGP-5-ADJCHANGE: neighbor 12.0.0.1 UpR2(config-router)#exit*Sep 12 19:42:41.763: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR2(config-router)#do sh ip bgp sumBGP router identifier 2.2.2.2, local AS number 234BGP table version is 2, main routing table version 21 network entries using 101 bytes of memory1 path entries using 48 bytes of memory1 BGP path attribute entries using 60 bytes of memory1 BGP AS-PA TH 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 233 total bytes of memoryBGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secsNeighbor V AS MsgRcvd MsgSent TblV er InQ OutQ Up/Down State/PfxRcd 3.3.3.3 4 234 6 7 2 0 0 00:02:35 012.0.0.1 4 100 10 9 2 0 0 00:05:23 1R2(config-router)#do sh ip bgpBGP table version is 2, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 12.0.0.1 0 0 100 iR2(config)#router bgp 234R2(config-router)#nei 3.3.3.3 next-hop-self /R3开始学到了1.1.1.0/24没有优化的路由,因为下一跳不可达,要在R2上给R3指明next-hop-self *Sep 12 19:48:50.667: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR2(config-router)#do sh ip bgpBGP table version is 3, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 12.0.0.1 0 0 100 i*>i5.5.5.0/24 4.4.4.4 0 100 0 500 iR3(config)#int s2/1R3(config-if)#ip add 23.0.0.3 255.255.255.0R3(config-if)#no shuR3(config-if)#ip add 34.0.0.3 255.255.255.0R3(config-if)#no shuR3(config-if)#do ping 34.0.0.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 20/68/112 msR3(config-if)#router eigrp 90R3(config-router)#no auR3(config-router)#net 23.0.0.0 0.0.0.255R3(config-router)#net 34.0.0.0 0.0.0.255R3(config-router)#net 3.3.3.3 0.0.0.0R3(config-router)#int lo0R3(config-if)#ip add 3.3.3.3 255.255.255.255R3(config-if)#router bgp 234R3(config-router)#bgp rouR3(config-router)#bgp router-id 3.3.3.3R3(config-router)#no synR3(config-router)#no auR3(config-router)#nei 2.2.2.2 remote-as 234R3(config-router)#nei 2.2.2.2 up lo0R3(config-router)#nei 4.4.4.4 remote-as 234R3(config-router)#nei 4.4.4.4 up lo0*Sep 12 19:42:54.131: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 UpR3(config-router)#*Sep 12 19:43:06.723: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 UpR3(config-router)#do sh ip bgp/因为下一跳不可达BGP table version is 1, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path * i1.1.1.0/24 12.0.0.1 0 100 0 100 i * i5.5.5.0/24 45.0.0.5 0 100 0 500 i R3(config-router)#do sh ip bgpBGP table version is 2, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 2.2.2.2 0 100 0 100 i* i5.5.5.0/24 45.0.0.5 0 100 0 500 iR3(config-router)#do sh ip bgp/下一跳可达,在R2和R4上做next-hop-selfBGP table version is 3, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*>i1.1.1.0/24 2.2.2.2 0 100 0 100 i*>i5.5.5.0/24 4.4.4.4 0 100 0 500 iR3(config)#router bgp 234R3(config-router)#nei 2.2.2.2 route-reflector-client /指明R2为自己的客户,符合第一条R3(config-router)#*Sep 12 19:48:33.619: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down RR client config change R3(config-router)#*Sep 12 19:49:03.139: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 UpR3(config-router)#R4(config)#int s2/1R4(config-if)#ip add 34.0.0.4 255.255.255.0R4(config-if)#no shuR4(config-if)#int s2/2R4(config-if)#ip add 45.0.0.4 255.255.255.0R4(config-if)#no shuR4(config-if)#do ping 45.0.0.5Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 45.0.0.5, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 4/66/156 msR4(config-if)#router eigrp 90R4(config-router)#no auR4(config-router)#net 34.0.0.0 0.0.0.255R4(config-router)#net 4.4.4.4 0.0.0.0R4(config-router)#int lo0R4(config-if)#ip add 4.4.4.4 255.255.255.255R4(config-if)#router bgp 234R4(config-router)#bgp rouR4(config-router)#bgp router-id 4.4.4.4R4(config-router)#no synR4(config-router)#no auR4(config-router)#nei 3.3.3.3 remote-as 234R4(config-router)#nei 3.3.3.3 up lo0R4(config-router)#nei 45.0.0.5 remote-as 500R4(config-router)#*Sep 12 19:41:59.647: %BGP-5-ADJCHANGE: neighbor 45.0.0.5 UpR4(config-router)#*Sep 12 19:43:10.147: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR4(config-router)#do sh ip bgpBGP table version is 2, local router ID is 4.4.4.4Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *> 5.5.5.0/24 45.0.0.5 0 0 500 i R4(config-router)#exitR4(config)#router bgp 234R4(config-router)#nei 3.3.3.3 next-hop-selfR4(config-router)#do sh ip bgpBGP table version is 3, local router ID is 4.4.4.4Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 2.2.2.2 0 100 0 100 i *> 5.5.5.0/24 45.0.0.5 0 0 500 iR5(config)#int s2/2R5(config-if)#ip add 45.0.0.5 255.255.255.0R5(config-if)#no shuR5(config-if)#int lo0R5(config-if)#ip add 5.5.5.5 255.255.255.0R5(config-if)#router bgp 500R5(config-router)#bgp rouR5(config-router)#bgp router-id 5.5.5.5R5(config-router)#no synR5(config-router)#no auR5(config-router)#nei 45.0.0.4 remote-as 234R5(config-router)#net 5.5.5.0 mask 255.255.255.0R5(config-router)#do sh ip bgpBGP table version is 3, local router ID is 5.5.5.5Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 45.0.0.4 0 234 100 i *> 5.5.5.0/24 0.0.0.0 0 32768 iR5(config-router)#do sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsB 1.1.1.0 [20/0] via 45.0.0.4, 00:05:295.0.0.0/24 is subnetted, 1 subnetsC 5.5.5.0 is directly connected, Loopback045.0.0.0/24 is subnetted, 1 subnetsC 45.0.0.0 is directly connected, Serial2/2。
BGP.a理论
BGP可以将路由协议分为内部网关协议IGP 外部网关协议EGP,目前使用最广的EGP是BGP版本4 BGP被称为路径向量路由协议,它的任务是在自治系统之间交换路由信息,同时确保没有路由环路BGP的特征用属性描述路径,而不用度量值;使用TCP179端口作为传输协议,继承了TCP的可靠性和面向连接的特性;通过Keepalive信息来检验TCP连接;具有丰富的属性特征,方便实现基于策略的路由;拥有自己的BGP表;支持VLSM和CIDR;适合在大型网路中使用BGP常用术语对等体peer:当两台BGP路由器之间建立了一条基于TCP的连接后,就称它们为邻居或对等体AS:是一组处于统一管理控制和策略下的路由器或主机、AS号是由Internet 注册机构分配,范围为1~65535,其中64512~65535是私有使用IBGP:当BGP在一个AS内运行时,被称为内部BUG(IBGP)EBGP:当BGP运行在AS之间时,被称为外部BUG(EBGP)NLRI:BGP通过NLRI支持CIDR,NLRI是BGP更新报文的一部分,用于列出可到达目的地的集合同步:在BGP能够通告路由之前,该路由必须存在于当前的IP路由表中,也就是说,BGP和IGP必须在网络能被通告前同步,Cisco允许通过命令no synchronization来关闭同步IBGP水平分割:通过IGBP学到的路由不能通告给其它的IBGP邻居BGP属性公认必遵:BGP更新报文中必须包含的,且必须被所有BGP厂商实现所能识别的属性包括ORIGIN,AS_PATH和Next_Hop.a.ORIGIN(起源):这个属性说明了源路由是怎样放到BGP表中的,有3个可能的源—IGP,EGP,INCOMPLETE.路由器在多个路由选择的处理中使用这个信息。
路由器选择具有最低ORINIG类型的路径,ORINIG类型从低到高的顺序为IGP<EGP<INCOMPLETEb.AS_PATH(AS路径):指出包含在UPDATE报文中的路由信息所经过的自治系统的序列c.Next_HOP(下一跳):声明路由器所获得的BGP路由的下一跳,对EBGP会话来说,下一跳就是通告该路由的邻居路由器的源地址。
RIP EIGRP BGP OSPF的防环机制
RIP 防环机制:
1.设置最大跳数(默认15,16条为不可达);
2.水平分割:从某接口收到的路由信息不会再从该接口发送出去;
3.毒性逆转:从某接口收到的路由信息会从该接口发送出去,但是该路由信息被设置
为不可达;
4.路由毒化
5.触发更新;
EIGRP 防环机制:
1.在主网络边界将自动汇总,同时在路由器上将产生一条指向NULL 0的路由;
2.水平分割;
BGP 防环机制:
1.AS-PATH:当收到的BGP路由信息中AS-PATH列表中包含自己的AS号,回丢弃该路
由;
2.IBGP水平分割:不把从IBGP邻居学到的路由信息发送给其他IBGP邻居;
3.cluster_list:是一种可选非传递性属性,用于记录簇ID,就像AS-PATH记录AS号一样,
当RR将来自客户的路由反射给给客户时,同时将其簇ID附加到cluster_list中,如果cluster_list为空,则RR将创建一个cluster_list。
RR接受到update消息后,就会检查cluster_list,如果发现其簇ID位于簇列表中,则知道已经出现了路由环路,从而忽略该update消息;
4.BGP同步:开启同步时,BGP路由器不会把从IBGP邻居收到的路由信息放入自己的
路由表或发送给其他EBGP邻居,除非该路由信息已经存在于IGP路由表中;
OSPF 防环机制:
1.区域内SPF算法保证区域内无环;
2.区域间:其他区域必须和区域0相连,区域间的通信需要通过区域0来进行通信;。
BGP的防环机制
•EBGP的防环
1.利用AS-PASH属性,路由条目在传递的过
程中,将记录所经过的AS号,BGP协议拒
绝接受携带本地AS号的BGP路由
•IBGP 的防环机制
1.水平分割,IBGP不中转路由,从一个IBGP
邻居处学习到的路由条目不得传递给下一个
IBGP邻居
2.Next-hop下一跳属性
3.Origin属性,解决反射器产生的环路,不接
收与自己起源ID相同的路由。
•IBGP中的反射器的防环机制
1.通过Originator_ID属性和Cluster_list属
性
2.路由反射器和它的客户机组成一个集群
(Cluster),使用AS内唯一的Cluster ID
作为标识。
为了防止集群间产生路由环路,
路由反射器使用Cluster_List属性,记录路
由经过的所有集群的Cluster ID。
3.Originator ID由RR产生,使用的Router
ID的值标识路由的始发者,用于防止集群内
产生路由环路
•IBGP中的联盟的防环
1.通过AS_Path属性防环
2.联盟相关的属性在传出联盟时会自动被删除。
BGP基础
BGP基础
1.BGP端口号:179
2.BGP默认通告原则:
IBGP:从一个IBGP邻居收到的路由条目将不会传输给另一个IBGP
从一个EBGP邻居收到的路由条目将传输给自己的IBGP和EBGP邻居EBGP: 从一个EBGP邻居收到的路由条目将传输给自己所有的邻居
3.BGP全连接:不是指物理上的全连结,是指同一个AS内,每个路由器之间或间接建立了IBGP邻居关系。
4.BGP的消息类型:
Open:用于建立BGP对等体之间的连接关系,包含:BGP版本AS_ID,BGP RID
Keepalive:周期性向BGP对等体发送,保持连接的有效性(60S发一次)Update: 携带路由更新
Notification:当BGP检测到错误状态时,向对等体发送,之后BGP连接立刻被关闭5.BGP状态机制:
IDLE:空闲状态
Connect:连接状态
Active: 激活状态
Open –sent :发送open包
Open-confirm:接受OPEN包
Established: 已经连接
6.BGP属性:
公认必遵:Origin AS-path Next-hop
公认可选:LOACL_PREF
可选传递:Community Aggregate
可选非传递:MED
注意还有一个H3C私有的Preferred_value
7.BGP的路由选择:
首先丢弃下一跳不可达
优选Preferred_value值最大
优选本地优先级最高
优选聚合链路
优选AS路径最短
依次选起源属性IGP EBGP INCOMLIETE 联系方式:
QQ:478242180
QQ群:190996265。
RIPEIGRPBGPOSPF的防环机制
RIPEIGRPBGPOSPF的防环机制
RIP 防环机制:
1.设置最大跳数(默认15,16条为不可达);
2.水平分割:从某接口收到的路由信息不会再从该接口发送出去;
3.毒性逆转:从某接口收到的路由信息会从该接口发送出去,但是该路由信息被设置
为不可达;
4.路由毒化
5.触发更新;
EIGRP 防环机制:
1.在主网络边界将自动汇总,同时在路由器上将产生一条指向NULL 0的路由;
2.水平分割;
BGP 防环机制:
1.AS-PATH:当收到的BGP路由信息中AS-PATH列表中包含自己的AS号,回丢弃该路
由;
2.IBGP水平分割:不把从IBGP邻居学到的路由信息发送给其他IBGP邻居;
3.cluster_list:是一种可选非传递性属性,用于记录簇ID,就像AS-PATH记录AS号一样,
当RR将来自客户的路由反射给给客户时,同时将其簇ID附加到cluster_list中,如果cluster_list为空,则RR将创建一个cluster_list。
RR接受到update消息后,就会检查cluster_list,如果发现其簇ID 位于簇列表中,则知道已经出现了路由环路,从而忽略该update消息;
4.BGP同步:开启同步时,BGP路由器不会把从IBGP邻居收到的路由信息放入自己的
路由表或发送给其他EBGP邻居,除非该路由信息已经存在于IGP 路由表中;
OSPF 防环机制:
1.区域内SPF算法保证区域内无环;
2.区域间:其他区域必须和区域0相连,区域间的通信需要通过区域0来进行通信;。
BGP同步实验与总结
BGP同步实验与总结
一、BGP同步学习总结。
1、BGP同步打开后:从IBGP学到的路由默认不会用(不会加入路由表),直到从IGP也学到。
2、BGP同步打开后:在bgp同步打开的情况下,一个BGP路由器不会把那些通过ibgp邻居学到的bgp路由通告给自己的ebgp邻居;除非自己的igb路由表中存在这些路由,才可以向ebgp路由器通告。
3、BGP同步目的:防止一个AS(不是所有的路由器都运行bgp)内部出现路由黑洞,即向外部通告了一个本AS不可达的虚假的路由。
二、实验:
1、拓扑。
R2开启BGP同步后,10.1.1.0路由的变化。
2、配置。
2.1 变化一:关闭BGP同步。
2.2 R2开启BGP同步。
AS 3中的R3没有收到10.1.1.0的路由,在R2上写入一条默认路由:ip route 10.1.1.0 255.255.255.0 12.1.1.1
R3上的BGP路由:
R3上的10.1.1.0 加入ip 路由表:。
IBGP水平分割:从一个IBGP学到的BGP路由不会传到另一个IBGP
IBGP水平分割:从一个IBGP学到的BGP路由不会传到另一个IBGP解决办法RR(路由反射器)可以指定他的客户1、如果一条路由通过客户学习到,那么会反射到客户、非客户、EBGP邻居2、如果一条路由通过EBGP邻居学习到,那么会反射给客户、非客户、EBGP邻居3、如果一条路由通过非客户学习到,那么会反射给客户和EBGP邻居,不会反射给非客户R1(config)#int s2/1R1(config-if)#ip add 12.0.0.1 255.255.255.0R1(config-if)#no shuR1(config-if)#int lo0R1(config-if)#ip add 1.1.1.1 255.255.255.0R1(config-if)#do ping 12.0.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 24/58/96 msR1(config-if)#router bgp 100R1(config-router)#bgp router-id 1.1.1.1R1(config-router)#nei 12.0.0.2 remote-as 234R1(config-router)#net 1.1.1.0 mask 255.255.255.0R1(config-router)#*Sep 12 19:39:51.659: %BGP-5-ADJCHANGE: neighbor 12.0.0.2 UpR1(config-router)#do sh ip bgpBGP table version is 3, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 0.0.0.0 0 32768 i*> 5.5.5.0/24 12.0.0.2 0 234 500 iR1(config-router)#do sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback05.0.0.0/24 is subnetted, 1 subnetsB 5.5.5.0 [20/0] via 12.0.0.2, 00:05:0612.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial2/1R2(config)#int s2/1R2(config-if)#ip add 12.0.0.2 255.255.255.0R2(config-if)#no shuR2(config-if)#int s2/2R2(config-if)#ip add 23.0.0.2 255.255.255.0R2(config-if)#no shuR2(config-if)#do ping 23.0.0.3Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/65/144 msR2(config)#router eigrp 90R2(config-router)#no auR2(config-router)#net 23.0.0.0 0.0.0.255R2(config-router)#net 2.2.2.2 0.0.0.0R2(config-router)#int lo0R2(config-if)#ip add 2.2.2.2 255.255.255.255R2(config)#router bgp 234R2(config-router)#bgp router-id 2.2.2.2R2(config-router)#no synR2(config-router)#no auR2(config-router)#nei 3.3.3.3 remote-as 234R2(config-router)#nei 3.3.3.3 up lo0R2(config-router)#nei 12.0.0.1 remote-as 100R2(config-router)#*Sep 12 19:39:54.599: %BGP-5-ADJCHANGE: neighbor 12.0.0.1 UpR2(config-router)#exit*Sep 12 19:42:41.763: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR2(config-router)#do sh ip bgp sumBGP router identifier 2.2.2.2, local AS number 234BGP table version is 2, main routing table version 21 network entries using 101 bytes of memory1 path entries using 48 bytes of memory1 BGP path attribute entries using 60 bytes of memory1 BGP AS-PA TH 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 233 total bytes of memoryBGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secsNeighbor V AS MsgRcvd MsgSent TblV er InQ OutQ Up/Down State/PfxRcd 3.3.3.3 4 234 6 7 2 0 0 00:02:35 012.0.0.1 4 100 10 9 2 0 0 00:05:23 1R2(config-router)#do sh ip bgpBGP table version is 2, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 12.0.0.1 0 0 100 iR2(config)#router bgp 234R2(config-router)#nei 3.3.3.3 next-hop-self /R3开始学到了1.1.1.0/24没有优化的路由,因为下一跳不可达,要在R2上给R3指明next-hop-self *Sep 12 19:48:50.667: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR2(config-router)#do sh ip bgpBGP table version is 3, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 12.0.0.1 0 0 100 i*>i5.5.5.0/24 4.4.4.4 0 100 0 500 iR3(config)#int s2/1R3(config-if)#ip add 23.0.0.3 255.255.255.0R3(config-if)#no shuR3(config-if)#ip add 34.0.0.3 255.255.255.0R3(config-if)#no shuR3(config-if)#do ping 34.0.0.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 20/68/112 msR3(config-if)#router eigrp 90R3(config-router)#no auR3(config-router)#net 23.0.0.0 0.0.0.255R3(config-router)#net 34.0.0.0 0.0.0.255R3(config-router)#net 3.3.3.3 0.0.0.0R3(config-router)#int lo0R3(config-if)#ip add 3.3.3.3 255.255.255.255R3(config-if)#router bgp 234R3(config-router)#bgp rouR3(config-router)#bgp router-id 3.3.3.3R3(config-router)#no synR3(config-router)#no auR3(config-router)#nei 2.2.2.2 remote-as 234R3(config-router)#nei 2.2.2.2 up lo0R3(config-router)#nei 4.4.4.4 remote-as 234R3(config-router)#nei 4.4.4.4 up lo0*Sep 12 19:42:54.131: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 UpR3(config-router)#*Sep 12 19:43:06.723: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 UpR3(config-router)#do sh ip bgp/因为下一跳不可达BGP table version is 1, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path * i1.1.1.0/24 12.0.0.1 0 100 0 100 i * i5.5.5.0/24 45.0.0.5 0 100 0 500 i R3(config-router)#do sh ip bgpBGP table version is 2, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 2.2.2.2 0 100 0 100 i* i5.5.5.0/24 45.0.0.5 0 100 0 500 iR3(config-router)#do sh ip bgp/下一跳可达,在R2和R4上做next-hop-selfBGP table version is 3, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*>i1.1.1.0/24 2.2.2.2 0 100 0 100 i*>i5.5.5.0/24 4.4.4.4 0 100 0 500 iR3(config)#router bgp 234R3(config-router)#nei 2.2.2.2 route-reflector-client /指明R2为自己的客户,符合第一条R3(config-router)#*Sep 12 19:48:33.619: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down RR client config change R3(config-router)#*Sep 12 19:49:03.139: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 UpR3(config-router)#R4(config)#int s2/1R4(config-if)#ip add 34.0.0.4 255.255.255.0R4(config-if)#no shuR4(config-if)#int s2/2R4(config-if)#ip add 45.0.0.4 255.255.255.0R4(config-if)#no shuR4(config-if)#do ping 45.0.0.5Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 45.0.0.5, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 4/66/156 msR4(config-if)#router eigrp 90R4(config-router)#no auR4(config-router)#net 34.0.0.0 0.0.0.255R4(config-router)#net 4.4.4.4 0.0.0.0R4(config-router)#int lo0R4(config-if)#ip add 4.4.4.4 255.255.255.255R4(config-if)#router bgp 234R4(config-router)#bgp rouR4(config-router)#bgp router-id 4.4.4.4R4(config-router)#no synR4(config-router)#no auR4(config-router)#nei 3.3.3.3 remote-as 234R4(config-router)#nei 3.3.3.3 up lo0R4(config-router)#nei 45.0.0.5 remote-as 500R4(config-router)#*Sep 12 19:41:59.647: %BGP-5-ADJCHANGE: neighbor 45.0.0.5 UpR4(config-router)#*Sep 12 19:43:10.147: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 UpR4(config-router)#do sh ip bgpBGP table version is 2, local router ID is 4.4.4.4Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *> 5.5.5.0/24 45.0.0.5 0 0 500 i R4(config-router)#exitR4(config)#router bgp 234R4(config-router)#nei 3.3.3.3 next-hop-selfR4(config-router)#do sh ip bgpBGP table version is 3, local router ID is 4.4.4.4Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 2.2.2.2 0 100 0 100 i *> 5.5.5.0/24 45.0.0.5 0 0 500 iR5(config)#int s2/2R5(config-if)#ip add 45.0.0.5 255.255.255.0R5(config-if)#no shuR5(config-if)#int lo0R5(config-if)#ip add 5.5.5.5 255.255.255.0R5(config-if)#router bgp 500R5(config-router)#bgp rouR5(config-router)#bgp router-id 5.5.5.5R5(config-router)#no synR5(config-router)#no auR5(config-router)#nei 45.0.0.4 remote-as 234R5(config-router)#net 5.5.5.0 mask 255.255.255.0R5(config-router)#do sh ip bgpBGP table version is 3, local router ID is 5.5.5.5Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 45.0.0.4 0 234 100 i *> 5.5.5.0/24 0.0.0.0 0 32768 iR5(config-router)#do sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsB 1.1.1.0 [20/0] via 45.0.0.4, 00:05:295.0.0.0/24 is subnetted, 1 subnetsC 5.5.5.0 is directly connected, Loopback045.0.0.0/24 is subnetted, 1 subnetsC 45.0.0.0 is directly connected, Serial2/2。
BGP路由反射器11
BGP路由反射器原理概述缺省情况下,路由器从它的一个IBGP对等体那里接收到的路由条目不会被该路由器再传递给其他IBGP对等体,这个原则称为BGP水平分割原则。
该原则的根本作用是防止as内部的BGP路由环路。
因此,在AS内部,一般需要每台路由器都运行BGP协议;并建立全互联的IBGP对等体关系,这样才能避免BGP路由黑洞等问题。
对于有n个BGP路由的AS来说。
全互联的IBGP对等体关系将有n*(n-1)÷2个。
对于。
大型的as来说。
数量众多的IBGP 对等体关系江。
导致配置和维护的工作量都非常大。
且人为出错的可能性也随之增加。
解决上述问题的方法之一。
就是使用BGP路由反射器。
BGP路由反射器的使用。
可以在很大程度上减少大型AS中IBGP对等体关系的数量,并简化相应的配置和维护工作。
BGP路由反射器是AS内部IBGP网络环境中的一个特殊角色,其他的角色还有反射器的客户端和非客户端。
一个反射器和他所有的客户端一起被统称为一个Cluster;客户端与他的反射器建立的是IBGP对等体关系。
非客户端之间需要建立全互联的IBGP对等的关系。
非客户端与客户端之间无须建立IBGP对等体关系。
一个AS内部,可以有多个Cluster。
一个Cluster中可以有多台反射器。
另外,EBGP对等体之间是不存在BGP路由反射器的概念。
BGP路由反射器在反射路由的时候遵循的原则是:从一个非客户端那里接收到的路由,反射器会将它传递给所有的客户端;从一个客户在那里接受的路由,反射器会将它传递所有其他客户端以及所有的非客户端。
从EBGP对等体那里接收到的路由。
反射器会将它传递给所有的客户端和非客户端。
试验内容:实验拓扑图1所示。
实验编址如表1所示。
本试验网络包含了两个AS,两个Cluster。
R1、R2、R3属于Cluster1,R4、R5、R6属于Cluster2,R7不属于任何在AS100内,所有的路由器都运行ospf协议作为IGP,并将各自的LoopBack 0接口宣告进ospf进程中。
BGP问题总结
1.为什么要有AS的存在?答:为了解决网络规模的增长问题,当网络规模变大,路由数量也就不断的增加。
我们划分AS后,AS内部可以自由选择IGP协议来实现内部互通,在AS之间通过统一的一种协议来互连就可以了。
这种协议现在就只有BGP一种。
2.为什么使用TCP作为传输层协议?答:因为TCP很可靠,重传,排序等机制保证了BGP消息的可靠性传输。
3.BGP中邻居为什么需要手工指定?答:BGP建立在两个AS之间(也就是两个不同的机构之间),存在着信任问题,所以不能通过自动发现,而需要手工配置邻居,使用指定地址建立TCP关系。
这样也有个好处就是,可以跨越设备,邻居的建立不一定需要设备直连。
4.BGP是一种基于距离矢量算法的路由协议,它是怎么保证无环路的?答:AS之间:利用AS号来解决,BGP在向EBGP对等体通告一条路由时,要把自己的AS号加入到AS_PA TH属性中,以记录此路由经过AS的信息,如果在路由更新消息中发现自己所在的AS号已经被包含在AS_PA TH属性中,则表明该路由之前曾经通过该AS或者是源自于该AS,为避免路由环路,应该将此路由信息丢弃。
AS内部:由于没有AS号的变化,强行规定从IBGP邻居学习到的路由不能传递给另一个IBGP邻居,简单的说也就是IBGP间路由只传一跳,路由只传递一次当然不会出现环路。
5.什么时候需要BGP全连接?答:以为BGP是基于TCP的,而TCP连接是以点到点的单播方式来进行报文传输的,所以BGP也是点到点的连接。
同时因为BGP是距离矢量算法的路由协议,为了防止产生路由环路,协议规定BGP发言者从IBGP对等体获得的路由不能向其他的IBGP对等体发布。
综上,在运行BGP的AS内,为了确保所有BGP路由器的路由信息相同,则需要使所有的IBGP 路由器保持全连接。
6.如何解决全连接问题?答:反射器和联盟两种技术来解决路由反射器是指AS中指定一个节点为反射器,所有其他节点都与反射器建立IBGP 关系,反射器作为中间节点,在其他任意两个IBGP间传递路由。
个人吐血BGP经验总结(上)
BGP简介BGP 属于路径矢量协议他和距离矢量路由协议的区别是:距离矢量强调的是一个距离,即下一跳路由器,因为一台路由器下一跳地址总是他的邻居路由器路径矢量强调的是一个下个AS,即下一跳AS。
他的选路也是基于AS不同的ISP之间有不同的AS号,不同的AS主要目的是基于管理,电信和网络各自管理各自AS内部的IGP,而AS和AS之间的路由则基于BGP,同时也是为了减少路由条目。
BGP更新利用TCP 端口179 所以更新是可靠的更新基础概念一些名词peer=neighborBgpspeakers= 运行BGP的路由器BGP管理距离IBGP 200 IBGP是就是同一个AS之中建立的bgp邻居关系EBGP 20 EBGP就是在不同as之间所建立的bgp邻居关系用EBGP是为了提供AS之间的路由,单既然用IGP就可以在一个AS内部通告路由问什么要再搞个IBGP出来答:IBGP的作用就是为了在同一个AS内的边界路由器上互相通告更新信息,必须有个机制能让同一个AS内的BGP路由器来互相通告更新信息BGP中的建立邻居不需要有直连的链路(这点和IGP的不同)原因是BGP使用的TCP协议,TCP是个点到点的协议他不支持组播,所以他是单播的,单播是可以被路由器转发的。
由此我推理出BGP的所有报文都是单播的,因为他的邻居不直连所以无法通告组播来传递BGP是路劲矢量协议凡矢量协议必有水品分割,BGP的水品分割分为EBGP和IBGP的水品分割EBGP水平分割:主要依赖AS号来防止环路(例如从某个EBGP邻居学到路由会再通告给此邻居通告命令sh ip bgp nei x.x.x.x advertised-route 查看,单对方不会接收而已),在路由被传播过程中每个传播者都加入自身的AS进去.(AS是bgp的属性之一)IBGP水平分割: 默认的通过IBGP学到的路由不会再通告给其他的邻居,所以必须保证网络是全网状的或者通过其他手段来通告给其他IBGP)BGP的边界网关路由器从EBGP学到的路由通告给IBGP的邻居,通过IBGP接收到的路由的路由器默认不再通告给其他IBGP邻居了,所以要保持一个full mesh接口,(但是如果此路由器也是BGP的边界网关路由器,则可以通告给其他的EBGP邻居)有个例外是通告的路由如果不在路由表中的则不会通告此路由BGP的route-id 建议和OSPF的一致不然会出问题BGP的用环回口建立邻居的时候neighbor x.x.x.x update-source 虽然理论上只要一边设置就可以但是建议两边都设置BGP的neighbor 和network 是分开的neighbor 命令用来建立邻居,而network命令仅用来传路由(通告路由)BGP中三张表?BGP表是什么?答1 路由表,bgp表,邻居表 2 sh ip bgp 可查看被注入(用network命令)BGP的路由BGP默认不负载均衡BGP传播和下一跳;BGP传播的是AS的路径,所以实际的下一跳地址是通告AS路劲的bgp路由器,不像IGP 总是相邻的邻居路由器,所以必须保证通过递归让bgp路由器能有下一跳地址。
