HCIP---BGP综合实验

实验拓扑

在这里插入图片描述

实验要求

  • AS1中存在两个环回地址一个为192.168.1.0/24,该地址不能在任何协议中宣告
  • AS3中存在两个环回地址一个为192.168.2.0/24,该地址不能在任何协议中宣告,最终要求这两个环回(192.168.1.0/24—192.168.2.0/24)可以ping通;
  • 整个AS2的IP地址为172.16.0.0/16,请合理划分;并且其内部配置OSPF协议2、R1-R8的建邻环回用x.x.x.x/32表示;R2-R7上再划分一个业务网段;
  • As间的骨干链路IP地址随意定制; 使用BGP协议让整个网络所有设备的环回可以互相访问;

实验思路及其步骤

划分IP
1、R1-R8的建邻环回:172.168.0.0/24
依次取32位掩码的地址
2、R2-R7的业务网段
172.16.2.0/24-172.16.7.0/24依次对应分配
3、AS 2内部链路-172.16.10.0/24
细分为多个掩码为30的网段

ospf内网互通
单区域宣告
有IGP和EGP的路由:宣告需要注意不要把公网宣告
仅有IGP的路由:可直接OSPF全网宣告

BGP配置

为了使所有路由器设备都可以学到业务可用路由(解决水平分割/黑洞路由问题),AS内部建立全连接或者利用路由反射器

R1

[R1-bgp]peer 12.1.1.2 as-number 2
#与AS 200的ASBR设备建邻

R2

[R2]bgp 64512
#声明私有AS归属公有AS 2
[R2-bgp]confederation id 2
#定义BGP联邦对等AS号码
[R2-bgp]confederation peer-as 64513	
#与公有AS 1建邻
[R2-bgp]peer 12.1.1.1 as-number 1

#与私有AS内部建邻
[R2-bgp]peer 172.16.0.3 as-number 64512
#由于主设备既有EGP又有IGP,故需修改下一跳为本机,以防止产生路由黑洞
[R2-bgp]peer 172.16.0.3 next-hop-local
#修改邻居连接接口为环回口0
[R2-bgp]peer 172.16.0.3 connect-interface l0

#与同一公有AS不同联邦建邻
[R2-bgp]peer 172.16.0.5 as-number 64513
[R2-bgp]peer 172.16.0.5 connect-interface l0
[R2-bgp]peer 172.16.0.5 next-hop-local
#由于EGP最大跳数为1,要用环回口连接,需修改最大跳数大于1
[R2-bgp]peer 172.16.0.5 ebgp-max-hop 10

R3

[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.2 as-number 64512
[R3-bgp]peer 172.16.0.2 connect-interface l0
[R3-bgp]peer 172.16.0.4 as-number 64512
[R3-bgp]peer 172.16.0.4 connect-interface l0
#以此路由器为路由反射器,配置客户机,反射器需要与AS内部所有BGP-speaker建邻
[R3-bgp]peer 172.16.0.2 reflect-client	
[R3-bgp]peer 172.16.0.4 reflect-client 

R4

[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.0.3 as-number 64512
[R4-bgp]peer 172.16.0.3 connect-interface l0

R5

[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512	
[R5-bgp]peer 172.16.0.2 as-number 64512
[R5-bgp]peer 172.16.0.2 connect-interface l0
[R5-bgp]peer 172.16.0.2 next-hop-local
[R5-bgp]peer 172.16.0.2 ebgp-max-hop 10

[R5-bgp]peer 172.16.0.6 as-number 64513
[R5-bgp]peer 172.16.0.6 connect-interface l0
[R5-bgp]peer 172.16.0.6 next-hop-local

R6

[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.0.5 as-number 64513
[R6-bgp]peer 172.16.0.5 connect-interface l0
[R6-bgp]peer 172.16.0.7 as-number 64513
[R6-bgp]peer 172.16.0.7 connect-interface l0	
[R6-bgp]peer 172.16.0.5 reflect-client 
[R6-bgp]peer 172.16.0.7 reflect-client 

R7

[R7]bgp 64513
[R7-bgp]confederation id 2	
[R7-bgp]peer 172.16.0.6 as-number 64513
[R7-bgp]peer 172.16.0.6 connect-interface l0
[R7-bgp]peer 172.16.0.6 next-hop-local

[R7-bgp]peer 34.1.1.2 as-number 3

R8

[R8-bgp]peer 34.1.1.1 as-number 2

如此配置之后,BGP peer建邻成功

BGP内宣告业务网段
宣告时需要建邻地址不要宣告进BGP,即使宣告后也不可达

R1—R8业务网段互通

引入路由或者建立隧道

引入直连路由
R1

抓取流量,以防其他流量引入进BGP
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
路由策略:如果匹配则放通
[R1]route-policy remote permit node 10
[R1-route-policy]if-match acl 2000
引入直连,使用路由策略
[R1-bgp]import direct route-policy remote

R2

[R8]route-policy remote permit node 10
[R8-route-policy]if-match acl 2000

[R8]acl 2000
[R8-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255

[R8-bgp]import direct route-policy remote 

搭建隧道
隧道接口网段使用192.168.3.0/24
R1

[R1-Tunnel0/0/0]ip addr 192.168.3.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 172.16.0.1 
[R1-Tunnel0/0/0]destination 172.16.0.8

[R1]ip route-static 192.168.2.0 24 192.168.3.2

R8

[R8-Tunnel0/0/0]ip addr 192.168.3.2 24
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]source 172.16.0.8
[R8-Tunnel0/0/0]destination 172.16.0.1

[R8]ip route-static 192.168.1.0 24 192.168.3.1

测试
R1<—>R8
在这里插入图片描述
R1<—>R3
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值