实验需求:
① R2-7上每台路由器均存在一个环回接口用来建立邻居;同时还存在一个环回代表连接用户的接 口;最终这些连接用户的接口网络需要和R1/8的环回通讯
② AS2网段的地址由172.16.0.0/16划分
实验拓扑:
实验步骤:
Ⅰ.配置接口ip地址
[R1]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.12.1/24 up up
LoopBack0 1.1.1.1/24 up up(s)
[R2]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.12.2/24 up up
GigabitEthernet0/0/1 172.16.23.2/24 up up
GigabitEthernet0/0/2 172.16.25.2/24 up up
LoopBack0 172.16.0.2/32 up up(s)
LoopBack1 172.16.2.1/24 up up(s)
[R3]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 172.16.23.3/24 up up
GigabitEthernet0/0/2 172.16.34.3/24 up up
LoopBack0 172.16.0.3/32 up up(s)
LoopBack1 172.16.3.1/24 up up(s)
[R4]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 172.16.47.4/24 up up
GigabitEthernet0/0/2 172.16.34.4/24 up up
LoopBack0 172.16.0.4/32 up up(s)
LoopBack1 172.16.4.1/24 up up(s)
[R5]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 172.16.56.5/24 up up
GigabitEthernet0/0/2 172.16.25.5/24 up up
LoopBack0 172.16.0.5/32 up up(s)
LoopBack1 172.16.5.1/24 up up(s)
[R6]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 172.16.56.6/24 up up
GigabitEthernet0/0/2 172.16.67.6/24 up up
LoopBack0 172.16.0.6/32 up up(s)
LoopBack1 172.16.6.1/24 up up(s)
[R7]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.78.7/24 up up
GigabitEthernet0/0/1 172.16.47.7/24 up up
GigabitEthernet0/0/2 172.16.67.7/24 up up
LoopBack0 172.16.0.7/32 up up(s)
LoopBack1 172.16.7.1/24 up up(s)
[R8]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.0.78.8/24 up up
LoopBack0 2.2.2.2/24 up up(s)
Ⅱ.在AS2区域起OSPF协议
ospf 2
area 0
nework 172.16.0.0 0.0.255.255
Ⅲ.把AS2区域的用户网段(LOOPBACK 1)更改为BROADCAST
intface loopback 1
ospf network-type broadcast
Ⅳ.开始建立bgp邻居关系
[R1]
bgp 1
peer 10.0.12.2 as-number 2
[R2]
bgp 64512
confederation id 2
confederation peer-as 64513
peer 10.0.12.1 as-number 1
peer 172.16.0.3 as-number 64512
peer 172.16.0.3 connect-interface LoopBack0
peer 172.16.0.3 next-hop-local
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 ebgp-max-hop 2
peer 172.16.0.5 connect-interface LoopBack0
[R3]
bgp 64512
confederation id 2
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 connect-interface LoopBack0
peer 172.16.0.4 as-number 64512
peer 172.16.0.4 connect-interface LoopBack0
peer 172.16.0.2 next-hop-local
peer 172.16.0.4 next-hop-local
[R4]
bgp 64512
confederation id 2
confederation peer-as 64513
peer 172.16.0.3 as-number 64512
peer 172.16.0.3 connect-interface LoopBack0
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 ebgp-max-hop 2
peer 172.16.0.7 connect-interface LoopBack0
peer 172.16.0.3 next-hop-local
[R5]
bgp 64513
confederation id 2
confederation peer-as 64512
peer 172.16.0.2 as-number 64512
peer 172.16.0.2 ebgp-max-hop 2
peer 172.16.0.2 connect-interface LoopBack0
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack0
peer 172.16.0.6 next-hop-local
[R6]
bgp 64513
confederation id 2
peer 172.16.0.5 as-number 64513
peer 172.16.0.5 connect-interface LoopBack0
peer 172.16.0.7 as-number 64513
peer 172.16.0.7 connect-interface LoopBack0
peer 172.16.0.5 next-hop-local
peer 172.16.0.7 next-hop-local
[R7]
bgp 64513
confederation id 2
confederation peer-as 64512
peer 10.0.78.8 as-number 3
peer 172.16.0.4 as-number 64512
peer 172.16.0.4 ebgp-max-hop 2
peer 172.16.0.4 connect-interface LoopBack0
peer 172.16.0.6 as-number 64513
peer 172.16.0.6 connect-interface LoopBack0
peer 172.16.0.6 next-hop-local
[R8]
bgp 3
peer 10.0.78.7 as-number 2
Ⅴ.在R3和R6上建立反射器
[R3]
bgp 64512
peer 172.16.0.2 reflect-client
[R6]
bgp 64513
peer 172.16.0.7 reflect-client
Ⅵ.宣告网段
[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
// 重发布时会携带cost,如果不在R7上再次宣告的话,cost值会被洗掉
Ⅶ.测试