当前位置: 首页 > news >正文

HCIP(BGP综合实验)

一、实验拓扑

  • AS 划分
    • AS1:R1(环回 L0:172.16.0.1/32,L1:192.168.1.0/24)
    • AS2:R2、R3、R4、R5、R6、R7(内部运行 OSPF,AS 号为 64512 和 64513 的联盟)
    • AS3:R8(环回 L0:172.16.0.8/32,L1:192.168.2.0/24)
  • 链路与环回
    • 骨干链路:AS2 内部使用 172.16.1.0/24 网段划分为 6 个 / 30 子网(如 172.16.1.0/30、172.16.1.4/30 等)。
    • 建邻环回:各路由器建邻环回地址均属于 172.16.0.0/24 网段(如 R1:172.16.0.1/32,R2:172.16.0.2/32 等)。
    • 业务环回:各路由器业务环回使用剩余子网(如 R3:172.16.3.0/24,R7:172.16.7.0/24)。

二、实验需求

  1. 特殊环回互通
    • AS1 的 192.168.1.0/24 和 AS3 的 192.168.2.0/24 不宣告任何协议,但需通过隧道实现互通。
  2. AS2 配置
    • 使用 172.16.0.0/16 划分 IP,内部运行 OSPF 协议。
  3. BGP 要求
    • 全网设备环回通过 BGP 互通,减少路由条目并避免环路。
    • AS2 内部采用联盟(Sub AS 64512 和 64513),通过路由反射器(R3、R6)优化 IBGP 建邻。

三、实验思路

  1. 子网划分
    • 建邻环回:172.16.0.0/24 划分为 8 个 / 32 地址(R1-R8 各一个)。
    • 骨干链路:172.16.1.0/24 划分为 6 个 / 30 子网(每链路两个 IP)。
    • 业务环回:剩余子网分配给各路由器业务接口(如 172.16.3.0/24 给 R3)。
  2. 协议配置
    • AS2 内部通过 OSPF 实现互通。
    • 配置 BGP 联盟、EBGP/IBGP 邻居关系,使用路由反射器防止环路。
    • 对 192.168.1.0/24 和 192.168.2.0/24 搭建 GRE 隧道,通过静态路由引导流量。

四、实验步骤

1. 接口与环回配置
  • 示例
    • R1:
      • 接口 GE0/0/0:12.1.1.1/24(连接 R2)。
      • 环回 L0:172.16.0.1/32(BGP 建邻),L1:192.168.1.1/24(业务,不宣告)。
    • R2:
      • 接口 GE0/0/0:12.1.1.2/24(连接 R1),GE0/0/1:172.16.1.1/30(连接 R3),GE0/0/2:172.16.1.21/30(连接 R5)。
      • 环回 L1:172.16.0.2/32(BGP 建邻)。
2. OSPF 配置(AS2 内部)
  • 配置示例
    [R2] ospf 1 router-id 2.2.2.2
    [R2-ospf-1-area-0.0.0.0] network 172.16.1.1 0.0.0.0  # 骨干链路接口
    [R2-ospf-1-area-0.0.0.0] network 172.16.1.21 0.0.0.0 # 骨干链路接口
    [R2-ospf-1-area-0.0.0.0] network 172.16.0.2 0.0.0.0 # 建邻环回
    
  • 目标:使 AS2 内部路由器通过 OSPF 学习到彼此的建邻环回和骨干链路路由,确保 BGP 建邻可达。
