BGP联邦实验

BGP联邦实验

要求:

在这里插入图片描述

1.AS1存在两个环回,一个地址为192.168.1.0/24该地址不能在任何协议中宣告,
AS3中存在两个环回,一个地址为192.168.2.0/24该地址不能在任何协议中宣告,最终要求这两个环回可以互相通讯,
AS1的另一个环回为10.0.0.0/24,AS3的另一个环回为11.0.0.0/24
2.整个AS2的IP地址为172.16.0.0/16,请合理划分
3.AS间的骨干链路IP地址随意定制
4.使用BGP协议让整个网络所有设备的环回可以互相访问
5.减少路由条目数量,避免环路出现

一、划分配置地址

在这里插入图片描述

R1:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.0.0.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         10.0.0.1/24          up         up(s)     
LoopBack1                         192.168.1.1/24       up         up(s)     
NULL0                             unassigned           up         up(s)

R2:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.1/30        up         up        
GigabitEthernet0/0/1              12.0.0.2/24          up         up        
GigabitEthernet0/0/2              172.16.0.22/30       up         up        
LoopBack0                         172.16.2.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)

R3:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.5/30        up         up        
GigabitEthernet0/0/1              172.16.0.2/30        up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.3.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)

R4:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.9/30        up         up        
GigabitEthernet0/0/1              172.16.0.6/30        up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.4.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)   

R5:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.21/30       up         up        
GigabitEthernet0/0/1              172.16.0.18/30       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.5.1/24        up         up(s)     
NULL0                             unassigned           up         up(s) 

R6:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.17/30       up         up        
GigabitEthernet0/0/1              172.16.0.14/30       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.6.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)    

R7:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.0.13/30       up         up        
GigabitEthernet0/0/1              78.0.0.1/24          up         up        
GigabitEthernet0/0/2              172.16.0.10/30       up         up        
LoopBack0                         172.16.7.1/24        up         up(s)     
NULL0                             unassigned           up         up(s) 

R8:
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              78.0.0.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         11.0.0.1/24          up         up(s)     
LoopBack1                         192.168.2.1/24       up         up(s)     
NULL0                             unassigned           up         up(s) 
二、IGP内部运行OSPF协议
AS 2内按照172.16.0.0/16网段进行划分,AS内部运行IGP协议为ospf,ospf上直接宣告172.16.0.0/16网段

