BGP反射器与联邦

题目如下图:

拓扑图如下:

 

各路由的接口IP配置如图:

R1:

R2:

 

R3:

 

R4:

 

R5:

 

R6;

 

R7:

 

 R8:

配置完成后可以简单测试一下直连网段是否通畅。

 接下来配置IGP配置,我们选择在R2-R7的区域中使用OSPF协议。

 配置完成后我们查看一下邻居关系:

R2:

R3:

 

R4:

 

R6:

 

R7:

 

 让我们来看一下R3上通过OSPF学习到的路由表是否完整:

 没有缺少,我们继续下一步起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关系:

R4:

 

 我们接下来可以宣告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访问一个黑洞路由 172.1.1.0,它会在R2处被丢弃,我们希望它在R7处就被丢弃,以免占用资源。

所以我们再在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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值