一、实验拓扑: 二、实验要求: 1、R1、R2、R4、R5部署BGP基本配置: bgp号、bgp router-id、no auto-summary、neighbor、network; 2、三个不同AS之间手动建立邻居关系:R1和R2建立邻居关系:用物理接口地址、R4和R5建立邻居关系、R2和R4建立邻居关系并带update-source:用环回口地址; 3、R2、R4分别告诉对方下一跳为自己,使得R2、R4能够收到5.5.5.5、1.1.1.1的路由条目;

三、命令部署: 1、BGP基本部署: R1(config)#router bgp 1 R1(config-router)#bgp router-id 1.1.1.1 R1(config-router)#no auto-summary R1(config-router)#network 1.1.1.0 mask 255.255.255.0 R1(config-router)#eighbor 12.1.1.2 remote-as 24

R2(config)#router bgp 24 R2(config-router)#bgp router-id 2.2.2.2 R2(config-router)#no auto-summary R2(config-router)#neighbor 12.1.1.1 remote-as 1 R2(config-router)#neighbor 4.4.4.4 remote-as 24 R2(config-router)#network 2.2.2.0 mask 255.255.255.0

R4(config)#router bgp 24 R4(config-router)#bgp router-id 4.4.4.4 R4(config-router)#no auto-summary R4(config-router)#neighbor 2.2.2.2 remote-as 24 R4(config-router)#network 4.4.4.0 mask 255.255.255.0 R4(config-router)#neighbor 5.5.5.5 remote-as 5

R5(config)#router bgp 5 R5(config-router)#bgp router-id 5.5.5.5 R5(config-router)#no auto-summary R5(config-router)#network 5.5.5.0 mask 255.255.255.0 R5(config-router)#neighbor 4.4.4.4 remote-as 24

R2(config-router)#network 3.3.3.0 mask 255.255.255.0 //可以宣告3.3.3.0的路由条目 R1#show ip bgp neighbors //会出现很长的邻居关系信息 R1#show ip bgp summary //查看本地BGP、邻居BGP汇总信息 R1#show ip bgp //查看BGP信息

2、R2和R4建立邻居关系 R2(config-router)#router bgp 24 R2(config-router)#neighbor 4.4.4.4 update-source loopback 1

R4(config)#router bgp 24 R4(config-router)#neighbor 2.2.2.2 update-source loopback 1

3、R4获取1.1.1.1路由条目下一跳修改(如果R2 EIGRP中宣告了12.1.1.0网段,R4会自动获取1.1.1.1条目): R2(config)#router bgp 24 R2(config-router)#neighbor 4.4.4.4 next-hop-self

4、R4和R5配置更新源,即使有更新源依然不可达, 因为:①路由不通; ②默认TTL=1,实则需要TTL=2才行;

R4(config)#router bgp 24 R4(config-router)#neighbor 5.5.5.5 update-source loopback 1 R5(config)#router bgp 5 R5(config-router)#neighbor 4.4.4.4 update-source loopback 1 解决方法: R4(config)#ip route 5.5.5.0 255.255.255.0 f1/0 R5(config)#ip route 4.4.4.0 255.255.255.0 f0/0

R4(config-router)#neighbor 5.5.5.5 ebgp-multihop R5(config-router)#neighbor 4.4.4.4 ebgp-multihop

5、R1收不到5.5.5.5的路由:因为R2关于5.5.5.5下一跳是5.5.5.5不可达: 将R2的下一跳修改为:4.4.4.4 R4(config)#router bgp 24 R4(config-router)#neighbor 2.2.2.2 next-hop-self

6、R2、R3、R4连接接口下部署MPLS,使得递归可达: R2(config)#int f1/0 R2(config-if)#mpls ip

R3(config)#int f0/0 R3(config-if)#mpls ip R3(config-if)#int f1/0 R3(config-if)#mpls ip

R4(config)#int f0/0 R4(config-if)#mpls ip

四、验证: 1、R1、R2邻居UP状态:路由器BGP进程里宣告仅仅是将该路由转换为BGP条目 R1# *Mar 1 01:08:19.683: %BGP-5-ADJCHANGE: neighbor 12.1.1.2 Up R2# *May 9 14:53:11.307: %BGP-5-ADJCHANGE: neighbor 12.1.1.1 Up

2、基本BGP部署后,show命令: R1#show ip route bgp 2.0.0.0/24 is subnetted, 1 subnets B 2.2.2.0 [20/0] via 12.1.1.2, 00:05:07 3.0.0.0/24 is subnetted, 1 subnets B 3.3.3.0 [20/156160] via 12.1.1.2, 00:00:59

R2#show ip route bgp 1.0.0.0/24 is subnetted, 1 subnets B 1.1.1.0 [20/0] via 12.1.1.1, 00:01:27

R1#show ip bgp neighbors BGP neighbor is 12.1.1.2, remote AS 24, external link BGP version 4, remote router ID 2.2.2.2 BGP state = Established, up for 00:06:34

R1#show ip bgp summary // InQ OutQ 入站、出站QoS;PfxRcd:邻居传递过来的路由条目数量。 Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 12.1.1.2 4 24 14 14 4 0 0 00:09:15 2

R1#show ip bgp Network Next Hop Metric LocPrf Weight Path *> 1.1.1.0/24 0.0.0.0 0 32768 i *> 2.2.2.0/24 12.1.1.2 0 0 24 i *> 3.3.3.0/24 12.1.1.2 156160 0 24 i

2、R2和R4邻居关系起来: R2(config-router)# *May 9 15:41:48.215: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up R4(config-router)# *May 9 15:41:38.687: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Up

R2#show ip bgp summary Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 4.4.4.4 4 24 7 9 24 0 0 00:03:50 1 12.1.1.1 4 1 57 61 23 0 0 00:52:27 1

3、下一跳的问题: ①R2宣告12.1.1.0到EIGRP R4#show ip bgp //有>符号 Network Next Hop Metric LocPrf Weight Path *>i1.1.1.0/24 12.1.1.1 0 100 0 1 i r>i2.2.2.0/24 2.2.2.2 0 100 0 i r>i3.3.3.0/24 23.1.1.3 156160 100 0 i *> 4.4.4.0/24 0.0.0.0 0 32768 i

R4#show ip route bgp 1.0.0.0/24 is subnetted, 1 subnets B 1.1.1.0 [200/0] via 12.1.1.1, 00:07:57 ②修改下一跳问题 R4#show ip route bgp 1.0.0.0/24 is subnetted, 1 subnets B 1.1.1.0 [200/0] via 2.2.2.2, 00:00:27

4、R1没有5.5.5.5路由条目,因为:R2上关于5.5.5.5下一跳是5.5.5.5不可达: ①未做之前: R2#show ip bgp Network Next Hop Metric LocPrf Weight Path

  • i5.5.5.0/24 5.5.5.5 0 100 0 5 I

②修改R2下一跳后: R2#show ip bgp *>i5.5.5.0/24 4.4.4.4 0 100 0 5 i

R1#show ip bgp *> 5.5.5.0/24 12.1.1.2 0 24 5 i