一、实验要求
1、R2-7每台路由器均存在一个环回接口用于建立邻居;同时还存在一个环回来代表连接用户的接口;最终这些连接用户的接口网络需要可以和R1/8的环回通讯。
2、AS2网段地址17216.0.0/16,减少路由条目数量。
二、拓扑的搭建:IP地址规划,基于172.16.0.0/16划分。
三、配置
第一步:给所有路由器配置IP地址及环回接口。
R2的配置:
R3的配置:
第二步:EBGP建邻,IP可达,在R1与R2,R7与R8建立。
IP可达:[R1]ip route-static 172.16.0.2 32 12.1.1.2
[R2]ip route-static 1.1.1.0 24 12.1.1.1
建邻:[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 172.16.0.2 as-number 2
[R1-bgp]peer 172.16.0.2 connect-interface LoopBack 0
[R1-bgp]peer 172.16.0.2 ebgp-max-hop 2
[R2]bgp 64512
[R2-bgp]confederation id 2 联邦内所有运行BGP协议的设备均声明自己所在的大AS号
[R2-bgp]peer 1.1.1.1 as-number 1
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 1.1.1.1 ebgp-max-hop 2
第三步:AS2内部互通,用OSPF协议,区域为0,R2--R7每台均配置。
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
建立完成,测试:R2的环回可以访问R7的环回。
第四步:AS2内建邻,R2R3R4为编号64512,R5R6R7为编号64513. R3与R2R4建立邻居关系,
R6与R5R7建立邻居关系。
以R2与R5,R3建邻为例:
[R2]bgp 64512
[R2-bgp]confederation id 2 联邦内所有运行BGP协议的设备均声明自己所在的大AS号
[R2-bgp]peer 172.16.0.3 as-number 64512
[R2-bgp]peer 172.16.0.3 connect-interface LoopBack 0
[R2-bgp]peer 172.16.0.3 next-hop-local 修改下一跳为本地
在于R5建邻居时,小AS间互指peer;在联邦内的ebgp邻居关系间的两台设备,互相定义对端的小AS号;
[R2-bgp]confederation peer-as 64513 小AS间互指PEER
[R2-bgp]peer 172.16.0.5 as-number 64513
[R2-bgp]peer 172.16.0.5 connect-interface LoopBack 0
[R2-bgp]peer 172.16.0.5 ebgp-max-hop 2 内部EBGP直接的跳数
第五步:BGP宣告
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 99.1.1.1 24
[R1-LoopBack1]q
[R1]bgp 1
[R1-bgp]network 99.1.1.0 24
第六步:小AS内,将R3、R6做为反射器
[R3-bgp]peer 172.16.0.2 reflect-client
[R6-bgp]peer 172.16.0.7 reflect-client
第七步:查看BGP表,R1上查看:
第八步:减少路由条目
[R2]bgp 64512
[R2-bgp]aggregate 172.16.0.0 21 detail-suppressed
在R1查看:
四、测试
R1环回访问R8的环回:
R1环回访问R6的环回: