BGP综合实验2
实验BGP综合实验

实验BGP综合实验实验物理拓扑图R1r1(config)#interface e1/0r1(config-if)#ip add 192.168.1.1 255.255.255.0r1(config-if)#no shutdownr1(config-if)#exitr1(config)#interface loopback 1r1(config-if)#ip add 1.1.1.1 255.255.255.0r1(config-if)#no shutdownr1(config-if)#exitr1(config)#interface loopback 2r1(config-if)#ip add 192.168.7.11 255.255.255.0r1(config-if)#no shutdownr1(config-if)#exitr1(config)#router ripr1(config-router)#net 192.168.1.0r1(config-router)#net 192.168.7.0r1(config-router)#net 1.1.1.0r1(config-router)#exitr1(config)#router bgp 100r1(config-router)#neighbor 2.2.2.2 remote-as 200 手动指上邻居r1(config-router)#neighbor 2.2.2.2 update-source loopback 1 以我的LOOPBACK 1 为原与2 .2..2.2 建立邻居关系r1(config-router)#neighbor 2.2.2.2 ebgp-multihop 2 EB与EB用回环口建立邻居所要经历的HOP数r1(config-router)#exitr1(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2r1(config)#router bgp 100r1(config-router)#net 192.168.1.0r1(config-router)#net 1.1.1.0r1(config-router)#net 192.168.7.0r1(config-router)#endR2r2(config)#interface e1/0r2(config-if)#ip add 192.168.1.2 255.255.255.0r2(config-if)#no shutdownr2(config-if)#exitr2(config)#interface e1/1r2(config-if)#ip add 192.168.2.1 255.255.255.0r2(config-if)#no shutdownr2(config-if)#exitr2(config)#interface loopback 1r2(config-if)#ip add 2.2.2.2 255.255.255.0r2(config-if)#no shutdownr2(config-if)#exitr2(config)#router eigrp 100r2(config-router)#net 2.2.2.0r2(config-router)#net 192.168.2.0r2(config-router)#exitr2(config)#router bgp 200r2(config-router)#neighbor 1.1.1.1 remote-as 100r2(config-router)#neighbor 1.1.1.1 update-source loopback 1r2(config-router)#neighbor 1.1.1.1 ebgp-multihop 2r2(config-router)#exitr2(config)#ip route 1.1.1.0 255.255.255.0 192.168.1.1r2(config)#router bgp 200r2(config-router)#neighbor 3.3.3.3 remote-as 200r2(config-router)#neighbor 3.3.3.3 update-source loopback 1r2(config-router)#neighbor 4.4.4.4 remote-as 200r2(config-router)#neighbor 4.4.4.4 update-source loopback 1r2(config-router)#net 192.168.1.0r2(config-router)#net 192.168.2.0r2(config-router)#net 2.2.2.0r2(config-router)#endr2#show ip r*Mar 1 00:19:29.135: %SYS-5-CONFIG_I: Configured from console by consoler2#show 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 rouo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsS 1.1.1.0 [1/0] via 192.168.1.12.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 2.2.2.0/24 is directly connected, Loopback1D 2.0.0.0/8 is a summary, 00:13:45, Null0D 3.0.0.0/8 [90/409600] via 192.168.2.2, 00:09:50, Ethernet1/1D 4.0.0.0/8 [90/435200] via 192.168.2.2, 00:07:28, Ethernet1/1B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:00:38B 192.168.7.0/24 [20/0] via 1.1.1.1, 00:01:19C 192.168.1.0/24 is directly connected, Ethernet1/0C 192.168.2.0/24 is directly connected, Ethernet1/1D 192.168.3.0/24 [90/307200] via 192.168.2.2, 00:09:47, Ethernet1/1r2(config)#router bgp 200r2(config-router)#neighbor 3.3.3.3 next-hop-self 默认EB告诉IB路由条目是下一跳不会改变所以必须强制下一跳r2(config-router)#neighbor 4.4.4.4 next-hop-selfr2(config-router)#endr2#show ip route*Mar 1 00:21:54.807: %SYS-5-CONFIG_I: Configured from console by consoler2#show 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 rouo - ODR, P - periodic downloaded static routeGateway of last resort is not setB 192.168.12.0/24 [200/0] via 4.4.4.4, 00:00:061.0.0.0/24 is subnetted, 1 subnetsS 1.1.1.0 [1/0] via 192.168.1.12.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 2.2.2.0/24 is directly connected, Loopback1D 2.0.0.0/8 is a summary, 00:16:11, Null0D 3.0.0.0/8 [90/409600] via 192.168.2.2, 00:12:16, Ethernet1/1D 4.0.0.0/8 [90/435200] via 192.168.2.2, 00:09:54, Ethernet1/1B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:03:04B 192.168.7.0/24 [20/0] via 1.1.1.1, 00:03:45C 192.168.1.0/24 is directly connected, Ethernet1/0C 192.168.2.0/24 is directly connected, Ethernet1/1D 192.168.3.0/24 [90/307200] via 192.168.2.2, 00:12:13, Ethernet1/1R3r3(config)#interface e1/1r3(config-if)#ip add 192.168.2.2 255.255.255.0r3(config-if)#no shutdownr3(config-if)#exitr3(config)#interface e1/0r3(config-if)#ip add 192.168.3.1 255.255.255.0r3(config-if)#no shutdownr3(config-if)#exitr3(config)#interface loopback 1r3(config-if)#ip add 3.3.3.3 255.255.255.0r3(config-if)#no shutdownr3(config-if)#exitr3(config)#router eigrp 100r3(config-router)#net 3.3.3.0r3(config-router)#net 192.168.2.0r3(config-router)#net 192.168.3.0r3(config-router)#exitr3(config)#router bgp 200r3(config-router)#neighbor 2.2.2.2 remote-as 200r3(config-router)#neighbor 2.2.2.2 update-source loopback 1r3(config-router)#neighbor 4.4.4.4 remote-as 200r3(config-router)#neighbor 4.4.4.4 update-source loopback 1r3(config-router)#net 192.168.2.0r3(config-router)#net 192.168.3.0r3(config-router)#net 3.3.3.0r3(config-router)#endr3#show ip route*Mar 1 00:19:36.211: %SYS-5-CONFIG_I: Configured from console by r3#show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter aN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typE1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-ia - IS-IS inter area, * - candidate default, U - per-usero - ODR, P - periodic downloaded static routeGateway of last resort is not setD 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:09:58, Ethernet1/13.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 3.3.3.0/24 is directly connected, Loopback1D 3.0.0.0/8 is a summary, 00:10:00, Null0D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:07:36, Ethernet1/0B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:00:46B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:01:28C 192.168.2.0/24 is directly connected, Ethernet1/1C 192.168.3.0/24 is directly connected, Ethernet1/0r3#show ip bgpBGP table version is 7, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path *>i192.168.1.0 2.2.2.2 0 100 0 i *> 192.168.2.0 0.0.0.0 0 32768 i* i 2.2.2.2 0 100 0 i* i192.168.3.0 4.4.4.4 0 100 0 i *> 0.0.0.0 0 32768 i *>i192.168.4.0 4.4.4.4 0 100 0 i* i192.168.7.0 1.1.1.1 0 100 0 100 i * i192.168.12.0 5.5.5.5 0 100 0 300 i r3#show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter aN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typE1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-ia - IS-IS inter area, * - candidate default, U - per-usero - ODR, P - periodic downloaded static routeGateway of last resort is not setD 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:10:53, Ethernet1/13.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 3.3.3.0/24 is directly connected, Loopback1D 3.0.0.0/8 is a summary, 00:10:56, Null0D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:08:31, Ethernet1/0B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:01:41B 192.168.7.0/24 [200/0] via 2.2.2.2, 00:00:13B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:02:23C 192.168.2.0/24 is directly connected, Ethernet1/1C 192.168.3.0/24 is directly connected, Ethernet1/0r3#show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter aN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typE1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-ia - IS-IS inter area, * - candidate default, U - per-usero - ODR, P - periodic downloaded static routeGateway of last resort is not setB 192.168.12.0/24 [200/0] via 4.4.4.4, 00:00:09D 2.0.0.0/8 [90/409600] via 192.168.2.1, 00:12:10, Ethernet1/13.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 3.3.3.0/24 is directly connected, Loopback1D 3.0.0.0/8 is a summary, 00:12:12, Null0D 4.0.0.0/8 [90/409600] via 192.168.3.2, 00:09:48, Ethernet1/0B 192.168.4.0/24 [200/0] via 4.4.4.4, 00:02:58B 192.168.7.0/24 [200/0] via 2.2.2.2, 00:01:29B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:03:40C 192.168.2.0/24 is directly connected, Ethernet1/1C 192.168.3.0/24 is directly connected, Ethernet1/0R4r4(config)#interface e1/0r4(config-if)#ip add 192.168.3.2 255.255.255.0r4(config-if)#no shutdownr4(config-if)#exitr4(config)#interface e1/1r4(config-if)#ip add 192.168.4.1 255.255.255.0r4(config-if)#no shutdownr4(config-if)#exitr4(config)#interface loopback 1r4(config-if)#ip add 4.4.4.4 255.255.255.0r4(config-if)#no shutdownr4(config-if)#exitr4(config)#router eigrp 100r4(config-router)#net 192.168.3.0r4(config-router)#net 4.4.4.0r4(config-router)#exitr4(config)#router bgp 200r4(config-router)#neighbor 3.3.3.3 remote-as 200r4(config-router)#neighbor 3.3.3.3 update-source loopback r4(config-router)#neighbor 2.2.2.2 remote-as 200r4(config-router)#neighbor 2.2.2.2 update-source loopback r4(config-router)#neighbor 5.5.5.5 remote-as 300r4(config-router)#neighbor 5.5.5.5 update-source loopback r4(config-router)#neighbor 5.5.5.5 ebgp-multihop 2r4(config-router)#exitr4(config)#ip route 5.5.5.0 255.255.255.0 192.168.4.2r4(config)#router bgp 200r4(config-router)#net 192.168.3.0r4(config-router)#net 192.168.4.0r4(config-router)#net 4.4.4.0r4(config-router)#endr4(config)#router bgp 200r4(config-router)#neighbor 3.3.3.3 next-hop-selfr4(config-router)#neighbor 2.2.2.2 next-hop-selfR5r5(config)#interface e1/1r5(config-if)#ip add 192.168.4.2 255.255.255.0r5(config-if)#no shutdownr5(config-if)#exitr5(config)#interface loopback 1r5(config-if)#ip add 5.5.5.5 255.255.255.0r5(config-if)#no shutdownr5(config-if)#exitr5(config)#interface loopback 2r5(config-if)#ip add 192.168.12.27 255.255.255.0r5(config-if)#no shutdownr5(config-if)#exitr5(config)#router ospf 1r5(config-router)#net 5.5.5.0 0.0.0.255 area 0r5(config-router)#net 192.168.4.0 0.0.0.255 area 0r5(config-router)#net 192.168.12.0 255.255.255.0 area 0r5(config-router)#exitr5(config)#ip route 4.4.4.0 255.255.255.0 192.168.4.1r5(config)#router bgp 300r5(config-router)#neighbor 4.4.4.4 remote-as 200r5(config-router)#neighbor 4.4.4.4 update-source loopback 1 r5(config-router)#neighbor 4.4.4.4 ebgp-multihop 2r5(config-router)#net 192.168.4.0r5(config-router)#net 192.168.12.0r5(config-router)#net 5.5.5.0。
BGP综合实验

