BGP-community应用配置实例
- 格式:docx
- 大小:20.01 KB
- 文档页数:9
实验十、BGP实验实验要求:1、掌握BGP的基本配置方法。
2、掌握如何查看BGP的各种配置信息。
3、掌握基于回环口的BGP的邻居关系建立的配置方法。
4、理解需要使用回环口为目的。
5、理解BGP同步功能的作用和配置。
6、掌握使用指向NULL0接口的静态路由的汇总配置方法。
7、掌握使用聚合属性的路由汇总配置方法。
实验拓扑:根据实验要求,实验拓扑如图10-1所示。
图10-1 BGP实验拓扑注:R1和R2属于自治系统65001,R3属于自治系统65002实验步骤:1、根据实验拓扑,对路由器各接口配置IP地址,使直连链路相互间可以进行通信。
2、在R1和R2上配置EIGRP,关闭自动汇总。
参考命令如下:R1(config)#router eigrp 50 50修改为自己学号后两位R1(config-router)#network 192.168.1.0R1(config-router)#network 1.0.0.0R1(config-router)#no auto-summaryR2(config)#router eigrp 50 50修改为自己学号后两位R2(config-router)#network 192.168.1.0R2(config-router)#network 2.0.0.0R2(config-router)#no auto-summary3、首先在R1和R2配置BGP协议,使用回环口创建邻居关系,参考命令如下:R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#neighbor 2.2.2.2 remote-as 65001 65001修改为65000+自己学号后两位R1(config-router)#network 1.1.1.1 mask 255.255.255.255R1(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)#network 192.168.1.0R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 1.1.1.1 remote-as 65001 65001修改为65000+自己学号后两位R2(config-router)#network 2.2.2.2 mask 255.255.255.255R2(config-router)#network 192.168.1.0R2(config-router)#network 192.168.2.04、配置后在路由器R1中查看BGP邻居关系和汇总信息,参考命令如下:R1#show ip bgp neighborsR1#show ip bgp summary问题1:R1中邻居关系的状态是什么?5、查看路由器R1和R2的BGP的路由链路数据库信息,参考命令如下:R1#show ip bgp ipv4 unicast问题2:在数据库中是否有非直连链路信息?6、在路由器R1和R2中分别指定回环接口建立邻居关系,参考命令如下:R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#neighbor 2.2.2.2 update-source lo1 lo1为地址1.1.1.1的接口R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 1.1.1.1 update-source lo0 lo0为地址2.2.2.2的接口问题3:再次查看R1的邻居关系,邻居关系状态为什么?问题4:在路由器R2中查看路由链路数据库,能否看到R1上面的路由?如果能看到的话这些路由是否为最佳路由?(提示:最佳路由提示符为“*>”)问题5:查看R2路由表,能否看到172.16.1.0路由?7、在路由器R1、R2中关闭同步功能R1(config)#router bgp 65001 65001修改为65000+自己学号后两位R1(config-router)#no synchronizationR2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#no synchronization问题6:过一段时间查看路由器R2的路由表,是否能看到172.16.1.0的路由?8、在路由器R2和R3中配置不同自治系统的BGP路由,参考命令如下:R2(config)#router bgp 65001 65001修改为65000+自己学号后两位R2(config-router)#neighbor 3.3.3.3 remote-as 65002 65002修改为65001+自己学号后两位R2(config-router)#neighbor 3.3.3.3 update-source lo0 lo0为地址2.2.2.2的接口R2(config-router)#neighbor 3.3.3.3 ebgp-multihop 2R2(config)#ip route 3.3.3.3 255.255.255.255 192.168.2.3注:添加静态路由,使得R2能够访问3.3.3.3R3(config)#router bgp 65002 65002修改为65001+自己学号后两位R3(config-router)#neighbor 2.2.2.2 remote-as 65001 65001修改为65000+自己学号后两位R3(config-router)#neighbor 2.2.2.2 update-source lo1 lo1为3.3.3.3的接口R3(config-router)#neighbor 2.2.2.2 ebgp-multihop 2R3(config-router)#network 192.168.2.0R3(config-router)#network 192.168.3.0R3(config-router)#network 192.168.4.0R3(config-router)#network 192.168.5.0R3(config-router)#network 192.168.6.0R3(config-router)#network 192.168.7.0R3(config)#ip route 2.2.2.2 255.255.255.255 192.168.2.2注:添加静态路由,使得R2能够访问2.2.2.2问题7:查看路由器R3的路由表,能否得到全网的路由信息?问题8:查看路由器R1的路由器,能否得到全网的路由信息?9、在路由器R1中添加静态路由,使得能够访问3.3.3.3R1(config)#ip route 3.3.3.3 255.255.255.255 192.168.1.2问题9:过一段时间后再查看路由器R1的路由表,能否看到全网路由信息?10、通过路由汇总配置,有效的减少路由表的大小,提高路由效率。
配置BGPBGP协议概述BGP是目前Internet使用最广的外部网关协议(Exterior Gateway Protocol,EGP),其提供的主要功能是在不同的自治系统(autonomous systems,AS)之间交换网络可达信息,并通过协议自身机制消除路由环路。
BGP使用TCP作为传输协议,用TCP协议的可靠传输机制保证BGP的传输可靠性。
运行BGP协议的router称为BGP speaker,建立了BGP会话连接(BGP session)的BGP speakers之间被称作对等体(BGP peers)。
BGP speaker之间建立对等体的模式有两种:IBGP(Internal BGP)和EBGP(External BGP)。
IBGP是指在相同AS内建立的BGP连接,EBGP是指在不同AS之间建立的BGP连接。
二者的作用简而言之就是:EBGP是完成不同AS之间路由信息的交换,IBGP是完成路由信息在本AS内的过渡。
锐捷网络的BGP协议有如下特点:●支持BGP-4●支持路径属性✓ORIGN Attribute✓AS_PATH Attribute✓NEXT_HOP Attribute✓MULTI_EXIT_DISC Attribute✓LOCAL-PREFERENCE Attribute✓ATOMIC_AGGREGATE Attribute✓AGGREGATOR Attribute✓COMMUNITY Attribute✓ORIGINATOR_ID Attribute✓CLUSTER_LIST Attribute●支持BGP对等体组●支持使用Loopback接口●支持使用TCP的MD5认证●支持BGP和IGP的同步●支持BGP路由聚合●支持BGP路由衰减●支持BGP路由反射器●支持AS联盟●支持BGP软复位缺省的BGP配置:要运行交换机的BGP ,在特权模式下,按照如下步骤进行: Step1 Step2 Step3 Step4 Step5 Step6 Step7使用no router bgp 关闭BGP 。
BGP小结一、需要使用BGP的网络:1、在国干网络使用BGP:目的是为了传递各个省、运营商或不同AS的路由,为不同的AS间数据互访进行寻经;将本国使用的路由发布到国际网络上。
国干路由器和AS出口路由器建立EBGP邻居。
2、省干网络使用BGP:目的是为了传递本省内各个不同城市的路由,为本省内不同城市间数据互访进行寻经;将本省内使用的路由发布到国干网络上。
省干落地设备可以与城域网出口建立EBGP邻居,同时为城域网下发EBGP缺省路由。
3、城域网出口路由器使用BGP:EBGP网络的末梢设备,目的将本城域网使用的路由发布到省干网络上,同时从省干落地设备接受BGP缺省路由;同时和城域网汇聚层设备建立IBGP邻居。
4、城域网汇聚层路由器使用BGP:城域网BGP网络的末梢设备,目的是对出网流量在汇聚层进行分流,从而可以减轻城域网骨干层路由器的负担。
MP-BGP运行在MPLS的网络上,目的是为了传递VPN的路由。
二、BGP常用的属性:BGP路由属性是一套参数,它对特定的路由进行了进一步的描述,使得BGP 能够对路由进行过滤和选择。
在配置路由策略时我们将广泛地使用路由属性,但是不是所有路由属性都要被用上。
事实上,路由属性被分为以下几类:必遵属性:所有BGP路由器都可以识别,且必须存在于Update消息中。
如果缺少这种属性,路由信息就会出错。
可选属性:所有BGP路由器都可以识别,但不要求必须存在于Update消息中,可以根据具体情况来选择。
过渡属性:在AS之间具有可传递性的属性。
BGP路由器可以不支持此属性,但它仍然会接收带有此属性的路由,并通告给其他对等体。
非过渡属性:如果BGP路由器不支持此属性,则相应的Update消息会被忽略,且不会通告给其他对等体。
1、Origin属性:起点属性是一个必遵过渡属性,它指示路由更新的起源。
BGP允许三种类型的起源:BGP来说,BGP优先选用具有最小起点属性值的路由,即:IGP 优先于EGP,EGP优先于INCOMPLETE。
CISCO 路由器OSPF+MPLS+BGP配置实例二OO八年九月四日目录一、网络环境 (3)二、网络描述 (3)三、网络拓扑图 (4)四、P路由器配置 (4)五、PE1路由器配置 (6)六、PE2路由器配置 (9)七、CE1路由器配置 (11)八、CE2路由器配置 (13)九、业务测试 (14)一、网络环境由5台CISCO7204组成的网络,一台为P路由器,两台PE路由器,两台CE 路由器;二、网络描述在P和两台PE路由器这间通过OSPF动态路由协议完成MPLS网络的建立,两台PE路由器这间启用BGP路由协议,在PE路由器上向所属的CE路由器指VPN 路由,在CE路由器中向PE路由器配置静态路由。
配置思路:1、在P和两台PE路由器这间通过OSPF动态路由协议,在P和PE路由器两两互连的端口上启用MPLS,两台PE之间的路为备份路由,这属公网路由。
2、两台PE路由器这间启用BGP路由协议,这使得属于VPN的IP地址能在两个网络(两台CE所属的网络)互相发布,这属私网(VPN)路由。
3、在PE路由器上向所属的CE路由器指VPN路由,这打通了两个网络(两台CE所属的网络)之间的路由。
三、网络拓扑图P路由器(r1)(r4) CE1路由器(r5)LOOP0:192.168.3.1/24LOOP0:192.168.4.1/24四、P路由器配置p#SHOW RUNBuilding configuration...Current configuration : 1172 bytes!version 12.3service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname p!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!!ip cefip audit po max-events 100!!interface Loopback0ip address 202.98.4.3 255.255.255.255 !interface FastEthernet0/0description to_r2ip address 10.1.1.10 255.255.255.252 ip ospf cost 20duplex fulltag-switching mtu 1508tag-switching ip!interface FastEthernet1/0description to_r3ip address 10.1.1.6 255.255.255.252 ip ospf cost 20duplex fulltag-switching mtu 1508tag-switching ip!interface FastEthernet2/0no ip addressshutdownduplex half!interface FastEthernet3/0no ip addressshutdownduplex half!router ospf 100log-adjacency-changesredistribute connected subnets redistribute static subnetsnetwork 10.1.1.6 0.0.0.0 area 0 network 10.1.1.10 0.0.0.0 area 0!ip classlessno ip http serverno ip http secure-server!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4login!!endp#五、PE1路由器配置pe1#show runBuilding configuration...Current configuration : 1813 bytes!version 12.3service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption!hostname pe1!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!!ip vrf vpnard 1:100route-target export 200:1route-target import 200:1!ip cefip audit po max-events 100!!interface Loopback0ip address 202.98.4.1 255.255.255.255!interface FastEthernet0/0description to_r5ip vrf forwarding vpnaip address 172.16.1.1 255.255.255.252 duplex fulltag-switching ip!interface FastEthernet1/0description to_r1ip address 10.1.1.5 255.255.255.252ip ospf cost 20duplex fulltag-switching mtu 1508tag-switching ip!interface FastEthernet2/0ip address 10.1.1.1 255.255.255.252ip ospf cost 100duplex fulltag-switching mtu 1508tag-switching ip!interface FastEthernet3/0no ip addressshutdownduplex half!router ospf 100log-adjacency-changesredistribute connected metric-type 1 subnetsnetwork 10.1.1.0 0.0.0.255 area 0network 202.98.4.0 0.0.0.255 area 0!router bgp 100no bgp default ipv4-unicastbgp log-neighbor-changesneighbor 202.98.4.2 remote-as 100neighbor 202.98.4.2 update-source Loopback0 neighbor 202.98.4.2 version 4!address-family vpnv4neighbor 202.98.4.2 activateneighbor 202.98.4.2 send-community extendedexit-address-family!address-family ipv4 vrf vpnaredistribute connectedredistribute staticno auto-summaryno synchronizationexit-address-family!ip classlessip route vrf vpna 192.168.3.0 255.255.255.0 172.16.1.2 no ip http serverno ip http secure-server!ip ospf name-lookup!!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4login!!endpe1#六、PE2路由器配置pe2#show runBuilding configuration...Current configuration : 1725 bytes!version 12.3service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption!hostname pe2!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!!ip vrf vpnard 1:100route-target export 200:1route-target import 200:1!ip cefip audit po max-events 100!!interface Loopback0ip address 202.98.4.2 255.255.255.255 !interface FastEthernet0/0description to_r1ip address 10.1.1.9 255.255.255.252ip ospf cost 20duplex fulltag-switching ip!interface FastEthernet1/0ip vrf forwarding vpnaip address 172.16.2.1 255.255.255.0duplex fulltag-switching ip!interface FastEthernet2/0ip address 10.1.1.2 255.255.255.252ip ospf cost 100duplex fulltag-switching ip!interface FastEthernet3/0no ip addressshutdownduplex half!router ospf 100log-adjacency-changesredistribute connected metric 1 subnets redistribute static metric-type 1 subnets network 10.1.1.0 0.0.0.255 area 0!router bgp 100no bgp default ipv4-unicastbgp log-neighbor-changesneighbor 202.98.4.1 remote-as 100neighbor 202.98.4.1 update-source Loopback0 neighbor 202.98.4.1 version 4!address-family vpnv4neighbor 202.98.4.1 activateneighbor 202.98.4.1 send-community extended exit-address-family!address-family ipv4 vrf vpnaredistribute connectedredistribute staticno auto-summaryno synchronizationexit-address-family!ip classlessip route vrf vpna 192.168.4.0 255.255.255.0 172.16.2.2 no ip http serverno ip http secure-server!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4login!!End七、CE1路由器配置ce1#show runBuilding configuration...Current configuration : 892 bytes!version 12.3service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname ce1!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!!ip cefip audit po max-events 100!!interface Loopback0ip address 192.168.3.1 255.255.255.0 !interface FastEthernet0/0description to_r3ip address 172.16.1.2 255.255.255.252 duplex full!interface FastEthernet1/0no ip addressshutdownduplex half!interface FastEthernet2/0no ip addressshutdownduplex half!interface FastEthernet3/0no ip addressshutdownduplex half!ip classlessip route 0.0.0.0 0.0.0.0 172.16.1.1no ip http serverno ip http secure-server!!!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4login!!end八、CE2路由器配置Ce2#show runBuilding configuration...*Sep 3 13:53:56.167: %SYS-5-CONFIG_I: Configured from console by console Current configuration : 888 bytes!version 12.3service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname ce2!boot-start-markerboot-end-marker!!no aaa new-modelip subnet-zero!!!ip cefip audit po max-events 100!!interface Loopback0ip address 10.10.13.1 255.255.255.0!interface FastEthernet0/0no ip addressshutdownduplex half!interface FastEthernet1/0description to_r2ip address 10.10.12.2 255.255.255.0duplex full!interface FastEthernet2/0no ip addressshutdownduplex half!interface FastEthernet3/0no ip addressshutdownduplex half!ip classlessip route 0.0.0.0 0.0.0.0 172.16.2.1no ip http serverno ip http secure-server!!gatekeepershutdown!!line con 0exec-timeout 0 0logging synchronousstopbits 1line aux 0stopbits 1line vty 0 4login!!end九、业务测试ce1# ping 172.16.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:Success rate is 100 percent (5/5), round-trip min/avg/max = 96/190/324 ms ce1#ce2#ping 192.168.3.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:Success rate is 100 percent (5/5), round-trip min/avg/max = 336/468/588 ms ce2#。
BGP aggregationYeslab Ender(安德)制作,更多内容请关注://andrew14BGP aggregation (1)1、实验目的:了解和掌握BGP聚合。
(1)2、实验拓扑描述 (1)3、实验步骤: (2)步骤一、建立基本的BGP连接 (2)步骤二、汇总各个参数具体实验 (3)1、实验目的:了解和掌握BGP聚合。
BGP的路由聚合是一项庞大而重要的任务,公布的一项数据表明,中国某ISP通告的前缀数目总是名列前茅的,这自然会增加设备的负担以及其他一些性能。
本实验涉及的内容包括:summary-only(只通告汇总路由);as-set(还原路由AS属性);suppress-map(抑制某些路由);attribute-map(可修改极少的一些属性),advertise-map以及通常的先汇总再通告的情况,route-map的参数,可以用这个参数在汇总之后的路由上增加一些属性比如community等2、实验拓扑描述IP地址说明,比如R2上连接R3的地址为23.1.1.2/24,以此类推3、实验步骤:步骤一、建立基本的BGP连接如图所示R1和R2建立EBGP邻居关系,AS200内为全互联的full-mesh,R4和R5为EBGP 邻居关系。
这里仅仅给出R4的邻居配置:router bgp 200no synchronizationbgp log-neighbor-changesnetwork 44.1.1.0 mask 255.255.255.0redistribute connected route-map CONN---该route-map匹配R4和R5的直连,重分步到AS200 neighbor 10.1.1.3 remote-as 200neighbor 10.1.1.5 remote-as 300neighbor 22.1.1.1 remote-as 200neighbor 22.1.1.1 update-source Loopback0neighbor 33.1.1.1 remote-as 200no auto-summary我们来查看邻居情况R4#show ip bgp summaryBGP router identifier 44.1.1.1, local AS number 200-------------------------------------------------省略部分无关内容-------------------------------------------- Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 10.1.1.3 4 200 95 104 61 0 0 01:31:55 010.1.1.5 4 300 98 142 61 0 0 01:31:40 122.1.1.1 4 200 450 431 61 0 0 01:13:17 2步骤二、汇总各个参数具体实验R1上增加环回口lo0---3并通告路由,然后观察汇总的路由情况router bgp 100no synchronizationbgp log-neighbor-changesnetwork 1.1.1.0 mask 255.255.255.0network 11.1.0.0 mask 255.255.255.0network 11.1.1.0 mask 255.255.255.0network 11.1.2.0 mask 255.255.255.0下面是一种通用的汇总办法,即先用静态做一条汇总路由指向null 0,然后在BGP同通告该路由达到汇总的目的R1(config)#ip route 11.1.0.0 255.255.252.0 null 0R1(config)#router bgp 100R1(config-router)#network 11.1.0.0 m 255.255.252.0在R1和R2上查看路由情况R1#show ip bgpBGP table version is 64, local router ID is 11.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*> 11.1.0.0/24 0.0.0.0 0 32768 i*> 11.1.0.0/22 0.0.0.0 0 32768 i---R1通告成功汇总路由*> 11.1.1.0/24 0.0.0.0 0 32768 i*> 11.1.2.0/24 0.0.0.0 0 32768 i*> 11.1.3.0/24 0.0.0.0 0 32768 iR2#sh ip bgpBGP table version is 44, local router ID is 22.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*> 11.1.0.0/24 12.1.1.1 0 0 100 i*> 11.1.0.0/22 12.1.1.1 0 0 100 i-R2接收到汇总的路由,同时也收到了明细路由*> 11.1.1.0/24 12.1.1.1 0 0 100 i*> 11.1.2.0/24 12.1.1.1 0 0 100 i*> 11.1.3.0/24 12.1.1.1 0 0 100 i步骤3、使用aggregate命令汇总去掉之前的汇总R1(config)#router bgp 100R1(config-router)#no network 11.1.0.0 m 255.255.252.0R1(config)#no ip route 11.1.0.0 255.255.252.0 null 0只通告汇总之后的路由- summary-only参数R1(config)#router bgp 100R1(config-router)#aggregate-address 11.1.0.0 255.255.252.0 summary-only查看R2的情况,它仅仅收到通告后的路由R2#show ip bgpBGP table version is 50, local router ID is 22.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*> 11.1.0.0/22 12.1.1.1 0 0 100 i另外一种情况,通告汇总路由,同时抑制某些路由不被通告出去- suppress-map R1(config)#access-list 1 permit 11.1.2.0 0.0.0.255R1(config)#route-map SupR1(config-route-map)#match ip address 1R1(config)#router bgp 100R1(config-router)#aggregate-address 11.1.0.0 255.255.252.0 suppress-map SupR1#clear ip bgp *查看R1和R2的路由情况R1#show ip bgpBGP table version is 11, local router ID is 11.1.3.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*> 11.1.0.0/24 0.0.0.0 0 32768 i*> 11.1.0.0/22 0.0.0.0 32768 i*> 11.1.1.0/24 0.0.0.0 0 32768 is> 11.1.2.0/24 0.0.0.0 0 32768 i---S代表被抑制,其他路由通告给R2*> 11.1.3.0/24 0.0.0.0 0 32768 iR2上验证了我们预期的结果,没有11.1.2.0/24的路由R2#show ip bgpBGP table version is 63, local router ID is 22.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*> 11.1.0.0/24 12.1.1.1 0 0 100 i*> 11.1.0.0/22 12.1.1.1 0 0 100 i*> 11.1.1.0/24 12.1.1.1 0 0 100 i*> 11.1.3.0/24 12.1.1.1 0 0 100 i去掉R1上的汇总,以便我们进行下面的实验R1(config)#router bgp 100R1(config-router)#no aggregate-address 11.1.0.0 255.255.252.0 suppress-map Sup步骤3、观察另外两个参数as-set和attribute-map我们在R2上做汇总,这种场景也很合乎逻辑,即某些ISP接收到路由后汇总它们R2(config)#router bgp 200R2(config-router)#aggregate-address 11.1.0.0 255.255.252.0 summary-only查看R5以及R1的路由R5#sh ip bgpBGP table version is 80, local router ID is 55.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*> 11.1.0.0/22 10.1.1.3 0 200 i需要说明的是该路由是由R2产生的,且其源自IGP,不再具有其源自AS100的属性。
BGP community属性无敌详解文档(视频详解+配套文档)community属性是BGP众多路径属性中一个相对比较难理解的知识点,需要通过大量实验加深印象,为了帮助大家更清晰的了解这个路径属性,我特定编写了这份文档,希望对大家有所帮助。
本文档配套详解视频:1、community的基本概念可选传递,用于简化路由策略的执行。
可以将某些路由分配一个特定的COMMUNITY 属性,之后就可以基于COMMUNITY值而不是每条路由进行BGP属性的设置了。
COMMUNITY属性对邻居起作用,在设置后,同时需要向邻居发送(send community,默认是不会发送的)。
COMMUNITY属性是一组4个8位组的数值,RFC1997规定前2B表示AS号,后2B 表示基于管理目的设置的标示符,格式为AA:NN,而CISCO默认显示格式为NN:AA (CISCO IOS在显示community值时,默认是按10进制格式显示),可使用全局配置命令ip bgpcommunity new-format将CISCO默认格式改为RFC格式。
例如将AS12的某条路由COMM值改为10000,RFC采用十六进制表示COMMUNITY属性,而CISCO采用十进制。
RFC格式为12:10000,十六进制为0x 000C2710,再转换为十进制796432(这就是CISCO IOS默认显示的值)。
抓个包看一下:2、在route-map中设置community属性route-map test permit 10set community ?<1-4294967295> community numberaa:nn community number in aa:nn formatadditive Add to the existing community 设置commu值为附加,否则为覆盖 internet Internet (well-known community) 默认所有路由都属于该团体local-AS Do not send outside local AS (well-known community)no-advertise Do not advertise to any peer (well-known community)no-export Do not export to next AS (well-known community)none No community attribute下边我们来看一下community的这几个众所周知值的本文为原创博文,no-advertiseno-exportlocal-as配置示例(使用route-map为路由分配community):在R1上为路由11.11.11.0/24分配community 100:11,并且传递给R2,那么R1上配置如下:ip prefix-list 11 permit 11.11.11.0/24route-map test permit 10match ip address prefix-list 11set community 100:11router bgp 100network 11.11.11.0 mask 255.255.255.0neighbor 10.1.12.2 remote-as 200neighbor 10.1.12.2 send-community // 默认community不发送,因此必须配置该命令neighbor 10.1.12.2 route-map test out注意community默认不发送,必须send-community。
BGP配置实验案例BGP(边界网关协议)是一个用于在互联网中交换路由信息的协议。
在本篇文章中,我们将探讨一个BGP配置实验案例,其中包括两个自治系统(AS)之间的BGP邻居关系的建立和路由的传递。
这个实验案例可以帮助读者更好地理解BGP协议的工作原理和配置步骤。
在这个实验案例中,我们有两个自治系统:AS1和AS2、AS1拥有IP 地址段192.168.0.0/24,AS2拥有IP地址段10.0.0.0/24、我们的目标是在两个自治系统之间建立BGP邻居关系,并实现路由的传递。
首先,我们需要在两个自治系统中配置BGP路由器。
在AS1中,我们选择一个路由器作为BGP路由器,并配置其Loopback接口的IP地址为192.168.0.1、在AS2中,选择另一个路由器作为BGP路由器,并配置其Loopback接口的IP地址为10.0.0.1、这些Loopback接口的IP地址将用作BGP邻居之间的通信地址。
接下来,我们开始配置BGP邻居关系。
在AS1中,我们需要告诉BGP 路由器与AS2的BGP路由器建立邻居关系。
假设AS2的BGP路由器的IP 地址为10.0.0.2,我们将在AS1的BGP路由器上执行以下命令:``````同样地,在AS2的BGP路由器上,我们需要告诉其与AS1的BGP路由器建立邻居关系。
假设AS1的BGP路由器的IP地址为192.168.0.1,我们将在AS2的BGP路由器上执行以下命令:``````配置完BGP邻居关系后,我们可以开始传递路由信息。
在AS1中,我们希望将本地的IP地址段192.168.0.0/24传输给AS2、我们需要在AS1的BGP路由器上执行以下命令:```network 192.168.0.0 mask 255.255.255.0```这些命令告诉AS1的BGP路由器将地址段192.168.0.0/24传输给BGP邻居。
同样地,在AS2中,我们希望将本地的IP地址段10.0.0.0/24传输给AS1、我们需要在AS2的BGP路由器上执行以下命令:```network 10.0.0.0 mask 255.255.255.0```这些命令告诉AS2的BGP路由器将地址段10.0.0.0/24传输给BGP邻居。
bgp知识点总结BGP(Border Gateway Protocol,边界网关协议)知识点总结。
一、BGP概述。
1. 定义与作用。
- BGP是一种用于在不同自治系统(AS)之间交换路由信息的外部网关协议(EGP)。
自治系统是由一个或多个网络组成的,在一个管理机构下运行并使用统一的内部路由策略。
- 其主要作用是实现不同自治系统之间的可达性,通过传递路由信息,使得不同AS中的网络能够相互通信。
2. BGP的特点。
- 路径矢量协议:BGP不像内部网关协议(如OSPF、RIP)那样基于链路状态或距离矢量,而是基于路径矢量。
它通告的是到达目的网络的完整路径(包括经过的自治系统序列)。
- 可靠性高:使用TCP作为传输协议(端口号179),这保证了BGP消息的可靠传输。
因为TCP具有确认、重传等机制,可以确保BGP对等体之间的消息准确无误地传递。
- 策略丰富:BGP允许网络管理员根据多种策略来控制路由的传播和选择。
例如,可以基于AS路径长度、路由的本地优先级等因素来决定选择哪条路由进入自己的路由表。
二、BGP的消息类型。
1. Open消息。
- 用于建立BGP对等体关系。
在Open消息中包含了BGP版本号、本地AS号、保持时间(Hold Time)、BGP标识符(通常是路由器的某个接口的IP地址)等信息。
- 当两个BGP路由器之间交换Open消息并且参数协商成功后,它们之间就建立了BGP对等体关系。
2. Update消息。
- 用于通告可达路由信息和撤销不可达路由信息。
Update消息包含网络层可达性信息(NLRI),即目的网络的前缀和掩码,以及到达这些目的网络的路径属性(如AS 路径、下一跳等)。
- 如果某个路由不再可达,BGP也会通过Update消息来撤销该路由的通告。
3. Notification消息。
- 用于报告错误信息。
当BGP对等体检测到错误时,会发送Notification消息给对等体,然后关闭BGP连接。
去年12月的时候做了一个项目,中间碰到一个问题,今天写出来跟大家分享一下。
项目概况是这样的,国家电网的一市局,市局里放了两台NE20E-8的路由器,做为全市的核心路由器,每台NE20E-8用一个CPOS口通过传输设备复用出多个2M线路,下接多个变电所,变电所路由器为cisco的2811路由器。
cisco 2811路由器与两台NE20E-8组成一个链路双归网络,cisco 2811、两台NE20E-8路由器均为PE设备,两台NE20E-8做为全市的路由反射器,变电所的cisco2811路由器只与两台NE20E-8路由器建立BGP邻居关系。
全市存在两个VPN(MPLS/VPN),分别以VRF A和VRF B表示,两台NE20E-8使用upe 方式向cisco2811下发缺省路由引导上行流量,在cisco 2811中重分布直连路由。
以下为网络示意图:以下为三台设备的配置文件NE20E-8A:dis cu#sysname HZLA-NE20E-8A#router id 33.10.191.11#diffserv domain#ip vpn-instance realtimeroute-distinguisher 2007:1vpn-target 30033:11 export-extcommunityvpn-target 30033:1 30033:11 30033:13 import-extcommunity #ip vpn-instance nrtroute-distinguisher 2007:2vpn-target 30033:12 export-extcommunityvpn-target 30033:2 30033:12 30033:14 import-extcommunity #mpls lsr-id 33.10.191.11mpls#mpls ldp#controller Cpos3/0/0e1 6 channel-set 0 timeslot-list 1-31#interface Aux0async mode flowlink-protocol ppp#interface Ethernet1/0/0#interface Ethernet1/0/1#interface Ethernet1/0/2#interface Ethernet1/0/3#interface Ethernet1/0/4description LINK_TO_HZ-NE20-8Aip address 33.10.190.6 255.255.255.252mplsmpls ldp#interface Ethernet1/0/5#interface Ethernet1/0/6#interface Ethernet1/0/7#interface Ethernet2/0/0#interface Ethernet2/0/1#interface Ethernet2/0/2description LINK_TO_HZLA-NE20-8Bip address 33.10.190.61 255.255.255.252 mplsmpls ldp#interface Ethernet2/0/3#interface Ethernet2/0/4#interface Ethernet2/0/5#interface Ethernet2/0/6#interface Ethernet2/0/6.100vlan-type dot1q 100description LINK_TO_HZLA-S3328TP-RT ip binding vpn-instance realtimeip address 33.10.190.209 255.255.255.252 #interface Ethernet2/0/6.200vlan-type dot1q 200description realtimeip binding vpn-instance realtimeip address 10.33.177.94 255.255.255.224 vrrp vrid 200 virtual-ip 10.33.177.94#interface Ethernet2/0/7#interface Ethernet4/0/0#interface Ethernet4/0/1#interface Ethernet4/0/2#interface Ethernet4/0/3#interface Ethernet4/0/4#interface Ethernet4/0/5#interface Ethernet4/0/6#interface Ethernet4/0/6.300#interface Ethernet4/0/6.400description nrt#interface Ethernet4/0/7#interface Serial3/0/0/6:0link-protocol pppdescription xiushuiip address 33.10.177.217 255.255.255.252 mplsmpls ldp#interface GigabitEthernet0/0/1#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0ip address 33.10.191.11 255.255.255.255 #bgp 30033group 500 internalpeer 500 connect-interface LoopBack0 peer 33.10.191.131 as-number 30033 peer 33.10.191.131 group 500group 300 internalpeer 300 connect-interface LoopBack0 peer 33.10.191.1 as-number 30033peer 33.10.191.1 group 300peer 33.10.191.12 as-number 30033peer 33.10.191.12 group 300#ipv4-family unicastundo synchronizationreflector cluster-id 100.100.100.100peer 300 enablepeer 33.10.191.1 enablepeer 33.10.191.1 group 300peer 33.10.191.12 enablepeer 33.10.191.12 group 300peer 500 enablepeer 500 reflect-clientpeer 33.10.191.131 enablepeer 33.10.191.131 group 500#ipv4-family vpnv4reflector cluster-id 100.100.100.100policy vpn-targetpeer 300 enablepeer 33.10.191.1 enablepeer 33.10.191.1 group 300peer 33.10.191.12 enablepeer 33.10.191.12 group 300peer 500 enablepeer 500 reflect-clientpeer 500 upepeer 500 default-originate vpn-instance realtimepeer 500 default-originate vpn-instance nrtpeer 33.10.191.131 enablepeer 33.10.191.131 group 500#ipv4-family vpn-instance realtimeimport-route directimport-route static#ipv4-family vpn-instance nrtimport-route directimport-route static#aaalocal-user admin password cipher .]@USE=B,53Q=^Q`MAF4<1!! local-user admin service-type telnetlocal-user admin level 15authentication-scheme default#authorization-scheme default#accounting-scheme default#domain default##ospf 1area 0.0.0.21network 33.10.191.11 0.0.0.0network 33.10.190.4 0.0.0.3network 33.10.190.60 0.0.0.3network 33.10.177.216 0.0.0.3#nqa-jitter tag-version 1#snmp-agentsnmp-agent local-engineid 000007DB7F00000100004E8Bsnmp-agent community write Zpepbdc@sjwsnmp-agent community read huaWei8zjepsnmp-agent sys-info version allsnmp-agent target-host trap address udp-domain 10.33.223.178 params securityname huaWei8zjepsnmp-agent target-host trap address udp-domain 10.33.223.179 params securityname huaWei8zjepsnmp-agent trap enable standardsnmp-agent trap source LoopBack0#user-interface con 0user-interface aux 0user-interface vty 0 4authentication-mode aaa#returnNE20—B:dis cu#sysname HZLA-NE20E-8B#router id 33.10.191.12#diffserv domain#ip vpn-instance realtimeroute-distinguisher 2008:1vpn-target 30033:11 export-extcommunityvpn-target 30033:1 30033:11 30033:13 import-extcommunity#ip vpn-instance nrtroute-distinguisher 2008:2vpn-target 30033:12 export-extcommunityvpn-target 30033:2 30033:12 30033:14 import-extcommunitympls lsr-id 33.10.191.12mpls#mpls ldp#controller Cpos3/0/0e1 6 channel-set 0 timeslot-list 1-31#interface Aux0async mode flowlink-protocol ppp#interface Ethernet1/0/0#interface Ethernet1/0/1#interface Ethernet1/0/2#interface Ethernet1/0/3#interface Ethernet1/0/4#interface Ethernet1/0/5#interface Ethernet1/0/6#interface Ethernet1/0/7#interface Ethernet2/0/0#interface Ethernet2/0/1#interface Ethernet2/0/2description LINK_TO_HZLA-NE20-8A ip address 33.10.190.62 255.255.255.252 mplsmpls ldp#interface Ethernet2/0/3#interface Ethernet2/0/4#interface Ethernet2/0/5interface Ethernet2/0/6#interface Ethernet2/0/6.300vlan-type dot1q 300description LINK_TO_HZLA-S3328TP-NRT ip binding vpn-instance nrtip address 33.10.190.217 255.255.255.252#interface Ethernet2/0/6.400vlan-type dot1q 400description nrtip binding vpn-instance nrtip address 10.33.177.126 255.255.255.224 vrrp vrid 40 virtual-ip 10.33.177.126#interface Ethernet2/0/7#interface Ethernet4/0/0#interface Ethernet4/0/1#interface Ethernet4/0/2#interface Ethernet4/0/3#interface Ethernet4/0/4description LINK_TO_HZFY-NE20-8Aip address 33.10.190.58 255.255.255.252 mplsmpls ldp#interface Ethernet4/0/5#interface Ethernet4/0/6#interface Ethernet4/0/6.100#interface Ethernet4/0/6.200description realtime#interface Ethernet4/0/7#interface Serial3/0/0/6:0link-protocol pppdescription xiushuiip address 33.10.226.217 255.255.255.252 mplsmpls ldp#interface GigabitEthernet0/0/1#interface GigabitEthernet0/0/2#interface NULL0#interface LoopBack0ip address 33.10.191.12 255.255.255.255 #bgp 30033group 500 internalpeer 500 connect-interface LoopBack0 peer 33.10.191.131 as-number 30033 peer 33.10.191.131 group 500group 300 internalpeer 300 connect-interface LoopBack0 peer 33.10.191.11 as-number 30033peer 33.10.191.11 group 300peer 33.10.191.9 as-number 30033peer 33.10.191.9 group 300#ipv4-family unicastundo synchronizationreflector cluster-id 100.100.100.100peer 300 enablepeer 33.10.191.11 enablepeer 33.10.191.11 group 300peer 33.10.191.9 enablepeer 33.10.191.9 group 300peer 500 enablepeer 33.10.191.131 enablepeer 33.10.191.131 group 500#ipv4-family vpnv4reflector cluster-id 100.100.100.100 policy vpn-targetpeer 300 enablepeer 33.10.191.11 enablepeer 33.10.191.11 group 300peer 33.10.191.9 enablepeer 33.10.191.9 group 300peer 500 enablepeer 500 reflect-clientpeer 500 upepeer 500 default-originate vpn-instance realtimepeer 500 default-originate vpn-instance nrtpeer 33.10.191.131 enablepeer 33.10.191.131 group 500#ipv4-family vpn-instance realtimeimport-route directimport-route static#ipv4-family vpn-instance nrtimport-route directimport-route static#aaalocal-user admin password cipher .]@USE=B,53Q=^Q`MAF4<1!! local-user admin service-type telnetlocal-user admin level 15authentication-scheme default#authorization-scheme default#accounting-scheme default#domain default##ospf 1import-route directarea 0.0.0.21network 33.10.191.12 0.0.0.0network 33.10.190.60 0.0.0.3network 33.10.190.56 0.0.0.3network 33.10.226.216 0.0.0.3#nqa-jitter tag-version 1#snmp-agentsnmp-agent local-engineid 000007DB7F00000100004E8Bsnmp-agent community write Zpepbdc@sjwsnmp-agent community read huaWei8zjepsnmp-agent sys-info version allsnmp-agent target-host trap address udp-domain 10.33.223.178 params securityname huaWei8zjepsnmp-agent target-host trap address udp-domain 10.33.223.179 params securityname huaWei8zjepsnmp-agent trap enable standardsnmp-agent trap source LoopBack0#user-interface con 0user-interface aux 0user-interface vty 0 4authentication-mode aaa#returncisco 2811LAXIUSHUI-R2811-1#sho runBuilding configuration...Current configuration : 3511 bytes!version 12.4no service padservice timestamps debug datetime msecservice timestamps log datetime msecservice password-encryption!hostname LAXIUSHUI-R2811-1!boot-start-markerboot-end-marker!card type e1 0 1logging message-counter syslogenable secret 5 $1$0LKz$71.irTxS.bL56D.GD74lD/!no aaa new-modelclock timezone CST 8no network-clock-participate wic 1!dot11 syslogno ip source-routeno ip gratuitous-arps!!ip cefip vrf nrtrd 2406:2route-target export 30033:14route-target import 30033:2route-target import 30033:12!ip vrf realtimerd 2406:1route-target export 30033:13route-target import 30033:1route-target import 30033:11!!!no ipv6 cef!multilink bundle-name authenticated !!!!!!!!!!!!!!!!!!!!!!!voice-card 0!!!!!archivelog confighidekeys!!!!!controller E1 0/1/0framing NO-CRC4clock source internalchannel-group 0 timeslots 1-31!controller E1 0/1/1framing NO-CRC4clock source internalchannel-group 0 timeslots 1-31!!!!!interface Loopback0ip address 33.10.191.131 255.255.255.255 !interface FastEthernet0/0ip address 192.168.1.1 255.255.255.0 duplex autospeed auto!interface FastEthernet0/1no ip addressshutdownduplex autospeed auto!interface FastEthernet0/0/0description ***TO LAXIUSHUI-C2918-01 G0/24*** switchport mode trunk!interface FastEthernet0/0/1description ***TO LAXIUSHUI-C2918-02 G0/24*** switchport mode trunk!interface FastEthernet0/0/2!interface FastEthernet0/0/3!interface Serial0/1/0:0description ***TO LINAN-NE20-A ....***ip address 33.10.177.218 255.255.255.252 encapsulation pppmpls ip!interface Serial0/1/1:0description ***TO LINAN-NE20-B ....***ip address 33.10.226.218 255.255.255.252 encapsulation pppmpls ip!interface Vlan1no ip address!interface Vlan10ip vrf forwarding realtimeip address 33.10.234.97 255.255.255.248!interface Vlan20ip vrf forwarding nrtip address 33.10.234.105 255.255.255.248!interface Vlan30description management-realtimeip vrf forwarding realtimeip address 33.10.185.218 255.255.255.252ip access-group 100 in!interface Vlan40description management-nrtip vrf forwarding nrtip address 33.10.189.218 255.255.255.252!router ospf 1router-id 33.10.191.131log-adjacency-changesnetwork 33.10.177.216 0.0.0.3 area 21 network 33.10.191.131 0.0.0.0 area 21 network 33.10.226.216 0.0.0.3 area 21 !router bgp 30033bgp router-id 33.10.191.131no bgp default ipv4-unicastbgp log-neighbor-changesneighbor 500 peer-groupneighbor 500 remote-as 30033 neighbor 500 update-source Loopback0 neighbor 33.10.191.11 peer-group 500 neighbor 33.10.191.12 peer-group 500 !address-family ipv4neighbor 33.10.191.11 activate neighbor 33.10.191.12 activateno auto-summaryno synchronizationexit-address-family!address-family vpnv4neighbor 500 send-community extended neighbor 33.10.191.11 activate neighbor 33.10.191.12 activateexit-address-family!address-family ipv4 vrf realtime redistribute connectedredistribute staticno synchronizationexit-address-family!address-family ipv4 vrf nrt redistribute connectedredistribute staticno synchronizationexit-address-family!ip forward-protocol ndno ip http serverno ip http secure-server!!!!!!!!!control-plane!!!!!!!!!!line con 0line aux 0line vty 0 4exec-timeout 5 0password 7 1511021F07257A767Blogin!scheduler allocate 20000 1000end正常情况下,按照上面的配置,网络是不会有问题的,但当天做完后,发现网络不通,经检查,发现cisco 2811中每个vrf中均上存在一条缺省路由,为bgp路由是指向NE20-A 的(优选router-ID小的),这条路由是正常的。
BGP的宣告、BGP的属性详解、专治各种BGP的属性选路问题BGP的宣告、BGP的属性详解、专治各种BGP的属性选路问题南兮⾬朦胧 2019-08-02 17:50:45 2456 收藏 18版权⽂章⽬录⼀、BGP的宣告⼆、BGP的属性三、属性详情1、Weihgt2、Origin:标识该路由如何得到的3、AS path4、next-hop5、local-pref6、MED7、Atomic_aggregate8、Aggregator9、Community社团属性的四个⼦属性10、Originator_id11、Cluster_list⼀、BGP的宣告BGP的最终⽬标是完成本AS的全部或者某些路由的转发,⽽实质就是将原有的路由条⽬宣告出去,所以应该满⾜以下条件:1、被宣告的路由必须在路由表中;2、被宣告的路由必须和路由表中的前缀和掩码⼀致;3、EBGP邻居建邻⼀般使⽤直连建邻,如果使⽤⾮直连建邻需要修改跳数,默认为1(不修改则⽆法建邻),直连⼀般指的是接⼝两端,如果采⽤环回建邻,必须修改跳数;正常建邻:全局下:router bgp 1 //启动BGP协议,加上AS号neighbor 10.2.2.2 remote-as 2 //指定对⽅成为邻居,加上对⽅AS号;R1(config)# neighbor 10.1.1.1 ebgp-multihop //修改跳数(不加则为255);⼆、BGP的属性BGP最重要的是属性,可以完成选路、防环、标记等⼯作,IGP协议的度量在AS之间⽆法选择正确的最佳路径;属性分为四类:1.公认必尊 --必须传递必须识别所有 BGP 路由器必须识别遵守的原则有 origin,as_path ,next_hop2.公认可尊–必须识别所有路由器都能识别但是不⼀定要遵守,local_pref,atomic_aggregate3.可选传递–打开传递不是所有 BGP 路由器都能识别,但是所有 BGP 都能传递,aggregator 和 community4.可选⾮传递–打开不传递不是所有路由器都被识别,不能识别的 BGP 路由器就丢弃它,MED,originator_id 和 cluster_id,weight三、属性详情1、Weihgtcisco 私有属性,对于离开 AS 的路由在路由器选择那⼀条最优,本台路由器产⽣为 32768,学习的为 0,越⼤越优,适⽤于⼀台路由去往别的 AS 有多个出⼝。
网通集团公司IP高级培训教材BGP协议北京邮电大学培训中心授课教师: 赵振民Zhmzhao@1BGP协议主要内容•BGP中的新概念•BGP消息类型•BGP的标准路径属性•BGP与IGP的信息传递•BGP的实际应用•BGP的发展2BGP协议培训目标•了解和掌握BGP中的新概念•了解和掌握BGP的四种报文•掌握BGP常用的七种标准路径属性•掌握E-BGP和I-BGP的使用•了解在实际网络中使用BGP解决策略路由的方法•了解BGP的发展3BGP中的新概念路径向量的概念在BGP中,每个路由更新分组都带有中转网络(AS)的从源站点到目地站点的全部列表。
只要AS在列表中出现两次,即表明出错(会产生环路)。
环路保护算法:收到一个路由广告,外部路由检查本身的AS是否在路径列表中。
是,拒绝使用;否则,在进一步发送路由广告前,将本地标识插入路径之中。
优点:不要求所有的中继节点使用相同的度量制式。
缺点:加大了路由报文长度,运行协议所需要的的内存总量。
每个网络有一个表项,内存与网络数N成正比。
4 5BGP 中的新概念BGP Session使用BGP 在两个路由器之间交换路由信息时,第一步是在它们之间建立一个连接。
两个端点称为BGP peers ,它们合在一起称为BGP Session 。
在BGP 中,必须保证两个端点之间的信息的可靠性,因此BGP 在TCP 协议之上运行。
BGP peer BGP peer 基于TCP BGP Session 6BGP 中的新概念BGP SessionBGP Session 的建立过程•在试图建立一个TCP 连接前,BGP Session 认为是在idle 状态。
•任何一个端点开始进行TCP 连接的建立,BGP Session 认为是在Connection 状态。
•如果一定时间内,TCP 连接无法建立,端点转移到Active 状态,此时它周期性重复建立连接。
•基于可靠的TCP 连接,可以节省许多开销。
BGP基础之community属性BGP基础之community属性⼀试验说明:本实验我们来研究⼀下BGP的⼀个属性:community属性。
这是不同于选路属性的⼀个属性。
该属性具有以下⼏个特点;1 community是⼀个任选可透明传送属性,它可以简化策略的执⾏。
2 它是cisco的⼀个专有属性,现在在RFC1997中已被标准化。
3 commnity属性标明⼀个⽬的地作为⼀些⽬的地团体中的⼀个成员,这些⽬的地共享⼀个或多个共同的特性。
4 community值可以⾃⼰定义,另外有⼏个已经定义好的团体属性:NO_ADVERTISE:表⽰携带该值的路由不能公布给EBGP和IBGP邻居NO_EXPORT:表⽰携带该值的路由不能公布给EBGP邻居LOCAL_AS:(NO_EXPORT_SUBCONFED)携带该值的路由可以公布给联盟内的其它⼦⾃治系统但不能在构成联盟的AS 以外进⾏公布。
在本实验中,我们就先来研究以下这⼏个已经定义好的团体属性。
试验步骤如下:1 底层配置2 配置BGP,在本实验中要建⽴联邦我们顺便学习⼀下联邦3 配置团体属性,让2.2.2.0⽹络只被R2学习到4 配置团体属性,让22.22.22.0⽹络只被R2,R3学习到5 配置团体属性,让222.222.222.0⽹络只被R2,R3,R4学习到6 配置团体属性,让R1不传递2.2.2.0 这条路由********************************************************************* *********⼆试验配置1 底层配置――――――――――――――――――――――――――2 配置BGPr1#sh run | b r brouter bgp 100no synchronizationnetwork 2.2.2.0 mask 255.255.255.0network 22.22.22.0 mask 255.255.255.0network 222.222.222.0neighbor 12.0.0.2 remote-as 234no auto-summary――――――――――――――――――r2#sh run | b r brouter bgp 64512no synchronizationbgp confederation identifier 234 /指明联邦号是234neighbor 12.0.0.1 remote-as 100neighbor 23.0.0.3 remote-as 64512 /R3跟它处于联邦内同⼀个⼦AS中neighbor 23.0.0.3 next-hop-self /指定下⼀跳是它⾃⼰no auto-summary―――――――――――――――――――r3#sh run | b r brouter bgp 64512no synchronizationbgp confederation identifier 234bgp confederation peers 64513 /指明该联邦内的另⼀个⼦AS neighbor 23.0.0.2 remote-as 64512neighbor 34.0.0.4 remote-as 64513 /R4跟它处于联邦内不同⼦AS之间no auto-summary ―――――――――――――――――――r4#sh run | b r brouter bgp 64513no synchronizationbgp confederation identifier 234bgp confederation peers 64512neighbor 34.0.0.3 remote-as 64512neighbor 45.0.0.5 remote-as 500no auto-summary―――――――――――――――――――r5#sh run | b r brouter bgp 500no synchronizationneighbor 45.0.0.4 remote-as 234no auto-summary――――――――――――――――――――――――――――――――――――――查看⽹络r2#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 12.0.0.1 0 0 100 i*> 22.22.22.0/24 12.0.0.1 0 0 100 i*> 222.222.222.0 12.0.0.1 0 0 100 ir3#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*>i2.2.2.0/24 23.0.0.2 0 100 0 100 i*>i22.22.22.0/24 23.0.0.2 0 100 0 100 i*>i222.222.222.0 23.0.0.2 0 100 0 100 i在R2上已经修改了下⼀跳,所以这时下⼀跳已经是R2⾃⼰了。
概念定义:所谓地址族,就是把ipv4、ipv6和vpnv4分成不同的“块”,对每个“块”单独进行配置,如下所示:Rack1R3(config-router)#address-family ?ipv4 Address familyipv6 Address familyvpnv4 Address family由于ipv6现在应用较少,所以暂时不予讨论,如果大家配置过MPLS VPN,那么对ipv4和vpnv4这两个地址族应该有些了解。
其实如果不是有特殊应用(MPLS、Ipv6),也不会用到这些地址族的概念,直接默认建立全局BGP邻居及属性就可以了。
所以可以理解地址组是BGP的一个扩展。
下面我们就这两个地址族进行分析。
Ipv4和vpnv4地址族的分析:特殊说明:“no bgp default ipv4-unicast” 命令是在全局BGP下禁用单播的传播,在MPLS中,正确的配置就是打上此命令,然后如果需要全局BGP连接或在BGP vpnv4连接,那么就在各个地址族中激活此邻居就可以了。
但有些全局命令是可以被继承到各个地址族中的。
以下分别分析几种常见的情况1、如果没有配置“no bgp default ipv4-unicast”,直接在全局配置BGP邻居关系,这样ipv4地址族会默认被激活的,但是不会显示在“show run”中,如下所示:Rack1R1#config terEnter configuration commands, one per line. End with CNTL/Z.Rack1R1(config)#router bgp 1Rack1R1(config-router)#bgp router-id 150.1.1.1Rack1R1(config-router)#nei 150.1.2.2 remote-as 1Rack1R1(config-router)#nei 150.1.2.2 update-source lo0Rack1R1(config-router)#address-family vpnv4Rack1R1(config-router-af)#nei 150.1.2.2 activateRack1R1(config-router-af)#nei 150.1.2.2 send-community exRack1R1(config-router-af)#exitRack1R1(config-router)#endRack1R1#Rack1R1#sh run | b r brouter bgp 1no synchronizationbgp router-id 150.1.1.1neighbor 150.1.2.2 remote-as 1neighbor 150.1.2.2 update-source Loopback0no auto-summary! >>>>> 没有ipv4地址族address-family vpnv4neighbor 150.1.2.2 activateneighbor 150.1.2.2 send-community extendedexit-address-family!2、此时如果打上“no bgp default ipv4-unicast” ,address-family ipv4地址族就会自动显示出来,此时如果再建立BGP全局邻居,这条命令就会生效:Rack1R1#config terEnter configuration commands, one per line. End with CNTL/Z.Rack1R1(config)#router bgp 1Rack1R1(config-router)#no bgp default ipv4-unicastRack1R1(config-router)#endRack1R1#Rack1R1#sh run | b r brouter bgp 1bgp router-id 150.1.1.1no bgp default ipv4-unicastneighbor 150.1.2.2 remote-as 1neighbor 150.1.2.2 update-source Loopback0!address-family ipv4neighbor 150.1.2.2 activateno auto-summary >>>>> 这些命令从全局BGP配置中继承到了ipv4的地址族中no synchronizationexit-address-family!address-family vpnv4neighbor 150.1.2.2 activateneighbor 150.1.2.2 send-community extendedexit-address-familyRack1R1#config terEnter configuration commands, one per line. End with CNTL/Z.Rack1R1(config)#router bgp 1Rack1R1(config-router)#nei 150.1.3.3 remot 1Rack1R1(config-router)#nei 150.1.3.3 update-source lo0Rack1R1(config-router)#endRack1R1#Rack1R1#sh run | b r brouter bgp 1bgp router-id 150.1.1.1no bgp default ipv4-unicastneighbor 150.1.2.2 remote-as 1neighbor 150.1.2.2 update-source Loopback0neighbor 150.1.3.3 remote-as 1neighbor 150.1.3.3 update-source Loopback0!address-family ipv4 >>>>> 在ipv4地址族中没有150.1.3.3 的邻居neighbor 150.1.2.2 activateno auto-summaryno synchronizationexit-address-family!address-family vpnv4neighbor 150.1.2.2 activateneighbor 150.1.2.2 send-community extendedexit-address-family!由于“no bgp default ipv4-unicast”命令的关系,虽然建立了全局BGP的邻居,但它是不会出现在任何地址族中的。
cisco路由器怎么配置BGP思科cisco是全世界领先且顶尖的通讯厂商,他出产的路由器功能也是很出色的,那么你知道cisco路由器怎么配置BGP吗?下面是店铺整理的一些关于cisco路由器怎么配置BGP的相关资料,供你参考。
cisco路由器配置BGP的案例如下:在RA上启动BGP AS 100,在RB,RC,RD上启动BGP AS200;并在AS 200 中启动OSPF。
实验要求:1 AB,BC,CD之间分别建立EBGP,IBGP,IBGP 邻接关系。
2 通过BGP宣告A,B,C上的3个虚拟接口。
要求所有路由器都能通过 sh ip bgp 看到这些虚拟接口。
(将RC设为路由反射器)3 要求所有路由器都有全部网络的路由信息*************************************************************** ***********************一基本配置RA#sh run!!interface Loopback0ip address 1.1.1.1 255.255.255.0!interface Serial0ip address 192.1.1.1 255.255.255.0!router bgp 100no synchronizationbgp log-neighbor-changesnetwork 1.1.1.0 mask 255.255.255.0neighbor 192.1.1.2 remote-as 200no auto-summary!RB#sh run!interface Loopback0ip address 2.2.2.2 255.255.255.0!interface Ethernet0ip address 193.1.1.1 255.255.255.0!interface Serial0ip address 192.1.1.2 255.255.255.0clockrate 64000!router ospf 1 //在RB上启动OSPFnetwork 0.0.0.0 255.255.255.255 area 0 //宣告所有与RB相连的网络!router bgp 200no synchronizationnetwork 2.2.2.0 mask 255.255.255.0neighbor 192.1.1.1 remote-as 100neighbor 193.1.1.2 remote-as 200no auto-summary!RC#sh run!interface Loopback0ip address 3.3.3.3 255.255.255.0!interface Ethernet0ip address 193.1.1.2 255.255.255.0!interface Serial0ip address 194.1.1.1 255.255.255.0clock rate 64000!router ospf 1log-adjacency-changesnetwork 0.0.0.0 255.255.255.255 area 0 // 同RB !router bgp 200no synchronizationbgp log-neighbor-changesnetwork 3.3.3.0 mask 255.255.255.0 neighbor 193.1.1.1 remote-as 200neighbor 194.1.1.2 remote-as 200no auto-summary!RD#sh runinterface Serial0ip address 194.1.1.2 255.255.255.0!router ospf 1 //同RBlog-adjacency-changesnetwork 0.0.0.0 255.255.255.255 area 0!router bgp 200no synchronizationbgp log-neighbor-changesneighbor 194.1.1.1 remote-as 200no auto-summary二检查BGPRA#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 1.1.1.0/24 0.0.0.0 0 32768 i*> 2.2.2.0/24 192.1.1.2 0 0 200 i*> 3.3.3.0/24 192.1.1.2 0 200 i可以看到RA已经通过BGP学习到了各个虚拟接口,这两条路由下一跳均为192.1.1.2。
BGP-不同AS间运⾏的协议在之前介绍的⽹络场景中,ERGRP,OPSF,RIP 等都是运⾏在单独⼀个 AS(⾃治系统之间)。
这些协议统称为 IGP - 内部⽹关协议,⽬的主要是为⾃治系统内发现邻居和计算路由,从⽽找到合适的路径。
⽽ BGP 这样的协议,运⾏在不同的 AS 间(⽐如联通和电信间的通信)。
⽬的是为了传递路由和控制路由。
这类协议统称为 EGP - 外部⽹关协议。
BGP 特点BGP 运⾏在不同 AS 间,端⼝为 179.是路径⽮量路由协议增量更新,只发送更新的路由,原因在于 BGP ⽀持海量的路由传输(⼏⼗,上百万路由)⽆环路路由策略丰富,对路由进⾏过滤和选择基于 TLV 结构,易于扩展收敛较慢,由于基于 TCP 可靠传输,⽽且数量较⼤。
BGP 管理值 AD 分为两种:20:通过 EGP 邻居学到的路由 AD 为 20200:通过 IBGP 学习到的路由 AD 为 200 (⼀般在 AS 内都有 IGP - OSPF,EIGRP 等,⽽ IBGP 收敛很慢所以 AD 值较⼤)关于路径⽮量路由协议:在这⾥,将 AS 65050 的路由传递给 AS 65010 时:其中经过 65050->65030->65020 三个节点,并知道节点的⽅向,这就是基于路径⽮量的路由协议。
BGP 数据结构BGP 邻居表:建⽴的 Peer(对等体)信息。
BGP 表:通过 BGP 协议学习到的路由(所有路由)。
路由表:实际转发的路由表(最优路由)。
BGP 协议术语AS:⾃治系统,由⼀个技术管理机构管理,使⽤统⼀选录策略的⼀些路由器的集合。
每⼀个⾃治系统都有⼀个唯⼀的⾃治系统编号,像公有 IP ⼀样,需要向IANA 机构申请。
同样也有私有的 AS 编号。
两字节 AS 编号:0 - 65535,早期。
其中 1 - 64511 公有编号,64512 - 65535 私有编号。
四字节 AS 编号:四字节设备兼容两字节设备。
BGP community属性网友:怒咆的野狼发布于:2007.05.18 13:11(共有条评论) 查看评论| 我要评论R1R2R3R4R5顺次互联community属性。
这是不同于选路属性的一个属性。
该属性具有以下几个特点;1 community是一个任选可透明传送属性,它可以简化策略的执行。
2 它是cisco的一个专有属性,现在在RFC1997中已被标准化。
3 commnity属性标明一个目的地作为一些目的地团体中的一个成员,这些目的地共享一个或多个共同的特性。
4 community值可以自己定义,另外有几个已经定义好的团体属性:NO_ADVERTISE:表示携带该值的路由不能公布给EBGP和IBGP邻居NO_EXPORT:表示携带该值的路由不能公布给EBGP邻居LOCAL_AS:(NO_EXPORT_SUBCONFED)携带该值的路由可以公布给联盟内的其它子自治系统但不能在构成联盟的AS以外进行公布。
试验步骤如下:配置BGP,在本实验中要建立联邦我们顺便学习一下联邦配置团体属性,让2.2.2.0网络只被R2学习到配置团体属性,让22.22.22.0网络只被R2,R3学习到配置团体属性,让222.222.222.0网络只被R2,R3,R4学习到配置团体属性,让R1不传递2.2.2.0 这条路由二试验配置配置BGPr1#sh run | b r brouter bgp 100no synchronizationnetwork 2.2.2.0 mask 255.255.255.0network 22.22.22.0 mask 255.255.255.0network 222.222.222.0neighbor 12.0.0.2 remote-as 234no auto-summaryr2#sh run | b r brouter bgp 64512no synchronizationbgp confederation identifier 234 /指明联邦号是234neighbor 12.0.0.1 remote-as 100neighbor 23.0.0.3 remote-as 64512 /R3跟它处于联邦内同一个子AS中neighbor 23.0.0.3 next-hop-self /指定下一跳是它自己no auto-summaryr3#sh run | b r brouter bgp 64512no synchronizationbgp confederation identifier 234bgp confederation peers 64513 /指明该联邦内的另一个子AS neighbor 23.0.0.2 remote-as 64512neighbor 34.0.0.4 remote-as 64513 /R4跟它处于联邦内不同子AS之间no auto-summaryr4#sh run | b r brouter bgp 64513no synchronizationbgp confederation identifier 234bgp confederation peers 64512neighbor 34.0.0.3 remote-as 64512neighbor 45.0.0.5 remote-as 500no auto-summaryr5#sh run | b r brouter bgp 500no synchronizationneighbor 45.0.0.4 remote-as 234no auto-summary查看网络r2#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path *> 2.2.2.0/24 12.0.0.1 0 0 100 i *> 22.22.22.0/24 12.0.0.1 0 0 100 i *> 222.222.222.0 12.0.0.1 0 0 100 i r3#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path *>i2.2.2.0/24 23.0.0.2 0 100 0 100 i *>i22.22.22.0/24 23.0.0.2 0 100 0 100 i *>i222.222.222.0 23.0.0.2 0 100 0 100 i在R2上已经修改了下一跳,所以这时下一跳已经是R2自己了。
r4#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path* 2.2.2.0/24 23.0.0.2 0 100 0 (64512) 100 i* 22.22.22.0/24 23.0.0.2 0 100 0 (64512) 100 i* 222.222.222.0 23.0.0.2 0 100 0 (64512) 100 i注意在R4上看,下一跳依然是R2;为什么不是R3呢?因为R3,R4虽然在同一联邦内,但它们在不同的子AS之间,应该是EBGP关系。
EBGP之间传递路由时,下一跳因该是EBGP邻居。
但这里为什么不是呢。
这就是联邦内EBGP与联邦外EBGP的不同之处。
所以现在这些路由的下一跳对于R4来说是不可达的,所以现在路由无法优化,也就无法向R5传递。
现在在R3上修改下一跳r3(config)#router bgp 64512r3(config-router)#neighbor 34.0.0.4 next-hop-selfr4#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 34.0.0.3 0 100 0 (64512) 100 i*> 22.22.22.0/24 34.0.0.3 0 100 0 (64512) 100 i*> 222.222.222.0 34.0.0.3 0 100 0 (64512) 100 i这时,在R4上看,下一跳已经变成了R3,路由可以优化。
注意在AS路径中可以看到路由经过了子AS 64512r5#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 45.0.0.4 0 234 100 i*> 22.22.22.0/24 45.0.0.4 0 234 100 i*> 222.222.222.0 45.0.0.4 0 234 100 iR5上也可以收到这些路由了,注意R5的AS路径看不到子AS ,只能看到联邦的总AS号。
因此可以得出这样的结论:联邦内的子AS对于联邦外部来说是隐藏的,不可见的。
到现在为止,所有路由器都可以学习到路由,下面就要应用团体属性来控制路由的传递了。
三配置团体属性,让2.2.2.0网络只被R2学习到这里最合适的community属性应该是:no_advertise 因为它不会向任何EBGP IBGP邻居公布路由。
r1(config)#access-list 1 permit 2.2.2.0 0.0.0.255 /用ACL匹配该路由r1(config)#route-map WY permit 10r1(config-route-map)#match ip add 1r1(config-route-map)#set community no-advertise /设定团体属性r1(config)#route-map WY permit 20 /与ACL一样route-map最后也隐藏了一句deny any ,所以在这里要允许所有,要不然其它两条路由会因为匹配不上而无法从R1传递出去。
r1(config)#router bgp 100r1(config-router)#neighbor 12.0.0.2 route-map WY out /在进程下出方向调用route-mapr1(config-router)#neighbor 12.0.0.2 send-community /让R2传递该社团属性先在R2上进行查看;r2#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 12.0.0.1 0 0 100 i*> 22.22.22.0/24 12.0.0.1 0 0 100 i*> 222.222.222.0 12.0.0.1 0 0 100 iR2可以学习到该路由在R3上查看r3#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*>i222.222.222.0 23.0.0.2 0 100 0 100 i可以看到R3已经收不到2.2.2.0这个网络了,往后的路由器也无法收到了。
所以社团属性No_advertise 满足了只让R2学到该路由的需求。
四配置团体属性,让22.22.22.0网络只被R2,R3学习到因为R2,R3处于联邦内同一个子AS,意思是该路由不能传递出这个子AS,所以可以用community属性:LOCAL_ASr1(config)#access-list 2 permit 22.22.22.0 0.0.0.255r1(config)#route-map WY permit 10r1(config-route-map)#match ip add 2r1(config-route-map)#set community local-ASr1(config)#route-map WY permit 20现在进行查看r2#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 12.0.0.1 0 0 100 i*> 22.22.22.0/24 12.0.0.1 0 0 100 i*> 222.222.222.0 12.0.0.1 0 0 100 iR2可以学习到。
r3#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*>i2.2.2.0/24 23.0.0.2 0 100 0 100 i*>i222.222.222.0 23.0.0.2 0 100 0 100 iR3也可以学到r4#sh ip bgpNetwork Next Hop Metric LocPrf Weight Path*> 2.2.2.0/24 34.0.0.3 0 100 0 (64512) 100 i*> 22.22.22.0/24 34.0.0.3 0 100 0 (64512) 100 i*> 222.222.222.0 34.0.0.3 0 100 0 (64512) 100 i为什么R4依然可以学习到,难道属性没起作用吗?显然属性没有起作用,这是因为R2向R3传递该路由时没有让R3继承这个属性,所以R4依然可以学习到,现在必须在R2上配置让R3继承这个属性,这样R3向R4传递路由时团体属性才能生效。