BGP实验

目录

实验要求:

优化及要求:

拓扑设计:​编辑

步骤一:地址划分

步骤二:拓扑建立,IP地址配置

拓扑建立​编辑 

IP地址配置

步骤三:OSPF配置

R2~R7均配置:

检测:

 修改业务网段位24位:

检测:​编辑

步骤四:配置BGP协议:

抽查检测:

​编辑

​编辑

​编辑

步骤五:发布路由

检测:​编辑

做反射器

检测:​编辑

步骤六:完成优化1中的不能宣告问题

检测:​编辑

​编辑创建Tunnel隧道:

检测:​编辑

 步骤七:完成优化5

方法一:在R2上聚合

检测:​编辑

​编辑

方法二:

 检测:​编辑

 先写空接口防环路由:

直接在BGP中宣告

 检测:​编辑


实验要求:

优化及要求:

1,AS1存在两个环回,,一个地址为192.168.1.0/24该地址不能在任何协议中宣告,

AS3中存在两个环回,一个地址为192.168.2./24该地址不能在任何协议中宣告,最终要求这两个环回可以互相通讯

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

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

4,使用BGP协议让整个网络所有设备的环回可以互相访问,

5,减少路由条自数量,避免环路出现

拓扑设计:BGP实验_第1张图片

步骤一:地址划分

总地址网段:172.16.0.0 /16

骨干链路172.16.0.0 /24划分至30位

        172.16.0.0  30

        172.16.0.4  30

        172.16.0.8  30

        ......

建邻的环回地址172.16.1.0 /24下的主机地址

        172.16.1.2/32

        172.16.1.3/32

        172.16.1.4/32 

         ........

用户网段:172.16.2.0 /24   172.16.3.0 /24   172.16.4.0 24 ......

步骤二:拓扑建立,IP地址配置

拓扑建立BGP实验_第2张图片 

IP地址配置

R1

interface GigabitEthernet0/0/0
 ip address 12.1.1.1 255.255.255.0 
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
interface LoopBack1
 ip address 192.168.1.1 255.255.255.0 

R2

interface GigabitEthernet0/0/0
 ip address 12.1.1.2 255.255.255.0 
interface GigabitEthernet0/0/1
 ip address 172.16.0.1 255.255.255.252 
interface GigabitEthernet0/0/2
 ip address 172.16.0.13 255.255.255.252 
interface LoopBack0
 ip address 172.16.1.2 255.255.255.255 
interface LoopBack1
 ip address 172.16.2.1 255.255.255.0 

R3

interface GigabitEthernet0/0/0
 ip address 172.16.0.2 255.255.255.252 
interface GigabitEthernet0/0/1
 ip address 172.16.0.5 255.255.255.252 
interface LoopBack0
 ip address 172.16.1.3 255.255.255.255 
interface LoopBack1
 ip address 172.16.3.1 255.255.255.0 

R4

interface GigabitEthernet0/0/0
 ip address 172.16.0.6 255.255.255.252 
interface GigabitEthernet0/0/1
 ip address 172.16.0.9 255.255.255.252
interface LoopBack0
 ip address 172.16.1.4 255.255.255.255 
interface LoopBack1
 ip address 172.16.4.1 255.255.255.0 

R5

interface GigabitEthernet0/0/0
 ip address 172.16.0.14 255.255.255.252 
interface GigabitEthernet0/0/1
 ip address 172.16.0.17 255.255.255.252 
interface LoopBack0
 ip address 172.16.1.5 255.255.255.255 
interface LoopBack1
 ip address 172.16.5.1 255.255.255.0 

R6

interface GigabitEthernet0/0/0
 ip address 172.16.0.18 255.255.255.252 
interface GigabitEthernet0/0/1
 ip address 172.16.0.21 255.255.255.252 
interface LoopBack0
 ip address 172.16.1.6 255.255.255.255 
interface LoopBack1
 ip address 172.16.6.1 255.255.255.0 

