github.com/osrg/gobgp/v3@v3.30.0/docs/sources/dynamic-neighbor.md (about)

     1  # Dynamic Neighbor
     2  
     3  This page explains how to configure the Dynamic Neighbor features.
     4  Dynamic Neighbor enables GoBGP to accept connections from the peers in specific prefix.
     5  
     6  ## Contents
     7  
     8  - [Prerequisite](#prerequisite)
     9  - [Configuration](#configuration)
    10  - [Verification](#verification)
    11  
    12  ## Prerequisite
    13  
    14  Assumed that you finished [Getting Started](getting-started.md) and learned [Peer Group](peer-group.md).
    15  
    16  ## Configuration
    17  
    18  The Dynamic Neighbor feature requires a peer group setting for its configuration.
    19  
    20  ```toml
    21  [global.config]
    22    as = 65001
    23    router-id = "172.40.1.2"
    24  
    25  [[peer-groups]]
    26    [peer-groups.config]
    27      peer-group-name = "sample-group"
    28      peer-as = 65002
    29    [[peer-groups.afi-safis]]
    30      [peer-groups.afi-safis.config]
    31        afi-safi-name = "ipv4-unicast"
    32    [[peer-groups.afi-safis]]
    33      [peer-groups.afi-safis.config]
    34        afi-safi-name = "ipv4-flowspec"
    35  
    36  [[dynamic-neighbors]]
    37    [dynamic-neighbors.config]
    38      prefix = "172.40.0.0/16"
    39      peer-group = "sample-group"
    40  ```
    41  
    42  By this configuration, peers in `172.40.0.0/16` will be accepted by this GoBGP,
    43  and the `sample-group` configuration is used as the configuration of members of this dynamic neighbor.
    44  
    45  Note that GoBGP will be passive mode to members of dynamic neighbors.
    46  So if both peers listen to each other as dynamic neighbors, the connection will never be established.
    47  
    48  ## Verification
    49  
    50  Dynamic neighbors are not shown by `gobgp neighbor` command until the connection is established.
    51  
    52  ```shell
    53  $ gobgp neighbor
    54  Peer AS Up/Down State       |#Received  Accepted
    55  ```
    56  
    57  After the connection is established, the neighbor will appear by `gobgp neighbor` command.
    58  You can see the neighbor config is inherited from the peer group config.
    59  
    60  ```shell
    61  $ gobgp neighbor
    62  Peer          AS  Up/Down State       |#Received  Accepted
    63  172.40.1.3 65001 00:00:23 Establ      |        0         0
    64  $ gobgp neighbor 172.40.1.3
    65  BGP neighbor is 172.40.1.3, remote AS 65002
    66    BGP version 4, remote router ID 172.40.1.3
    67    BGP state = established, up for 00:00:07
    68    BGP OutQ = 0, Flops = 0
    69    Hold time is 90, keepalive interval is 30 seconds
    70    Configured hold time is 90, keepalive interval is 30 seconds
    71  
    72    Neighbor capabilities:
    73      multiprotocol:
    74          ipv4-unicast:	advertised and received
    75          ipv4-flowspec:	advertised and received
    76      route-refresh:	advertised and received
    77      4-octet-as:	advertised and received
    78    Message statistics:
    79                           Sent       Rcvd
    80      Opens:                  1          1
    81      Notifications:          0          0
    82      Updates:                0          0
    83      Keepalives:             1          1
    84      Route Refresh:          0          0
    85      Discarded:              0          0
    86      Total:                  2          2
    87    Route statistics:
    88      Advertised:             0
    89      Received:               0
    90      Accepted:               0
    91  ```