BGP综合实验基本配置略。
注意的是我的RT1上的源地址是12.12.12.1所有ipv6地址是2002:c0c:c01:2::1(你自己的是什么就写什么)同理RT5上我用的源地址是5.5.5.5,ipv6地址是2002:505:505:2:1BGP配置Ospf配置略。
加入验证增加安全注意把12.12.12.0网段发布下不然IPV6隧道路由你还得引入什么的6TO4隧道RT1(注意先开启ipv6功能)ipv6 route-static 2002:: 16 Tunnel 0两边加入静态路由可以看到没有问题选路问题选路有多种方法我这里修改的通过BGP修改下一跳,别的方法我也迷糊,- -!首先我们看RT2的路由表,我只是截取了部分我们想看的太多我们先做RT1到RT5的路由选路,原理是做一个route-policy的过滤器,在第一个节点匹配10.0.0.1和11.0.0.1这个网段的或者这个IP,动作是修改下一跳为3.3.3.3(这个3.3.3.3可以让你断一条链路的情况下也能互通)我这个是为了方便在这RT5的一边做的同样匹配10.0.1.1和11.0.1.1这个,动作是修改下一跳为4.4.4.4应用到import和export两个方向上还需要注意的是11.0.0.1和11.0.1.1这两条路由产生了黑洞,黑洞在RT3和RT4上我没还需要在RT3和RT4上加入静态路由解决黑洞[RT3]ip route-static 11.0.0.0 24 5.5.5.5[RT4]ip route-static 11.0.1.0 24 5.5.5.5这样我们再看路由表RT2上RT5上OK了命令简单想费劲RT1上测试RT5上来回路径一致。
BGP综合实验

