HCIP-6.6BGP配置中IGP路由表和BGP路由表、IP路由表关系

本文详细阐述了BGP配置过程,包括IGP路由表、BGP路由表和IP路由表之间的关系。讨论了如何建立IBGP和EBGP对等体,以及使用network命令宣告路由。重点解析了路由优选级、BGP如何选择最优路径加载到路由表中,并通过实例分析了BGP在不同AS间如何传递路由信息。此外,还介绍了BGP不支持负载均衡的特性,以及如何解决下一跳问题和静态路由引入等问题。
摘要由CSDN通过智能技术生成


路由优选级越小越优,路由优选级Direct0>OSPF10>IS-IS15>Static60>RIP 100>OSPF ASE、OSPF NSSA150>IBGP、EBGP255。

在实际配置中常常会出现各种问题,常出现配置的路由信息没有出现在路由表中,BGP怎样把宣告的路由、引入的路由、传给其它AS?BGP是怎样从ibgp邻居学来的路由,和ebgp中学到路由以最优路径加载到路由表中?

BGP是AS By AS协议,基于TCP,只要能够建立TCP连接即可建立BGP。不同于IGP的下一跳是路由器地址,BGP的下一跳是如何去往其他AS的一个设备;而且在不同AS之间保持不变?

BGP只传递路由信息,不会暴露AS内的拓扑信息。

BGP :是一个无类别的路径矢量型协议。路径矢量 :是将一个AS看作一个整体。路径矢量不牵扯算法,因为BGP仅仅是将IGP计算出来的路由信息发送到其他AS之中,相当于仅将现成的路由进行传递而不需要计算。

注:BGP协议是不支持负载均衡的。在BGP当中,如果到达同一个目标网段存在多条路径可以走时,BGP将会根据其中的路径属性来选择一条最优的加载到路由表中,而不会进行负载均衡。

IGP是运行在AS内部的路由协议,主要有RIP、OSPF及IS-IS,着重于发现和计算路由。

EBGP对等体关系 :如果建立对等体的两台路由器位于不同的AS中,则他们的关系被称为EBGP对等体关系。

IBGP对等体关系 :如果建立对等体的两台路由器位于同一个的AS中,则他们的关系被称为IBGP对等体关系。

邻居关系的建立–>邻居表
从IBGP学习到宣告的IGP路由条目、引入IGP路由条目–>建立BGP表;
从EBPG学习到路由条目–>建立BGP表;
将BGP表中的最优路径–>加载到路由表中。

1、基础配置

在这里插入图片描述

R1基本配置

sys
sysn R1
int g0/0/0
ip add 12.0.0.1 24
int g0/0/1
ip add 13.0.0.1 24
int lo 0
ip add 1.1.1.1 32
ospf 1 router 1.1.1.1
area 0
net 12.0.0.0 0.0.0.255
net 13.0.0.0 0.0.0.255
net 1.1.1.1 0.0.0.0

R2基本配置

sys
sysn R2
int g0/0/0
ip add 12.0.0.2 24
int g0/0/1
ip add 24.0.0.2 24
int lo 0
ip add 2.2.2.2 32
ospf 1 router 2.2.2.2
area 0
net 12.0.0.0 0.0.0.255
net 2.2.2.2 0.0.0.0

R3基本配置

interface GigabitEthernet0/0/0
 ip address 35.0.0.3 255.255.255.0 
interface GigabitEthernet0/0/1
 ip address 13.0.0.3 255.255.255.0 
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 13.0.0.0 0.0.0.255 

R4基本配置

interface GigabitEthernet0/0/1
 ip address 24.0.0.4 255.255.255.0 
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255 

R5基本配置

interface GigabitEthernet0/0/0
 ip address 35.0.0.5 255.255.255.0 
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255 

ping -a 3.3.3.3 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=254 time=20 ms

ping 35.0.0.3
PING 35.0.0.3: 56 data bytes, press CTRL_C to break
Reply from 35.0.0.3: bytes=56 Sequence=1 ttl=254 time=20 ms

自治系统AS123中使用OSPF作为IGP,R1、R2、R3上配置IBGP全互联,lo0地址作为更新源,所以要将loopback 0网段发布进入OSPF。

<R1>dis ospf peer br

	 OSPF Process 1 with Router ID 1.1.1.1
		  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             3.3.3.3          Full        
 ----------------------------------------------------------------------------
<R1>dis ip routing-table pro ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        2.2.2.2/32  OSPF    10   1           D   12.0.0.2        GigabitEthernet
0/0/0
        3.3.3.3/32  OSPF    10   1           D   13.0.0.3        GigabitEthernet
