实验要求:
1、按照图示配置IP地址,R2,R3,R4,R5分别配置Loopback0口地址作为 OSPF的Router_id和IBGP邻居地址,地址格式为 X.X.X.X/32,X为设备编号。R1上配置Loopback口模拟业务网段
2、AS 200内部配置OSPF,仅用于实现BGP的TCP可达
3、AS 200内部建立BGP联盟,联盟AS为AS 200,包含2个子AS为AS 65001和AS 65002。R1和R2建立EBGP邻居,R4和R6建立EBGP邻居,R2和R4建立EBGP邻居,子AS内部建立IBGP全连接
4、R1把业务网段宣告进BGP,要求AS 200内部所有路由器都能够学习到该业务网段路由
5、通过配置团体属性,使192.168.0.0/24 网段路由只能传递至AS 200
实验思路:
1.合理划分IP地址
2.AS2部分布置OSPF协议
AS 200内部建立BGP联盟,联盟AS为 AS 200,包含2个子AS为 AS 65001和AS 65002。R1和R2建立EBGP邻居,R4和R6建立EBGP邻居,R2和R4建立EBGP邻居,子AS内部建立IBGP全连接。
3.变更IBGP邻居的下一跳为本机
一个路由同时有IBGP和EBGP两种邻居关系,则需要变更IBGP邻居的下一跳为本机,R4虽然是R2的EBGP,但由于是联盟内的EBGP,所以仍然需要配置下一跳变更为本机
实验过程:
1.对所有设备进行IP配置
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 192.168.0.1 24
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 100.2.2.2 24
[R2-GigabitEthernet0/0/2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.3.3.2 24
[R2]int l0
[R2-LoopBack0]ip add 2.2.2.2 32
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.3.3.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 100.5.5.3 24
[R3]int l0
[R3-LoopBack0]ip add 3.3.3.3 32
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 100.2.2.4 24
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 100.4.4.4 24
[R4-GigabitEthernet0/0/1]
[R4-GigabitEthernet0/0/1]int g0/0/2
[R4-GigabitEthernet0/0/2]ip add 100.6.6.4 24
[R4]int l0
[R4-LoopBack0]ip add 4.4.4.4 32
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 100.5.5.5 24
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 100.4.4.5 24
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 32
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 100.6.6.6 24
2.在AS 2内部配置OSPF协议
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 100.5.5.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 100.2.2.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 100.4.4.0 0.0.0.255
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 100.5.5.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]network 100.4.4.0 0.0.0.255
3.BGP建邻
1)R1上使用直连接口地址配置与R2的EBGP邻居,AS编号为真实AS
[R1]bgp 100
[R1-bgp]peer 100.1.1.2 as-number 200
2)R2上创建BGP进程运行在 AS 65001中,联盟ID为200,与R1和R4建立EBGP邻居,与R3建立IBGP邻居,联盟内邻居AS为AS 65002
[R2]bgp 65001
[R2-bgp]confederation id 200
[R2-bgp]peer 100.1.1.1 as-number 100
[R2-bgp]confederation peer-as 65002
[R2-bgp]peer 3.3.3.3 as-number 65001
[R2-bgp]peer 3.3.3.3 connect-interface l0
[R2-bgp]peer 3.3.3.3 next-hop-local
[R2-bgp]peer 100.2.2.4 as-number 65002
[R2-bgp]peer 100.2.2.4 next-hop-local
3)R3创建BGP进程运行在AS 65001中,联盟ID为200,仅与R2建立IBGP邻居
[R3]bgp 65001
[R3-bgp]confederation id 200
[R3-bgp]peer 2.2.2.2 as-number 65001
[R3-bgp]peer 2.2.2.2 connect-interface l0
4)对照拓扑进行配置对R4进行配置
[R4]bgp 65002
[R4-bgp]confederation id 200
[R4-bgp]confederation peer-as 65001
[R4-bgp]peer 5.5.5.5 as-number 65002
[R4-bgp]peer 5.5.5.5 connect-interface l0
[R4-bgp]peer 5.5.5.5 next-hop-local
[R4-bgp]peer 100.6.6.6 as-number 300
[R4-bgp]peer 100.2.2.2 as-number 65001
[R4-bgp]peer 100.2.2.2 next-hop-local
5)对照拓扑进行配置对R5进行配置
[R5]bgp 65002
[R5-bgp]confederation id 200
[R5-bgp]peer 4.4.4.4 as-number 65002
[R5-bgp]peer 4.4.4.4 connect-interface l0
6)对照拓扑进行配置对R6进行配置
[R6]bgp 300
[R6-bgp]peer 100.6.6.4 as-number 200
4.宣告网段
[R1]bgp 100
[R1-bgp]network 192.168.0.1 24
[R1-bgp]network 192.168.1.1 24
5.配置团体属性
通过配置团体属性,使192.168.0.0/24网段路由只能传递至AS 200
1)在R1上配置ACL抓取192.168.0.0/24网段路由
[R1]acl 2000
[R1-acl-basic-2000]rule permit source 192.168.0.0 0.0.0.255
2)创建路由策略,赋予 192.168.0.0/24网段路由No_export 团体属性。并配置空节点放行其他路由
[R1]route-policy tuanti permit node 10
[R1-route-policy]if-match acl 2000
[R1-route-policy]apply community no-export
[R1]route-policy tuanti permit node 20
3)在R1上对R2调用上一步创建的路由策略
[R1-bgp]peer 100.1.1.2 route-policy tuanti export
4)在R1上开启对 R2传递团体属性,在R2上开启对R4传递团体属性
[R1-bgp]peer 100.1.1.2 advertise-community
[R2-bgp]peer 100.2.2.4 advertise-community