1.搭建拓扑
2.IP配置
R1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 10.0.12.1 24
[r1-GigabitEthernet0/0/0]int loop 0
[r1-LoopBack0] ip add 1.1.1.1 24
R2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.23.2 24
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.25.2 24
[r2-GigabitEthernet0/0/2]int loop 0
[r2-LoopBack0] ip add 172.16.0.2 24
[r2-LoopBack0]int loop 1
[r2-LoopBack1]ip add 172.16.2.1
R3
R4
R5
R6
R7
R8
3.ospf
[R2]ospf 2
[R2-ospf-2]area 0
[R2-ospf-2-area 0]nework 172.16.0.0 0.0.255.255
4. 把AS2的用户网段更改为BROADCAST
[R2] intface loopback 1
[R2-LoopBack1]ospf network-type broadcast
5.建立bgp邻居关系
[R1]bgp 1
[R1-bgp]peer 10.0.12.2 as-number 2
[R2]bgp 64512
[R2-bgp]confederation id 2
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 10.0.12.1 as-number 1
[R2-bgp]peer 172.16.0.3 as-number 64512
[R2-bgp]peer 172.16.0.3 connect-interface LoopBack0
[R2-bgp]peer 172.16.0.3 next-hop-local
[R2-bgp]peer 172.16.0.5 as-number 64513
[R2-bgp]peer 172.16.0.5 ebgp-max-hop 2
[R2-bgp]peer 172.16.0.5 connect-interface LoopBack0
[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.2 as-number 64512
[R3-bgp]peer 172.16.0.2 connect-interface LoopBack0
[R3-bgp]peer 172.16.0.4 as-number 64512
[R3-bgp]peer 172.16.0.4 connect-interface LoopBack0
[R3-bgp]peer 172.16.0.2 next-hop-local
[R3-bgp]peer 172.16.0.4 next-hop-local
[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.0.3 as-number 64512
[R4-bgp]peer 172.16.0.3 connect-interface LoopBack0
[R4-bgp]peer 172.16.0.7 as-number 64513
[R4-bgp]peer 172.16.0.7 ebgp-max-hop 2
[R4-bgp]peer 172.16.0.7 connect-interface LoopBack0
[R4-bgp]peer 172.16.0.3 next-hop-local
[R5]bgp 64513
[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 ebgp-max-hop 2
[R5-bgp]peer 172.16.0.2 connect-interface LoopBack0
[R5-bgp]peer 172.16.0.6 as-number 64513
[R5-bgp]peer 172.16.0.6 connect-interface LoopBack0
[R5-bgp]peer 172.16.0.6 next-hop-local
[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.0.5 as-number 64513
[R6-bgp]peer 172.16.0.5 connect-interface LoopBack0
[R6-bgp]peer 172.16.0.7 as-number 64513
[R6-bgp]peer 172.16.0.7 connect-interface LoopBack0
[R6-bgp]peer 172.16.0.5 next-hop-local
[R6-bgp]peer 172.16.0.7 next-hop-local
[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 10.0.78.8 as-number 3
[R7-bgp]peer 172.16.0.4 as-number 64512
[R7-bgp]peer 172.16.0.4 ebgp-max-hop 2
[R7-bgp]peer 172.16.0.4 connect-interface LoopBack0
[R7-bgp]peer 172.16.0.6 as-number 64513
[R7-bgp]peer 172.16.0.6 connect-interface LoopBack0
[R7-bgp]peer 172.16.0.6 next-hop-local
[R8]bgp 3
[R8-bgp]peer 10.0.78.7 as-number 2
6.建立反射器和宣告:
[R1]
network 1.1.1.0 255.255.255.0
[R8]
network 2.2.2.0 255.255.255.0
[R2]
import-route ospf 1
[R7]
import-route ospf 1
实验结果