一,实验拓扑
二,实验要求
三、实验思路
1.规划IP,起OSPF协议
2.BGP建邻
3.宣告
四、实验步骤
1.规划IP,起OSPF协议
(1)R2起OSPF,其他同理
(2)更改用户接口环回工作方式
[r2]int lo 1
[r2-LoopBack1]ospf network-type broadcast
//其余同理
2.BGP建邻
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 172.16.1.3 as-number 64512
[r2-bgp]peer 172.16.1.3 connect-interface LoopBack 0
[r2-bgp]peer 172.16.1.5 as-number 64513
[r2-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r2-bgp]peer 172.16.1.5 ebgp-max-hop 2
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.1.2 as-number 64512
[r3-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r3-bgp]peer 172.16.1.4 as-number 64512
[r3-bgp]peer 172.16.1.4 connect-interface LoopBack 0
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.3 as-number 64512
[r4-bgp]peer 172.16.1.3 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.7 as-number 64513
[r4-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.7 ebgp-max-hop 2
[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.1.2 as-number 64512
[r5-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r5-bgp]peer 172.16.1.2 ebgp-max-hop 2
[r5-bgp]peer 172.16.1.6 as-number 64513
[r5-bgp]peer 172.16.1.6 connect-interface LoopBack 0
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.1.5 as-number 64513
[r6-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r6-bgp]peer 172.16.1.7 as-number 64513
[r6-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[r7]bgp 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.1.4 as-number 64512
[r7-bgp]peer 172.16.1.4 connect-interface LoopBack 0
[r7-bgp]peer 172.16.1.4 ebgp-max-hop 2
[r7-bgp]peer 172.16.1.6 as-number 64513
[r7-bgp]peer 172.16.1.6 connect-interface LoopBack 0
[r7-bgp]peer 78.1.1.2 as-number 3
[r8]bgp 3
[r8-bgp]peer 78.1.1.1 as-number 2
3.宣告
[r1]bgp 1
[r1-bgp]network 1.1.1.0 24
[r2-bgp]peer 172.16.1.3 next-hop-local
[r2-bgp]peer 172.16.1.5 next-hop-local
[r3]bgp 64512
[r3-bgp]peer 172.16.1.4 reflect-client
[r6]bgp 64513
[r6-bgp]peer 172.16.1.7 reflect-client
[r8]bgp 3
[r8-bgp]network 8.8.8.0 24
[r7]bgp 64513
[r7-bgp]peer 172.16.1.4 next-hop-local
[r7-bgp]peer 172.16.1.6 next-hop-local
//两种方法汇总.1
[r2]ip route-static 172.16.0.0 21 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 21
//两种方法汇总.2
[r7]bgp 64513
[r7-bgp]network 172.16.2.0 24
[r7-bgp]network 172.16.3.0 24
[r7-bgp]network 172.16.4.0 24
[r7-bgp]network 172.16.5.0 24
[r7-bgp]network 172.16.6.0 24
[r7-bgp]network 172.16.7.0 24
[r7-bgp]aggregate 172.16.0.0 21 detail-suppressed