0/0/1

查看DR和BDR

<R1>dis ospf peer

	 OSPF Process 1 with Router ID 1.1.1.1
		 Neighbors 

 Area 0.0.0.0 interface 12.0.0.1(GigabitEthernet0/0/0)'s neighbors
 Router ID: 2.2.2.2          Address: 12.0.0.2        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 12.0.0.2  BDR: 12.0.0.1  MTU: 0    

		 Neighbors 

 Area 0.0.0.0 interface 13.0.0.1(GigabitEthernet0/0/1)'s neighbors
 Router ID: 3.3.3.3          Address: 13.0.0.3        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 13.0.0.3  BDR: 13.0.0.1  MTU: 0  

2、配置建立IBGP对等体

在R1、AR2、AR3上配置IBGP全互联,使用loopback 0地址作为更新源。
R1_IBGP邻居配置命令

[R1]bgp 123         //声明所在AS号(创建进程)
[R1-bgp]router-id 1.1.1.1   //配置RID,必须唯一   最好手动
[R1-bgp]peer 2.2.2.2 as-number 123
[R1-bgp]peer 2.2.2.2 connect-interface loopback 0
[R1-bgp]peer 3.3.3.3 as-number 123
[R1-bgp]peer 3.3.3.3 connect-interface loopback 0

R2_IBGP邻居配置命令

[R2]bgp 123	   //声明所在AS号(创建进程)
[R2-bgp]router-id 2.2.2.2	
[R2-bgp]peer 3.3.3.3 as-number 123	
[R2-bgp]peer 3.3.3.3 connect-interface lo0	  
[R2-bgp]peer 1.1.1.1 as 123
[R2-bgp]peer 1.1.1.1 con lo0

R3_IBGP邻居配置命令

[R3]bgp 123                     
[R3-bgp]router-id 3.3.3.3               
[R3-bgp]peer 2.2.2.2 as-number 123                 
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack0
[R3-bgp]peer 1.1.1.1 as 123
[R3-bgp]peer 1.1.1.1 con lo0
[R1-bgp]dis bgp peer

 BGP local router ID : 1.1.1.1
 Local AS number : 123
 Total number of peers : 2		  Peers in established state : 2
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State PrefRcv
  2.2.2.2         4         123     3        2     0   00:00:18 Established    1
  3.3.3.3         4         123     2        2     0   00:00:16 Established    0

V版本 MsgRcvd从对端收到报文 OutQ队列 从对端收到的PrefRcv为0对端的路由
MsgRcvd从对端收到报文(Open报文 Keepalive报文) Established(连接已建立)

3、配置EBGP对等体

R2与R4之间采用EBGP通常采用直连建立邻居关系,实际应用中采用直连口。

[R4]bgp 100
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 24.0.0.2 as-number 123

[R2]bgp 123
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 24.0.0.4 as-number 100
[R4-bgp]dis bgp peer
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State PrefRcv
 24.0.0.2        4          123        3        4     0    00:01:55 Established    0

演示采用R3和R5之间使用使用环回口作为更新源建立EBGP,与使用采用直连口不同的是,两个环回口是不可达的,首先必须使两个环回口可达,使用静态路由方式来做。

[R3]ip route-static 5.5.5.5 32 35.0.0.5

[R5]ip route-static 3.3.3.3 32 35.0.0.3

[R3]ping -a 3.3.3.3 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=255 time=50 ms

R3和R5之间建立EBGP配置:

R3
bgp 123
peer 5.5.5.5 as-number 200
peer 5.5.5.5 connect-interface loopback 0      //指定更新源为loopback 0接口地址
peer 5.5.5.5 ebgp-max-hop 5                       //跳数修改为5

R5
bgp 200
peer 3.3.3.3 as-number 123
peer 3.3.3.3 connect-interface loopback 0
peer 3.3.3.3 ebgp-max-hop  5
<R3>dis bgp peer
  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State PrefRcv
  1.1.1.1         4         123       32       33     0 00:30:48 Established    0
  5.5.5.5         4         200        2        3     0 00:00:28 Established    0

此时,AS100、AS123、AS200邻居建立完成,这时BGP表是没有路由条目,需要宣告或者引入才能完成IP路由表,实现AS100、AS123、AS200之间的数据传输。

<R3>dis tcp status
TCPCB    Tid/Soid Local Add:port        Foreign Add:port      VPNID  State
b4bb7d30 6  /1    0.0.0.0:23            0.0.0.0:0             23553  Listening
b4bb7aa8 164/1    0.0.0.0:179           1.1.1.1:0             0      Listening
b4bb84c8 164/99   0.0.0.0:179           5.5.5.5:0             0      Listening
b4bb7bec 164/98   3.3.3.3:179           1.1.1.1:49960         0      Established
b4bb860c 164/110  3.3.3.3:179           5.5.5.5:50721         0      Established

