目录
一,实验要求
二,实验步骤
(1)规划IP
(2)配IP地址
(3)ospf宣告
(4)起BGP,IBGP
(5)宣告环回
(6) 减少路由条目
(7)黑洞
1.AS1存在两个环回,一个地址为192.168.1.0/24该地址不能在任何协议中宣告
AS3中存在两个环回,一个地址为192.168.2.0/24该地址不能在任何协议中宣告,
最终要求这两个环回可以互相通讯
2.整个AS2的ip地址为172.16.0.0/16,请合理划分
3.As间的骨干链路1P地址随意定制
4.使用B6P协议让整个网络所有设备的环回可以互相访问
5,减少路由条自数量,避免环路出现
172.16.0.0 16
172.16.16.0 20
172.16.18.0 23 AR23
172.16.20.0 23 AR34
172.16.22.0 23 AR47
172.16.24.0 23 AR67
172.16.26.0 23 AR56
172.16.28.0 23 AR25172.16.30.0 23
172.16.32.0 23
172.16.32.0 20 AR2
172.16.48.0 20 AR3
172.16.64.0 20 AR4
172.16.80.0 20 AR5
172.16.96.0 20 AR6
172.16.112.0 20 AR7172.16.128.0 20
注意:加粗的为要用的IP地址
R1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip add 192.168.1.1 25
[r1-LoopBack1]ip add 192.168.1.129 25
R2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.18.1 30
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.28.1 30
[r2-GigabitEthernet0/0/2]int l0
[r2-LoopBack0]ip add 172.16.33.0 20
R3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.18.2 30
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 172.16.20.1 30
[r3-GigabitEthernet0/0/1]int l0
[r3-LoopBack0]ip add 172.16.49.0 20
R4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 172.168.20.2 30
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip add 172.16.22.1 30
[r4-GigabitEthernet0/0/1]int l0
[r4-LoopBack0]ip add 172.16.65.0 20
R5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 172.16.28.2 30
[r5-GigabitEthernet0/0/0]int g0/0/1
[r5-GigabitEthernet0/0/1]ip add 172.16.26.1 30
[r5-GigabitEthernet0/0/1]int l0
[r5-LoopBack0]ip add 172.16.113.0 20
R6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.26.2 30
[r6-GigabitEthernet0/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 172.16.24.1 30
[r6-GigabitEthernet0/0/1]int l0
[r6-LoopBack0]ip add 172.16.97.0 20
R7
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 172.16.24.2 30
[r7-GigabitEthernet0/0/0]int g0/0/2
[r7-GigabitEthernet0/0/2]ip add 172.16.22.2 30
[r7-GigabitEthernet0/0/2]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 78.1.1.7 24
[r7-GigabitEthernet0/0/1]int l0
[r7-LoopBack0]ip add 172.16.81.0 2
R8
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 78.1.1.8 24
[r8-GigabitEthernet0/0/0]int l0
[r8-LoopBack0]ip add 192.168.2.1 25
[r8-LoopBack0]int l1
[r8-LoopBack1]ip add 192.168.2.129 25
R2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.33.0 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 172.16.18.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 172.16.28.1 0.0.0.0
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.18.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 172.16.49.0 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 172.16.20.1 0.0.0.0
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.20.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 172.16.65.0 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 172.16.22.1 0.0.0.0
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.113.0 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 172.16.26.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 172.16.28.2 0.0.0.0
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.24.1 0.0.0.0[r6-ospf-1-area-0.0.0.0]network 172.16.97.0 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 172.16.26.2 0.0.0.0
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.22.2 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.16.24.2 0.0.0.0
[r7-ospf-1-area-0.0.0.0]network 172.16.81.0 0.0.0.0
R1
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
R2
[r2]bgp 64512
[r2-bgp]confederation id 2 申明本地的大AS号
[r2-bgp]confederation peer-as 64513 告知本地直连的其他小AS号
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 172.16.49.0 as-number 64512
[r2-bgp]peer 172.16.49.0 connect-interface LoopBack 0
[r2-bgp]peer 172.16.113.0 as-number 64513
[r2-bgp]peer 172.16.113.0 connect-interface LoopBack 0
[r2-bgp]peer 172.16.113.0 next-hop-local 下一跳为本地
[r2-bgp]peer 172.16.113.0 ebgp-max-hop 2 内部BGP也要两跳
[r2-bgp]peer 172.16.49.0 next-hop-local 下一跳为本地
R3
[r3]bgp 64512
[r3-bgp]peer 172.16.33.0 as-number 64512
[r3-bgp]peer 172.16.33.0 connect-interface LoopBack 0
[r3-bgp]peer 172.16.33.0 reflect-client 设立反射器,并指定R为客户端
[r3-bgp]peer 172.16.65.0 as-number 64512
[r3-bgp]peer 172.16.65.0 connect-interface LoopBack 0注意:要建立邻居关系,才能设立反射器
R4
[r4]bgp 64512
[r4-bgp]confederation id 2 宣告本地大AS
[r4-bgp]confederation peer-as 64513 告知本地直连的其他小AS号
[r4-bgp]peer 172.16.49.0 as-number 64512
[r4-bgp]peer 172.16.49.0 connect-interface LoopBack 0
[r4-bgp]peer 172.16.81.0 as-number 64513
[r4-bgp]peer 172.16.81.0 connect-interface LoopBack 0
[r4-bgp]peer 172.16.81.0 ebgp-max-hop 2 内部BGP也要两跳
R5
[r5]bgp 64513
[r5-bgp]confederation id 2 宣告本地大AS
[r5-bgp]confederation peer-as 64512 告知本地直连的其他小AS号
[r5-bgp]peer 172.16.97.0 as-number 64513
[r5-bgp]peer 172.16.97.0 connect-interface LoopBack 0
[r5-bgp]peer 172.16.33.0 as-number 64512
[r5-bgp]peer 172.16.33.0 ebgp-max-hop 2 内部BGP也要两跳
[r5-bgp]peer 172.16.33.0 connect-interface LoopBack 0
R6
[r6]bgp 64513
[r6-bgp]peer 172.16.81.0 as-number 64513
[r6-bgp]peer 172.16.81.0 connect-interface LoopBack 0
[r6-bgp]peer 172.16.113.0 as-number 64513
[r6-bgp]peer 172.16.113.0 connect-interface LoopBack 0
[r6-bgp]peer 172.16.81.0 reflect-client
R7
[r7]bgp 64513
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.65.0 as-number 64512
[r7-bgp]peer 172.16.65.0 connect-interface LoopBack 0
[r7-bgp]peer 172.16.65.0 ebgp-max-hop 2
[r7-bgp]peer 78.1.1.8 as-number 3
[r7-bgp]peer 172.16.65.0 next-hop-local
[r7-bgp]peer 172.16.97.0 as-number 64513
[r7-bgp]peer 172.16.97.0 next-hop-local
[r7-bgp]peer 172.16.97.0 connect-interface LoopBack 0
R8
[r8]bgp 3
[r8-bgp]peer 78.1.1.7 as-number 2
总结:AS1和AS2起BGP直接用大AS号,AS内部建立时用小AS号,内部起EBGP时要将跳数改为2,且要将与外面AS直连的EBGP修改下一跳地址为本地 ,内部其他地方不用修改下一跳位置,并用环回建立邻居关系,内部联邦时,宣告本地大AS,EBGP间要告知本地直连的其他小AS号
R1
[r1]bgp 1
[r1-bgp]ne
[r1-bgp]network 192.168.1.0 25
[r1-bgp]network 192.168.1.128 25
R2
[r2]bgp 64512
[r2-bgp]ne
[r2-bgp]network 172.16.32.20[r2-bgp]network 172.16.32.0 20
R3
[r3]bgp 64512
[r3-bgp]network 172.16.48.0 20
R4
[r4]bgp 64512
[r4-bgp]network 172.16.64.0 20
R5
[r5]bgp 64513
[r5-bgp]network 172.16.112.0 20
R6
[r6]bgp 64513
[r6-bgp]network 172.16.96.0 20
R7
[r7]bgp 64513
[r7-bgp]network 172.16.80.0 20
R8
[r8]bgp 3
[r8-bgp]network 192.168.2.0 25
[r8-bgp]network 192.168.2.128 25
R2
[r2]ip route-static 172.16.0.0 16 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 16
R7
[r7]ip route-static 172.16.0.0 16 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 16
R7上面也宣告,是因为R8访问到空路由时,可以直接在R7上面直接丢弃,避免占用内部资源
因为图上的每个设备都在运行BGP,BGP有自己的防环机制,所以没有环路出现