3. BGP 配置
  • 联盟与邻居关系
    • AS2 联盟:Sub AS 64512(R2、R3、R4)和 64513(R5、R6、R7),联盟 ID 为 2。
    • EBGP 邻居
      • R1 与 R2(直连接口,AS1-AS2)。
      • R7 与 R8(直连接口,AS2-AS3)。
      • 联盟内 EBGP:R2 与 R5、R4 与 R7(环回口建邻,修改 TTL 为 255)。
    • IBGP 邻居
      • R2 与 R3、R3 与 R4(R3 为路由反射器)。
      • R5 与 R6、R6 与 R7(R6 为路由反射器)。
  • 配置示例
    # R1(AS1)与R2(AS2)建立EBGP
    [R1] bgp 1
    [R1-bgp] peer 12.1.1.2 as-number 2
    [R1-bgp-af-ipv4] peer 12.1.1.2 enable# R2(Sub AS 64512)配置联盟
    [R2] bgp 64512
    [R2-bgp] confederation id 2
    [R2-bgp] confederation peer-as 64513  # 声明联盟内其他Sub AS
    [R2-bgp] peer 172.16.0.5 as-number 64513  # 与R5(Sub AS 64513)建立联盟内EBGP
    [R2-bgp] peer 172.16.0.5 connect-interface LoopBack1  # 使用环回口建邻
    [R2-bgp] peer 172.16.0.5 ebgp-max-hop 255  # 修改TTL防止环回丢包
    
4. 路由宣告与隧道配置
  • BGP 宣告
    • 宣告各路由器的建邻环回和业务环回(除 192.168.1.0/24 和 192.168.2.0/24)。
  • GRE 隧道
    • 目的:实现 192.168.1.0/24 与 192.168.2.0/24 互通。
    • 配置
      # R1隧道配置
      [R1] interface Tunnel0/0/0
      [R1-Tunnel0/0/0] ip address 10.1.1.1 24
      [R1-Tunnel0/0/0] tunnel-protocol gre
      [R1-Tunnel0/0/0] source 172.16.0.1  # 源为R1建邻环回
      [R1-Tunnel0/0/0] destination 172.16.0.8  # 目的为R8建邻环回# R8隧道配置
      [R8] interface Tunnel0/0/0
      [R8-Tunnel0/0/0] ip address 10.1.1.2 24
      [R8-Tunnel0/0/0] tunnel-protocol gre
      [R8-Tunnel0/0/0] source 172.16.0.8
      [R8-Tunnel0/0/0] destination 172.16.0.1
      
    • 静态路由
      [R1] ip route-static 192.168.2.0 24 10.1.1.2  # 通过隧道转发至R8
      [R8] ip route-static 192.168.1.0 24 10.1.1.1  # 通过隧道转发至R1
      
5. 测试验证
  • BGP 邻居状态:通过dis bgp peer确认所有邻居状态为Established
  • 路由表检查:通过dis bgp routing-table验证各路由器学习到全网环回路由。
  • 连通性测试
    • 普通环回互通:如 R3(172.16.3.1) ping R7(172.16.7.1)。
    • 特殊环回互通:R1(192.168.1.1) ping R8(192.168.2.8),通过 GRE 隧道实现通信。

五、关键技术点

  1. BGP 联盟(Confederation)
    • 将 AS2 划分为两个 Sub AS,通过联盟内 EBGP 解决 IBGP 路由黑洞问题,同时隐藏内部 Sub AS 编号。
  2. 路由反射器(Route Reflector)
    • 在 AS2 的 Sub AS 内设置 R3 和 R6 为路由反射器,减少 IBGP 全连接复杂度,防止环路。
  3. GRE 隧道
    • 用于传输未宣告的特殊网段流量,通过隧道封装跨越 BGP 网络实现互通。
  4. TTL 修改与更新源
    • 联盟内 EBGP 使用环回口建邻时,需修改ebgp-max-hop(TTL)确保数据包可达。

六、具体配置

