• H3C BGP配置1基本功能配置举例


    1.组网需求

      如下图,所有交换机均运行BGP协议。要求Switch A和Switch B之间建立EBGP连接,Switch B和Switch C之间建立IBGP连接,使得Switch C能够访问Switch A直连的8.1.1.0/24网段。

      

    2.配置步骤

      1)配置各接口的IP地址

      2)配置IBGP连接  

      为了防止端口状态不稳定引起路由震荡,本举例使用Loopback接口来创建IBGP对等体。

      使用Loopback接口创建IBGP对等体时,因为Loopback接口不是两对等体实际连接的接口,所以,必须使用peer connect-interface命令将Loopback接口配置为BGP连接的源接口。

      在AS 65009内部,使用OSPF协议,保证Switch B到Switch C的Loopback接口路由可达, Switch C到Switch B的Loopback接口路由可达。  

    SW B
    [SwitchB] bgp 65009
    [SwitchB-bgp-default] router-id 2.2.2.2
    [SwitchB-bgp-default] peer 3.3.3.3 as-number 65009
    [SwitchB-bgp-default] peer 3.3.3.3 connect-interface loopback 0
    [SwitchB-bgp-default] address-family ipv4 unicast
    [SwitchB-bgp-default-ipv4] peer 3.3.3.3 enable
    
    [SwitchB] ospf 1
    [SwitchB-ospf-1] area 0
    [SwitchB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
    [SwitchB-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
    SW C
    [SwitchC] bgp 65009
    [SwitchC-bgp-default] router-id 3.3.3.3
    ‌[SwitchC-bgp-default] peer 2.2.2.2 as-number 65009
    [SwitchC-bgp-default] peer 2.2.2.2 connect-interface loopback 0
    [SwitchC-bgp-default] address-family ipv4 unicast
    [SwitchC-bgp-default-ipv4] peer 2.2.2.2 enable
    
    [SwitchC] ospf 1
    [SwitchC-ospf-1] area 0
    [SwitchC-ospf-1-area-0.0.0.0] network 3.3.3.3 0.0.0.0
    [SwitchC-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255
    [SwitchC] display bgp peer ipv4
    
     BGP local router ID : 3.3.3.3
     Local AS number : 65009
     Total number of peers : 1                 Peers in established state : 1
    
      * - Dynamically created peer
      ^ - Peer created through link-local address
      Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State
      2.2.2.2              65009        2        2    0       0 00:00:13 Established
    
    以上显示信息表明Switch B和Switch C之间的IBGP连接已经建立。

      3)配置EBGP连接

      EBGP邻居关系的两台路由器(通常属于两个不同运营商),处于不同的AS域,对端的Loopback接口一般路由不可达,所以一般使用直连地址建立EBGP邻居。

      因为要求Switch C能够访问Switch A直连的8.1.1.0/24网段,所以,建立EBGP连接后,需要将8.1.1.0/24网段路由通告到BGP路由表中。  

    SW A
    [SwitchA] bgp 65008
    [SwitchA-bgp-default] router-id 1.1.1.1
    [SwitchA-bgp-default] peer 3.1.1.1 as-number 65009
    [SwitchA-bgp-default] address-family ipv4 unicast
    [SwitchA-bgp-default-ipv4] peer 3.1.1.1 enable
    [SwitchA-bgp-default-ipv4] network 8.1.1.0 24
    SW B
    [SwitchB] bgp 65009
    [SwitchB-bgp-default] peer 3.1.1.2 as-number 65008
    [SwitchB-bgp-default] address-family ipv4 unicast
    [SwitchB-bgp-default-ipv4] peer 3.1.1.2 enable
    # 查看Switch B的BGP对等体的连接状态。
    
    [SwitchB] display bgp peer ipv4
     BGP local router ID : 2.2.2.2
     Local AS number : 65009
     Total number of peers : 2                 Peers in established state : 2
      * - Dynamically created peer
      ^ - Peer created through link-local address
      Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State
      3.3.3.3              65009        4        4    0       0 00:02:49 Established
      3.1.1.2              65008        2        2    0       0 00:00:05 Established
    可以看出,Switch B与Switch C、Switch B与Switch A之间的BGP连接均已建立。
    # 查看Switch A的BGP路由表。
    
    [SwitchA] display bgp routing-table ipv4
     Total number of routes: 1
     BGP local router ID is 1.1.1.1
     Status codes: * - valid, > - best, d - dampened, h - history,
                   s - suppressed, S - stale, i - internal, e - external
                   a – additional-path
           Origin: i - IGP, e - EGP, ? - incomplete
         Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
    * >  8.1.1.0/24         8.1.1.1         0                     32768   i
    # 显示Switch B的BGP路由表。
    
    [SwitchB] display bgp routing-table ipv4
     Total number of routes: 1
     BGP local router ID is 2.2.2.2
     Status codes: * - valid, > - best, d - dampened, h - history,
                   s - suppressed, S - stale, i - internal, e - external
                   a – additional-path
           Origin: i - IGP, e - EGP, ? - incomplete
         Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
    * >e 8.1.1.0/24         3.1.1.2         0                     0       65008i
    # 显示Switch C的BGP路由表。
    
    [SwitchC] display bgp routing-table ipv4
     Total number of routes: 1
     BGP local router ID is 3.3.3.3
     Status codes: * - valid, > - best, d - dampened, h - history,
                   s - suppressed, S - stale, i - internal, e - external
                   a – additional-path
           Origin: i - IGP, e - EGP, ? - incomplete
         Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
       i 8.1.1.0/24         3.1.1.2         0          100        0       65008i

      从路由表可以看出,Switch A没有学到AS 65009内部的任何路由,Switch C虽然学到了AS 65008中的8.1.1.0的路由,但因为下一跳3.1.1.2不可达,所以也不是有效路由。

      4)配置BGP引入直连路由

      在Switch B上配置BGP引入直连路由,以便Switch A能够获取到网段9.1.1.0/24的路由,Switch C能够获取到网段3.1.1.0/24的路由。

    # 配置Switch B。
    
    [SwitchB] bgp 65009
    [SwitchB-bgp-default] address-family ipv4 unicast
    [SwitchB-bgp-default-ipv4] import-route direct
    # 显示Switch A的BGP路由表。
    
    [SwitchA] display bgp routing-table ipv4
     Total number of routes: 4
     BGP local router ID is 1.1.1.1
     Status codes: * - valid, > - best, d - dampened, h - history,
                   s - suppressed, S - stale, i - internal, e - external
                   a – additional-path
           Origin: i - IGP, e - EGP, ? - incomplete
         Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
    * >e 2.2.2.2/32         3.1.1.1         0                     0       65009?
    * >e 3.1.1.0/24         3.1.1.1         0                     0       65009?
    * >  8.1.1.0/24         8.1.1.1         0                     32768   i
    * >e 9.1.1.0/24         3.1.1.1         0                     0       65009?
    以上显示信息表明,在Switch B上引入直连路由后,Switch A新增了到达2.2.2.2/32和9.1.1.0/24的两条路由。
    # 显示Switch C的BGP路由表。
    
    [SwitchC] display bgp routing-table ipv4
     Total number of routes: 4
     BGP local router ID is 3.3.3.3
     Status codes: * - valid, > - best, d - dampened, h - history,
                   s - suppressed, S - stale, i - internal, e - external
                   a – additional-path
           Origin: i - IGP, e - EGP, ? - incomplete
         Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
    * >i 2.2.2.2/32         2.2.2.2         0          100        0       ?
    * >i 3.1.1.0/24         2.2.2.2         0          100        0       ?
    * >i 8.1.1.0/24         3.1.1.2         0          100        0       65008i
    * >i 9.1.1.0/24         2.2.2.2         0          100        0       ? 
    以上显示信息表明,到8.1.1.0的路由变为有效路由,下一跳为Switch A的地址。
    看看天上,于是我去了满是风雪的地方
  • 相关阅读:
    Windows Mobile 中 Cellular Emulator 与 Device Emulator 连接不上的解决办法?
    Windows Mobile Space Index
    通过Windows Mobile连接管理器建立网络连接
    为Windows mobile编写设计友好的控件[Writing designer friendly controls for Windows Mobile]
    TransparentImage、TransparentBlt [Daliy APIs]
    GetDC、GetDCEx、GetWindowDC [Daily APIs]
    SHCreateMenuBar [Daily APIs]
    无法创建VC++ 智能项目的解决方法?
    CreateCompatibleBitmap [Daliy APIs]
    Windows Mobile Gesture 开发学习 持续更新
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/15714704.html
Copyright © 2020-2023  润新知