HCIP | BGP综合实验报告册
要求:
- AS1 中存在两个环回,一个地址为 192.168.1.0/24,该地址不能在任何协议中宣告;
AS3 中存在两个环回,一个地址为 192.168.2.0/24,该地址不能在任何协议中宣告,最终要求这两个环回可以 ping 通; - R1 - R8 的建邻环回用 x.x.x.x/32 表示
- 整个 AS2 的 IP 地址为 172.16.0.0/16,R3 - R7 上各有一个业务网段,请合理划分;并且其内部配置 ospf 协议
- AS 间的骨干链路 IP 地址随意定制;
- 使用 BGP 协议让整个网络所有设备的环回可以互相访问;
- 减少路由条目数量,避免环路出现;
二、实验需求
特殊环回地址:
- AS1:192.168.1.0/24(禁止协议宣告)
- AS3:192.168.2.0/24(禁止协议宣告)
- 最终实现两个业务环回互通
地址规划:
- AS2使用172.16.0.0/16地址空间
- 所有设备配置/32建邻环回
- R3-R7各分配/24业务网段
协议要求:
- AS2内部运行OSPF
- 跨AS使用BGP协议
- AS2采用联邦设计(64512/64513)
优化要求:
- 最小化路由条目
- 避免路由环路
- 全网环回互通
三、地址规划表
设备 | 接口类型 | IP地址 | 备注 |
AS1 | |||
R1 | Lo1 | 1.1.1.1/32 | 建邻环回 |
Lo2 | 192.168.1.1/24 | 业务环回 | |
GE0/0/0 | 12.1.1.1/24 | 连接R2 | |
AS2 | |||
R2 | Lo1 | 2.2.2.2/32 | 建邻环回 |
GE0/0/0 | 12.1.1.2/24 | 连接R1 | |
GE0/0/1 | 172.16.1.1/30 | 连接R3 | |
R3 | Lo1 | 3.3.3.3/32 | 建邻环回 |
Lo2 | 172.16.3.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.2/30 | 连接R2 | |
R4 | Lo1 | 4.4.4.4/32 | 建邻环回 |
Lo2 | 172.16.4.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.6/30 | 连接R3 | |
R5 | Lo1 | 5.5.5.5/32 | 建邻环回 |
Lo2 | 172.16.5.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.22/30 | 连接R2 | |
R6 | Lo1 | 6.6.6.6/32 | 建邻环回 |
Lo2 | 172.16.6.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.18/30 | 连接R5 | |
R7 | Lo1 | 7.7.7.7/32 | 建邻环回 |
Lo2 | 172.16.7.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.14/30 | 连接R6 | |
AS3 | |||
R8 | Lo1 | 8.8.8.8/32 | 建邻环回 |
Lo2 | 192.168.2.1/24 | 业务环回 | |
GE0/0/0 | 172.16.1.10/30 | 连接R4 | |
GE0/0/1 | 34.1.1.2/24 | 连接R7 |
四、关键配置
1. AS2内部OSPF配置
# 所有AS2路由器通用配置
router id x.x.x.x # 设置Router ID
ospf 1
area 0.0.0.0
network 172.16.0.0 0.0.255.255 # 宣告整个AS2网络
2. BGP联邦配置
R2/R3/R4(AS64512)配置:
bgp 64512
router-id 2.2.2.2 # 各设备设置自己的Router ID
confederation id 65000
confederation peer-as 64513
# 联邦内IBGP全互联
peer 3.3.3.3 as-number 64512
peer 3.3.3.3 connect-interface LoopBack1
peer 4.4.4.4 as-number 64512
peer 4.4.4.4 connect-interface LoopBack1
# 联邦外EBGP
peer 12.1.1.1 as-number 1 # 连接AS1
R5/R6/R7(AS64513)配置:
bgp 64513
router-id 5.5.5.5
confederation id 65000
confederation peer-as 64512
# 联邦内IBGP全互联
peer 6.6.6.6 as-number 64513
peer 6.6.6.6 connect-interface LoopBack1
peer 7.7.7.7 as-number 64513
peer 7.7.7.7 connect-interface LoopBack1
3. 特殊业务环回解决方案
R1配置(AS1):
bash
# 静态路由指向AS2
ip route-static 192.168.2.0 24 12.1.1.2
# BGP重分发静态路由
bgp 1
import-route static
peer 12.1.1.2 as-number 65000
R8配置(AS3):
bash
# 静态路由指向AS2(主备路径)
ip route-static 192.168.1.0 24 172.16.1.9 preference 60 # 主路径:R4
ip route-static 192.168.1.0 24 34.1.1.1 preference 70 # 备路径:R7
# BGP重分发静态路由
bgp 3
import-route static
peer 172.16.1.9 as-number 65000
peer 34.1.1.1 as-number 65000
4. 路由优化配置
# 路由聚合(AS边界路由器)
bgp 65000
aggregate 172.16.0.0 255.255.0.0 detail-suppressed # 聚合AS2路由
# 防环机制
peer 12.1.1.1 ebgp-max-hop 2 # 允许非直连EBGP
peer 12.1.1.1 route-policy AS1-IMPORT import # 路由过滤
# 路由策略
route-policy AS1-IMPORT deny node 10
if-match as-path-filter 1 # 拒绝包含本AS的路由
route-policy AS1-IMPORT permit node 20
as-path-filter 1 permit _65000_ # 匹配包含65000的AS_PATH
五、验证测试
1. BGP邻居验证
<R2>display bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 64512
Total number of peers : 3
Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State
3.3.3.3 4 64512 152 155 0 02:15:12 Established
4.4.4.4 4 64512 148 150 0 02:14:55 Established
12.1.1.1 4 1 35 37 0 00:28:22 Established
2. 业务环回互通测试
<R1>ping -a 192.168.1.1 192.168.2.1
PING 192.168.2.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=251 time=9 ms
3. 路由表验证
<R3>display bgp routing-table
Status codes: * - valid, > - best
Origin codes: i - IGP, e - EGP, ? - incomplete
*> 1.1.1.1/32 12.1.1.1 0 0 1i
*> 192.168.1.0/24 12.1.1.1 0 0 1?
*> 192.168.2.0/24 172.16.1.10 0 0 3?
六、故障排查指南
1. BGP邻居无法建立
# 检查TCP连接
display tcp status | grep 179
# 检查路由可达性
ping -a 3.3.3.3 5.5.5.5
# 验证BGP配置
display bgp peer verbose
2. 业务环回不通
# 检查静态路由
display ip routing-table 192.168.2.0
# 验证路由重分发
display bgp routing-table 192.168.1.0
# 检查策略路由
display route-policy AS1-IMPORT
3. 路由环路检测
# 查看AS_PATH属性
display bgp routing-table 8.8.8.8 verbose
# 检查路由聚合
display bgp routing-table aggregate
七、实验总结
关键技术实现:
BGP联邦设计:
bash
confederation id 65000
confederation peer-as 64513
- 解决大规模AS内部IBGP全互联问题
- 保持AS2外部表现为单一自治系统
特殊业务网段方案:
- 静态路由 + BGP重分发
- 多路径备份(主备链路)
- 策略路由控制
路由优化技术:
- 地址聚合(172.16.0.0/16)
- AS_PATH过滤防环
- 路由策略控制
典型故障分析:
联邦EBGP邻居中断:
- 原因:未配置ebgp-max-hop
- 解决:peer x.x.x.x ebgp-max-hop 2
业务网段缺失:
- 原因:路由策略过滤过度
- 定位:display route-policy
非最优路径选择:
- 原因:MED属性未传递
- 解决:peer x.x.x.x med non-deterministic
扩展实验建议:
- 路由反射器替代联邦
- 基于Community的路由策略
- BGP路由震荡防护
route-flap dampening