BGP反射器与联邦实验

文章描述了一个网络配置过程,包括划分AS内的网段,配置OSPF协议,建立BGP联邦,调整路由表,设置反射器解决IBGP水平分割问题,以及通过GRE隧道实现192.168.1.0与192.168.2.0两个网段的互通。
摘要由CSDN通过智能技术生成

拓扑图与要求如下

划分AS内的网段

完成后给每个路由器配置接口id和环回地址

R1

R2

 

R3

 

R4

 

R5

 

R6

 

R7

 

R8

 

配置完成后测试直连网段是否能够ping通

接下来配置IGP,在AS2区域中使用OSPF协议

邻居关系如下

R2

R3

 

R4

 

R6

 

R7

 

查看R3的路由表

 确定完整后开始配置BGP

[R1] bgp 1

[R1-bgp]router-id 1.1.1.1

[R1-bgp]peer 12.1.1.2 as-number 2

目的是在R2上建立联邦,但我们的BGP是一个小号64512,所以需要声明我们是AS2,

我们还需要跟我们的邻居声明,并且在环回建邻之间更改TTL值,

[R2]bgp 64512

[R2-bgp]confederation id 2
[R2-bgp]router-id 2.2.2.2
 [R2-bgp]peer 172.16.3.1 as-number 64512    
[R2-bgp]confederation peer-as 64513     
[R2-bgp]peer 172.16.3.1 connect-interface LoopBack 0 
[R2-bgp]peer 172.16.5.1 as-number 64513
[R2-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.5.1 ebgp-max-hop 2

[R3]bgp 64512                   
[R3-bgp]confederation id 2
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 172.16.2.1 as-number 64512
[R3-bgp]peer 172.16.2.1 connect-interface LoopBack 0 
[R3-bgp]peer 172.16.4.1 as-number 64512    
[R3-bgp]peer 172.16.4.1 connect-interface LoopBack 0
 

[R4]bgp 64512
[R4-bgp]router-id 4.4.4.4 
[R4-bgp]confederation id 2    
[R4-bgp]confederation peer-as 64513  
[R4-bgp]peer 172.16.3.1 as-number 64512 
[R4-bgp]peer 172.16.3.1 connect-interface LoopBack 0   
[R4-bgp]peer 172.16.7.1 as-number 64513
[R4-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.7.1 ebgp-max-hop 2

[R5]bgp 64513
[R5-bgp]router-id 5.5.5.5  
[R5-bgp]confederation id 2  
[R5-bgp]confederation peer-as 64512   
[R5-bgp]peer 172.16.2.1 as-number 64512   
[R5-bgp]peer 172.16.2.1 connect-interface LoopBack 0 
[R5-bgp]peer 172.16.2.1 ebgp-max-hop 2 
[R5-bgp]peer 172.16.6.1 as-number 64513   
[R5-bgp]peer 172.16.6.1 connect-interface LoopBack 0

[R6]bgp 64513
[R6-bgp]router-id 6.6.6.6 
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.5.1 as-number 64513   
[R6-bgp]peer 172.16.5.1 connect-interface LoopBack 0  
[R6-bgp]peer 172.16.7.1 as-number 64513   
[R6-bgp]peer 172.16.7.1 connect-interface LoopBack 0

[R7]bgp 64513 
[R7-bgp]router-id 7.7.7.7
[R7-bgp]confederation  id 2
[R7-bgp]confederation peer-as 64512 
[R7-bgp]peer 172.16.6.1 as-number 64513  
[R7-bgp]peer 172.16.6.1 connect-interface LoopBack 0
[R7-bgp]peer 172.16.4.1 as-number 64512
[R7-bgp]peer 172.16.4.1 connect-interface LoopBack 0
[R7-bgp]peer 172.16.4.1 ebgp-max-hop 2

[R8]bgp 3
[R8-bgp]router-id 8.8.8.8  
[R8-bgp]peer 78.1.1.1 as-number 2

BGP邻居关系配置完成 在R2上查看BGP关系:

接下来宣告AS1中的10.1.1.0 24 网段,对R2的BGP邻居更改下一跳属性。

[R1]bgp 1  
[R1-bgp]network 10.1.1.0 24

[R2]bgp 64512
[R2-bgp]peer 172.16.3.1 next-hop-local
[R2-bgp]peer 172.16.5.1 next-hop-local

由于IBGP区域水平分割,在R4和R7上无法学习到路由,所以我们应该将R3和R6调成一个反射器

所以我们需要让R2变成R3的客户,R5成为R6的客户。

[R3]bgp 64512 
[R3-bgp]peer 172.16.2.1 reflect-client 

[R6]bgp 64513
[R6-bgp]peer 172.16.5.1 reflect-client 

此时我们再来看R4  R7:

 

此时我们可以看到R4和R7学到了路由,但是R7有两条一样的路由

因为R4和R6都给了R7发送了同一条路由。

接下来继续宣告R8上的环回 10.1.2.0 24,并在R4和R7上更改下一跳

 [R8]bgp 3
[R8-bgp]network 10.1.2.0 24

[R7]bgp 64513
[R7-bgp]peer 172.16.4.1 next-hop-local
[R7-bgp]peer 172.16.6.1 next-hop-local
这样10.1.1.1就可以PING通10.1.2.1 了

汇总整个AS2的路由,在AS2宣告一个空接口路由,
[R2]ip route-static 172.16.0.0 21 NULL 0 
[R2]bgp 64512 
[R2-bgp]network 172.16.0.0  21

为了防止R8访问到黑洞路由

所以我们再在R7上做一个空接口,并宣告:

[R7]ip route-static 172.16.0.0 21 NULL 0 

[R7]bgp 64513
[R7-bgp]network 172.16.0.0 21

目标是192.168.1.0 与 192.168.2.0可以互通,所以就可以用gre打通这两个网段。

[R1]int Tunnel 0/0/0 
[R1-Tunnel0/0/0]ip address 10.1.3.1 24 
[R1-Tunnel0/0/0]tunnel-protocol gre 
[R1-Tunnel0/0/0]source 10.1.1.1
[R1-Tunnel0/0/0]destination 10.1.2.1
[R1-Tunnel0/0/0]q
[R1]ip route-static 192.168.2.0 24 10.1.3.2

[R8]int Tunnel 0/0/0 
[R8-Tunnel0/0/0]ip address 10.1.3.2 24
[R8-Tunnel0/0/0]tunnel-protocol gre 
[R8-Tunnel0/0/0]source 10.1.2.1
[R8-Tunnel0/0/0]destination 10.1.1.1
[R8-Tunnel0/0/0]q  
[R8]ip route-static 192.168.1.0 24 Tunnel 0/0/0

至此配置结束,实验结束
 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值