要点总结:bgp的next-hop属性取值有三种情况1、bgp路由器把自己产生的路由发给ibgp对等体时,将下一跳属性设为自己与对端连接的接口的地址。
2、bgp路由器把自己收到的路由发给ebgp对等体时,把下一跳属性设置为自己与对端连接的接口的地址。
3、bgp路由器把从ebgp学到的路由发给ibgp对等体时,并不改变路由信息的属性。
如果配置了负载分担,则会修改下一跳属性。
BGP路由的Origin属性有以下三种:IGP---路由起源于同一AS域内,用show ip bgp时由I代表EGP---路由通过Exterior Gateway Protocol学得,EGP也是一种自治系统间通讯的路由协议,在BGP 出现前使用,已经被BGP取代。
用show ip bgp时由e代表。
Incomplete---路由起源未知或通过其他方式学得,用?表示实验拓扑1、验证AS-PATH属性启动RA/RB/RC/RF配置接口IP,按图示启动各路由器BGP的协议查看RA的路由表RA#show ip route1.0.0.0/32 is subnetted, 1 subnetsC 1.1.1.1 is directly connected, Loopback0C 200.1.0.0/24 is directly connected, FastEthernet0/0C 200.2.0.0/24 is directly connected, Serial1/0B 200.3.0.0/24 [200/0] via 200.2.0.2, 00:01:37C 192.168.1.0/24 is directly connected, Serial1/1B 192.168.2.0/24 [200/0] via 200.2.0.2, 00:01:37红色字第一条,RA到200.3.0.0网段的下一跳是RC,而不是用快速以太网链路连接的RB。
BGP基础实验-2