R1
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 172.16.0.1 32
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 192.168.1.1 24
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.1.1.2 as-number 2
[R1-bgp]ipv4-family unicast 
[R1-bgp-af-ipv4]peer 12.1.1.2 enable
[R1-bgp-af-ipv4]network 172.16.0.1 32
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip address 10.1.1.1 255.255.255.0 
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 172.16.0.1
[R1-Tunnel0/0/0]destination 172.16.0.8
[R1]ip route-static 192.168.2.0 255.255.255.0 10.1.1.2
R2
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 172.16.1.1 30
[R2]interface GigabitEthernet 0/0/2
[R2-GigabitEthernet0/0/2]ip address 172.16.1.21 30
[R2]interface LoopBack 1
[R2-LoopBack1]ip address 172.16.0.2 32
[R2]ospf router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.1.21 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[R2]bgp 64512
[R2-bgp]confederation id 2
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 12.1.1.1 as-number 1
[R2]bgp 64512
[R2-bgp]peer 172.16.0.5 as-number 64513
[R2-bgp]peer 172.16.0.5 connect-interface LoopBack 1
[R2-bgp]peer 172.16.0.5 ebgp-max-hop
[R2-bgp]ipv4-family unicast 
[R2-bgp-af-ipv4]peer 172.16.0.5 enable 
[R2-bgp]peer 172.16.0.3 as-number 64512
[R2-bgp]peer 172.16.0.3 connect-interface LoopBack 1
[R2-bgp]peer 172.16.0.3 next-hop-local 
[R2-bgp]ipv4-family unicast 
[R2-bgp-af-ipv4]peer 172.16.0.3 enable
[R2-bgp-af-ipv4]network 172.16.0.2 32 
R3
[Huawei]sysname R3
[R3]interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0]ip address 172.16.1.2 30
[R3]interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 172.16.1.5 30
[R3]interface LoopBack 0
[R3-LoopBack0]ip address 172.16.0.3 24
[R3]interface LoopBack 1
[R3-LoopBack1]ip address 172.16.3.1 24
[R3]ospf router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.1.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.1.5 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.3.1 0.0.0.0
[R3]bgp 64512
[R3-bgp]router-id 3.3.3.3
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.2 as-number 64512
[R3-bgp]peer 172.16.0.2 connect-interface LoopBack 0
[R3-bgp]peer 172.16.0.2 next-hop-local
[R3-bgp]ipv4-family unicast 
[R3-bgp-af-ipv4]peer 172.16.0.2 enable
[R3-bgp]peer 172.16.0.4 as-number 64512
[R3-bgp]peer 172.16.0.4 connect-interface LoopBack 0
[R3-bgp]peer 172.16.0.4 next-hop-local
[R3-bgp]ipv4-family unicast
[R3-bgp-af-ipv4]peer 172.16.0.4 enable
[R3-bgp]peer 172.16.0.2 reflect-client
[R3-bgp-af-ipv4]network 172.16.0.3 32
[R3-bgp-af-ipv4]network 172.16.3.1 24
R4
[Huawei]sysname R4
[R4]interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0]ip address 172.16.1.6 30
[R4]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/1]ip address 172.16.1.9 30
[R4]interface LoopBack 0
[R4-LoopBack0]ip address 172.16.0.4 32
[R4]interface LoopBack 1
[R4-LoopBack1]ip address 172.16.4.1 24
[R4]ospf router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.1.6 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.1.9 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.0.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.4.1 0.0.0.0
[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.0.7 as-number 64513
[R4-bgp]peer 172.16.0.7 connect-interface LoopBack 0
[R4-bgp]peer 172.16.0.7 ebgp-max-hop
[R4-bgp]ipv4-family unicast
[R4-bgp-af-ipv4]peer 172.16.0.7 enable
[R4-bgp]peer 172.16.0.4 as-number 64512
[R4-bgp]peer 172.16.0.3 connect-interface LoopBack 0
[R4-bgp]peer 172.16.0.3 next-hop-local
[R4-bgp]ipv4-family unicast
[R4-bgp-af-ipv4]peer 172.16.0.3 enable 
[R4-bgp-af-ipv4]network 172.16.0.4 32
[R4-bgp-af-ipv4]network 172.16.4.1 24
R5
[Huawei]sysname R5
[R5]interface GigabitEthernet 0/0/0
[R5-GigabitEthernet0/0/0]ip address 172.16.1.22 30
[R5]interface GigabitEthernet 0/0/1
[R5-GigabitEthernet0/0/1]ip address 172.16.1.17 30
[R5]interface LoopBack 0
[R5-LoopBack0]ip address 172.16.0.5 32
[R5-LoopBack0]ip address 172.16.0.5 30
[R5]interface LoopBack 1
[R5-LoopBack1]ip address 172.16.5.1 24
[R5]ospf router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.22 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.17 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.5.1 0.0.0.0
[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.0.2 as-number 64512
[R5-bgp]peer 172.16.0.2 connect-interface LoopBack 0
[R5-bgp]peer 172.16.0.2 ebgp-max-hop
[R5-bgp]ipv4-family unicast
[R5-bgp-af-ipv4]peer 172.16.0.2 enable
[R5-bgp]peer 172.16.0.6 as-number 64513
[R5-bgp]peer 172.16.0.6 connect-interface LoopBack 0
[R5-bgp]peer 172.16.0.6 next-hop-local 	
[R5-bgp]ipv4-family unicast 	
[R5-bgp-af-ipv4]peer 172.16.0.6 enable 
[R5-bgp-af-ipv4]network 172.16.0.5 32
[R5-bgp-af-ipv4]network 172.16.5.1 24
R6
[Huawei]sysname R6
[R6]interface GigabitEthernet 0/0/0
[R6-GigabitEthernet0/0/0]ip address 172.16.1.18 30
[R6]interface GigabitEthernet 0/0/1
[R6-GigabitEthernet0/0/1]ip address 172.16.1.13 30
[R6]interface LoopBack 0
[R6-LoopBack0]ip address 172.16.0.6 32
[R6]interface LoopBack 1
[R6-LoopBack1]ip address 172.16.6.1 24
[R6]ospf router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.18 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.1.13 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.0.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.6.1 0.0.0.0
[R6]bgp 64513
[R6-bgp]router-id 6.6.6.6
[R6-bgp]confederation id 2	
[R6-bgp]peer 172.16.0.5 as-number 64513
[R6-bgp]peer 172.16.0.5 connect-interface LoopBack 0
[R6-bgp]peer 172.16.0.5 next-hop-local 
[R6-bgp]ipv4-family unicast 
[R6-bgp-af-ipv4]peer 172.16.0.5 enable
[R6-bgp]peer 172.16.0.7 as-number 64513
[R6-bgp]peer 172.16.0.7 connect-interface LoopBack 0
[R6-bgp]peer 172.16.0.7 next-hop-local 
[R6-bgp]ipv4-family unicast 
[R6-bgp-af-ipv4]peer 172.16.0.7 enable 
[R6-bgp]peer 172.16.0.7 reflect-client 
[R6-bgp-af-ipv4]network 172.16.0.6 32
[R6-bgp-af-ipv4]network 172.16.6.1 24
R7
[Huawei]sysname R7
[R7]interface GigabitEthernet 0/0/0
[R7-GigabitEthernet0/0/0]ip address 172.16.1.14 30
[R7]interface GigabitEthernet 0/0/2
[R7-GigabitEthernet0/0/2]ip address 34.1.1.7 24
[R7]interface LoopBack 0
[R7-LoopBack0]ip address 172.16.0.7 32
[R7]interface LoopBack 1
[R7-LoopBack1]ip address 172.16.7.1 24
[R7]ospf router-id 7.7.7.7
[R7-ospf-1-area-0.0.0.0]network 172.16.1.14 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.1.10 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.0.7 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.7.1 0.0.0.0
[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 34.1.1.8 as-number 3
[R7-bgp]ipv4-family unicast 
[R7-bgp-af-ipv4]peer 34.1.1.8 enable
[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 172.16.0.4 as-number 64512
[R7-bgp]peer 172.16.0.4 connect-interface LoopBack 0
[R7-bgp]peer 172.16.0.4 ebgp-max-hop
[R7-bgp]ipv4-family unicast
[R7-bgp-af-ipv4]peer 172.16.0.4 enable 
[R7-bgp]peer 172.16.0.6 as-number 64513
[R7-bgp]peer 172.16.0.6 connect-interface LoopBack 0
[R7-bgp]peer 172.16.0.6 next-hop-local 
[R7-bgp]ipv4-family unicast 
[R7-bgp-af-ipv4]peer 172.16.0.6 enable 
[R7-bgp-af-ipv4]network 172.16.0.7 32
[R7-bgp-af-ipv4]network 172.16.7.1 24
R8
[Huawei]sysname R8
[R8]interface GigabitEthernet 0/0/0
[R8-GigabitEthernet0/0/0]ip address 34.1.1.8 24
[R8]interface LoopBack 0
[R8-LoopBack0]ip address 172.16.0.8 32
[R8]interface LoopBack 1
[R8-LoopBack1]ip address 192.168.2.8 24
[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 34.1.1.7 as-number 2
[R8-bgp]ipv4-family unicast 
[R8-bgp-af-ipv4]peer 34.1.1.7 enable 
[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0]ip address 10.1.1.2 255.255.255.0 
[R8-Tunnel0/0/0] tunnel-protocol gre
[R8-Tunnel0/0/0] source 172.16.0.8
[R8-Tunnel0/0/0]destination 172.16.0.1
[R8]ip route-static 192.168.1.0 24 10.1.1.1

 七、检查配置

1.查看R2-R7路由器的路由表,看表中是否学习到R2-R7的环回地址,这非常重要,关系到BGP的建邻。下图以R2和R5的路由表为例:
R2
[R2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 28       Routes : 28       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface12.1.1.0/24  Direct  0    0           D   12.1.1.2        GigabitEthernet
0/0/012.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/012.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0172.16.0.2/32  Direct  0    0           D   127.0.0.1       LoopBack1172.16.0.3/32  OSPF    10   1           D   172.16.1.2      GigabitEthernet
0/0/1172.16.0.4/32  OSPF    10   2           D   172.16.1.2      GigabitEthernet
0/0/1172.16.0.5/32  OSPF    10   1           D   172.16.1.22     GigabitEthernet
0/0/2172.16.0.6/32  OSPF    10   2           D   172.16.1.22     GigabitEthernet
0/0/2172.16.0.7/32  OSPF    10   3           D   172.16.1.22     GigabitEthernet
R5
[R5]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 28       Routes : 28       Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0172.16.0.2/32  OSPF    10   1           D   172.16.1.21     GigabitEthernet
0/0/0172.16.0.3/32  OSPF    10   2           D   172.16.1.21     GigabitEthernet
0/0/0172.16.0.4/30  Direct  0    0           D   172.16.0.5      LoopBack0172.16.0.4/32  OSPF    10   3           D   172.16.1.21     GigabitEthernet
0/0/0172.16.0.5/32  Direct  0    0           D   127.0.0.1       LoopBack0172.16.0.6/32  OSPF    10   1           D   172.16.1.18     GigabitEthernet
0/0/1172.16.0.7/32  Direct  0    0           D   127.0.0.1       LoopBack0
2.查看邻居表,邻居是否起来,如果邻居没起来,即使后面宣告了网段,也不会全网通,所以这步很关键
R1
[R1]dis bgp peerBGP local router ID : 1.1.1.1    
Local AS number : 1
Total number of peers : 1       Peers in established state : 1Peer            V           AS  MsgRcvd MsgSent OutQ Up/Down      State Pre
fRCV 
12.1.1.2          4            2       14       9    0 00:06:45 Established6
R2
[R2]dis bgp peerBGP local router ID : 2.2.2.2
Local AS number : 64512
Total number of peers : 3      Peers in established state : 3Peer           V          AS  MsgRcvd MsgSent OutQ Up/Down      State Pre
fRCV12.1.1.1         4           1        9      15    0 00:06:32 Established1
172.16.0.3       4       64512       15      12    0 00:05:14 Established2
172.16.0.5       4       64513       14      14    0 00:04:19 Established5
R3
[R3]dis bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 64512
Total number of peers : 2      Peers in established state : 2Peer          V           AS  MsgRcvd MsgSent OutQ Up/Down    State Pre
fRCV172.16.0.2      4        64512       24      20    0 00:09:42 Established
5
172.16.0.4      4        64512       30      30    0 00:22:33 Established
6
R4
[R4]dis bgp peerBGP local router ID : 4.4.4.4
Local AS number : 64512
Total number of peers : 2       Peers in established state : 2Peer           V           AS    MsgRcvd MsgSent OutQ Up/Down       State Pre   
fRCV172.16.0.3       4        64512         31      31    0 00:23:13 Established6
172.16.0.7       4        64513         30      29    0 00:23:13 Established5
R5
[R5]dis bgp peerBGP local router ID : 5.5.5.5
Local AS number : 64513
Total number of peers : 2      Peers in established state : 2Peer           V          AS  MsgRcvd MsgSent OutQ Up/Down       State Pre
fRCV172.16.0.2       4       64512       19      22    0 00:09:50 Established
3
172.16.0.6       4       64513       34      29    0 00:23:39 Established
5
R6
[R6]dis bgp peerBGP local router ID : 6.6.6.6
Local AS number : 64513
Total number of peers : 2      Peers in established state : 2Peer           V          AS  MsgRcvd MsgSent OutQ Up/Down       State Pre
fRcv172.16.0.5       4       64513       30      36    0 00:24:01 Established4
172.16.0.7       4       64513       32      31    0 00:24:06 Established6
R7
[R7]dis bgp peerBGP local router ID : 7.7.7.7
Local AS number : 64513
Total number of peers : 3       Peers in established state : 3Peer           V          AS   MsgRcvd MsgSent OutQ Up/Down       State Pre
fRCV34.1.1.8         4           3        28      34    0 00:25:06 Established1
172.16.0.4       4       64512        30      32    0 00:24:24 Established4
172.16.0.6       4       64513        31      33    0 00:24:32 Established5
R8
[R8]dis bgp peerBGP local router ID : 8.8.8.8
Local AS number : 3
Total number of peers : 1       Peers in established state : 1Peer           V          AS    MsgRcvd MsgSent OutQ Up/Down       State Pre
fRcv34.1.1.7         4          2          34      29    0 00:25:29 Established
7

3.查看bgp路由表的学习情况。

R1
[R1]dis bgp routing-tableBGP Local router ID is 1.1.1.1Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 7Network            NextHop        MED        LocPrf   PrefVal Path/Ogn*>   172.16.0.1/32      0.0.0.0         0                    0      i
*>   172.16.0.8/32      12.1.1.2                             0      2 3i
*>   172.16.3.0/24      12.1.1.2                             0      2i
*>   172.16.4.0/24      12.1.1.2                             0      2i
*>   172.16.5.0/24      12.1.1.2                             0      2i
*>   172.16.6.0/24      12.1.1.2                             0      2i
*>   172.16.7.0/24      12.1.1.2                             0      2i
R2
[R2]dis bgp routing-tableBGP Local router ID is 2.2.2.2Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 8Network            NextHop        MED        LocPrf   PrefVal Path/Ogi*>   172.16.0.1/32      0.0.0.0         0          100       0      1ii  172.16.0.5/32      172.16.0.5      0          100              (64513)i
*>i  172.16.0.8/32      172.16.0.7      0          100       0      (64513)3i
*>i  172.16.3.0/24      172.16.0.3      0          100       0      i
*>i  172.16.4.0/24      172.16.0.4      0          100       0      i
*>i  172.16.5.0/24      172.16.0.5      0          100       0      (64513)i
*>i  172.16.6.0/24      172.16.0.6      0          100       0      (64513)i
*>i  172.16.7.0/24      172.16.0.7      0          100       0      (64513)i
R3
[R3]dis bgp routing-tableBGP Local router ID is 3.3.3.3Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP, ? - incompleteTotal Number of Routes: 13Network            NextHop        MED        LocPrf   PrefVal Path/Ogn
*>i  172.16.0.1/32      172.16.0.2      0          100       0      i
*>   172.16.0.3/32      0.0.0.0 0       0                           ii  172.16.0.4/32      172.16.0.4      0          100       0      i
*>i  172.16.0.8/32      172.16.0.7      0          100       0      (64513)3ii  172.16.0.9/32      172.16.0.7      0          100       0      (64513)3i
*>   172.16.3.0/24      0.0.0.0 0       0                           i
*>i  172.16.4.0/24      172.16.0.4      0          100       0      (64513)i
*>i  172.16.5.0/24      172.16.0.5      0          100       0      (64513)i
*>i  172.16.6.0/24      172.16.0.6      0          100       0      (64513)i
*>i  172.16.7.0/24      172.16.0.7      0          100       0      (64513)i
R4
[R4]dis bgp routing-tableBGP Local router ID is 4.4.4.4Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP,? - incompleteTotal Number of Routes: 13Network            NextHop       MED        LocPrf     PrefVal Path/Ogn
*>i  172.16.0.1/32      172.16.0.2     0          100         0      li
*>   172.16.0.4/32      0.0.0.0        0                      0      ii  172.16.0.7/32      172.16.0.7     0          100         0      (64513)i
*>i  172.16.0.8/32      172.16.0.7     0          100         0      (64513) 3ii  172.16.0.9/32      172.16.0.7     0          100         0      (64513) 3i
*>i  172.16.3.0/24      172.16.0.3     0          100         0      i
*>   172.16.4.0/24      0.0.0.0        0                      0      i
*>i  172.16.5.0/24      172.16.0.5     0          100         0      (64513)ii  172.16.5.0/24      172.16.0.5     0          100         0      (64513)i
*>i  172.16.6.0/24      172.16.0.6     0          100         0      (64513)ii  172.16.6.0/24      172.16.0.6     0          100         0      (64513)i
*>i  172.16.7.0/24      172.16.0.7     0          100         0      (64513)ii  172.16.7.0/24      172.16.0.7     0          100         0      (64513)i
R5
[R5]dis bgp routing-tableBGP Local router ID is 5.5.5.5Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP,? - incompleteTotal Number of Routes: 10Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
*>i  172.16.0.1/32      172.16.0.2      0          100        0      (64512)1i
*>i  172.16.0.2/32      12.1.1.1        0          100        0      (64512)1i
*>   172.16.0.5/32      0.0.0.0         0                     0      i    i  172.16.0.6/32      172.16.0.6      0          100        0      i
*>i  172.16.0.8/32      172.16.0.7      0          100        0      3i
*>i  172.16.3.0/24      172.16.0.3      0          100        0      (64512)i
*>i  172.16.4.0/24      172.16.0.4      0          100        0      (64512)i
*>   172.16.5.0/24      0.0.0.0         0                     0      i
*>i  172.16.6.0/24      172.16.0.6      0          100        0      i
*>i  172.16.7.0/24      172.16.0.7      0          100        0      i
R6
[R6]dis bgp routing-tableBGP Local router ID is 6.6.6.6Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP,? - incompleteTotal Number of Routes: 12Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
*>i  172.16.0.1/32      172.16.0.2      0          100         0     (64512) 1ii  172.16.0.5/32      172.16.0.5      0          100         0     i
*>   172.16.0.6/32      0.0.0.0         0                      0     ii  172.16.0.7/32      172.16.0.7      0          100         0     i
*>i  172.16.0.8/32      172.16.0.7      0          100         0     3i
*>i  172.16.3.0/24      172.16.0.3      0          100         0     (64512)i
*>i  172.16.3.0/24      172.16.0.3      0          100         0     (64512)i
*>i  172.16.4.0/24      172.16.0.4      0          100         0     (64512)ii  172.16.4.0/24      172.16.0.4      0          100         0     (64512)i
*>i  172.16.5.0/24      172.16.0.5      0          100         0     i
*>   172.16.6.0/24      0.0.0.0         0                      0     i
*>i  172.16.7.0/24      172.16.0.7      0          100         0     i
R7
[R7]dis bgp routing-tableBGP Local router ID is 7.7.7.7Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP,? - incompleteTotal Number of Routes: 12Network            NextHop        MED        LocPrf    PrefVal Path/Ogn
*>i  172.16.0.1/32      172.16.0.2      0          100        0     (64512)1i i  172.16.0.4/32      172.16.0.4      0          100        0     (64512)ii  172.16.0.6/32      172.16.0.6      0          100        0     i
*>   172.16.0.7/32      0.0.0.0         0                     0     i
*>   172.16.0.8/32      34.1.1.8        0                     0     3i
*>i  172.16.3.0/24      172.16.0.3      0          100        0     (64512)i
*>i  172.16.3.0/24      172.16.0.3      0          100        0     (64512)i
*>i  172.16.4.0/24      172.16.0.4      0          100        0     (64512)ii  172.16.4.0/24      172.16.0.4      0          100        0     (64512)i
*>i  172.16.5.0/24      172.16.0.5      0          100        0     i
*>i  172.16.6.0/24      172.16.0.6      0          100        0     i
*>   172.16.7.0/24      0.0.0.0         0                     0     i
R8
[R8]dis bgp routing-tableBGP Local router ID is 8.8.8.8Status codes: * - valid, > - best, d - damped,h - history, i - internal, s - suppressed, S - StaleOrigin : i - IGP, e - EGP,? - incompleteTotal Number of Routes: 1Network            NextHop        MED        LocPrf    PrefVal Path/Ogn*>   172.16.0.1/32      34.1.1.7                              0      2  li

4.测试:全网通

R1
[R1]ping -a 172.16.0.1 172.16.0.8
PING 172.16.0.8: 56 data bytes, press CTRL C to break
Reply from 172.16.0.8: bytes=56 Sequence=1 ttl=251 time=70 ms
Reply from 172.16.0.8: bytes=56 Sequence=2 ttl=251 time=50 ms
Reply from 172.16.0.8: bytes=56 Sequence=3 ttl=251 time=50 ms
Reply from 172.16.0.8: bytes=56 Sequence=4 ttl=251 time=50 ms
Reply from 172.16.0.8: bytes=56 Sequence=5 ttl=251 time=50 ms
R3
[R3]ping -a 172.16.3.1 172.16.0.1
PING 172.16.0.1: 56 data bytes, press CTRL C to break
Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 172.16.0.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 172.16.0.1: bytes=56 Sequence=5 ttl=254 time=30 ms172.16.0.1 ping statistics
5 packet (s) transmitted
5 packet (s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms[R3]ping -a 172.16.3.1 172.16.7.1
PING 172.16.7.1: 56 data bytes, press CTRL C to break
Reply from 172.16.7.1: bytes=56 Sequence=1 ttl=252 time=50 ms
Reply from 172.16.7.1: bytes=56 Sequence=2 ttl=252 time=50 ms
Reply from 172.16.7.1: bytes=56 Sequence=3 ttl=252 time=30 ms
Reply from 172.16.7.1: bytes=56 Sequence=4 ttl=252 time=40 ms
Reply from 172.16.7.1: bytes=56 Sequence=5 ttl=252 time=40 ms172.16.7.1 ping statistics
5 packet (s) transmitted
5 packet (s) received
0.00% packet loss
round-trip min/avg/max = 30/42/50 ms
R8
[R8]ping -a 192.168.2.8 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 tt1=255 time=40 ms
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=50 ms192.168.1.1 ping statistics
5 packet (s) transmitted
5 packet (s) received
0.00% packet loss
round-trip min/avg/max = 40/44/50 ms

相关文章:

  • linux批量创建文件
  • RHEL7安装教程
  • 【QT】自定义QWidget标题栏,可拖拽(拖拽时窗体变为normal大小),可最小/大化、关闭(图文详情)
  • Spring AI之RAG入门
  • SpringBoot3.2新特性:JdbcClient
  • 模块化交互数字人系统:OpenAvatarChat,单台PC即可运行完整功能
  • 【Redis】大key对持久化的影响
  • 定时器时钟来源可以从输入捕获引脚输入
  • Unity ARPG战斗系统 _ RootMotion相关知识点
  • GPTBots在AI大语言模型应用中敏感数据匿名化探索和实践
  • 基于InternLM的情感调节大师FunGPT
  • agent mode 代理模式,整体要求,系统要求, 系统指令
  • 2025年微信小程序开发:AR/VR与电商的最新案例
  • [Python] struct.unpack() 用法详解
  • 深入理解前端DOM:现代Web开发的基石
  • Tauri(2.5.1)+Leptos(0.7.8)开发桌面应用--简单的工作进度管理
  • 法律大语言模型(Legal LLM)技术架构
  • React 项目初始化与搭建指南
  • istringstream
  • RTOS,其基本属性、语法、操作、api
  • 贵阳疫情最新情况最新消息今天/品牌搜索引擎服务优化
  • 设计方案格式模板/前端性能优化有哪些方法
  • 安徽省建设厅网站怎么进不去/百度推广下载安装
  • 福建省品牌建设促进会网站/引流软件
  • 网站建设用什么网站好一点/网站运营推广方案
  • 大连哪里做网站/网站查询系统