R7

interface GigabitEthernet0/0/0
 ip address 172.16.0.22 255.255.255.252 
interface GigabitEthernet0/0/1
 ip address 172.16.0.10 255.255.255.252 
interface GigabitEthernet0/0/2
 ip address 78.1.1.7 255.255.255.0 
interface LoopBack0
 ip address 172.16.1.7 255.255.255.255 
interface LoopBack1
 ip address 172.16.7.1 255.255.255.0 

R8

interface GigabitEthernet0/0/0
 ip address 78.1.1.8 255.255.255.0 
interface LoopBack0
 ip address 8.8.8.8 255.255.255.255 
interface LoopBack1
 ip address 192.168.2.1 255.255.255.0 

步骤三:OSPF配置

R2~R7均配置:

ospf 1 
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 

检测:

BGP实验_第3张图片

 修改业务网段位24位:

修改接口网络类型:broadcast 

    进入接口输入 ospf network-type broadcast 

检测:BGP实验_第4张图片

步骤四:配置BGP协议:

R1

bgp 1
 router-id 1.1.1.1
 peer 172.16.1.2 as-number 2 
 peer 172.16.1.2 ebgp-max-hop 2 
 peer 172.16.1.2 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.2 enable
#
ip route-static 172.16.1.2 255.255.255.255 12.1.1.2

 R2

bgp 64512
 router-id 172.16.1.2
 confederation id 2
 confederation peer-as 64513
 peer 1.1.1.1 as-number 1 
 peer 1.1.1.1 ebgp-max-hop 2 
 peer 1.1.1.1 connect-interface LoopBack0
 peer 172.16.1.3 as-number 64512 
 peer 172.16.1.3 connect-interface LoopBack0
 peer 172.16.1.5 as-number 64513 
 peer 172.16.1.5 ebgp-max-hop 2 
 peer 172.16.1.5 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.1.1 enable
  peer 172.16.1.3 enable
  peer 172.16.1.3 next-hop-local 
  peer 172.16.1.5 enable
#
ip route-static 1.1.1.1 255.255.255.255 12.1.1.1

R3

bgp 64512
 router-id 172.16.1.3
 confederation id 2
 peer 172.16.1.2 as-number 64512 
 peer 172.16.1.2 connect-interface LoopBack0
 peer 172.16.1.4 as-number 64512 
 peer 172.16.1.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.2 enable
  peer 172.16.1.4 enable

R4

bgp 64512
 router-id 172.16.1.4
 confederation id 2
 confederation peer-as 64513
 peer 172.16.1.3 as-number 64512 
 peer 172.16.1.3 connect-interface LoopBack0
 peer 172.16.1.7 as-number 64513 
 peer 172.16.1.7 ebgp-max-hop 2 
 peer 172.16.1.7 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.3 enable
  peer 172.16.1.7 enable

R5

bgp 64513
 router-id 172.16.1.5
 confederation id 2
 confederation peer-as 64512
 peer 172.16.1.2 as-number 64512 
 peer 172.16.1.2 ebgp-max-hop 2 
 peer 172.16.1.2 connect-interface LoopBack0
 peer 172.16.1.6 as-number 64513 
 peer 172.16.1.6 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.2 enable
  peer 172.16.1.6 enable

R6

bgp 64513
 router-id 172.16.1.6
 confederation id 2
 peer 172.16.1.5 as-number 64513 
 peer 172.16.1.5 connect-interface LoopBack0
 peer 172.16.1.7 as-number 64513 
 peer 172.16.1.7 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.5 enable
  peer 172.16.1.7 enable

R7

bgp 64513
 router-id 172.16.1.7
 confederation id 2
 confederation peer-as 64512
 peer 8.8.8.8 as-number 3 
 peer 8.8.8.8 ebgp-max-hop 2 
 peer 8.8.8.8 connect-interface LoopBack0
 peer 172.16.1.4 as-number 64512 
 peer 172.16.1.4 ebgp-max-hop 2 
 peer 172.16.1.4 connect-interface LoopBack0
 peer 172.16.1.6 as-number 64513 
 peer 172.16.1.6 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 8.8.8.8 enable
  peer 172.16.1.4 enable
  peer 172.16.1.6 enable
  peer 172.16.1.6 next-hop-local 
