1.如图连接网络,合理规格IP地址,AS200内IGP协议为OSPF
2.R1属于AS 100
R2-R3-R4
AS 234 R5-R6-R7
AS567,
同时声明大AS 200,
R8属于AS300
3.R2-R5 R4-R7之间为联邦EBGP邻居关系
4.R1-R8之间通信
1、配置IP地址部分
2、AS 2内部配置OSPF部分(R4567一样)
[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.1.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.1.21 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.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 172.16.1.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.1.5 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.3.0 0.0.0.255
3、AS 200内部建立BGP联盟,联盟AS为 AS200,包含2个子AS为 AS234和AS567。R1和R2建立EBGP邻居,R7和R8建立EBGP邻居,R2和R5建立EBGP邻居,子AS内部建立IBGP全连接
R1上使用环回地址与R2的EBGP邻居,AS编号为真实AS
[R1]BGP 100
[R1-bgp]peer 12.1.1.2 as-number 200
R2上创建BGP进程运行在 AS234中,联盟ID为200,与R1和R5建立EBGP邻居,与R3建立IBGP邻居,联盟内邻居AS为AS567
一个路由同时有IBGP和EBGP两种邻居关系,则需要变更IBGP邻居的下一跳为本机,R4虽然是R2的EBGP,但由于是联盟内的EBGP,所以仍然需要配置下一跳变更为本机
[R2]bgp 234
[R2-bgp]confederation id 200
[R2-bgp]confederation peer-as 234
[R2-bgp]peer 12.1.1.1 as-number 100
[R2-bgp]peer 172.16.0.3 as-number 234
[R2-bgp]peer 172.16.0.3 connect-interface l0
[R2-bgp]peer 172.16.0.3 next-hop-local
[R2-bgp]peer 172.16.0.5 as-number 234
[R2-bgp]peer 172.16.0.5 connect-interface l0
[R2-bgp]peer 172.16.0.5 next-hop-local
[R2-bgp]peer 172.16.0.5 ebgp-max-hop
R3创建BGP进程运行在AS234中,联盟ID为200,
[R3]bgp 234
[R3-bgp]confederation id 200
[R3-bgp]peer 172.16.0.2 as-number 234
[R3-bgp]peer 172.16.0.2 connect-interface l0
[R3-bgp]peer 172.16.0.4 as-number 234
[R3-bgp]peer 172.16.0.4 connect-interface l0
R4创建BGP进程运行在AS 234中,联盟ID为200,
[R4]bgp 234
[R4-bgp]confederation id 200
[R4-bgp]peer 172.16.0.3 as-number 234
[R4-bgp]peer 172.16.0.3 connect-interface l0
选择R3为反射器(所有的客户端都需要与反射器建邻,反射器之间不需要建邻)相当于建立IBGP全链接
[R3-bgp]bgp 234
[R3-bgp]peer 172.16.0.2 reflect-client
[R3-bgp]peer 172.16.0.4 reflect-client
R5的配置
[R5]bgp 567
[R5-bgp]confederation id 200
[R5-bgp]confederation peer-as 567
[R5-bgp]peer 172.16.0.6 as-number 567
[R5-bgp]peer 172.16.0.6 connect-interface LoopBack0
[R5-bgp]peer 172.16.0.6 next-hop-local
[R5-bgp]peer 172.16.0.2 as 567
[R5-bgp]peer 172.16.0.2 connect-interface l0
[R5-bgp]peer 172.16.0.2 next-hop-local
[R5-bgp]peer 172.16.0.2 ebgp-max-hop
R6的配置
[R6]bgp 567
[R6-bgp]confederation id 200
[R6-bgp]peer 172.16.0.5 as 567
[R6-bgp]peer 172.16.0.5 connect-interface l0
[R6-bgp]peer 172.16.0.7 as 567
[R6-bgp]peer 172.16.0.7 connect-interface l0
[R6-bgp]peer 172.16.0.5 reflect-client
[R6-bgp]peer 172.16.0.7 reflect-client
(7)R7的配置
[R7]bgp 567
[R7-bgp]confederation id 200
[R7-bgp]peer 172.16.0.6 as 567
[R7-bgp]peer 172.16.0.6 connect-interface l0
[R7-bgp]peer 172.16.0.6 next-hop-local
[R7-bgp]peer 34.1.1.8 as 300
(8)R8的配置
[R8]bgp 300
[R8-bgp]confederation id 200
[R8-bgp]peer 34.1.1.7 as 200
[R2]bgp 234
[R2-bgp]net 172.16.2.0 24
[R3]bgp 234
[R3-bgp]net 172.16.3.0 24
[R4]bgp 234
[R4-bgp]net 172.16.4.0 24
[R5]bgp 567
[R5-bgp]net 172.16.5.0 24
[R6]bgp 567
[R6-bgp]net 172.16.6.0 24
[R7]bgp 567
[R7-bgp]net 172.16.7.0 24
5、为了使R1上的192开头的网段可以互通(没有路由),做gre
[R1]int t0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 172.16.0.1
[R1-Tunnel0/0/0]destination 172.16.0.8
因为是down状态,所以需要宣告172.16.0.1 网段
[R1]bgp 100
[R1-bgp]net 172.16.0.1 32
[R8]bgp 300
[R8-bgp]net 172.16.0.8 32
[R8]int t0/0/0
[R8-Tunnel0/0/0]ip add 10.1.1.8 24
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]source 172.16.0.8
[R8-Tunnel0/0/0]destination 172.16.0.1
6、将两端私网搞通
[R1]ip route-static 192.168.2.0 24 10.1.1.8
[R8]ip route-static 192.168.1.0 24 10.1.1.1