一、实验拓扑
二、实验需求
1、AS1中存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告AS3中存在两个环回,一个地址为192.168.2.0/24,
该地址不能在任何协议中宣告,最终要求这两个环回可以ping通R1-R8的建邻环回用x.x.x.x/32表示
2 、R1-R8的建邻环回用x.x.x.x/32表示
3、整个AS2的Ip地址为172.16.0.0/16,R3-R7上各有一个业务网段,请合理划分;并且其内部配置0SPF协议
4、AS间的骨干链路IP地址随意定制,
5、使用BGP协议让整个网络所有设备的环回可以互相访问,
6、减少路由条目数量,避免环路出现;
三、需求分析
1、根据广播域划分子网,配置IP地址
2、在AS 2区域的路由器(R2~R7)上配置ospf协议,配置ID,划分区域,宣告网段。
3、根据AS 区域划分配置BGP,AS2 中在R2和R5上建立AS 64512和AS 64513的联系,在R2~R7上分别说明所在AS ID的大区域和AS小区域的编号,在路由器上配置邻居,在R3和R6上分别配置反射器,确保AS 的各个区域通常。
4、在bgp下各个路由器宣告业务网段,AS 业务网段全网通。
5、做路由聚合(bgp),减少路由条目数量,做防环操作。在R2和R7配置聚合
6、抓取流量过滤R1R8的业务网段,配置路由策略,允许自身业务网段通过,配置路由引入,使得R1可以访问R8的业务网段。
四、实验步骤
1、子网划分,配置IP地址
子网划分:
172.16.0.0/16
172.16.0000 0001.0---172.16.1.0/24
骨干:
172.16.1.0000 0000--172.16.1.0/30--R2-R3
172.16.1.0000 0100--172.16.1.4/30--R3-R4
172.16.1.0000 1000--172.16.1.8/30--R4-R7
172.16.1.0000 1100--172.16.1.12/30--R7-R6
172.16.1.0001 0000--172.16.1.16/30--R6-R5
172.16.1.0001 0100--172.16.1.20/30--R5-R2
172.16.0000 0010.0---172.16.2.0/24
环回:
172.16.0000 0011.0--172.16.3.0/24-R3
172.16.0000 0100.0--172.16.4.0/24-R4
172.16.0000 0101.0--172.16.5.0/24-R5
172.16.0000 0110.0--172.16.6.0/24-R6
配置IP地址
以R1为例
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.1 24
[R1-LoopBack1]q
配置结果:
2、在AS2路由器上配置ospf协议
配置ID,划分区域,宣告网段,测试
R2:
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 172.16.1.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 172.16.1.21 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
R3:
[R3-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 172.16.1.2 0.0.0.0
network 172.16.1.5 0.0.0.0
network 172.16.3.3 0.0.0.0
#
return
R4:
[R4-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 172.16.1.6 0.0.0.0
network 172.16.1.9 0.0.0.0
network 172.16.4.0 0.0.0.255
#
R5:
[R5-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 172.16.1.17 0.0.0.0
network 172.16.1.22 0.0.0.0
network 172.16.5.0 0.0.0.255
#
R6:
[R6-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 172.16.1.13 0.0.0.0
network 172.16.1.18 0.0.0.0
network 172.16.6.0 0.0.0.255
#
R7:
[R7-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 172.16.1.10 0.0.0.0
network 172.16.1.14 0.0.0.0
network 172.16.7.0 0.0.0.255
#
配置结果:
R2:
在R3上查看邻居表(R2、R4)
R4:
R5:
在R6上查看邻居表(R5、R7)
R7:
测试:
3、配置BGP
R1:
[R1]bgp 1
[R1-bgp]peer 12.1.1.2 as 2
[R1-bgp]q
R2:在R2上建立AS64512与AS64513的联系
[R2]bgp 64512
[R2-bgp]confederation id 2 //大区域为AS 2
[R2-bgp]confederation peer-as 64513 //声明R2的联盟是AS 62513
[R2-bgp]peer 12.1.1.1 as 1 //连接AS1区域的R1
[R2-bgp]peer 3.3.3.3 as 64512 //连接邻居R3在AS 64512
[R2-bgp]peer 3.3.3.3 connect-interface l0 //修改更新源,接口为环回接口l0
[R2-bgp]peer 3.3.3.3 next-hop-local //下一跳为本机
[R2-bgp]peer 172.16.1.22 as 64513 //连接R5物理口
[R2-bgp]peer 172.16.1.22 next-hop-local //修改下一跳为本机,环回口还需修改最大跳数
R3:
[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]confederation peer-as 64513
[R3-bgp]peer 2.2.2.2 as 64512
[R3-bgp]peer 2.2.2.2 connect-interface l0
[R3-bgp]undo peer 2.2.2.2 next-hop-local
[R3-bgp]peer 4.4.4.4 as 64512
[R3-bgp]peer 4.4.4.4 connect-interface l0
[R3-bgp]q
R3为反射器
将R2、R4设置为反射客户端
[R3-bgp]peer 2.2.2.2 reflect-client
[R3-bgp]peer 4.4.4.4 reflect-client
R4:
[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 3.3.3.3 as 64512
[R4-bgp]peer 3.3.3.3 connect-interface l0
[R4-bgp]
R5:
[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.1.21 as 64512
[R5-bgp]peer 172.16.1.21 next-hop-local
[R5-bgp]peer 6.6.6.6 as 64513
[R5-bgp]peer 6.6.6.6 connect-interface l0
[R5-bgp]peer 6.6.6.6 next-hop-local
R6:
[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]confederation peer-as 64512
[R6-bgp]peer 5.5.5.5 as 64513
[R6-bgp]peer 5.5.5.5 connect-interface l0
[R6-bgp]peer 7.7.7.7 as 64513
[R6-bgp]peer 7.7.7.7 connect-interface l0
[R6-bgp]q
R6为反射器
[R6-bgp]peer 5.5.5.5 reflect-client
[R6-bgp]peer 7.7.7.7 reflect-client
R7:
[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 6.6.6.6 as 64513
[R7-bgp]peer 6.6.6.6 connect-interface l0
[R7-bgp]peer 6.6.6.6 next-hop-local
//R7与R6建立的是EBGP,要对本机的IBGP邻居R6修改下一跳为本机
[R7-bgp]peer 34.1.1.8 as 3
[R7-bgp]
R8:
[R8]bgp 3
[R8-bgp]peer 34.1.1.7 as 2
[R8-bgp]q
配置结果:
4、宣告业务网段:
AS1:
[R1-bgp]net 1.1.1.1 32
AS2:
[R3-bgp]net 172.16.3.3 24
[R4-bgp]net 172.16.4.4 24
[R5-bgp]net 172.16.5.5 24
[R6-bgp]net 172.16.6.6 24
[R7-bgp]net 172.16.7.7 24
AS3:
[R8-bgp]net 8.8.8.8 32
配置结果:
AS1
AS64512
AS64513
AS3
测试:R1的1.1.1.1 pingR3~R7的业务环回地址和R8的8.8.8.8地址
5、做路由聚合(bgp),减少路由条目数量,做防环操作。
在边界设备配置聚合
R2:
[R2-bgp]aggregate 172.16.0.0 21 detail-suppressed as-set //抑制明晰,防止重复
R7:
[R7-bgp]aggregate 172.16.0.0 21 detail-suppressed as-set
配置结果:
AS 2
测试:
6、抓取流量过滤R1R8的业务网段,配置路由策略,允许自身业务网段通过,配置路由引入,使得R1可以访问R8的业务网段。
R1
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R1-acl-basic-2000]q
[R1]route-policy aaa permit node 10
[R1-route-policy]if-match acl 2000
[R1-route-policy]q
[R1]bgp 1
[R1-bgp]import-route direct route-policy aaa
[R1-bgp]q
[R1]
R8
[R8]acl 2000
[R8-acl-basic-2000]rule permit source 192.168.2.0 0.0.0.255
[R8-acl-basic-2000]q
[R8]route-policy bbb permit node 10
[R8-route-policy]if-match acl 2000
[R8-route-policy]q
[R8]bgp 3
[R8-bgp]import-route direct route-policy bbb
[R8-bgp]q
[R8]
配置结果:
测试:R8访问R1的业务网段