github.com/osrg/gobgp/v3@v3.30.0/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 Sending the `SIGHUP` signal to `gobgpd` triggers a configuration reload. 70 The `-a` option enables the auto reloading of the configuration whenever a change is detected. 71 72 Let's show the information of all the peers. 73 74 ```bash 75 $ gobgp neighbor 76 Peer AS Up/Down State |#Advertised Received Accepted 77 10.0.255.1 65001 00:00:14 Establ | 1 5 5 78 10.0.255.2 65002 00:00:14 Establ | 5 2 2 79 ``` 80 81 Want to see the details of a particular peer? 82 83 ```bash 84 $ gobgp neighbor 10.0.255.1 85 BGP neighbor is 10.0.255.1, remote AS 65001 86 BGP version 4, remote router ID 192.168.0.1 87 BGP state = BGP_FSM_ESTABLISHED, up for 00:01:49 88 BGP OutQ = 0, Flops = 0 89 Neighbor capabilities: 90 MULTIPROTOCOL: advertised and received 91 ROUTE_REFRESH: advertised and received 92 FOUR_OCTET_AS_NUMBER: advertised and received 93 ROUTE_REFRESH_CISCO: received 94 Message statistics: 95 Sent Rcvd 96 Opens: 2 1 97 Notifications: 0 0 98 Updates: 1 1 99 Keepalives: 4 5 100 Route Refresh: 0 0 101 Discarded: 0 0 102 Total: 7 7 103 ``` 104 105 Check out the global table. 106 107 ```bash 108 $ gobgp global rib 109 Network Next Hop AS_PATH Age Attrs 110 *> 10.3.0.0/16 10.0.255.1 [65001] 00:05:41 [{Origin: 0} {Med: 0}] 111 *> 10.3.0.0/24 10.0.255.1 [65001] 00:05:41 [{Origin: 0} {Med: 0}] 112 * 10.3.0.0/24 10.0.255.2 [65002] 00:05:41 [{Origin: 0} {Med: 111} {Community: [65001:65002 NO_EXPORT]}] 113 *> 10.3.0.0/32 10.0.255.1 [65001] 00:05:41 [{Origin: 0} {Med: 0}] 114 *> 10.3.0.1/32 10.0.255.1 [65001] 00:05:41 [{Origin: 0} {Med: 0}] 115 *> 10.33.0.0/16 10.0.255.1 [65001] 00:05:41 [{Origin: 0} {Med: 0}] 116 *> 192.168.2.0/24 10.0.255.2 [65002] 00:05:41 [{Origin: 0} {Med: 111} {Community: [65001:65002 NO_EXPORT]}] 117 ``` 118 119 You also can look at adjacent rib-in and rib-out: 120 121 ```bash 122 $ gobgp neighbor 10.0.255.1 adj-in 123 Network Next Hop AS_PATH Age Attrs 124 10.3.0.0/16 10.0.255.1 [65001] 00:06:55 [{Origin: 0} {Med: 0}] 125 10.3.0.0/24 10.0.255.1 [65001] 00:06:55 [{Origin: 0} {Med: 0}] 126 10.3.0.0/32 10.0.255.1 [65001] 00:06:55 [{Origin: 0} {Med: 0}] 127 10.3.0.1/32 10.0.255.1 [65001] 00:06:55 [{Origin: 0} {Med: 0}] 128 10.33.0.0/16 10.0.255.1 [65001] 00:06:55 [{Origin: 0} {Med: 0}] 129 $ gobgp neighbor 10.0.255.1 adj-out 130 Network Next Hop AS_PATH Attrs 131 192.168.2.0/24 10.0.255.254 [64512 65002] [{Origin: 0} {Community: [65001:65002 NO_EXPORT]}] 132 ```