R2:
[r2-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r2-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 2.2.2.2
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        
 0.0.0.0          GigabitEthernet0/0/2             5.5.5.5          Full        
 ----------------------------------------------------------------------------

R3:
[r3-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r3-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 3.3.3.3
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/1             2.2.2.2          Full        
 0.0.0.0          GigabitEthernet0/0/0             4.4.4.4          Full        
 ----------------------------------------------------------------------------

R4:
[r4-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r4-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 4.4.4.4
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/1             3.3.3.3          Full        
 0.0.0.0          GigabitEthernet0/0/0             7.7.7.7          Full        
 ----------------------------------------------------------------------------

R5:
[r5-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r5-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 5.5.5.5
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 0.0.0.0          GigabitEthernet0/0/1             6.6.6.6          Full        
 ----------------------------------------------------------------------------

R6:
[r6-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r6-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 6.6.6.6
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             5.5.5.5          Full        
 0.0.0.0          GigabitEthernet0/0/1             7.7.7.7          Full        
 ----------------------------------------------------------------------------

R7:
[r7-ospf-1-area-0.0.0.0]dis this
[V200R003C00]
#
 area 0.0.0.0 
  network 172.16.0.0 0.0.255.255 
#
return
[r7-ospf-1-area-0.0.0.0]dis ospf peer b

	 OSPF Process 1 with Router ID 7.7.7.7
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             6.6.6.6          Full        
 0.0.0.0          GigabitEthernet0/0/2             4.4.4.4          Full        
 ----------------------------------------------------------------------------
三、配置各个AS的BGP,进行相邻之间建邻配置
-----------------------AS 1中-----------------------
R1:
[r1-bgp]dis this
[V200R003C00]
#
bgp 1
 router-id 1.1.1.1
 peer 12.0.0.2 as-number 2 
 #
 ipv4-family unicast
  undo synchronization
  peer 12.0.0.2 enable
#
return

---------------R2-R4划分联邦,联邦内部AS为64512---------------
R2:
[r2-bgp]dis this
[V200R003C00]
#
bgp 64512
 router-id 2.2.2.2
 confederation id 2
 peer 12.0.0.1 as-number 1 
 peer 172.16.3.1 as-number 64512 
 peer 172.16.3.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 12.0.0.1 enable
  peer 172.16.3.1 enable
#
return

R3:
[r3-bgp]dis this
[V200R003C00]
#
bgp 64512
 router-id 3.3.3.3
 confederation id 2
 peer 172.16.2.1 as-number 64512 
 peer 172.16.2.1 connect-interface LoopBack0
 peer 172.16.4.1 as-number 64512 
 peer 172.16.4.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.2.1 enable
  peer 172.16.4.1 enable
#
return

R4:
[r4-bgp]dis this
[V200R003C00]
#
bgp 64512
 router-id 4.4.4.4
 confederation id 2
 peer 172.16.3.1 as-number 64512 
 peer 172.16.3.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.3.1 enable
#
return

---------------R5-R7划分联邦,联邦内部AS为64513---------------
R5:
[r5-bgp]dis this
[V200R003C00]
#
bgp 64513
 router-id 5.5.5.5
 confederation id 2
 peer 172.16.6.1 as-number 64513 
 peer 172.16.6.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.6.1 enable
#
return

R6:
[r6-bgp]dis this
[V200R003C00]
#
bgp 64513
 router-id 6.6.6.6
 confederation id 2
 peer 172.16.5.1 as-number 64513 
 peer 172.16.5.1 connect-interface LoopBack0
 peer 172.16.7.1 as-number 64513 
 peer 172.16.7.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 172.16.5.1 enable
  peer 172.16.7.1 enable
#
return

[r7-bgp]dis this
[V200R003C00]
#
bgp 64513
 router-id 7.7.7.7
 confederation id 2
 peer 78.0.0.2 as-number 3 
 peer 172.16.6.1 as-number 64513 
 peer 172.16.6.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 78.0.0.2 enable
  peer 172.16.6.1 enable
#
return

-----------------------AS 3中-----------------------
R8:
[r8-bgp]dis this
[V200R003C00]
#
bgp 3
 router-id 8.8.8.8
 peer 78.0.0.1 as-number 2 
 #
 ipv4-family unicast
  undo synchronization
  peer 78.0.0.1 enable
#
return
四、进行AS 2联邦AS之间的配置建邻
R2:
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 172.16.5.1 as-number 64513
[r2-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[r2-bgp]peer 172.16.5.1 ebgp-max-hop ---- 更改联邦之间的TTL为255

R5:
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.2.1 as-number 64512
[r5-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[r5-bgp]peer 172.16.2.1 ebgp-max-hop 

R4:
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.7.1 as-number 64513	
[r4-bgp]peer 172.16.7.1 connect-interface LoopBack  0
[r4-bgp]peer 172.16.7.1 ebgp-max-hop

R7:
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.4.1 as-number 64512
[r7-bgp]peer 172.16.4.1 connect-interface LoopBack 0
[r7-bgp]peer 172.16.4.1 ebgp-max-hop
五、查看建邻情况
R2:
[r2-bgp]dis bgp peer

 BGP local router ID : 2.2.2.2
 Local AS number : 64512
 Total number of peers : 3		  Peers in established state : 3

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  12.0.0.1        4           1       75       75     0 01:13:13 Established    
   0
  172.16.3.1      4       64512       51       51     0 00:49:30 Established    
   0
  172.16.5.1      4       64513       37       39     0 00:35:35 Established    
   0
   
R7:
[r7-bgp]dis bgp peer 

 BGP local router ID : 7.7.7.7
 Local AS number : 64513
 Total number of peers : 3		  Peers in established state : 3

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State Pre
fRcv

  78.0.0.2        4           3       48       48     0 00:46:12 Established    
   0
  172.16.4.1      4       64512       35       35     0 00:33:48 Established    
   0
  172.16.6.1      4       64513       50       50     0 00:48:43 Established    
   0
六、宣告10.0.0.0/24和11.0.0.0/24网段,以及在R2和R7上将传输给AS 2内部的对等体的下一跳属性指定为自己与对等体的连接地址
---------------R1和R8上分别宣告10.0.0.0/24和11.0.0.0/24网段---------------
R1:
[r1-bgp]network 10.0.0.0 24

R8:
[r8-bgp]network 11.0.0.0 24


---------------R2和R7上对AS 2内部对等体的传输下一跳属性的地址进行修改---------------
R2:
[r2-bgp]peer 172.16.3.1 next-hop-local ---- R2与R3指定对等体传输的下一跳属性为本地创建对等体连接地址
[r2-bgp]peer 172.16.5.1 next-hop-local ---- R2与R5指定对等体传输的下一跳属性为本地创建对等体连接地址

R7:
[r7-bgp]peer 172.16.4.1 next-hop-local ---- R7与R4指定对等体传输的下一跳属性为本地创建对等体连接地址
[r7-bgp]peer 172.16.6.1 next-hop-local ---- R7与R6指定对等体传输的下一跳属性为本地创建对等体连接地址
七、AS 2内部指定R3和R6为反射器,R2以及R7分别为R3和R6的客户
[r3-bgp]peer 172.16.2.1 reflect-client ---- 指定R2为客户,R3为反射器
[r6-bgp]peer 172.16.7.1 reflect-client ---- 指定R7为客户,R6为反射器

---------------查看R4和R5上的信息反射情况---------------
R4:
[r4-bgp]dis bgp routing-table 

 BGP Local router ID is 4.4.4.4 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      1i
 *>i  11.0.0.0/24        172.16.7.1      0          100        0      (64513) 3i
 * i  
 
 R5:
 [r5-bgp]dis bgp routing-table 

 BGP Local router ID is 5.5.5.5 
 Status codes: * - valid, > - best, d - damped,
               h - history,  i - internal, s - suppressed, S - Stale
               Origin : i - IGP, e - EGP, ? - incomplete


 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      (64512) 1i
 *>i  11.0.0.0/24        172.16.7.1      0          100        0      3i
八、对AS 2内部的172.16.0.0/16所划分的网段进行聚合宣告,并配置空接口
---------------宣告网段是在EBGP连接的设备上配置,在R2和R7上配置---------------
[r2]ip route-static 172.16.0.0 16 NULL 0 ---- 配置空接口,以及使用空接口所指向的网段进行宣告,从而达到聚合
[r7]ip route-static 172.16.0.0 16 NULL 0

[r2-bgp]network 172.16.0.0 16 ---- 宣告172.16.0.0/16网段
[r7-bgp]network 172.16.0.0 16
九、在R2和R7上宣告与AS 1和AS 3连接的网段,使AS 2内部可以与外部AS进行信息联通
[r2-bgp]network 12.0.0.0 24
[r7-bgp]network 78.0.0.0 24

---------------在R1和R8上查看路由表中BGP协议宣告网段的加表情况---------------
R1:
[r1-bgp]dis ip ro pr bgp
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : BGP
         Destinations : 3        Routes : 3        

BGP routing table status : <Active>
         Destinations : 3        Routes : 3

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       11.0.0.0/24  EBGP    255  0           D   12.0.0.2        GigabitEthernet
0/0/0
       78.0.0.0/24  EBGP    255  0           D   12.0.0.2        GigabitEthernet
0/0/0
     172.16.0.0/16  EBGP    255  0           D   12.0.0.2        GigabitEthernet
0/0/0

BGP routing table status : <Inactive>
         Destinations : 0        Routes : 0
         
R8:
[r8-bgp]dis ip ro pr bgp
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : BGP
         Destinations : 3        Routes : 3        

BGP routing table status : <Active>
         Destinations : 3        Routes : 3

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.0.0/24  EBGP    255  0           D   78.0.0.1        GigabitEthernet
0/0/0
       12.0.0.0/24  EBGP    255  0           D   78.0.0.1        GigabitEthernet
0/0/0
     172.16.0.0/16  EBGP    255  0           D   78.0.0.1        GigabitEthernet
0/0/0

BGP routing table status : <Inactive>
         Destinations : 0        Routes : 0
十、因为R1和R8的192.168.1.0/24网段和192.168.2.0/24网段不能宣告,但要相互通信,所以建立隧道使R1的192.168.1.0/24网段和R8的192.168.2.0/24网段可以互相通信
---------------R1上和R8上使用已互联的10.0.0.0/24和11.0.0.0/24网段进行隧道建立---------------
R1:[r1-Tunnel0/0/0]dis this
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 18.0.0.1 255.255.255.0 
 tunnel-protocol gre
 source 10.0.0.1
 destination 11.0.0.1
#
return

R8:
[r8-Tunnel0/0/0]dis this
[V200R003C00]
#
interface Tunnel0/0/0
 ip address 18.0.0.2 255.255.255.0 
 tunnel-protocol gre
 source 11.0.0.1
 destination 10.0.0.1
#
return

---------------测试隧道的联通---------------
[r1-Tunnel0/0/0]ping -a 18.0.0.1 18.0.0.2
  PING 18.0.0.2: 56  data bytes, press CTRL_C to break
    Reply from 18.0.0.2: bytes=56 Sequence=1 ttl=255 time=90 ms
    Reply from 18.0.0.2: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 18.0.0.2: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 18.0.0.2: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 18.0.0.2: bytes=56 Sequence=5 ttl=255 time=60 ms

  --- 18.0.0.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/56/90 ms

---------------在R1和R8上配置静态指向隧道对端的入口地址---------------
R1:
[r1]ip route-static 192.168.2.0 24 18.0.0.2

R8:
[r8]ip route-static 192.168.1.0 24 18.0.0.1

---------------测试192.168.1.1与192.168.2.1的互联---------------
[r1]ping -a 192.168.1.1 192.168.2.1
  PING 192.168.2.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time=70 ms
    Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time=50 ms
    Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time=50 ms
    Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=255 time=60 ms

  --- 192.168.2.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/56/70 ms
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值