BGP之BGP联邦综合实验

目录

BGP联邦综合实验

实验图

网段划分

基础配置

路由配置

启动AS2中的ospf--- IGP协议

        检测IGP

 启动AS之间的BGP

        测试

发布R1路由

修改:下一跳解决上述问题

解决水平分割

发布R8路由

测试

AS2内部环回路由信息互相访问

配置空接口

发布静态路由

测试

存在问题:

解决办法:

解决:环回地址192.168.2.0 /24不能在任何协议中宣告

BGP联邦综合实验

实验图

网段划分

已知整个AS2的IP地址为172.16..0.0/16

        172.16.0.0/16 ---- 172.16.2.0/24 ---- R2 

                                     172.16.3.0/24 ---- R3

                                     172.16.4.0/24 ---- R4 

                                     172.16.5.0/24 ---- R5 

                                     172.16.6.0/24 ---- R6 

                                     172.16.7.0/24 ---- R7

                                     172.16.0.0/24 ---- P2P

                                     172.16.1.0/24 ---- MA -----172.16.1.0/29 ----- R2-R3

                                                                              172.16.1.8/29 ----- R2-R4

                                                                              172.16.1.16/29 ----- R3-R4

                                                                              172.16.1.24/29 ----- R4-R7

                                                                              172.16.1.32/29 ----- R5-R6

                                                                              172.16.1.40/29 ----- R6-R7

                                                                              172.16.1.48/29

                                                                                     ......

基础配置

R1