4、使用network命令宣告路由

从R4开始,否则R4到R5之间现在是不能完成通信。

bgp 100
network 4.4.4.4 255.255.255.255 

R4上查看BGP路由表

[R4-bgp]dis bgp routing-table 
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         0.0.0.0         0                     0      i

*>有效且最优路由,0.0.0.0表示该网段是在本地AS产生的。i是通告network方式注入的路由。R4的BGP路由表中包含了所有明细路由。

5、路由的学习

5.1、R2的路由表

R2上查看BGP路由表

<R2>dis bgp routing-table 
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         24.0.0.4        0                     0      100i

*>有效且最优路由,下一跳是24.0.0.4 ;i是通告network方式注入的路由;100i:100i是指经过了AS100通过network方式注入的路由。
R1上查看BGP路由表

<R1>dis bgp rou
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
   i  4.4.4.4/32         24.0.0.4        0          100        0      100i

i非有效且最优路由,下一跳是24.0.0.4。也就是说明这条路由是没有被优先不可达,对于R1下一跳24.0.0.4是无效的。
dis ip routing-table pro bgp
没有这条路由。
没有被优先,BGP Speaker只选最优的路由放入路由表,将其最优的添加到路由表中 update BGP datebase。所以路由表中也不会有这条明细路由。
dis ip routing-table
没有这条路由。

为什么存在这样的问题?
从路由表中看出R2从它的EBGP邻居R4学来的路由4.4.4.4,传给它的IBGP邻居R1的时候,下一跳没有变,还是24.0.0.4,下一跳不是邻居而是2跳。

为什么会出现下一跳是边缘路由与EBGP的直连口?因为BGP协议是AS by AS的协议,不同于IGP的下一跳是路由器地址,BGP的下一跳是如何去往其他AS的一个设备。R1、R2、R3在一个AS123内部,被作为一个整体,相当一台集合无数台路由的大型路由设备,这台设备内的下一跳都是同一个直连口。

peer x.x.x.x next-hop-local命令用来解决在IBGP对等体(组)通告路由时,把下一跳属性设为自身的IP地址。
在全互联的IBGP内都添加这个命令。

修改更新源为本设备更新源。IBGP邻居的下一跳更新源是本设备。
R2

bgp 123
peer 1.1.1.1 next-hop-local   //1.1.1.1的更新源是本设备
peer 3.3.3.3 next-hop-local   //3.3.3.3的更新源是本设备

R1

[R1-bgp]peer 2.2.2.2 next-hop-local 
[R1-bgp]peer 3.3.3.3 next-hop-local 

R3

peer 2.2.2.2 next-hop-local
peer 1.1.1.1 next-hop-local

5.2、R1的BGP路由表

[R1-bgp]dis bgp ro
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>i  4.4.4.4/32         2.2.2.2         0          100        0      100i

*>有效且最优路由,下一跳是2.2.2.2 ;i是通告network方式注入的路由;100i:100i是指经过了AS100通过network方式注入的路由。

[R1-bgp]dis ip ro pro bgp
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        4.4.4.4/32  IBGP    255  0          RD   2.2.2.2         GigabitEthernet
0/0/0

查看指定BGP路由协议的路由信息。

5.3、R3的BGP路由表

IBGP的水平分割,IBGP只能update一跳。
为此我们配置了全互联,R2与R3也是IBGP邻居,所以R3可以从AR2上学习到该路由。

<R3>dis bgp rou
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>i  4.4.4.4/32         2.2.2.2         0          100        0      100i

下一跳也是2.2.2.2,由邻居学习过来。这也是为什么要作全互联的原因。

5.4、R5的BGP路由表

<R5>dis bgp routing-table 
 Total Number of Routes: 1
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         3.3.3.3       
<R5>dis ip rou pro bgp
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        4.4.4.4/32  EBGP    255  0          RD   3.3.3.3         G0/0/0
<R5>dis ip rout	
<R5>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 10       Routes : 10       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        3.3.3.3/32  Static  60   0          RD   35.0.0.3        G0/0/0
        4.4.4.4/32  EBGP    255  0          RD   3.3.3.3         G0/0/0
        5.5.5.5/32  Direct  0    0           D   127.0.0.1       LoopBack0
       35.0.0.0/24  Direct  0    0           D   35.0.0.5        G0/0/0
       35.0.0.5/32  Direct  0    0           D   127.0.0.1       G0/0/0

