github.com/osrg/gobgp@v2.0.0+incompatible/docs/sources/getting-started.md (about)

     1  # Running GoBGP
     2  
     3  This page explains how to run GoBGP. This example sets up GoBGP to
     4  connect with two eBGP peers for IPv4 routes. Even if you are
     5  interested in other GoBGP use cases (such as IPv6 routes, EVPN, and
     6  Route Server), this example gives you the basics of GoBGP usage.
     7  
     8  ## Configuration
     9  
    10  GoBGP can be configured via a configuration file or gRPC API. This example
    11  uses the following very simple configuration. All keys are case-insensitive.
    12  Default configuration format of GoBGP is [toml](https://github.com/toml-lang/toml).
    13  If you don't like `toml`, you can use `json`, `yaml` and `hcl` instead.
    14  
    15  ```toml
    16  [global.config]
    17    as = 64512
    18    router-id = "192.168.255.1"
    19  
    20  [[neighbors]]
    21    [neighbors.config]
    22      neighbor-address = "10.0.255.1"
    23      peer-as = 65001
    24  
    25  [[neighbors]]
    26    [neighbors.config]
    27      neighbor-address = "10.0.255.2"
    28      peer-as = 65002
    29  ```
    30  
    31  See [Configuration Example](configuration.md) for more complicated
    32  configuration.
    33  
    34  ## Starting GoBGP
    35  
    36  Save the configuration above as gobgpd.conf and start gobgpd:
    37  
    38  ```bash
    39  $ sudo -E gobgpd -f gobgpd.conf
    40  {"level":"info","msg":"Peer 10.0.255.1 is added","time":"2015-04-06T20:32:28+09:00"}
    41  {"level":"info","msg":"Peer 10.0.255.2 is added","time":"2015-04-06T20:32:28+09:00"}
    42  ```
    43  
    44  If you use a configuration format other than `toml`, you must specify the format
    45  by `-t` option.
    46  
    47  equivalent yaml configuration.
    48  
    49  ```yaml
    50  global:
    51      config:
    52          as: 64512
    53          router-id: 192.168.255.1
    54  neighbors:
    55      - config:
    56          neighbor-address: 10.0.255.1
    57          peer-as: 65001
    58      - config:
    59          neighbor-address: 10.0.255.2
    60          peer-as: 65002
    61  ```
    62  
    63  ```bash
    64  $ sudo -E gobgpd -t yaml -f gobgpd.yml
    65  {"level":"info","msg":"Peer 10.0.255.1 is added","time":"2015-04-06T20:32:28+09:00"}
    66  {"level":"info","msg":"Peer 10.0.255.2 is added","time":"2015-04-06T20:32:28+09:00"}
    67  ```
    68  
    69  Let's show the information of all the peers.
    70  
    71  ```bash
    72  $ gobgp neighbor
    73  Peer          AS  Up/Down State       |#Advertised Received Accepted
    74  10.0.255.1 65001 00:00:14 Establ      |          1        5        5
    75  10.0.255.2 65002 00:00:14 Establ      |          5        2        2
    76  ```
    77  
    78  Want to see the details of a particular peer?
    79  
    80  ```bash
    81  $ gobgp neighbor 10.0.255.1
    82  BGP neighbor is 10.0.255.1, remote AS 65001
    83    BGP version 4, remote router ID 192.168.0.1
    84    BGP state = BGP_FSM_ESTABLISHED, up for 00:01:49
    85    BGP OutQ = 0, Flops = 0
    86    Neighbor capabilities:
    87      MULTIPROTOCOL: advertised and received
    88      ROUTE_REFRESH: advertised and received
    89      FOUR_OCTET_AS_NUMBER: advertised and received
    90      ROUTE_REFRESH_CISCO: received
    91    Message statistics:
    92                           Sent       Rcvd
    93      Opens:                  2          1
    94      Notifications:          0          0
    95      Updates:                1          1
    96      Keepalives:             4          5
    97      Route Refresh:          0          0
    98      Discarded:              0          0
    99      Total:                  7          7
   100  ```
   101  
   102  Check out the global table.
   103  
   104  ```bash
   105  $ gobgp global rib
   106     Network            Next Hop        AS_PATH    Age        Attrs
   107  *> 10.3.0.0/16        10.0.255.1      [65001]    00:05:41   [{Origin: 0} {Med: 0}]
   108  *> 10.3.0.0/24        10.0.255.1      [65001]    00:05:41   [{Origin: 0} {Med: 0}]
   109  *  10.3.0.0/24        10.0.255.2      [65002]    00:05:41   [{Origin: 0} {Med: 111} {Community: [65001:65002 NO_EXPORT]}]
   110  *> 10.3.0.0/32        10.0.255.1      [65001]    00:05:41   [{Origin: 0} {Med: 0}]
   111  *> 10.3.0.1/32        10.0.255.1      [65001]    00:05:41   [{Origin: 0} {Med: 0}]
   112  *> 10.33.0.0/16       10.0.255.1      [65001]    00:05:41   [{Origin: 0} {Med: 0}]
   113  *> 192.168.2.0/24     10.0.255.2      [65002]    00:05:41   [{Origin: 0} {Med: 111} {Community: [65001:65002 NO_EXPORT]}]
   114  ```
   115  
   116  You also can look at adjacent rib-in and rib-out:
   117  
   118  ```bash
   119  $ gobgp neighbor 10.0.255.1 adj-in
   120     Network            Next Hop        AS_PATH    Age        Attrs
   121     10.3.0.0/16        10.0.255.1      [65001]    00:06:55   [{Origin: 0} {Med: 0}]
   122     10.3.0.0/24        10.0.255.1      [65001]    00:06:55   [{Origin: 0} {Med: 0}]
   123     10.3.0.0/32        10.0.255.1      [65001]    00:06:55   [{Origin: 0} {Med: 0}]
   124     10.3.0.1/32        10.0.255.1      [65001]    00:06:55   [{Origin: 0} {Med: 0}]
   125     10.33.0.0/16       10.0.255.1      [65001]    00:06:55   [{Origin: 0} {Med: 0}]
   126  $ gobgp neighbor 10.0.255.1 adj-out
   127     Network            Next Hop        AS_PATH    Attrs
   128     192.168.2.0/24     10.0.255.254    [64512 65002] [{Origin: 0} {Community: [65001:65002 NO_EXPORT]}]
   129  ```