[R1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2

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                         192.168.1.1/24       up         up(s)     
LoopBack1                         10.0.0.1/24          up         up(s)     
NULL0                             unassigned           up         up(s)     

R2

[R2]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.0.0.2/24          up         up        
GigabitEthernet0/0/1              172.16.1.1/29        up         up        
GigabitEthernet0/0/2              172.16.1.9/29        up         up        
LoopBack0                         172.16.2.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     

R3

[R3]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.2/29        up         up        
GigabitEthernet0/0/1              172.16.1.17/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.3.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     

R4

[R4]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.18/29       up         up        
GigabitEthernet0/0/1              172.16.1.25/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.4.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     
[R4]

R5

[R5]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.10/29       up         up        
GigabitEthernet0/0/1              172.16.1.33/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.5.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     

R6

[R6]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.34/29       up         up        
GigabitEthernet0/0/1              172.16.1.41/29       up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         172.16.6.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     

R7

[R7]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.1.42/29       up         up        
GigabitEthernet0/0/1              172.16.1.26/29       up         up        
GigabitEthernet0/0/2              78.0.0.1/24          up         up        
LoopBack0                         172.16.7.1/24        up         up(s)     
NULL0                             unassigned           up         up(s)     

R8

[R8]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 2

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                         192.168.2.1/24       up         up(s)     
LoopBack1                         11.0.0.1/24          up         up(s)     
NULL0                             unassigned           up         up(s)  

路由配置

启动AS2中的ospf--- IGP协议

R2

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0	
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]netwo	
[R2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[R2-ospf-1-area-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.0.0 0.0.255.255

注意:

        其他R4R5,R6,R7,R8类似

        检测IGP

R2

[R2]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 9        Routes : 10       

OSPF routing table status : <Active>
         Destinations : 9        Routes : 10

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    172.16.1.16/29  OSPF    10   2           D   172.16.1.2      GigabitEthernet
0/0/1
    172.16.1.24/29  OSPF    10   3           D   172.16.1.2      GigabitEthernet
0/0/1
    172.16.1.32/29  OSPF    10   2           D   172.16.1.10     GigabitEthernet
0/0/2
    172.16.1.40/29  OSPF    10   3           D   172.16.1.10     GigabitEthernet
0/0/2
     172.16.3.1/32  OSPF    10   1           D   172.16.1.2      GigabitEthernet
0/0/1
     172.16.4.1/32  OSPF    10   2           D   172.16.1.2      GigabitEthernet
0/0/1
     172.16.5.1/32  OSPF    10   1           D   172.16.1.10     GigabitEthernet
0/0/2
     172.16.6.1/32  OSPF    10   2           D   172.16.1.10     GigabitEthernet
0/0/2
     172.16.7.1/32  OSPF    10   3           D   172.16.1.10     GigabitEthernet
0/0/2
                    OSPF    10   3           D   172.16.1.2      GigabitEthernet
0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

R3

[R3]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 9        Routes : 10       

OSPF routing table status : <Active>
         Destinations : 9        Routes : 10

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

     172.16.1.8/29  OSPF    10   2           D   172.16.1.1      GigabitEthernet
0/0/0
    172.16.1.24/29  OSPF    10   2           D   172.16.1.18     GigabitEthernet
0/0/1
    172.16.1.32/29  OSPF    10   3           D   172.16.1.1      GigabitEthernet
0/0/0
    172.16.1.40/29  OSPF    10   3           D   172.16.1.18     GigabitEthernet
0/0/1
     172.16.2.1/32  OSPF    10   1           D   172.16.1.1      GigabitEthernet
0/0/0
     172.16.4.1/32  OSPF    10   1           D   172.16.1.18     GigabitEthernet
0/0/1
     172.16.5.1/32  OSPF    10   2           D   172.16.1.1      GigabitEthernet
0/0/0
     172.16.6.1/32  OSPF    10   3           D   172.16.1.1      GigabitEthernet
0/0/0
                    OSPF    10   3           D   172.16.1.18     GigabitEthernet
0/0/1
     172.16.7.1/32  OSPF    10   2           D   172.16.1.18     GigabitEthernet
0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

 启动AS之间的BGP

R1

[R1]bgp 1
[R1-bgp]ro	
[R1-bgp]router-id 1.1.1.1
[R1-bgp]pe	
[R1-bgp]peer 12.0.0.2 as	
[R1-bgp]peer 12.0.0.2 as-number 2
[R1-bgp]

R2

[R2]bgp 64512 ---- 有联邦存在的时候写联邦AS号
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 2 --- 告诉大AS号为2
[R2-bgp]confederation peer-as 64513 --- 指定EBGP对等体关系的AS号
[R2-bgp]peer 12.0.0.1 as-number 1 
[R2-bgp]peer 172.16.3.1 as-number 64512 --- 建立 R2 与 R3 的IGP对等体关系
[R2-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.5.1 as-number 64513 --- 建立 R2 与 R5 的非直连建邻
[R2-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.5.1 ebgp-max-hop --- 将ttl值修改 

R3

[R3]bgp 64512
[R3-bgp]router-id 3.3.3.3
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.2.1 as-number 64512
[R3-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[R3-bgp]peer 172.16.4.1 as-number 64512
[R3-bgp]peer 172.16.4.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.3.1 as 64512
[R4-bgp]peer 172.16.3.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.7.1 as 64513
[R4-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.7.1 ebgp-max-hop 

注意:

        R5与R4类似,R6与R3类似,R7与R2类似

R8

[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 78.0.0.1 as 2
[R8-bgp]

        测试

R2
[R2]display 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       19       19     0 00:17:28 Established    
   0
  172.16.3.1      4       64512       14       16     0 00:12:21 Established    
   0
  172.16.5.1      4       64513        8       10     0 00:06:11 Established    
   0

R3
[R3]display bgp peer 

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

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

  172.16.2.1      4       64512       14       14     0 00:12:49 Established    
   0
  172.16.4.1      4       64512       11       14     0 00:09:49 Established    
   0
[R3]

R4
[R4]display bgp peer 

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

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

  172.16.3.1      4       64512       12       12     0 00:10:18 Established    
   0
  172.16.7.1      4       64513        5        7     0 00:03:14 Established    
   0
[R4]

R5
[R5]display bgp peer 

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

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

  172.16.2.1      4       64512        9        9     0 00:07:24 Established    
   0
  172.16.6.1      4       64513        8        9     0 00:06:14 Established    
   0
[R5]

R6
[R6]display bgp peer 

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

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

  172.16.5.1      4       64513        8        8     0 00:06:25 Established    
   0
  172.16.7.1      4       64513        6        7     0 00:04:36 Established    
   0
[R6]

R7 
[R7]display 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        5        6     0 00:03:29 Established    
   0
  172.16.4.1      4       64512        6        6     0 00:04:07 Established    
   0
  172.16.6.1      4       64513        7        7     0 00:05:01 Established    
   0

R8
[R8]display bgp peer 

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

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

  78.0.0.1        4           2        5        5     0 00:03:48 Established    
   0
[R8]

发布R1路由

R1

[R1-bgp]network 10.0.0.0 24
[R1-bgp]display bgp peer 

测试

[R1-bgp]display bgp routing-table 

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


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

 *>   10.0.0.0/24        0.0.0.0         0                     0      i


<R2>display bgp routing-table 

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


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

 *>   10.0.0.0/24        12.0.0.1        0                     0      1i
<R2>


<R3>display bgp routing-table  ---- 收到但不可用

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


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

   i  10.0.0.0/24        12.0.0.1        0          100        0      1i
<R3>


R3与R5可以收到但不可用,所以R4,R6不能收到,包括后面

修改:下一跳解决上述问题

R2

[R2]bgp 64512
[R2-bgp]peer 172.16.3.1 next-hop-local

[R2-bgp]peer 172.16.5.1 next-hop-local

测试

R3

<R3>display bgp routing-table 

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


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

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      1i
<R3>

R6

<R6>display bgp routing-table 

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


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

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      (64512) 1i
<R6>

注意:

        R4收不到,原因:IBGP的水平分割导致

        R6收到,原因:R5与R2为联邦BGP 属于EBGP对等体,EBGP学到的路由信息可以发给自己的IBGP对等体

        R7收不到,原因:IBGP的水平分割

解决水平分割

        设置路由反射器 

R3作为反射指定R2作为客户

[R3]bgp	
[R3]bgp 64512
[R3-bgp]peer 172.16.2.1 reflect-client  --- 指定R2作为客户

测试

<R4>display 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: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      1i
<R4>

<R4>display bgp routing-table 10.0.0.0

 BGP local router ID : 4.4.4.4
 Local AS number : 64512
 Paths:   1 available, 1 best, 1 select
 BGP routing table entry information of 10.0.0.0/24:
 From: 172.16.3.1 (3.3.3.3)
 Route Duration: 00h01m23s  
 Relay IP Nexthop: 172.16.1.17
 Relay IP Out-Interface: GigabitEthernet0/0/0
 Original nexthop: 172.16.2.1
 Qos information : 0x0
 AS-path 1, origin igp, MED 0, localpref 100, pref-val 0, valid, internal-confed
, best, select, active, pre 255, IGP cost 2
 Originator:  2.2.2.2
 Cluster list: 3.3.3.3
 Advertised to such 1 peers:
    172.16.7.1
<R4>

同理R6作为反射指定R7或R5作为客户

[R6]bgp 64513
[R6-bgp]peer 172.16.7.1 reflect-client 

测试

[R7]display bgp routing-table

 BGP Local router ID is 7.7.7.7 
 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                     172.16.2.1      0          100        0      (64512) 1i
[R7]

收到两条一样的,R6反射一条,R4收到反射R7

<R8>display bgp routing-table 

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


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

 *>   10.0.0.0/24        78.0.0.1                              0      2 1i
<R8>

目前R1发送路由已经完全做通

发布R8路由

[R8]bgp  3
[R8-bgp]network 11.0.0.0 24

测试

[R7]display bgp routing-table 

 BGP Local router ID is 7.7.7.7 
 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      (64512) 1i
 * i                     172.16.2.1      0          100        0      (64512) 1i
 *>   11.0.0.0/24        78.0.0.2        0                     0      3i
[R7]

因为下一跳的地址为78.0.0.2 所以R4与R6收不到路由信息,解决办法:修改为本地路由信息

[R7]bgp 64513
[R7-bgp]peer 172.16.6.1 next-hop-local
[R7-bgp]peer 172.16.4.1 next-hop-local
[R7-bgp]
<R1>display bgp routing-table 

 BGP Local router ID is 1.1.1.1 
 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

 *>   10.0.0.0/24        0.0.0.0         0                     0      i
 *>   11.0.0.0/24        12.0.0.2                              0      2 3i
<R1>

因为发送路由信息以及互通,所以R1与R8路由已经可以互相访问

AS2内部环回路由信息互相访问

        路由聚合

进行路由汇总:

        172.16.2.0/24

        172.16.3.0/24

        172.16.4.0/24

        172.16.5.0/24

        172.16.6.0/24

        172.16.7.0/24 ----- 172.16.0.0 / 21

配置空接口

[R2]ip route-static 172.16.0.0 21 NULL 0

[R2]display ip routing-table protocol static 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 1        Routes : 1        Configured Routes : 1

Static routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

     172.16.0.0/21  Static  60   0           D   0.0.0.0         NULL0

Static routing table status : <Inactive>
         Destinations : 0        Routes : 0

[R2]

发布静态路由

[R2]bgp 64512
[R2-bgp]network 172.16.0.0 21

[R2-bgp]display bgp routing-table 

 BGP Local router ID is 2.2.2.2 
 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

 *>   10.0.0.0/24        12.0.0.1        0                     0      1i
 *>i  11.0.0.0/24        172.16.7.1      0          100        0      (64513) 3i
 *>   172.16.0.0/21      0.0.0.0         0                     0      i
[R2-bgp]

测试

[R1]display bgp routing-table 

 BGP Local router ID is 1.1.1.1 
 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

 *>   10.0.0.0/24        0.0.0.0         0                     0      i
 *>   11.0.0.0/24        12.0.0.2                              0      2 3i
 *>   172.16.0.0/21      12.0.0.2        0                     0      2i
[R1]

<R7>display bgp routing-table 

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


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

 *>i  10.0.0.0/24        172.16.2.1      0          100        0      (64512) 1i
 * i                     172.16.2.1      0          100        0      (64512) 1i
 *>   11.0.0.0/24        78.0.0.2        0                     0      3i
 *>i  172.16.0.0/21      172.16.2.1      0          100        0      (64512)i
 * i                     172.16.2.1      0          100        0      (64512)i
<R7>

<R8>display bgp routing-table 

 BGP Local router ID is 8.8.8.8 
 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

 *>   10.0.0.0/24        78.0.0.1                              0      2 1i
 *>   11.0.0.0/24        0.0.0.0         0                     0      i
 *>   172.16.0.0/21      78.0.0.1                              0      2i
<R8>

目前已完成整个网络所有设备的环回都可以互相访问

存在问题:

        如果R8发送172.16.0.1(路由黑洞)发送给R7,最终被R2丢掉会使得黑洞在AS2内部占用从而浪费资源

解决办法:


[R7]ip route-static 172.16.0.0 21 NULL 0
[R7]bgp 64513
[R7-bgp]network 172.16.0.0 21
[R7-bgp]

解决:环回地址192.168.2.0 /24不能在任何协议中宣告

        制作GRE隧道

[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip ad	
[R1-Tunnel0/0/0]ip address 99.0.0.1 24 ---- 配置网段
[R1-Tunnel0/0/0]
[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
Mar  2 2023 12:18:54-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]
[R8]int t 0/0/0
[R8-Tunnel0/0/0]ip address 99.0.0.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
Mar  2 2023 12:18:00-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R8-Tunnel0/0/0]
[R8-Tunnel0/0/0]

配置静态路由

[R1]ip route-static 192.168.2.0 24 99.0.0.2
[R8]ip route-static 192.168.1.0 24 99.0.0.1 

测试

[R8]ping -a 192.168.2.1 192.168.1.1
  PING 192.168.1.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=50 ms
    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/44/60 ms

[R8]

猜你喜欢

转载自blog.csdn.net/qq_57289939/article/details/129294759
BGP