实验拓扑

实验需求
- 按照图示配置 IP 地址,R1 和 R5 上使用环回口模拟业务网段,R2,R3,R4 的环回口用于配置 Router-id 和建立 IBGP 邻居
- AS 200 运行 OSPF 实现内部网络互通
- R1,R2,R4,R5 运行 BGP,R1 和 R2 建立 EBGP 邻居,R4 和 R5 建立 EBGP 邻居,R2 和 R4 建立 IBGP 邻居。要求 EBGP 邻居使用直连接口建立邻居,IBGP 邻居使用环回口建立邻居
- R1 和 R5 把业务网段宣告进 BGP
- 在 R2 和 R4 上把 BGP 引入到 IGP 解决 BGP 路由黑洞问题
- 业务网段可以互通
实验过程
按照图示配置 IP 地址,R1 和 R5 上使用环回口模拟业务网段,R2,R3,R4 的环回口用于配置 Router-id 和建立 IBGP 邻居





2.AS 200 运行 OSPF 实现内部网络互通
[04-R2]ospf router-id 2.2.2.2
[04-R2-ospf-1]a 0
[04-R2-ospf-1-area-0.0.0.0]net 100.1.1.0 0.0.0.255
[04-R2-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.0.255
[04-R2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[04-R3]ospf router-id 3.3.3.3
[04-R3-ospf-1]a 0
[04-R3-ospf-1-area-0.0.0.0]net 100.2.2.0 0.0.0.255
[04-R3-ospf-1-area-0.0.0.0]net 100.3.3.0 0.0.0.255
[04-R3-ospf-1-area-0.0.0.0]net 3.3.3.3 0.0.0.0
[04-R4]ospf router-id 4.4.4.4
[04-R4-ospf-1]a 0
[04-R4-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
[04-R4-ospf-1-area-0.0.0.0]net 100.3.3.0 0.0.0.255
[04-R4-ospf-1-area-0.0.0.0]net 100.4.4.0 0.0.0.255
3.R1,R2,R4,R5 运行 BGP,R1 和 R2 建立 EBGP 邻居,R4 和 R5 建立 EBGP 邻居,R2 和 R4 建立 IBGP 邻居。要求 EBGP 邻居使用直连接口建立邻居,IBGP 邻居使用环回口建立邻居
步骤 1:在 R1,R2,R4,R5 上配置 BGP,建立邻居关系
[04-R1]bgp 100
[04-R1-bgp-default]peer 100.1.1.2 as 200
[04-R1-bgp-default]address-family ipv4
[04-R1-bgp-default-ipv4]peer 100.1.1.2 enable
[04-R2]bgp 200
[04-R2-bgp-default]peer 100.1.1.1 as 100
[04-R2-bgp-default]peer 4.4.4.4 as 200
[04-R2-bgp-default]peer 4.4.4.4 connect-interface l0
[04-R2-bgp-default]address-family ipv4
[04-R2-bgp-default-ipv4]peer 100.1.1.1 enable
[04-R2-bgp-default-ipv4]peer 4.4.4.4 enable
[04-R2-bgp-default-ipv4]peer 4.4.4.4 next-hop-local
[04-R4]bgp 200
[04-R4-bgp-default]peer 100.4.4.5 as 300
[04-R4-bgp-default]peer 2.2.2.2 as 200
[04-R4-bgp-default]peer 2.2.2.2 connect-interface l0
[04-R4-bgp-default]address-family ipv4
[04-R4-bgp-default-ipv4]peer 100.4.4.5 enable
[04-R4-bgp-default-ipv4]peer 2.2.2.2 enable
[04-R4-bgp-default-ipv4]peer 2.2.2.2 next-hop-local
[04-R5]bgp 300
[04-R5-bgp-default]peer 100.4.4.4 as 200
[04-R5-bgp-default]add
[04-R5-bgp-default]address-family ipv4
[04-R5-bgp-default-ipv4]peer 100.4.4.4 en
[04-R5-bgp-default-ipv4]peer 100.4.4.4 enable
效果测试:使用命令 display bgp peer ipv4 检查邻居是否正确建立



4.R1 和 R5 把业务网段宣告进 BGP
步骤 1:在 R1 和 R5 上把业务网段宣告进 BGP 的 IPv4 地址族模式
[04-R1-bgp-default-ipv4]net 192.168.1.0 24
[04-R5-bgp-default-ipv4]net 192.168.2.0 24
5.在 R2 和 R4 上把 BGP 引入到 IGP 解决 BGP 路由黑洞问题
步骤 1:在 R2 和 R4 上分别把 BGP 引入到 OSPF
[04-R2-ospf-1]import-route bgp
[04-R4-ospf-1]import-route bgp
效果测试:在 R3 上查看 IP 路由表,发现已经学习到业务网段的路由,来源为 OSPF 外部路由
6.业务网段可以互通
