拓扑
要求
IP配置
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-LoopBack0]ip add 192.168.1.1 24
[R1-LoopBack1]ip add 10.0.0.1 24[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/1]ip add 172.16.0.1 21
[R2-GigabitEthernet0/0/2]ip add 172.16.128.1 18[R3-GigabitEthernet0/0/0]ip add 172.16.0.2 21
[R3-GigabitEthernet0/0/1]ip add 172.16.8.1 21
[R3-LoopBack0]ip add 172.16.24.1 21[R4-GigabitEthernet0/0/0]ip add 172.16.8.2 21
[R4-GigabitEthernet0/0/1]ip add 172.16.192.1 18
[R4-LoopBack0]ip add 172.16.32.1 21[R5-GigabitEthernet0/0/0]ip add 172.16.128.2 18
[R5-GigabitEthernet0/0/1]ip add 172.16.64.1 21
[R5-LoopBack0]ip add 172.16.80.1 21 [R6-GigabitEthernet0/0/0]ip add 172.16.64.2 21
[R6-GigabitEthernet0/0/1]ip add 172.16.72.1 21
[R6-LoopBack0]ip add 172.16.88.1 21[R7-GigabitEthernet0/0/0]ip add 172.16.72.2 21
[R7-GigabitEthernet0/0/1]ip add 172.16.192.2 21
[R7-GigabitEthernet0/0/2]ip add 78.0.0.1 24
[R7-LoopBack0]ip add 172.16.96.1 21[R8-GigabitEthernet0/0/0]ip add 78.0.0.2 24
[R8-LoopBack0]ip add 192.168.2.1 24
[R8-LoopBack1]ip add 11.0.0.1 24
配置OSPF协议
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1-area-0.0.0.0]network 12.0.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.16.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.128.1 0.0.0.0[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.24.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.8.1 0.0.0.0[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]network 172.16.8.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.32.1 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.192.1 0.0.0.0[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]network 172.16.128.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.64.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.80.1 0.0.0.0[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.64.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.72.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.88.1 0.0.0.0[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]network 172.16.72.2 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.96.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 78.0.0.1 0.0.0.0[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 0
[R8-ospf-1-area-0.0.0.0]network 78.0.0.2 0.0.0.0
[R8-ospf-1-area-0.0.0.0]network 11.0.0.1 0.0.0.0
R1与R2之间进行EBGP的建立
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 2[R2]bgp 64512
[R2-bgp]peer 12.0.0.1 as-number 1
R7与R8之间进行EBGP的建立
[R7]bgp 2
[R7-bgp]router-id 7.7.7.7
[R7-bgp]peer 78.0.0.2 as-number 3[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 78.0.0.1 as-number 2
AS2区域中AS 64512内R/2/3/4之间建立联邦
[R2]bgp 64512
[R2-bgp]confederation id 2
[R2-bgp]peer 172.16.24.1 as-number 64512
[R2-bgp]peer 172.16.24.1 next-hop-local[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.16.1 as-number 64512
[R3-bgp]peer 172.16.16.1 next-hop-local
[R3-bgp]peer 172.16.32.1 as-number 64512
[R3-bgp]peer 172.16.32.1 next-hop-local[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.24.1 as-number 64512
[R4-bgp]peer 172.16.24.1 next-hop-loca
AS2区域中AS 64513内的R/5/6/7之间建立联邦
[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]peer 172.16.88.1 as-number 64513
[R5-bgp]peer 172.16.88.1 next-hop-local[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.80.1 as-number 64513
[R6-bgp]peer 172.16.80.1 next-hop-local
[R6-bgp]peer 172.16.96.1 as-number 64513
[R6-bgp]peer 172.16.96.1 next-hop-local[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]peer 172.16.88.1 as-number 64513
[R7-bgp]peer 172.16.88.1 next-hop-local
R2与R5之间建立EBGP邻居关系
[R2]bgp 64512
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 172.16.128.2 as-number 64513[R5]bgp 64513
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.128.1 as-number 64512
R4与R7之间建立EBGP邻居关系
R4]bgp 64512
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.192.2 as-number 64513[R7]bgp 64513
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 172.16.192.1 as-number 64512
R2与R5之间,R4与R7之间建立EBGP关系后还需修改TTL值
[R2-bgp]peer 172.16.128.2 ebgp-max-hop
[R5-bgp]peer 172.16.128.1 ebgp-max-hop
[R4-bgp]peer 172.16.192.2 ebgp-max-hop
[R7-bgp]peer 172.16.192.1 ebgp-max-hop
在R3与R6上配置路由反射器用来打破IBGP的水平分割
[R3-bgp]peer 172.16.16.1 reflect-client
[R6-bgp]peer 172.16.80.1 reflect-client
ping
<R1>ping 172.16.16.1PING 172.16.16.1: 56 data bytes, press CTRL_C to breakReply from 172.16.16.1: bytes=56 Sequence=1 ttl=255 time=40 msReply from 172.16.16.1: bytes=56 Sequence=2 ttl=255 time=20 msReply from 172.16.16.1: bytes=56 Sequence=3 ttl=255 time=20 msReply from 172.16.16.1: bytes=56 Sequence=4 ttl=255 time=10 msReply from 172.16.16.1: bytes=56 Sequence=5 ttl=255 time=20 ms--- 172.16.16.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 10/22/40 ms<R1>ping 172.16.24.1PING 172.16.24.1: 56 data bytes, press CTRL_C to breakReply from 172.16.24.1: bytes=56 Sequence=1 ttl=254 time=30 msReply from 172.16.24.1: bytes=56 Sequence=2 ttl=254 time=30 msReply from 172.16.24.1: bytes=56 Sequence=3 ttl=254 time=40 msReply from 172.16.24.1: bytes=56 Sequence=4 ttl=254 time=20 msReply from 172.16.24.1: bytes=56 Sequence=5 ttl=254 time=20 ms--- 172.16.24.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 20/28/40 ms<R1>ping 172.16.32.1PING 172.16.32.1: 56 data bytes, press CTRL_C to breakReply from 172.16.32.1: bytes=56 Sequence=1 ttl=253 time=40 msReply from 172.16.32.1: bytes=56 Sequence=2 ttl=253 time=30 msReply from 172.16.32.1: bytes=56 Sequence=3 ttl=253 time=40 msReply from 172.16.32.1: bytes=56 Sequence=4 ttl=253 time=30 msReply from 172.16.32.1: bytes=56 Sequence=5 ttl=253 time=30 ms--- 172.16.32.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 30/34/40 ms<R1>ping 172.16.88.1PING 172.16.88.1: 56 data bytes, press CTRL_C to breakReply from 172.16.88.1: bytes=56 Sequence=1 ttl=253 time=40 msReply from 172.16.88.1: bytes=56 Sequence=2 ttl=253 time=40 msReply from 172.16.88.1: bytes=56 Sequence=3 ttl=253 time=40 msReply from 172.16.88.1: bytes=56 Sequence=4 ttl=253 time=30 msReply from 172.16.88.1: bytes=56 Sequence=5 ttl=253 time=40 ms--- 172.16.88.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 30/38/40 ms<R1>ping 172.16.96.1PING 172.16.96.1: 56 data bytes, press CTRL_C to breakReply from 172.16.96.1: bytes=56 Sequence=1 ttl=252 time=60 msReply from 172.16.96.1: bytes=56 Sequence=2 ttl=252 time=40 msReply from 172.16.96.1: bytes=56 Sequence=3 ttl=252 time=40 msReply from 172.16.96.1: bytes=56 Sequence=4 ttl=252 time=50 msReply from 172.16.96.1: bytes=56 Sequence=5 ttl=252 time=50 ms--- 172.16.96.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 40/48/60 ms
创建虚拟隧道
[r1]int t0/0/1
[r1-Tunnel0/0/1]ip add 192.168.3.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre
[r1-Tunnel0/0/1]source 10.0.0.1
[r1-Tunnel0/0/1]description 11.0.0.1
[r1]ip route-static 192.168.2.0 24 192.168.3.2[r8]int t0/0/1
[r8-Tunnel0/0/1]ip add 192.168.3.2 24
[r8-Tunnel0/0/1]tunnel-protocol gre
[r8-Tunnel0/0/1]source 11.0.0.1
[r8-Tunnel0/0/1]description 10.0.0.1
[r8]ip route-static 192.168.1.0 24 192.168.3.1