一、实验需求
- IP 地址配置:按照图中给定的网络拓扑和网段信息,正确配置五台路由器(AR1 - AR5)各接口的 IP 地址。同时,为每台路由器配置环回地址。
- 路由协议配置:在 AS 200 内部(AR2、AR3、AR4 之间)运行 OSPF 协议,实现区域内路由。在自治系统边界(AR1 与 AR2、AR4 与 AR5 之间)配置外部网关协议(如 BGP ),实现跨自治系统的路由。
- 网络连通性:确保五台路由器的环回地址之间能够相互 ping 通,即实现全网可达。
二、需求分析
- 自治系统内通信:AS 200 内使用 OSPF 协议,它是链路状态型的内部网关协议。需合理规划 OSPF 区域,配置相关参数,使 AR2、AR3、AR4 之间建立邻居关系并同步链路状态数据库,以实现区域内路由计算和可达。
- 自治系统间通信:不同自治系统(AS 100、AS 200、AS 300)有各自管理域,需在边界路由器(AR1 与 AR2、AR4 与 AR5 )上配置 BGP 等外部网关协议,建立邻居关系并交换路由信息,实现跨自治系统的路由通告和数据包转发。
- IP 地址与环回地址:准确配置接口 IP 地址是网络通信基础,环回地址用于模拟路由器上的虚拟网络节点,配置后需通过路由协议将其通告出去,保证全网可达。
三、实验步骤
1、基础配置
1、R1 配置
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
2、R2 配置
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 23.0.0.2 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
3、R3 配置
interface GigabitEthernet0/0/0
ip address 23.0.0.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 34.0.0.3 255.255.255.0
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
4、 R4 配置
interface GigabitEthernet0/0/0
ip address 34.0.0.4 255.255.255.0
interface GigabitEthernet0/0/1
ip address 45.0.0.4 255.255.255.0
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
5、R5 配置
interface GigabitEthernet0/0/0
ip address 45.0.0.5 255.255.255.0
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
2、配置IGP
R2
[r2]ospf 1
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 23.0.0.2 0.0.0.0R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.0.0.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.0.0.3 0.0.0.0R4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 34.0.0.4 0.0.0.0
3、BGP的配置
R1:
[r1]bgp 100
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.0.0.2 as-number 200
R2:
[r2]bgp 200
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.0.0.1 as-number 100
[r2]bgp 200
[r2-bgp]peer 3.3.3.3 as-number 200
[r2-bgp]peer 4.4.4.4 as-number 200
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
R3:
[r3]bgp 200
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 2.2.2.2 as-number 200
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r3-bgp]peer 4.4.4.4 as-number 200
[r3-bgp]peer 4.4.4.4 connect-interface LoopBack 0
R4:
[r4]bgp 200
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3.3.3.3 as-number 200
[r4-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[r4-bgp]peer 2.2.2.2 as-number 200
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r4]bgp 200
[r4-bgp]peer 45.0.0.5 as-number 300
R5:
[r5]bgp 300
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 45.0.0.4 as-number 200
4、修改下一跳
R2:
[r2-bgp]peer 3.3.3.3 next-hop-local
[r2-bgp]peer 4.4.4.4 next-hop-local
R4:
[r4-bgp]peer 3.3.3.3 next-hop-local
[r4-bgp]peer 2.2.2.2 next-hop-local
5、宣告并引入路由
R1:
[r1-bgp]network 1.1.1.0 24
R5:
[r5-bgp]network 5.5.5.0 24
R2:
[r2-bgp]import-route ospf 1
四、测试结果
只ping出了r1.2.3