#
ip route-static 8.8.8.8 255.255.255.255 78.1.1.8

R8

bgp 3
 router-id 8.8.8.8
 peer 172.16.1.7 as-number 2 
 peer 172.16.1.7 ebgp-max-hop 2 
 peer 172.16.1.7 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.1.7 enable
#
ip route-static 172.16.1.7 255.255.255.255 78.1.1.7

抽查检测:

BGP实验_第5张图片
BGP实验_第6张图片
BGP实验_第7张图片

配置成功。

步骤五:发布路由

在R2上配置

[R2]bgp 64512
[R2-bgp]network 172.16.2.0 24
[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

检测:

display  bgp  routing-table 

BGP实验_第8张图片

BGP实验_第9张图片

BGP实验_第10张图片BGP实验_第11张图片

 由于水平分割,因此路由表无法传递到R4上

做反射器

因此在R3上做反射器,将R2变为客户端

[R3]bgp 64512
[R3-bgp]peer 172.16.1.2 reflect-client 

检测:BGP实验_第12张图片

BGP实验_第13张图片

BGP实验_第14张图片

BGP实验_第15张图片 BGP实验_第16张图片

步骤六:完成优化1中的不能宣告问题

R1

[R1]int l 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]bgp 1
[R1-bgp]network 1.1.1.0 24        	

 R2

[R2]ip route-static 1.1.1.1 32 12.1.1.1

R8

[R8]INT L 0
[R8-LoopBack0]IP ADD 8.8.8.8 24
[R8-LoopBack0]q
[R8]bgp 3	
[R8-bgp]network 8.8.8.0 24

检测:BGP实验_第17张图片

BGP实验_第18张图片创建Tunnel隧道:

R1

interface Tunnel0/0/0
 ip address 10.1.1.1 255.255.255.0 
 tunnel-protocol gre
 source 1.1.1.1
 destination 8.8.8.8

ip route-static 192.168.2.0 255.255.255.0 Tunnel0/0/0

 R8

[R8]int t 0/0/0
[R8-Tunnel0/0/0]tunnel-protocol  gre 
[R8-Tunnel0/0/0]ip add 10.1.1.2 24	
[R8-Tunnel0/0/0]source 8.8.8.8
[R8-Tunnel0/0/0]description
[R8-Tunnel0/0/0]destination 1.1.1.1
[R8-Tunnel0/0/0]q
[R8]ip route-static 192.168.1.0 24 Tunnel 0/0/0

检测:BGP实验_第19张图片

 步骤七:完成优化5

方法一:在R2上聚合

[R2]bgp 64512
[R2-bgp]aggregate 172.16.0.0 21 detail-suppressed 

检测:BGP实验_第20张图片

BGP实验_第21张图片

BGP实验_第22张图片

方法二:

在R2上配置

bgp 64512
    undo network 172.16.2.0 255.255.255.0 
    undo network 172.16.3.0 255.255.255.0 
    undo network 172.16.4.0 255.255.255.0 
    undo network 172.16.5.0 255.255.255.0 
    undo network 172.16.6.0 255.255.255.0 
    undo network 172.16.7.0 255.255.255.0
    undo aggregate 172.16.0.0 255.255.248.0 detail-suppressed
    undo network 172.16.0.0 

 检测:BGP实验_第23张图片

 先写空接口防环路由:

[R2]ip route-static 172.16.0.0 21 NULL 0

查看让R2路由表

直接在BGP中宣告

[R2]bgp 64512
[R2]network 172.16.0.0 21

 检测:

实验完成 

BGP实验_第24张图片

你可能感兴趣的:(网络)