查看IP路由表,直连的路由优先,Pre优先级越小越优,可排列为直连路由>ospf>is-is>Static>rip>bgp,然后是静态路由,再就是BGP路由。
在这里插入图片描述

6、AS200与AS100通信

R5数据包给R4可行不?
ping -a 5.5.5.5 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=20 ms

ping -a 3.3.3.3 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=255 time=30 ms

ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Request time out
Request time out

6.1、AS200出接口注入AS100IP路由表

结果直接拼4.4.4.4是不行,这是为什么?
前面R3和R5是作了静态路由,通过直连口连接环回地址。
直接拼4.4.4.4是通过g0/0/0的35.0.0.5去ping4.4.4.4。

查看R4的IP路由表

<R4>dis ip rou
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
       4.4.4.4/32  Direct  0    0           D   127.0.0.1       LoopBack0
       24.0.0.0/24  Direct  0    0           D   24.0.0.4        G0/0/1
       24.0.0.4/32  Direct  0    0           D   127.0.0.1       G0/0/1
     24.0.0.255/32  Direct  0    0           D   127.0.0.1       G0/0/1

没有35.0.0.5这条明细路由。

在BGP中宣告R5这条直连是否可行?
[R5]bgp 45
[R5-bgp] network 35.0.0.0 24
结果不行的,R3接收这个网段有直连又有BGP宣告的网段,直连路由>ospf>is-is>Static>rip>bgp,直连的优先级为0,BGP的Pre为255,R3邻居接收到这条路由将会丢弃,不会放入路由表中,在R3的BGP路由表中,因为是次优路由,R3不会将这条路由发给R1、R2。

在R4上宣告这个网段,对于R1和R2没有其它连接这个网段的路由,所以是最优的。

[R3]bgp 123
[R3-bgp]network 35.0.0.0 24
[R3-bgp]dis bgp rou
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>i  4.4.4.4/32         2.2.2.2         0          100        0      100i
 *>   35.0.0.0/24        0.0.0.0         0                     0      i

R2

<R2>dis bgp ro
 Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         24.0.0.4        0                     0      100i
 *>i  35.0.0.0/24        3.3.3.3         0          100        0      i
<R4>dis bgp rou
Total Number of Routes: 2
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         0.0.0.0         0                     0      i
 *>   35.0.0.0/24        24.0.0.2                              0      123i
<R4>dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 9        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        4.4.4.4/32  Direct  0    0           D   127.0.0.1       LoopBack0
       24.0.0.0/24  Direct  0    0           D   24.0.0.4        G0/0/1
       24.0.0.4/32  Direct  0    0           D   127.0.0.1       G0/0/1
     24.0.0.255/32  Direct  0    0           D   127.0.0.1       G0/0/1
       35.0.0.0/24  EBGP    255  0           D   24.0.0.2        G0/0/1

这时就可以通过35.0.0.5出接口拼通R4的环回口。
ping 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=252 time=50 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=252 time=30 ms

6.2、AS200环回注入AS100IP路由表

但是使用R5环回口拼R4还是拼不通,为什么?同样是在R4的路由表里没有5.5.5.5这条路由。
ping -a 5.5.5.5 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Request time out

将R5的环回口5.5.5.5宣告到BGP能否可以?

还是不行,别忘了前面已经有了ip route-static 5.5.5.5 32 35.0.0.5这条静态路由。直连路由>ospf>is-is>Static>rip>bgp,静态路由是60的优先级,BGP的路由优先级是255,越小越优先,那还是和前面引入直连口一样,R3接收到这条宣告路由后,作为无效路由不会发送给R1和R2。

查看R3路由表:

<R3>dis ip rou
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface
        1.1.1.1/32  OSPF    10   1           D   13.0.0.1        G0/0/1
        2.2.2.2/32  OSPF    10   2           D   13.0.0.1        G0/0/1
        3.3.3.3/32  Direct  0    0           D   127.0.0.1       LoopBack0
        4.4.4.4/32  IBGP    255  0          RD   2.2.2.2         G0/0/1
        5.5.5.5/32  Static  60   0          RD   35.0.0.5        G0/0/0

在R3通过import-route引入静态路由。
import-route static,这种方式通常不建议采用,会带来很问题,一般建议使用路由策略方式,精确的引入。

[R3]ip ip-prefix imstac index 10 permit 5.5.5.5 32
[R3]route-policy import permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix imstac
[R3-route-policy]q
[R3]bgp 123
[R3-bgp]import-route static route-policy import
[R3-bgp]dis bgp routing-table 
 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>i  4.4.4.4/32         2.2.2.2         0          100        0      100i
 *>   5.5.5.5/32         0.0.0.0         0                     0      ?
 *>   35.0.0.0/24        0.0.0.0         0                     0      i

