BGP综合实验

一,实验需求

1,AS1存在两个环回接口,一个地址为192.168.1.0/24该地址不能在任何协议中宣告。AS3存在两个环回接口,一个地址为192.168.2.0/24该地址不能在任何协议中宣告,最终要求两个环回可以互相通讯。

2,整个AS2的IP地址为172.16.0.0/16,请合理划分

3,ASB间的骨干链路IP地址随意定制

4,使用BGP协议让整个网络所有设备环回可以相互访问。 5,减少路由条目数量,避免环路出现。

二,实验思路

1、合理划分IP地址,配置IP地址及环回接口。

2、在AS2当中启动IGP协议OSPF,作为BGP协议的基础

3、启动BGP协议建立邻居关系,使得整个BGP协议可以使得BGP路由可达。其中需要注意,有小的联邦的AS号需要将小的联邦的AS号进行先配置,再将所属的真实的AS号进行发布。如果有联邦EBGP,并要宣告邻居联邦EBGP的AS号。此实验当中联邦IBGP对等体中需要配置路由反射器,从而实现BGP路由的传递。

4、减少路由条目,可以使用配置一条空接口路由来完成,即达成了路由条目的减少,也达到空接口防环的机制,且最重要的是,从而实现了整个AS2内的环回接口可达。

5、通过再AR1与AR8上创建GRE隧道,来实现192.168.1.0/24与192.168.2.0/24的环回接口进行通讯,注意的是,隧道中源目接口的IP地址要使用AR1与AR8上另外以一个换回接口,其原因是,如果选用物理接口,是无法通讯的,是因为物理接口根本没有去往对方的路由信息,物理接口都无法通讯,隧道就更不可能了。再写一条静态来指向对端,注意下一跳为隧道。

三,实验步骤

1,IP地址划分

AS1的IP地址

一个环回建立隧道,一个模拟访问

192.168.1.1 24——lookback 0

10.0.0.1 24——lookback 1

AS 2的IP地址划分:

172.16.0.0/16

骨干链路

172.16.0.0/18

172.16.0.0/30——23网段

172.16.0.4/30——34网段

172.16.0.8/30——47网段

172.16.0.12/30——67网段

172.16.0.16/30——56网段

172.16.0.20/30——25网段

建立对等体环回——lookback 0

172.16.64.0/18

172.16.64.1/32——R2

172.16.64.2/32——R3

172.16.64.3/32——R4

172.16.64.4/32——R5

172.16.64.5/32——R6

172.16.64.6/32——R7

模拟用户网段——lookback 1

172.16.128.0/18

172.16.128.0/24——R2

172.16.129.0/24——R3

172.16.130.0/24——R4

172.16.131.0/24——R5

172.16.132.0/24——R6

172.16.133.0/24——R7

AS3的IP地址

一个环回建立隧道,一个模拟访问

192.168.2.1 24——lookback 0

11.0.0.1 24——lookback 1

2,所有设备改名字配置IP地址

R1配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.0.0.1 24
Nov 24 2023 22:30:04-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r1-GigabitEthernet0/0/0]int l 0
[r1-LoopBack0]ip address 192.168.1.1 24
[r1-LoopBack0]int l 1
[r1-LoopBack1]ip address 10.0.0.1 24

R2配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip address 12.0.0.2 24
Nov 24 2023 22:34:19-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip address 172.16.0.1 30
Nov 24 2023 22:35:07-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r2-GigabitEthernet0/0/1]int g 0/0/2
[r2-GigabitEthernet0/0/2]ip address 172.16.0.22 30
Nov 24 2023 22:35:34-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r2-GigabitEthernet0/0/2]int l 0
[r2-LoopBack0]ip address 172.16.64.1 32
[r2-LoopBack0]int l 1
[r2-LoopBack1]ip address 172.16.128.1 24

R3配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip address 172.16.0.2 30
Nov 24 2023 22:37:53-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 172.16.0.5 30
Nov 24 2023 22:38:41-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r3-GigabitEthernet0/0/1]int l 0
[r3-LoopBack0]ip address 172.16.64.2 32
[r3-LoopBack0]int l 1
[r3-LoopBack1]ip address 172.16.129.1 24

R4配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip address 172.16.0.6 30
Nov 24 2023 22:41:44-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip address 172.16.0.9 30
Nov 24 2023 22:42:12-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r4-GigabitEthernet0/0/1]int l 0
[r4-LoopBack0]ip address 172.16.64.3 32
[r4-LoopBack0]int l 1
[r4-LoopBack1]ip address 172.16.130.1 24

R5配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r5
[r5]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip address 172.16.0.18 30
Nov 24 2023 22:51:13-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r5-GigabitEthernet0/0/1]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip address 172.16.0.21 30
Nov 24 2023 22:52:00-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r5-GigabitEthernet0/0/0]int l 0
[r5-LoopBack0]ip address 172.16.64.4 32
[r5-LoopBack0]int l 1
[r5-LoopBack1]ip address 172.16.131.1 24

R6配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r6
[r6]int g 0/0/1
[r6-GigabitEthernet0/0/1]ip address 172.16.0.14 30
Nov 24 2023 22:47:59-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r6-GigabitEthernet0/0/1]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip address 172.16.0.17 30
Nov 24 2023 22:48:22-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r6-GigabitEthernet0/0/0]int l 0
[r6-LoopBack0]ip address 172.16.64.5 32
[r6-LoopBack0]int l 1
[r6-LoopBack1]ip address 172.16.132.1 24