Step3:查看: 问题:在R1上,定义R2为自己的"路由反射器的客户端",但 R3不是. R4能收到105的路由吗? 能!R5能收到104的路由吗?能!
LAB9:联邦(Confederation):
假定:子AS65003/AS65012之间是不运行IGP的、AS65012内部运行的IGP是RIP.
结论:
联邦子AS之间的EBGP的下一跳,不像普通EBGP那样每经过一个AS,都发生改变.而保 留原始的BGP下一跳.
下一跳: 可达,因为两个AS间运行了RIP
同步: 原因是R2从IBGP学到的路由,默认要检查同步 但现在R2不可能通过RIP学到此BGP的路由(指这条路由 :i105.1.0.0/16)
默认情况下: 对于一个BGP路由器R1来说,从一个IBGP邻居R3那里学到的BGP路 由,是不是传递给另外的一个IBGP邻居R2的
提醒:EBGP是没有这种规则的!!
Step2:解决方法:BGP Route Reflector /RR 在R1上, 定义R2/R3为自己的"路由反射器的客户端" 2-1: 如果使用Peer-group: R1#neighbor R1-PG route-reflecgtor-client 2-2: 如果没有使用peer-group: R1(router bgp 123)# neighbor 2.2.2.2 route-reflector-client neighbor 3.3.3.3 route-reflector-client
Step8:联邦EBGP和普通EBGP的异同点(观察105.5.5.0)
下一跳: 在联邦的子AS中,所有路由器看到的BGP下一跳,都是相邻大AS的边 缘节点,而不是本联邦内子AS的下一跳,这是区别与普通EBGP的. 同步: 联邦EBGP和普通EBGP一样,无需考察同步问题.
IGP-BGP综合实验及答案