*>有效且最优路由,0.0.0.0表示该网段是在本地AS产生的。
i-通告和汇总产生的;i - IGP由IGP宣传的路由。
?-import重分布产生。

<R2>dis bgp rou
 Total Number of Routes: 3
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn

 *>   4.4.4.4/32         24.0.0.4        0                     0      100i
 *>i  5.5.5.5/32         3.3.3.3         0          100        0      ?
 *>i  35.0.0.0/24        3.3.3.3         0          100        0      i
<R4>dis bgp rou
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   4.4.4.4/32         0.0.0.0         0                     0      i
 *>   5.5.5.5/32         24.0.0.2                              0      123?
 *>   35.0.0.0/24        24.0.0.2                              0      123i

*>有效且最优路由,0.0.0.0表示该网段是在本地AS产生的。
i-通告和汇总产生的;i - IGP由IGP宣传的路由。AS123传送过来。
?-import重分布产生。AS123传送过来。
ping -a 5.5.5.5 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=252 time=70 ms
Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=252 time=40 ms

从以上就可以看出,BGP路由表的路由条目是在已有的路由基础上,通过BGP路由表传输到不同的AS自治系统。并不是由BGP自身产生。

7、BGP的优先路由

通过前面的案例,都是根据直连路由>ospf>is-is>Static>rip>bgp来优先选择路由。

对于IBGP内的R1、R2、R3同样原则,如果将R1、R2、R3的环回口在引入BGP,通过BGP宣告,BGP路由表会不产生这几条路由明细。答案是不会。

因为在IBGP内是通过ospf进行连接,R1、R2、R3的环回口已经在ospf里进行宣告,IBG比TCP的三次握手选路佳、收敛快、占用资源少。

根据ospf>is-is>Static>rip>bgp,R1、R2、R3的环回口在BGP宣告的路由将会是次优路由,不会发布出去,R4自然也不会收到。

[R1]bgp 123
[R1-bgp]net 1.1.1.1 32
[R2]bgp 123
[R2-bgp]net 2.2.2.2 32
[R2-bgp]dis bgp ro
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
   i  1.1.1.1/32         1.1.1.1         0          100        0      i
 *>   2.2.2.2/32         0.0.0.0         0                     0      i
 *>   4.4.4.4/32         24.0.0.4        0                     0      100i
 *>i  5.5.5.5/32         3.3.3.3         0          100        0      ?
 *>i  35.0.0.0/24        3.3.3.3         0          100        0      i

R2通过OSPF和BGP都学到1.1.1.1/32,OSPF上的1.1.1.1/32优先。
i 1.1.1.1/32 R2已将R1的路由列为次优路由。

[R1-bgp]dis bgp ro
 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   1.1.1.1/32         0.0.0.0         0                     0      i
   i  2.2.2.2/32         2.2.2.2         0          100        0      i

R1通过OSPF和BGP都学到2.2.2.2/32,OSPF上的2.2.2.2/32优先。
i 2.2.2.2/3 R2已将R2的路由列为次优路由。

<R3>dis bgp ro
 Total Number of Routes: 5
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
   i  1.1.1.1/32         1.1.1.1         0          100        0      i
   i  2.2.2.2/32         2.2.2.2         0          100        0      i

R3将两条都列为次优路由。R5不会收到。

R4接收到R2通过直连口学习的路由,R4和R2之间没有静态路由,只有这一条2.2.2.2/32 路由。所以优选。

<R4>dis bgp routing-table 
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   2.2.2.2/32         24.0.0.2        0                     0      123i
 *>   4.4.4.4/32         0.0.0.0         0                     0      i
 *>   5.5.5.5/32         24.0.0.2                              0      123?
 *>   35.0.0.0/24        24.0.0.2    

如果要将1.1.1.1/32、3.3.3.3/32宣告到BGP路由表中,R4能与这两个环回口进行通信。采用在R2上宣告,通过R2上IP路由表上的这两个明细路由,宣告对等体EBGP路由表上。

<R4>dis bgp rout
 Total Number of Routes: 6
      Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
 *>   1.1.1.1/32         24.0.0.2        1                     0      123i
 *>   2.2.2.2/32         24.0.0.2        0                     0      123i
 *>   3.3.3.3/32         24.0.0.2        2                     0      123i
 *>   4.4.4.4/32         0.0.0.0         0                     0      i
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0与1之旅

创作不易请给予一点帮助和鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值