HCIP----BGP实验

HCIP----BGP实验

  1. 按照图上显示进行IP配置

HCIP----BGP实验

  1. 在AS2内配置ospf协议

HCIP----BGP实验

AS2内所有路由都只需要宣告 172.16.0.0 0.0.255.255即可

HCIP----BGP实验

AS2内所有路由写入空接口防环

  1. 配置BGP并建邻,建立联邦

[r1]bgp 1

[r1-bgp]peer 12.1.1.2 as-number 2  真实EBGP之间建邻使用大AS

[r2]bgp 64512   联邦-----小AS

[r2-bgp]confederation id 2  声明本地所在的大AS号

[r2-bgp]peer 12.1.1.1 as-number 1

[r2-bgp]peer 172.16.3.1as-number 64512

[r2-bgp]peer 172.16.3.1 connect-interface LoopBack 0           使用环回接口建邻要声明建邻使用的源接口

[r2-bgp]peer 172.16.3.1 next-hop-local                  传递路由给r3时,下一跳属性改为本地(IBGP间传递路由属性不变,r3如果收到r1的环回路由,下一跳属性是12.1.1.2,r3并不认识,因此不会变优加表)

[r2-bgp]confederation peer-as 64513     与另一个联邦的路由建邻要先声明对端的联邦小AS号

[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 next-hop-local

[r2-bgp]peer 172.16.5.1 ebgp-max-hop 2     由于EBGP(模拟)之间的TTL值默认是1,如果使用环回接口建邻需要跳两跳,所以增加跳数

[r3]bgp 64512

[r3-bgp]confederation id 2        声明本地所在的大AS号

[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.3.1 next-hop-local

  

[r3-bgp]peer 172.16.4.1 as-number 64512

[r3-bgp]peer 172.16.4.1 connect-interface LoopBack 0          

[r3-bgp]peer 172.16.3.1 next-hop-local

[r4]bgp 64512

[r4-bgp]confederation id 2        声明本地所在的大AS号

[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.3.1 next-hop-local

[r4-bgp]confederation peer-as 64513

[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 next-hop-local

[r4-bgp]peer 172.16.7.1 ebgp-max-hop 2

[r5]bgp 64513

[r5-bgp]confederation id 2        声明本地所在的大AS号

[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 next-hop-local

[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

[r5-bgp]peer 172.16.6.1 next-hop-local

[r6]bgp 64513

[r6-bgp]confederation id 2        声明本地所在的大AS号

[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.5.1 next-hop-local

[r6-bgp]peer 172.16.7.1 as-number 64513

[r6-bgp]peer 172.16.7.1connect-interface LoopBack 0

[r6-bgp]peer 172.16.7.1 next-hop-local

[r7]bgp 64513

[r7-bgp]confederation id 2        声明本地所在的大AS号

[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.6.1 next-hop-local

[r7-bgp]confederation peer-as 64512

[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 next-hop-local

[r7-bgp]peer 172.16.4.1 ebgp-max-hop 2

[r7-bgp]peer 78.1.1.2 as-number 3

[r8]bgp 3

[r8-bgp]peer 78.1.1.1 as-number 2   真实EBGP之间建邻使用大AS

最终效果:

HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验

建立联邦的目的:打破IBGP之间的水平分割机制---IBGP收到的路由不会再传递给下一个IBGP,但是建立联邦以后还是没有解决这个问题,因为r1传递的路由r4和r7收不到,r8传递的路由r2和r5收不到,例:

HCIP----BGP实验

HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验

HCIP----BGP实验

R4和r7收不到的原因:as64512和as64513里面也只能传递一跳(水平分割),因此我们可以使用路由反射器协议。

4.设置路由反射器

[r3-bgp]peer 2.2.2.2 reflect-client             

r3将r2作为本地的客户端,本地成为RR,r4自然成为非客户端,根据反射规则打破了水平分割的机制。

[r6-bgp]peer 7.7.7.7 reflect-client

R6与r3同理,将r5作为客户端,r7成为非客户端

1).RR从本地的EBGP邻居处学习到的路由,可以共享给本地的客户端、非客户端、其他EBGP邻居

2).RR从本地的客户端学习到的路由,可以共享给本地其他的客户端、非客户端、EBGP邻居

3).RR从本地的非客户端学习到的路由,可以共享给本地客户端、EBGP邻居,不能共享给本地的其他非客户端;

最终效果:

HCIP----BGP实验HCIP----BGP实验HCIP----BGP实验

5.配置GRE使192.168.1.0和192.168.2.1互通

[r1]int Tunnel 0/0/0

[r1-Tunnel0/0/0]ip add 1.1.1.1 24

[r1-Tunnel0/0/0]tunnel-protocol gre                          ^

 [r1-Tunnel0/0/0]source 10.1.1.1     (源IP和目标IP首先要互通)

 [r1-Tunnel0/0/0]destination 10.1.2.1

[r8]int tun

[r8]int Tunnel 0/0/0

[r8-Tunnel0/0/0]ip add 1.1.1.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

[r1]ip route-static 192.168.2.0 24 1.1.1.2写入静态路由,告诉路由器如果去192.168.2.0 走tunnel 0/0/0口

[r8]ip route-static 192.168.1.0 24 1.1.1.1

HCIP----BGP实验

上一篇:12届蓝桥杯省赛Java B组 双向排序


下一篇:【题解】CF1063B Labyrinth(BFS)