1、IGP综合实验BRIDGE(3分)RIP(6分)EIGRP(9分)OSPF(12分) REDISTRIBUTE (2分)IPV6(3分)BGP(16)MULTICAST (3分)IOS(6分)SEC(6分)QOS(6分)一,地址描述:1.1 R1-R5都有一个LO0 IP ADD = 10.10.X.X X=ROUTER NUMBER比如R1 的LO0 =10.10.1.1 ....1.2 R1-R3 E0 地址为:1.1.123.X/27 X=ROUTER NO.1.3 R2-R4 的广域网接口为: 1.1.234.X/29 X=ROUTER NO.1.4 R4-R5 的广域网接口为: 1.1.45.X/24 X=ROUTER NO.二,BRIDGE:(3分)2.1 如图所示, 配置R1-R3的以太地址,2.2 如图所示, 配置R2-R4之间物理接口的IP ADDRESS,2.3 R2-R4之间的FRAME-RELAY是全互连的,要求只用图中所示的PVC,2.4配置R4-R5之间链路为PPP, 并配置相应接口的地址,请消除32位的主机路由。
2.5配置R1-R5的LO02.6配置完成后测试各链路应能正常通讯。
三,RIP (6分)基本配置:(1分)3.1 R1,R3的E0运行RIP VERSION 2,(1分)⏹高级配置: (3分)3.2 使R1,R3仅向E0发送更新,不要向其他接口发送,所有的更新都是明细路由(1分)Interface e0 ; passive-interface default ; no passive-interface e0;3.3 请确保它们之间的VERSION 2的更新是通过BROADCAST发送的。
(1分)ip rip v2-broadcast3.4 如果在R1、R2、R3的以太网段里有一些VER 2的RIP更新包,但UPDATE SOURCE是150.1.1.1,很显然R1是不会收这些包的,在R1上做配置,使它可以收到这些路由。
雷光全BGP实验报告二

一、实验名称
BGP同步
二、实验要求
分析BGP同步的好处,BGP同步的路由情况,以及在什么情况下使用同步。
三、实验拓扑
四、重要实验配置
Igp的配置:
RT1:
RT2:
RT3:
RT4:
BGP的配置RT1:
RT2:
RT5:
RT6:
五、实验现象
各设备的bpg表:
RT1:
RT2:
RT1路由表:
用ping命令进行全网互联的测试
在RT5上进行跟踪
六、实验分析
分析PC5(10.5.5.10)访问PC6(10.6.6.10)的过程
PC5:10.6.6.10与自己不在同一个网段,它将数据包发送给网关10.5.5.1(RT5)
RT5:查找路由表,发现:
RT1:查找路由表,发现:
RT3:查找路由表,发现:
RT4:查找路由表:发现:
一直到目标地址。
BGP同步,就是使IGP和BGP达到同步,如果没有达到同步的路由,将不会通告给邻居,也不会转发出去。
但是如果
开启同步的话,也有一点的危害,如果BGP的路由条目过多,发布到IGP的话,就会导致IGP路由器崩溃。
所以小心认真使用。
七、实验总结
通过本次实验,我掌握了BGP同步的概念,在什么情况下使用BGP同步,使用BGP同步的时候,要注意些什么,以及我们应该怎样去解决这种状况,显然BGP同步还是比较简单的。
BGP协议综合实验