R7配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r7
[r7]int g 0/0/0
[r7-GigabitEthernet0/0/0]ip address 172.16.0.13 30
Nov 24 2023 22:44:09-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r7-GigabitEthernet0/0/0]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip address 172.16.0.10 30
Nov 24 2023 22:44:40-08:00 r7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r7-GigabitEthernet0/0/1]int l 0
[r7-LoopBack0]ip address 172.16.64.6 32
[r7-LoopBack0]int l 1
[r7-LoopBack1]ip address 172.16.133.1 24
[r7]int g 0/0/2
[r7-GigabitEthernet0/0/2]ip address 78.0.0.1 24
Nov 24 2023 22:54:33-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 

R8配置
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r8
[r8]int g 0/0/0
[r8-GigabitEthernet0/0/0]ip address 78.0.0.2 24
Nov 24 2023 22:55:17-08:00 r8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r8-GigabitEthernet0/0/0]int l 0
[r8-LoopBack0]ip address 192.168.2.1 24
[r8-LoopBack0]int l 1
[r8-LoopBack1]ip address 11.0.0.1 24

3,AS 2中启动OSPF

R2配置
[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.0.0 0.0.255.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.0.0 0.0.255.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.0.0 0.0.255.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.0.0 0.0.255.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.0.0 0.0.255.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.0.0 0.0.255.255

BGP综合实验_第1张图片

 4,启动BGP协议,建立对应的对等体

R1配置
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1 	
[r1-bgp]peer 12.0.0.2 as-number 2

R2配置
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2 
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.0.0.1 as-number 1
[r2-bgp]peer 172.16.64.2 as-number 64512
[r2-bgp]peer 172.16.64.2 connect-interface LoopBack 0
[r2-bgp]peer 172.16.64.4 as-number 64513
[r2-bgp]peer 172.16.64.4 connect-interface LoopBack 0
[r2-bgp]peer 172.16.64.4 ebgp-max-hop 
[r2-bgp]peer 172.16.64.2 next-hop-local
[r2-bgp]peer 172.16.64.4 next-hop-local

R3配置
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.64.1 as-number 64512
[r3-bgp]peer 172.16.64.3 as-number 64512
[r3-bgp]peer 172.16.64.1 connect-interface LoopBack 0
[r3-bgp]peer 172.16.64.3 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.64.2 as-number 64512
[r4-bgp]peer 172.16.64.2 connect-interface LoopBack 0
[r4-bgp]peer 172.16.64.6 as-number 64513
[r4-bgp]peer 172.16.64.6 connect-interface LoopBack 0
[r4-bgp]peer 172.16.64.6 ebgp-max-hop

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.64.1 as-number 64512
[r5-bgp]peer 172.16.64.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.64.5 as-number 64513
[r5-bgp]peer 172.16.64.5 connect-interface LoopBack 0
[r5-bgp]peer 172.16.64.1 ebgp-max-hop

R6配置
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.64.4 as-number 64513
[r6-bgp]peer 172.16.64.6 as-number 64513
[r6-bgp]peer 172.16.64.4 connect-interface LoopBack 0
[r6-bgp]peer 172.16.64.6 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 78.0.0.2 as-number 3
[r7-bgp]peer 172.16.64.3 as-number 64512
[r7-bgp]peer 172.16.64.3 connect-interface LoopBack 0
[r7-bgp]peer 172.16.64.5 as-number 64513
[r7-bgp]peer 172.16.64.5 connect-interface LoopBack 0
[r7-bgp]peer 172.16.64.3 ebgp-max-hop 
[r7-bgp]peer 172.16.64.5 next-hop-local
[r7-bgp]peer 172.16.64.3 next-hop-local

R8配置
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8 	
[r8-bgp]peer 78.0.0.1 as-number 2

5,发布路由信息

[r1]bgp 1              
[r1-bgp]network 10.0.0.0 24
[r8]bgp 3
[r8-bgp]network 11.0.0.0 24

6,破除水平分割,配置路由反射器

[r3]bgp 64512
[r3-bgp]peer 172.16.64.1 reflect-client
[r6]bgp 64513
[r6-bgp]peer 172.16.64.4 reflect-client

7,配置空接口防环、汇总路由及宣告路由

[r2]ip route-static 172.16.0.0 16 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 16
[r7]ip route-static 172.16.0.0 16 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 16

BGP综合实验_第2张图片 

 8,建立GRE隧道,实现互通

[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.18.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre 
[r1-Tunnel0/0/0]source 10.0.0.1
[r1-Tunnel0/0/0]destination 11.0.0.1
[r1]ip route-static 192.168.2.0 24 192.168.18.2
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ip address 192.168.18.2 24
[r8-Tunnel0/0/0]tunnel-protocol gre 
[r8-Tunnel0/0/0]source 11.0.0.1
[r8-Tunnel0/0/0]destination 10.0.0.1
[r8]ip route-static 192.168.1.0 24 192.168.18.1

BGP综合实验_第3张图片

你可能感兴趣的:(HCIP学习,网络)