题目要求
1.As1存在两个环回,一个地址为192.168.1.0/24,该地址不能冉任何协议中宣告
A53存在两个环回,.一个地址为192.168.2.0/24,该地址不能再任何协议中宣告
As1还有一个环回地址为10.1.1.0/24,As3另一个环回地址是11.1.1.0/24
最终要求这两个环回可以互相通讯
2.整个As2的IP地址为172.16.9.0/16
3.As间的骨干链路IP地址随意分配
4.使用BGP协议让整个网络所有设备的环回可以互相访问
5.减少路由条目数量,避免环路出现
解题思路
1.使用联邦打破IBGP水平分割机制
2.将R3,R6配置为路由反射器,R2,R7为客户端
3.在R2,R7的BGP协议内通过重发布命令发布路由信息,并进行自动聚合
配置内容
R1
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 192.168.1.1 255.255.255.0
#
interface LoopBack1
ip address 10.1.1.1 255.255.255.0
#
bgp 1 ----启用BGP协议,并配置其路由器AS号为1
router-id 1.1.1.1 ----配置其路由器RID为1.1.1.1 ----全网唯一
peer 12.0.0.2 as-number 2 ----配置TCP协议连接时的目的IP地址,指定其邻居的AS号
#
ipv4-family unicast
undo synchronization
network 10.1.1.0 255.255.255.0 ----在BGP协议内宣告自己的环回地址,并通过BGP协议通告其BGP邻居
peer 12.0.0.2 enable
R2
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 172.16.0.1 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 172.16.64.1 255.255.255.252
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 64512 ----使用成员AS号启用BGP协议 ----成员AS号必须为私有AS号
router-id 2.2.2.2 ----配置其RID ----全网唯一
confederation id 2 ----指定其联邦AS号
confederation peer-as 64513 ----指定其邻居所在EBGP对等体的AS号 ----成员AS号
peer 3.3.3.3 as-number 64512 ----配置TCP协议连接时的目的IP地址,指定其邻居的AS号
peer 3.3.3.3 connect-interface LoopBack0 ----配置TCP协议连接时的源/目IP地址一致
peer 5.5.5.5 as-number 64513
peer 5.5.5.5 ebgp-max-hop 255 ----修改去往EBGP对等体邻居的TTL值为255
peer 5.5.5.5 connect-interface LoopBack0
peer 12.0.0.1 as-number 1
#
ipv4-family unicast
undo synchronization
summary automatic ----启用自动汇总功能
import-route ospf 1 route-policy aa ----在BGP内重发布路由信息时调用路由策略aa
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local ----在向邻居发布路由信息时,修改其下一跳地址为本地
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
peer 12.0.0.1 enable
#
ospf 1 ----启用OSPF协议
area 0.0.0.0 ----指定路由器所在区域
network 2.2.2.2 0.0.0.0 ----精准宣告自己的路由信息
network 172.16.0.1 0.0.0.0
network 172.16.64.1 0.0.0.0
#
route-policy aa permit node 10 ----创建路由策略aa,大动作为允许,节点编号为10
if-match ip-prefix aa ----创建条件语句 ----当匹配上前缀列表aa时,会使用此路由策略
#
ip ip-prefix aa index 10 permit 172.16.0.0 16 greater-equal 16 less-equal 32 ----创建前缀列表 ----抓取流量,前缀为172.16,掩码信息大于等于16,小于等于32的路由信息
R3
interface GigabitEthernet0/0/0
ip address 172.16.0.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.32.1 255.255.255.252
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bgp 64512
router-id 3.3.3.3
confederation id 2
peer 2.2.2.2 as-number 64512
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 64512
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 2.2.2.2 reflect-client ----配置本地为路由反射器,其客户端为:RID为2.2.2.2的IBGP邻居
peer 2.2.2.2 next-hop-local
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 172.16.0.2 0.0.0.0
network 172.16.32.1 0.0.0.0
R4
interface GigabitEthernet0/0/0
ip address 172.16.32.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.96.1 255.255.255.252
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
bgp 64512
router-id 4.4.4.4
confederation id 2
confederation peer-as 64513
peer 3.3.3.3 as-number 64512
peer 3.3.3.3 connect-interface LoopBack0
peer 7.7.7.7 as-number 64513
peer 7.7.7.7 ebgp-max-hop 255
peer 7.7.7.7 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local
peer 7.7.7.7 enable
peer 7.7.7.7 next-hop-local
#
ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 172.16.32.2 0.0.0.0
network 172.16.96.1 0.0.0.0
R5
interface GigabitEthernet0/0/0
ip address 172.16.64.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.128.1 255.255.255.252
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
bgp 64513
router-id 5.5.5.5
confederation id 2
confederation peer-as 64512
peer 2.2.2.2 as-number 64512
peer 2.2.2.2 ebgp-max-hop 255
peer 2.2.2.2 connect-interface LoopBack0
peer 6.6.6.6 as-number 64513
peer 6.6.6.6 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 2.2.2.2 next-hop-local
peer 6.6.6.6 enable
peer 6.6.6.6 next-hop-local
#
ospf 1
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 172.16.64.2 0.0.0.0
network 172.16.128.1 0.0.0.0
R6
interface GigabitEthernet0/0/0
ip address 172.16.128.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.160.1 255.255.255.252
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.255
#
bgp 64513
router-id 6.6.6.6
confederation id 2
peer 5.5.5.5 as-number 64513
peer 5.5.5.5 connect-interface LoopBack0
peer 7.7.7.7 as-number 64513
peer 7.7.7.7 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 5.5.5.5 enable
peer 5.5.5.5 next-hop-local
peer 7.7.7.7 enable
peer 7.7.7.7 reflect-client
peer 7.7.7.7 next-hop-local
#
ospf 1
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 172.16.128.2 0.0.0.0
network 172.16.160.1 0.0.0.0
R7
interface GigabitEthernet0/0/0
ip address 172.16.160.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.96.2 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 78.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 7.7.7.7 255.255.255.255
#
bgp 64513
router-id 7.7.7.7
confederation id 2
confederation peer-as 64512
peer 4.4.4.4 as-number 64512
peer 4.4.4.4 ebgp-max-hop 255
peer 4.4.4.4 connect-interface LoopBack0
peer 6.6.6.6 as-number 64513
peer 6.6.6.6 connect-interface LoopBack0
peer 78.0.0.2 as-number 3
#
ipv4-family unicast
undo synchronization
summary automatic
import-route ospf 1 route-policy aa
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 6.6.6.6 enable
peer 6.6.6.6 next-hop-local
peer 78.0.0.2 enable
#
ospf 1
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 172.16.96.2 0.0.0.0
network 172.16.160.2 0.0.0.0
#
route-policy bb permit node 10
if-match ip-prefix bb
#
ip ip-prefix bb index 10 permit 172.16.0.0 16 greater-equal 16 less-equal 32
R8
interface GigabitEthernet0/0/0
ip address 78.0.0.2 255.255.255.0
#
interface LoopBack0
ip address 192.168.2.1 255.255.255.0
#
interface LoopBack1
ip address 11.1.1.1 255.255.255.0
#
bgp 3
router-id 8.8.8.8
peer 78.0.0.1 as-number 2
#
ipv4-family unicast
undo synchronization
network 11.1.1.0 255.255.255.0
peer 78.0.0.1 enable
实验结果
R1基于BGP协议的路由表
R1 ping R4 的环回
R1 ping R5 的环回
R1 ping R8 的环回
R2的BGP邻居表
R7的BGP邻居表
R8基于BGP协议的路由表
R8 ping R2 的环回