R2(config-router)#neighbor 5.5.5.5 peer-group dcnp R2(config-router)#exit' R5(config)#router bgp 125 R5(config-router)#bgp router-id 5.5.5.5 R5(config-router)#neighbor dcnp peer-group R5(config-router)#neighbor dcnp remote-as 125 R5(config-router)#neighbor dcnp update-source loopback 0 R5(config-router)#neighbor dcnp next-hop-self R5(config-router)#neighbor 1.1.1.1 peer-group dcnp R5(config-router)#neighbor 2.2.2.2 peer-group dcnp R5(config-router)#neighbor 4.4.4.4 remote-as 4 R5(config-router)#neighbor 4.4.4.4 update-source loopback 0 R5(config-router)#neighbor 4.4.4.4 ebgp-multihop 2 R4(config)#router bgp 4 R4(config-router)#bgp router-id 4.4.4.4 R4(config-router)#neighbor 5.5.5.5 remote-as 125 R4(config-router)#neighbor 5.5.5.5 update-source loopback 0 R4(config-router)#neighbor 5.5.5.5 ebgp-multihop 2 R4(config-router)#^Z 3 在 R1,R2,R5 上启用 ospf 协议,在 R3 和 R4 上宣告路由,R4 和 R5 上配置默认路由 R1(config)#router ospf 110 R1(config-router)#network 12.1.1.0 0.0.0.255 ar R1(config-router)#network 12.1.1.0 0.0.0.255 area 0 R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 R1(config-router)#^Z R2(config)#router ospf 110 R2(config-router)#network 12.1.1.0 0.0.0.255 area 0 R2(config-router)#network 13.1.1.0 0.0.0.255 area 0 R2(config-router)#network 2.2.2.0 0.0.0.255 area 0 R2(config-router)#network 25.1.1.0 0.0.0.255 area 0 R2(config-router)#exit R5(config)#ip route 4.4.4.0 255.255.255.0 45.1.1.4 R5(config)#router ospf 110 R5(config-router)#network 25.1.1.0 0.0.0.255 area 0 R5(config-router)#network 5.5.5.0 0.0.0.255 area 0 R4(config)#ip route 5.5.5.0 255.255.255.0 45.1.1.5 R4(config)#router bgp 4 R4(config-router)#network 4.4.4.0 mask 255.255.255.0 4 在 R1,R2,R5 上关闭同步 R1(config)#router bgp 125 R1(config-router)#no synchronization R2(config)#router bgp 125 R2(config-router)#no synchronization R5(config)#router bgp 125 R5(config-router)#no synchronization R5(config-router)#^Z 5 在 R3 和 R4 上 ping 命令测试 R3#ping 4.4.4.4 source 3.3.3.3
bgp实验报告总结

