联邦和反射器实验

拓扑图

一.实验要求

1.AS1存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告

AS3存在两个环回,一个地址为192.168.2.0/24,该地址不能在任何协议中宣告

AS1还有一个环回地址为10.1.1.0/24,AS3另一个环回地址是11.1.1.8/24

最终要求这两个环回可以互相通讯

2.整个AS2的IP地址为172.16.0.0/16

3.AS间的骨干链路IP地址随意分配

4.使用BGP协议让整个网络所有设备的环回可以互相访问

5.减少路由条目数量,避免环路出现

三、实验步骤

1.配置IP

R1

r1\]int g0/0/0 \[r1-GigabitEthernet0/0/0\]ip add 12.0.0.1 30 May 29 2024 00:47:28-08:00 r1 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r1-GigabitEthernet0/0/0\]int l 0 \[r1-LoopBack0\]ip add 192.168.1.1 24 \[r1-LoopBack0\]int l 1 \[r1-LoopBack1\]ip add 10.1.1.1 24 R2 \[r2\]int g0/0/0 \[r2-GigabitEthernet0/0/0\]ip add 12.0.0.2 30 May 29 2024 00:48:24-08:00 r2 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r2-GigabitEthernet0/0/0\]int g0/0/1 \[r2-GigabitEthernet0/0/1\]ip add 172.16.1.1 30 May 29 2024 00:48:36-08:00 r2 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r2-GigabitEthernet0/0/1\]int g0/0/2 \[r2-GigabitEthernet0/0/2\]ip add 172.16.1.22 30 May 29 2024 00:48:54-08:00 r2 %%01IFNET/4/LINK_STATE(l)\[2\]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. \[r2-GigabitEthernet0/0/2\]int l 0 \[r2-LoopBack0\]ip add 2.2.2.2 32 \[r2-LoopBack0\]int l 1 \[r2-LoopBack1\]ip add 172.16.2.1 24 R3 \[r3\]int g0/0/0 \[r3-GigabitEthernet0/0/0\]ip add 172.16.1.2 30 May 29 2024 00:49:54-08:00 r3 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r3-GigabitEthernet0/0/0\]int g0/0/1 \[r3-GigabitEthernet0/0/1\]ip add 172.16.1.5 30 May 29 2024 00:50:11-08:00 r3 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r3-GigabitEthernet0/0/1\]int l 0 \[r3-LoopBack0\]ip add 3.3.3.3 32 \[r3-LoopBack0\]int l 1 \[r3-LoopBack1\]ip add 172.16.3.1 24 R4 \[r4\]int g0/0/0 \[r4-GigabitEthernet0/0/0\]ip add 172.16.1.6 30 May 29 2024 00:51:17-08:00 r4 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r4-GigabitEthernet0/0/0\]int g0/0/1 \[r4-GigabitEthernet0/0/1\]ip add 172.16.1.9 30 May 29 2024 00:51:28-08:00 r4 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r4-GigabitEthernet0/0/1\]int l 0 \[r4-LoopBack0\]ip add 4.4.4.4 32 \[r4-LoopBack0\]int l 1 \[r4-LoopBack1\]ip add 172.16.4.1 24 R5 \[r5\]int g0/0/0 \[r5-GigabitEthernet0/0/0\]ip add 172.16.1.21 30 May 29 2024 00:52:18-08:00 r5 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r5-GigabitEthernet0/0/0\]int g0/0/1 \[r5-GigabitEthernet0/0/1\]ip add 172.16.1.18 30 May 29 2024 00:52:29-08:00 r5 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r5-GigabitEthernet0/0/1\]int l 0 \[r5-LoopBack0\]ip add 5.5.5.5 32 \[r5-LoopBack0\]int l 1 \[r5-LoopBack1\]ip add 172.16.5.1 24 \[r6\]int g0/0/0 \[r6-GigabitEthernet0/0/0\]ip add 172.16.1.17 30 May 29 2024 00:53:33-08:00 r6 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r6-GigabitEthernet0/0/0\]int g0/0/1 \[r6-GigabitEthernet0/0/1\]ip add 172.16.1.14 30 May 29 2024 00:53:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r6-GigabitEthernet0/0/1\]int l 0 \[r6-LoopBack0\]ip add 6.6.6.6 32 \[r6-LoopBack0\]int l 1 \[r6-LoopBack1\]ip add 172.16.6.1 24 R7 \[r7\]int g0/0/0 \[r7-GigabitEthernet0/0/0\]ip add 172.16.1.10 30 May 29 2024 00:54:41-08:00 r7 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r7-GigabitEthernet0/0/0\]int g0/0/1 \[r7-GigabitEthernet0/0/1\]ip add 172.16.1.13 30 May 29 2024 00:54:53-08:00 r7 %%01IFNET/4/LINK_STATE(l)\[1\]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. \[r7-GigabitEthernet0/0/1\]int g0/0/2 \[r7-GigabitEthernet0/0/2\]ip add 78.0.0.1 30 \[r7-GigabitEthernet0/0/2

May 29 2024 00:55:04-08:00 r7 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP

on the interface GigabitEthernet0/0/2 has entered the UP state.

r7-GigabitEthernet0/0/2\]int l 0 \[r7-LoopBack0\]ip add 7.7.7.7 32 \[r7-LoopBack0\]int l 1 \[r7-LoopBack1\]ip add 172.16.7.1 24 R8 \[r8\]int g0/0/0 \[r8-GigabitEthernet0/0/0\]ip add 78.0.0.2 30 May 29 2024 00:56:02-08:00 r8 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. \[r8-GigabitEthernet0/0/0\]int l 0 \[r8-LoopBack0\]ip add 192.168.2.1 24 \[r8-LoopBack0\]int l 1 \[r8-LoopBack1\]ip add 11.1.1.1 24 2.AS2内部配置ospf R2 \[r2\]ospf 1 router-id 2.2.2.2 \[r2-ospf-1\]ar \[r2-ospf-1\]area 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 172.16.2.0 0.0.0.255 \[r2-ospf-1-area-0.0.0.0\]network 172.16.1.1 0.0.0.0 \[r2-ospf-1-area-0.0.0.0\]network 172.16.1.22 0.0.0.0 R3 \[r3\]ospf 1 router-id 3.3.3.3 \[r3-ospf-1\]area 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 172.16.3.0 0.0.0.255 \[r3-ospf-1-area-0.0.0.0\]network 172.16.1.2 0.0.0.0 \[r3-ospf-1-area-0.0.0.0\]network 172.16.1.5 0.0.0.0 R4 \[r4\]ospf 1 router-id 4.4.4.4 \[r4-ospf-1\]area 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 172.16.4.0 0.0.0.0 \[r4-ospf-1-area-0.0.0.0\]network 172.16.1.6 0.0.0.0 \[r4-ospf-1-area-0.0.0.0\]network 172.16.1.9 0.0.0.0 R5 \[r5\]ospf 1 router-id 5.5.5.5 \[r5-ospf-1\]area 0 \[r5-ospf-1-area-0.0.0.0\]network 5.5.5.5 0.0.0.0 \[r5-ospf-1-area-0.0.0.0\]network 172.16.5.0 0.0.0.255 \[r5-ospf-1-area-0.0.0.0\]network 172.16.1.21 0.0.0.0 \[r5-ospf-1-area-0.0.0.0\]network 172.16.1.18 0.0.0.0 R6 \[r6\]ospf 1 router-id 6.6.6.6 \[r6-ospf-1\]area 0 \[r6-ospf-1-area-0.0.0.0\]network 6.6.6.6 0.0.0.0 \[r6-ospf-1-area-0.0.0.0\]network 172.16.6.0 0.0.0.255 \[r6-ospf-1-area-0.0.0.0\]network 172.16.1.17 0.0.0.0 \[r6-ospf-1-area-0.0.0.0\]network 172.16.1.14 0.0.0.0 R7 \[r7\]ospf 1 router-id 7.7.7.7 \[r7-ospf-1\]area 0 \[r7-ospf-1-area-0.0.0.0\]network 7.7.7.7 0.0.0.0 \[r7-ospf-1-area-0.0.0.0\]network 172.16.7.0 0.0.0.255 \[r7-ospf-1-area-0.0.0.0\]network 172.16.1.10 0.0.0.255 \[r7-ospf-1-area-0.0.0.0\]network 172.16.1.13 0.0.0.0 3. R1与R2建立EBGP R1 \[r1\]bgp 1 \[r1-bgp\]router-id 1.1.1.1 \[r1-bgp\]peer 12.0.0.2 as-number 2 R2 \[r2\]bgp 64512 \[r2-bgp\]router-id 2.2.2.2 \[r2-bgp\]confederation id 2 \[r2-bgp\]peer 12.0.0.1 as-number 1 R7与R8建立EBGP \[r7\]bgp 64513 \[r7-bgp\]router-id 2.2.2.2 \[r7-bgp\]confederation id 2 \[r7-bgp\]peer 78.0.0.2 as-number 3 \[r8\]bgp 3 \[r8-bgp\]router-id 8.8.8.8 \[r8-bgp\]peer 78.0.0.1 as-number 2 4. AS2区域中64512内R2/3/4之间建立联邦 R2 \[r2\]bgp 64512 \[r2-bgp\]peer 3.3.3.3 as-number 64512 \[r2-bgp\]peer 3.3.3.3 connect-interface LoopBack 0 \[r2-bgp\]peer 3.3.3.3 next-hop-local R3 \[r3\]bgp 64512 \[r3-bgp\]confederation id 2 \[r3-bgp\]peer 2.2.2.2 as-number 64512 \[r3-bgp\]peer 2.2.2.2 connect-interface LoopBack 0 \[r3-bgp\]peer 4.4.4.4 as-number 64512 \[r3-bgp\]peer 4.4.4.4 connect-interface LoopBack 0 R4 \[r4\]bgp 64512 \[r4-bgp\]confederation id 2 \[r4-bgp\]peer 3.3.3.3 as-number 64512 \[r4-bgp\]peer 3.3.3.3 connect-interface LoopBack 0 AS2区域中64513内R5/6/7之间建立联邦 R5 \[r5\]bgp 64513 \[r5-bgp\]confederation id 2 \[r5-bgp\]peer 6.6.6.6 as-number 64513 \[r5-bgp\]peer 6.6.6.6 connect-interface LoopBack 0 R6 \[r6\]bgp 64513 \[r6-bgp\]confederation id 2 \[r6-bgp\]peer 7.7.7.7 as-number 64513 \[r6-bgp\]peer 7.7.7.7 connect-interface LoopBack 0 \[r6-bgp\]peer 5.5.5.5 as-number 64513 \[r6-bgp\]peer 5.5.5.5 connect-interface LoopBack 0 R7 \[r7\]bgp 6451 \[r7\]bgp 64513 \[r7-bgp\]peer 6.6.6.6 as-number 64513 \[r7-bgp\]peer 6.6.6.6 connect-interface LoopBack 0 \[r7-bgp\]peer 6.6.6.6 next-hop-local 5. R2与R5建立EBGP R2 \[r2\]bgp 64512 \[r2-bgp\]confederation peer-as 64513 \[r2-bgp\]peer 5.5.5.5 as-number 64513 \[r2-bgp\]peer 5.5.5.5 connect-interface LoopBack 0 \[r2-bgp\]peer 5.5.5.5 ebgp-max-hop \[r2-bgp\]peer 5.5.5.5 next-hop-local R5 \[r5\]bgp 64513 \[r5-bgp\]confederation peer-as 64512 \[r5-bgp\]peer 2.2.2.2 as-number 64512 \[r5-bgp\]peer 2.2.2.2 connect-interface LoopBack 0 \[r5-bgp\]peer 2.2.2.2 ebgp-max-hop R4与R7建立EBGP R4 \[r4\]bgp 64512 \[r4-bgp\]confederation peer-as 64513 \[r4-bgp\]peer 7.7.7.7 as-number 64513 \[r4-bgp\]peer 7.7.7.7 connect-interface LoopBack 0 \[r4-bgp\]peer 7.7.7.7 ebgp-max-hop R7 \[r7\]bgp 64513 \[r7-bgp\]confederation peer-as 64512 \[r7-bgp\]peer 4.4.4.4 as-number 64512 \[r7-bgp\]peer 4.4.4.4 connect-interface LoopBack 0 \[r7-bgp\]peer 4.4.4.4 ebgp-max-hop \[r7-bgp\]peer 4.4.4.4 next-hop-local 6.在R3与R6上配置路由反射器用来打破IBGP的水平分割 R3 \[r3\]bgp 64512 \[r3-bgp\]peer 2.2.2.2 reflect-client R6 \[r6\]bgp 64513 \[r6-bgp\]peer 7.7.7.7 reflect-client 6. 将用户网段宣告进BGP \[r1\]bgp 1 \[r1-bgp\]network 10.1.1.0 24 \[r2\]bgp 64512 \[r2-bgp\]network 172.16.2.0 24 \[r3\]bgp 64512 \[r3-bgp\]network 172.16.3.0 24 \[r4\]bgp 64512 \[r4-bgp\]network 172.16.4.0 24 \[r5\]bgp 64513 \[r5-bgp\]network 172.16.5.0 24 \[r6\]bgp 64513 \[r6-bgp\]network 172.16.6.0 24 \[r7\]bgp 64513 \[r7-bgp\]network 172.16.7.0 24 \[r8\]bgp 3 \[r8-bgp\]network 11.1.1.0 24 7. 创建R1-R8虚拟隧道,使用GRE R1 \[r1\]bgp 1 \[r1-bgp\]network 10.1.1.0 24 \[r1-bgp\]int t 0/0/1 \[r1-Tunnel0/0/1\]ip add 192.168.3.1 24 \[r1-Tunnel0/0/1\]tunnel-protocol gre \[r1-Tunnel0/0/1\]source 10.1.1.1 \[r1-Tunnel0/0/1\]destination 11.1.1.1 May 29 2024 01:45:22-08:00 r1 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state. \[r1-Tunnel0/0/1

r1-Tunnel0/0/1\]Q \[r1\]ip route-static 192.168.2.0 24 192.168.3.2 R8 \[r8\]bgp 3 \[r8-bgp\]network 11.1.1.0 24 \[r8-bgp\]int t0/0/1 \[r8-Tunnel0/0/1\]ip add 192.168.3.2 24 \[r8-Tunnel0/0/1\]tunnel-protocol gre \[r8-Tunnel0/0/1\]source 11.1.1.1 \[r8-Tunnel0/0/1\]destination 10.1.1.1 May 29 2024 01:46:40-08:00 r8 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state. \[r8-Tunnel0/0/1\]Q \[r8\]ip route-static 192.168.1.0 24 192.168.3.1 8. 路由聚合 R2 \[r2\]ip route-static 172.16.0.0 21 NULL 0 \[r2\]bgp 64512 \[r2-bgp\]aggregate 172.16.0.0 21 detail-suppressed R7 \[r7\]ip route-static 172.16.0.0 21 NULL 0 \[r7\]bgp 64513 \[r7-bgp\]aggregate 172.16.0.0 21 detail-suppressed 四、验证 ![](https://file.jishuzhan.net/article/1795591335802048513/0f120fa339bf3430f91c6a013b8d141f.webp) ![](https://file.jishuzhan.net/article/1795591335802048513/1175a5d2ecb1dc585785289cabae5c17.webp)

相关推荐
richer_202020 分钟前
双系统重装ubuntu
linux·运维·ubuntu
微学AI21 分钟前
用FileCodeBox打造私有文件传输:Ubuntu环境保姆级部署教程!
linux·运维·ubuntu
路溪非溪27 分钟前
websocket简介与基本使用
网络·websocket·网络协议
卓应1 小时前
2025年5月华为H12-821新增题库带解析
网络·华为·智能路由器
松树戈1 小时前
本地 PC 使用Offset Explorer连接实体Ubuntu Kafka 【单机】超时问题解决
linux·ubuntu·kafka
熬夜苦读学习1 小时前
Linux线程控制
linux·运维·服务器·开发语言·后端
Johny_Zhao2 小时前
CentOS Stream 10安装部署Zabbix 7.0网络监控平台和设备配置添加
linux·网络·网络安全·docker·信息安全·云计算·apache·zabbix·devops·yum源·huawei·系统运维·itsm·华三
zly88653722 小时前
MLX5 Linux 驱动代码分析
linux·运维·fpga开发
小oo呆2 小时前
【学习心得】WSL2安装Ubuntu22.04
linux
code monkey.2 小时前
【寻找Linux的奥秘】第五章:认识进程
linux·运维·硬件