拓扑图&IP划分如下:
第一步,配置IP&环回地址
以R1为例,R2~R8同理
interface GigabitEthernet 0/0/0
ip address 12.0.0.1 24
interface LoopBack 0
ip address 10.0.0.1 24
第二步:对AS200网段配置OSPF协议
以R2为例,R3~R7同理
ospf 1 router-id 2.2.2.2
area 0
network 172.16.0.0 0.0.255.255
第三步:建立BGP邻居
R1&R2进行EBGP对等体建邻,R7&R8同理
R1:
bgp 1
router-id 1.1.1.1
peer 12.0.0.2 as-number 2
R2:
bgp 64512
confederation id 2
router-id 2.2.2.2
peer 12.0.0.1 as-number 1
R3&R4进行IBGP对等体建邻,R2&R3同理,R5&R6同理,R6&R7同理
R3:
bgp 65412
router-id 3.3.3.3
confederation id 2
peer 172.16.64.1 as-number 64512
peer 172.16.64.1 connect-interface LoopBack 0
R4:
bgp 65412
router-id 4.4.4.4
confederation id 2
peer 172.16.32.1 as-number 64512
peer 172.16.32.1 connect-interface LoopBack 0
R4&R7进行联邦的EBGP对等体建邻,R2&R5同理
R4:
confederation peer-as 64513
peer 172.16.160.1 as-number 64512
peer 172.16.160.1 connect-interface LoopBack 0
peer 172.16.160.1 ebgp-max-hop
R7:
bgp 64512
router-id 7.7.7.7
confederation id 2
peer 172.16.64.1 as-number 64512
peer 172.16.64.1 connect-interface LoopBack 0
peer 172.16.64.1 ebgp-max-hop
第四步:发布路由
配置从R1发布环回的路由,R8同理
R1:
bgp 1
network 10.0.0.0 24
R2:
bgp 64512
peer 172.16.32.1 next-hop-local
peer 172.16.96.1 next-hop-local
R3,R6同理:
bgp 64512
peer 172.16.192.1 reflect-client
进行路由汇总
R2,R7同理
ip route-static 172.16.0.0 16 NULL 0
bgp 64512
network 172.16.0.0 16
使R1&R8的192.168.1.0/24&192.168.2.0/24两个网段形成回路
R1,R8同理
interface Tunnel 0/0/0
tunnel-protocol gre
source 10.0.0.1
destination 80.0.0.1
测试
R8