1、拓扑图
2、IP地址规划
172.16.0.0/16 --- 总网
172.16.1.0/24 --- 骨干链路 172.16.1.0/30 172.16.1.4/30 172.16.1.8/30
172.16.1.12/30 172.16.1.16/30 172.16.1.20/30
...... 172.16.1.252/30
172.16.2.0/24 --- MA骨干链路
172.16.3.0/24 --- R2环回
172.16.4.0/24 --- R3环回
172.16.5.0/24 --- R4环回
172.16.6.0/24 --- R5环回
172.16.7.0/24 --- R6环回
172.16.8.0/24 --- R7环回
172.16.9.0/24—172.16.255.0/24 --- 保留地址
1、底层—所有节点拥有合法的IP地址
测试:看是否能够ping通(截图太多就不放了)
2、AS内部路由(AS2运行OSPF协议)
R2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 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.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 172.16.3.0 0.0.0.255
R3:
[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.5 0.0.0.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.4.0 0.0.0.255
R4:
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 172.16.1.9 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 172.16.1.6 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 172.16.5.0 0.0.0.255
R5:
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.1.22 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 172.16.1.17 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 172.16.6.0 0.0.0.255
R6:
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.1.18 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.1.13 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.7.0 0.0.0.255
R7:
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.1.14 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.16.1.10 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.16.8.0 0.0.0.255
测试:
以R2为例查看是否通过OSPF学齐了路由
3、策略
(1)联邦:
R2:
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2 —— 说明自己的大AS号
[r2-bgp]confederation peer-as 64513 —— 告知对端的小AS号
[r2-bgp]peer 12.1.1.1 as-number 1 —— 建立真实的EBGP邻居关系
[r2-bgp]peer 172.16.6.1 as-number 64513
[r2-bgp]peer 172.16.6.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.6.1 ebgp-max-hop 2 —— 建立虚假的EBGP邻居关系
[r2-bgp]peer 172.16.4.1 as-number 64512
[r2-bgp]peer 172.16.4.1 connect-interface LoopBack 0 —— 建立小AS内的IBGP邻居关系
R3:
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.3.1 as-number 64512
[r3-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r3-bgp]peer 172.16.5.1 as-number 64512
[r3-bgp]peer 172.16.5.1 connect-interface LoopBack 0
R4:
[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.4.1 as-number 64512
[r4-bgp]peer 172.16.4.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.8.1 as-number 64513
[r4-bgp]peer 172.16.8.1 connect-interface LoopBack 0
[r4-bgp]peer 172.16.8.1 ebgp-max-hop 2
R5:
[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.3.1 as-number 64512
[r5-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.3.1 ebgp-max-hop 2
[r5-bgp]peer 172.16.7.1 as-number 64513
[r5-bgp]peer 172.16.7.1 connect-interface LoopBack 0
R6:
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.6.1 as-number 64513
[r6-bgp]peer 172.16.6.1 connect-interface LoopBack 0
[r6-bgp]peer 172.16.8.1 as-number 64513
[r6-bgp]peer 172.16.8.1 connect-interface LoopBack 0
R7:
[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.5.1 as-number 64512
[r7-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[r7-bgp]peer 172.16.5.1 ebgp-max-hop 2
[r7-bgp]peer 172.16.7.1 as-number 64513
[r7-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[r7-bgp]peer 78.1.1.2 as-number 3
(2)AS之间建立邻居关系
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.1.1.1 as-number 2
测试(1)和(2):
(3)运行BGP协议的路由器宣告各自的环回
以R1、R8为例:
[r1]bgp 1
[r1-bgp]network 192.168.1.0 24
[r8]bgp 3
[r8-bgp]network 192.168.2.0 24
(4)路由反射器:
[r3]bgp 64512
[r3-bgp]peer 172.16.3.1 reflect-client —— 设置R3为RR,R2为客户端
[r6]bgp 64513
[r6-bgp]peer 172.16.6.1 reflect-client —— 设置R6为RR,R5为客户端
(5)聚合,减少路由条目,防环
[r2]bgp 64512
[r2-bgp]network 172.16.3.0 24
[r2-bgp]network 172.16.4.0 24
[r2-bgp]network 172.16.5.0 24
[r2-bgp]network 172.16.6.0 24
[r2-bgp]network 172.16.7.0 24
[r2-bgp]network 172.16.8.0 24
[r2-bgp]q
[r2]ip route-static 0.0.0.0 0 NULL 0
[r2]bgp 64512
[r2-bgp]aggregate 172.16.0.0 16 detail-suppressed
[r7]bgp 64513
[r7-bgp]network 172.16.4.0 24
[r7-bgp]network 172.16.5.0 24
[r7-bgp]q
[r7]ip route-static 0.0.0.0 0 NULL 0
[r7]bgp 64513
[r7-bgp]aggregate 172.16.0.0 16 detail-suppressed
测试发现路由不优
(6)排错
[r2]bgp 64512
[r2-bgp]peer 172.16.6.1 next-hop-local
[r2-bgp]peer 172.16.4.1 next-hop-local
[r7]bgp 64513
[r7-bgp]peer 172.16.7.1 next-hop-local
[r7-bgp]peer 172.16.5.1 next-hop-local
测试:
完成