bgp实验报告总结
BGP实验报告总结
背景
BGP(Border Gateway Protocol)是用于在互联网中交换路由信息的协议。
它是一种路径矢量协议,用于确定最佳路径,并且能够适应网络拓扑的变化。
在本次实验中,我们对BGP进行了实验,并对实验结果进行了总结和分析。
实验过程
在实验中,我们使用了模拟器来模拟网络环境,并配置了多个路由器和主机。
我们通过配置BGP协议来模拟网络中的路由器之间的路由信息交换。
我们还模拟了网络中的故障情况,以观察BGP协议对网络拓扑变化的适应能力。
实验结果
通过实验,我们观察到BGP协议在网络拓扑变化时能够快速地重新计算最佳路径,并更新路由表。
当网络中发生故障时,BGP能够及时地发现并通知其他路由器,从而保证了网络的稳定性和可靠性。
此外,我们还观察到BGP协议在处理大规模网络时的效率和性能表现良好。
总结与分析
通过本次实验,我们对BGP协议的工作原理和性能有了更深入的了解。
BGP作为互联网中最重要的路由协议之一,具有很强的稳定性和可靠性。
它能够适应网络拓扑的变化,并且能够处理大规模网络的路由信息交换。
因此,BGP协议在互联网中扮演着至关重要的角色。
结论
通过本次实验,我们对BGP协议有了更深入的了解,并且验证了其在网络中的
稳定性和可靠性。
BGP协议的高效性和性能表现使其成为互联网中不可或缺的一部分,对于构建稳定和可靠的互联网具有重要意义。
我们将继续深入研究BGP协议,并将其应用于实际网络中,以提高网络的稳定性和可靠性。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
BGP综合实验拓扑一:所有路由器配置环回口及接口地址,启用BGP。
router bgp xxxnei x.x.x.x remote y.y.y.y//回环口地址nei x.x.x.x update-source loopback0//指定更新源,否则BGP邻居关系无法建立注:BGP邻居建立需要neighbor语句中x.x.x.x可达,而且检查接受的包的源地址是否是x.x.x.x,不一致则无法建立邻居关系。
使用debug ip tcp packet和debug ip bgp来查看BGP邻居信息,使用sh tcp brief查看哪一方发起TCP连接,使用sh ip bgp sum查看是否建立。
R2#sh ip bgp summaryBGP router identifier2.2.2.2,local AS number123BGP table version is6,main routing table version6//初始为0,随着路由更新递增5network entries using485bytes of memory//内存使用情况5path entries using180bytes of memory1BGP path attribute entries using60bytes of memory1BGP AS-PATH entries using24bytes of memory0BGP route-map cache entries using0bytes of memory0BGP filter-list cache entries using0bytes of memoryBGP using749total bytes of memoryBGP activity5/0prefixes,5/0paths,scan interval60secsNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 1.1.1.14123747860000:08:3504.4.4.44400636160000:57:575所有路由器均未建立BGP邻居关系,AS123内是因为没有启用IGP,配置OSPF,使各环回口可达。
R1、R2、R3建立IBGP邻居关系。
R4和R2没有对方环回口地址,通过静态路由指定,但是依旧无法建立邻居,因为TTL,所以还需配置neighbor x.x.x.x ebgp-multihop y来修改默认的TTL值,R3和R5一样,至此,两对路由器建立起EBGP邻居关系。
R4(config-router)#neighbor 2.2.2.2ebgp-multihop2抓包图:可见,R2向R4发起了连接,前三行为TCP三次握手信息,建立TCP连接后会触发OPEN 消息,通过keepalive消息来维持连接。
R4#sh tcp briefTCB Local Address Foreign Address(state)653CE2C0 4.4.4.4.179 2.2.2.2.42144ESTAB//发起端使用随机端口,接收端使用TCP179在R4上宣告四个网段:192.168.1.0/24192.168.2.0/24192.168.3.0/24192.168.4.0/24语法:network192.168.x.0mask255.255.255.0使用sh ip bgp查看BGP表,发现R4会通告EBGP邻居R2,但R2也会通告IBGP邻居R1,但R1并不放入路由表,虽然R1的BGP表中有相关条目,但不是最优,因为R1查看自己的IGP路由表,并没有发现192.168.x.0网段,由于BGP同步原则,不认为最优,关闭R1上的同步,学习到路由。
R3没有学习到,因为BGP对等体不将从IBGP邻居学习到的路由通告给其他IBGP邻居以避免环路,即BGP的水平分割原则。
解决方法一:R2和R3之间建立IBGP邻居关系,BGP对等体不需要直连,只要全网可达,能够建立TCP 连接就可以建立邻居关系。
此时,R2会将从EBGP对等体R4学习到的路由通告给IBGP邻居R3,但是R3得到的并不是最优路由,查看sh ip bgp,发现下一跳地址为R4环回口,不可达,所以不是最优,可以在R2上,将静态路由重分布至OSPF,让R3学习到4.4.4.4这个地址,也可以使用neighbor x.x.x.x next-hop-self来修改通告时的源地址。
注:BGP用于AS与AS之间的路由通告,从EBGP邻居学习到的路由进行传递时源地址为EBGP邻居地址,穿越整个AS都保持不变,对AS内的路由器来说,该地址不可达,所以造成路由不优。
解决方法二:使用路由反射器。
R1充当RR,R2和R3充当客户端,三者形成路由反射簇。
语法:Neighbor x.x.x.x route-reflector-client,只需在RR上配置,客户端不用配置。
注:可以在一个AS内任意设置路由反射簇。
通过bgp cluster-id xxx来区分。
RR会将学习到的路由传递给客户端和EBGP邻居,如果R2为RR,则只会传递给R1,而不会传递给R3,因为R1还是遵循传统的水平分割法则。
此时,全网连通。
注意从EBGP学到的路由metric为20,而IBGP的metric为200.BGP可以在任何对等体上进行路由聚合以减小路由表容量。
语法:aggregate-address192.168.0.0255.255.0.0如果聚合成非主类网络,R2和R1上学习到的路由会带上子网掩码,如果是主类,则没有相关信息。
同时路由表将自动产生一条指向Null0的路由来防止路由黑洞。
aggregate-address192.168.0.0255.255.0.0加上参数summary-only,则只通告聚合路由。
此时明细路由前缀变成s,表示抑制路由,即无法通告。
Network Next Hop Metric LocPrf Weight Path*>192.168.0.0/160.0.0.032768is>192.168.1.00.0.0.0032768i另外一种聚合路由的方法是只宣告聚合路由,同时添加一条指向Null0的静态路由。
如在R4上,network218.5.0.0mask255.255.0.0ip route218.5.0.0255.255.0.0null0//只有当本地路由表中有相关条目,才会放入BGP表Network Next Hop Metric LocPrf Weight Path*>218.5.0.0/160.0.0.0032768i在路由通告时,可以使用route-map和suppress-map来控制所通告的路由。
不同的是,route-map使用ACL,而suppress-map是用前缀列表。
在匹配时使用match ip add ip prefix-list X如果不是在源进行汇总,则PATH属性会丢失,加上参数as-set,则在传递路由时保持PATH 属性。
另外,使用attribute-map属性来设置度量值等属性。
拓扑二:R4上有三个网段172.16.1.0/24172.16.2.0/24172.16.3.0/24汇聚成172.16.0.0/22R2和R1均正常接收,此时PATH显示为4,i如果在R2上进行汇总,则R4和R1上PATH均显示2,i,认为起源于AS2,可见PATH信息丢失了。
此时若加上as-set参数,则保留PATH信息,但是R4无法收到汇总后的路由。
因为R4会对路由更新进行AS PATH检查,发现自己的AS在其中的话丢弃,使用R4(config-router)#neighbor192.168.1.2allowas-in2//允许收到相同AS的路由更新R4#sh ip bgp00:11:22:%SYS-5-CONFIG_I:Configured from console by consoleBGP table version is9,local router ID is192.168.1.1Status codes:s suppressed,d damped,h history,*valid,>best,i-internalOrigin codes:i-IGP,e-EGP,?-incompleteNetwork Next Hop Metric LocPrf Weight Path*>172.16.0.0/22192.168.1.2024i*>172.16.1.0/240.0.0.0032768i*>172.16.2.0/240.0.0.0032768i*>172.16.3.0/240.0.0.0032768i联邦confederation为了管理目的,有时将AS划分为许多小AS,各小AS之间为联邦。
如拓扑一:R1和R2组成联邦AS65012,R3独自为联邦AS65003。
R1和R2之间为联邦IBGP邻居关系,R1和R3为联邦EBGP邻居关系。
联邦对于外部AS透明,在R4和R5看来,仍以为与AS123在通信。
配置联邦时,需要使用bgp confederation identifier123来明确大联邦身份,同时还需使用bgp confederation peers X来形成与外部AS和各联邦EBGP对等体之间的EBGP邻居关系。
注:联邦AS配置等同普通AS配置,需要注意可达性、TTL、下一跳地址等。
配置联邦后,PATH属性会丢失。
社团CommunityBGP所传递的路由数量相当庞大,为了方便控制,使用Community属性。
如拓扑一,在R4上的192.168.4.0/24不希望传递到AS500,如果按照传统做法,在AS123内的R3上做策略进行过滤,可是要求增多或变复杂时,策略就不好做了。
例如,AS123内存在联邦时,要求192.168.1.0/24不在小AS之间传递,于是又要在R2上控制,能不能不要在多台路由器上做策略,而是集中于一台,易于管理。
于是想到了Community属性。
利用前缀列表和路由图进行路由的筛选,在对等体之间传递路由时附带Community属性。
R4配置:ip prefix-list haha seq5permit192.168.1.0/24ip prefix-list xixi seq5permit192.168.4.0/24route-map az iz permit10match ip address prefix-list haha//注明前缀列表,无的话表示匹配ACLset community400:192no-advertise additiveroute-map az iz permit20match ip address prefix-list xixiset community no-export//设置为不传递到外ASroute-map az iz permit30//无的话会默认deny其他路由neighbor 2.2.2.2send-community//配置路由传递时附带Community属性neighbor 2.2.2.2route-map az iz out//在与邻居通告时使用策略R2#sh ip bgp192.168.4.0BGP routing table entry for192.168.4.0/24,version36Paths:(1available,best#1,table Default-IP-Routing-Table,not advertised to EBGP peer) Advertised to non peer-group peers:1.1.1.14004.4.4.4from4.4.4.4(4.4.4.4)Origin IGP,metric0,localpref100,valid,external,bestCommunity:no-export也可以使用Community-listip community-list1permit400:192local-ASroute-map az iz permit40match community1使用ip bgp-community new-format可以进行community号和aa:nn转换。