一 步骤:
1.ip地址划分
(1). 先将172.16.0.0/16划分到/24的网段,因为/24的网段可用地址数量为254(接近一个局域网容纳主机的 极限)
172.16.0.0/16
172.16.0.0/24
172.16.1.0/24
...
(2). 其中选取172.16.0.0/24网段,划分至/32,这些地址分配用于环回接口,用来未来建立BGP的邻居
172.16.0.0/24
172.16.0.0/32
172.16.0.1/32
...
3. 剩下的因为骨干链路不做要求,所以可以自行随意配置(这里仅提供一种,如果需求规划的思路) 选择172.16.1.0/24网段做骨干链路使用,将该网段划分至/30,原因在于/30的网段实际只包含两个可 用IP地址(而骨干链路一般不会连接设备,所以实际上只需要配置链路两端的节点IP) 172.16.1.0/24
172.16.1.0/32
172.16.1.4/32
...
(4). 剩余网段统一用于AS区域的用户使
172.16.2.0/24------R2环回(用来模拟用户网段)
172.16.3.0/24------R3环回
...
2—按照规划的IP配置路由器的IP地
3.—AS内部配置IGP使得AS2内部网络互通
R2配置:
ospf 1 router-id 2.2.2.2 —配置路由器
RID area 0.0.0.0 —创建区域
network 23.0.0.0 0.0.0.255
network 25.0.0.0 0.0.0.255
network 172.16.0.0 0.0.255.255
R3配置:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 23.0.0.0 0.0.0.255
network 34.0.0.0 0.0.0.255
network 172.16.0.0 0.0.255.255
4.—配置BGP
步骤1:在R1-R2上配置EBGP,建立并使能邻居关系
R1配置
[r1]bgp 1—创建BGP并指定AS号
[r1-bgp]router-id 1.1.1.1—指定BGP路由器RID
[r1-bgp]peer 12.0.0.2 as-number 2—和R2建立EBGP邻居(EBGP的建邻建议使用接口建邻的方式)
R2配置:
[r2]bgp 64512—创建BGP指定AS号为64512
[r2-bgp]router-id 2.2.2.2—指定RID
[r2-bgp]confederation id 2—声明自身处于的大的AS号
[r2-bgp]confederation peer-as 64513—通告一个联盟内部的子自治系统号(注意:配置本命令前, 需使用confederation id命令指定各子自治系统所属的联盟ID,若未指定联盟ID,本命令无效)
[r2-bgp]peer 12.0.0.1 as-number 1—和R1建立EBGP邻居
步骤2:在R2和R5之间建立联邦内部的EBGP邻居,联盟内部使用小号建邻(同时由于是联盟内部的EBGP建 邻,所以仍然推荐使用环回建邻)
[r2-bgp]peer 172.16.0.5 as-number 64513
[r2-bgp]peer 172.16.0.5 connect-interface LoopBack 1—使用环回建邻需要更改更新源
[r2-bgp]peer 172.16..0.5 ebgp-max-hop—改变传递的TTL值(联盟内部同样遵循值传一条的原则)
R5配置:
[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.0.2 as-number 64512
[r5-bgp]peer 172.16.0.2 connect-interface LoopBack 1
[r5-bgp]peer 172.16.0.2 ebgp-max-hop
步骤三—联盟内部建立全连接的IBGP邻居
R2配置:
[r2-bgp]peer 172.16.0.3 as-number 64512 —和R3建邻
[r2-bgp]peer 172.16.0.3 connect-interface LoopBack 1—IBGP使用环回建邻,更改更新源
[r2-bgp]peer 172.16.0.4 as-number 64512—和R4建邻
[r2-bgp]peer 172.16.0.4 connect-interface LoopBack 1
R3配置:
[r3-bgp]peer 172.16.0.2 as-number 64512
[r3-bgp]peer 172.16.0.2 connect-interface LoopBack 1
[r3-bgp]peer 172.16.0.4 as-number 64512
[r3-bgp]peer 172.16.0.4 connect-interface LoopBack 1
R4配置:
[r4-bgp]peer 172.16.0.2 as-number 64512
[r4-bgp]peer 172.16.0.2 connect-interface LoopBack 1
[r4-bgp]peer 172.16.0.3 as-number 64512
[r4-bgp]peer 172.16.0.3 connect-interface LoopBack 1
同时R4还需要和R7建立EBGP邻居
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.0.7 as-number 64513
[r4-bgp]peer 172.16.0.7 ebgp-max-hop
[r4-bgp]peer 172.16.0.7 connect-interface LoopBack 1
R5配置:
bgp 64513 router-id 5.5.5.5
confederation id 2
confederation peer-as 64512
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 ebgp-max-hop 255
peer 172.16.0.2 connect-interface LoopBack1
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack1
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 connect-interface LoopBack1
R6配置:
bgp 64513
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack1
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 connect-interface LoopBack1
R7配置:
bgp 64513
router-id 7.7.7.7
confederation id 2
confederation peer-as 64512
peer 78.0.0.2 as-number 3
peer 172.16.0.4 as-number 64512
peer 172.16.0.4 ebgp-max-hop 255
peer 172.16.0.4 connect-interface LoopBack1
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack1
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack1
二、BGP宣告网段
R2宣告
[r2-bgp]network 172.16.2.0 24
[r2-bgp]network 23.0.0.0 24—这里只宣告R2用户网段和R2-R3相连骨干
R3宣告
[r3-bgp]network 172.16.3.0 24
...
三、AS1和AS3环回互通
需要建立VPN隧道—这里使用GRE
R1上创建隧道 这里隧道使用10.0.0.0/24网段,或者任取一个新网段也可以。
interface Tunnel0/0/0
description 78.0.0.2
ip address 10.0.0.1 255.255.255.0
tunnel-protocol gre
source 12.0.0.1
R8配置:
interface Tunnel0/0/0
ip address 10.0.0.2 255.255.255.0
tunnel-protocol gre
source 78.0.0.2
destination 12.0.0.1
为了使全网可达,又不能宣告AS1-3的环回,就只能写一条静态让目标下一跳指向Tunnel隧道 [r1]ip route-static 192.168.2.0 24 Tunnel 0/0/0
[r8]ip route-static 192.168.1.0 24 Tunnel 0/0/0
实验配置完成