2015-04-06 23:47:08 +09:00
|
|
|
# CLI Operations
|
|
|
|
|
|
|
|
This page explains comprehensive examples of operations via GoBGP CLI.
|
|
|
|
|
|
|
|
## Prerequisites
|
|
|
|
|
2018-03-30 13:51:51 +09:00
|
|
|
Assumed that you finished [Getting Started](getting-started.md).
|
2015-04-06 23:47:08 +09:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2018-03-30 13:51:51 +09:00
|
|
|
This example starts with the same configuration with
|
|
|
|
[Getting Started](getting-started.md)
|
2015-04-06 23:47:08 +09:00
|
|
|
|
|
|
|
Make sure that all the peers are connected.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor
|
2020-03-05 14:25:30 +09:00
|
|
|
Peer AS Up/Down State |#Received Accepted
|
|
|
|
10.0.255.1 65001 00:00:04 Establ | 2 2
|
|
|
|
10.0.255.2 65002 00:00:04 Establ | 2 2
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
## Adding or deleting a peer dynamically
|
|
|
|
|
|
|
|
You can add a new peer or delete the existing peer without stopping
|
|
|
|
GoBGP daemon. You can do such by adding a new peer configuration or
|
|
|
|
deleting the existing configuration of a peer in your configuration
|
|
|
|
file and sending `HUP` signal to GoBGP daemon.
|
|
|
|
|
|
|
|
In this example, 10.0.255.3 peer is added. The configuration file
|
|
|
|
should be like the following.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```toml
|
|
|
|
[global.config]
|
|
|
|
as = 64512
|
|
|
|
router-id = "192.168.255.1"
|
|
|
|
|
|
|
|
[[neighbors]]
|
|
|
|
[neighbors.config]
|
|
|
|
neighbor-address = "10.0.255.1"
|
|
|
|
peer-as = 65001
|
|
|
|
[neighbors.route-server.config]
|
|
|
|
route-server-client = true
|
|
|
|
|
|
|
|
[[neighbors]]
|
|
|
|
[neighbors.config]
|
|
|
|
neighbor-address = "10.0.255.2"
|
|
|
|
peer-as = 65002
|
|
|
|
[neighbors.route-server.config]
|
|
|
|
route-server-client = true
|
|
|
|
|
|
|
|
[[neighbors]]
|
|
|
|
[neighbors.config]
|
|
|
|
neighbor-address = "10.0.255.3"
|
|
|
|
peer-as = 65003
|
|
|
|
[neighbors.route-server.config]
|
|
|
|
route-server-client = true
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
After you send `HUP` signal (`kill` command), you should see 10.0.255.3 peer.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor
|
2020-03-05 14:25:30 +09:00
|
|
|
Peer AS Up/Down State |#Received Accepted
|
|
|
|
10.0.255.1 65001 00:03:42 Establ | 2 2
|
|
|
|
10.0.255.2 65002 00:03:42 Establ | 2 2
|
|
|
|
10.0.255.3 65003 00:01:39 Establ | 1 1
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
## Temporarily disable a configured peer
|
|
|
|
|
|
|
|
Sometime you might want to disable the configured peer without
|
|
|
|
removing the configuration for the peer. Likely, again you enable the
|
|
|
|
peer later.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor 10.0.255.1 disable
|
|
|
|
$ gobgp neighbor
|
2020-03-05 14:25:30 +09:00
|
|
|
Peer AS Up/Down State |#Received Accepted
|
|
|
|
10.0.255.1 65001 never Idle(Admin) | 0 0
|
|
|
|
10.0.255.2 65002 00:12:32 Establ | 2 2
|
|
|
|
10.0.255.3 65003 00:10:29 Establ | 1 1
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
The state of 10.0.255.1 is `Idle(Admin)`. Let's enable the peer again.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor 10.0.255.1 enable
|
|
|
|
$ gobgp neighbor
|
2020-03-05 14:25:30 +09:00
|
|
|
Peer AS Up/Down State |#Received Accepted
|
|
|
|
10.0.255.1 65001 never Idle | 0 0
|
|
|
|
10.0.255.2 65002 00:13:33 Establ | 2 2
|
|
|
|
10.0.255.3 65003 00:11:30 Establ | 1 1
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
Eventually, the state should be `Established` again.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor
|
2020-03-05 14:25:30 +09:00
|
|
|
Peer AS Up/Down State |#Received Accepted
|
|
|
|
10.0.255.1 65001 00:00:02 Establ | 2 2
|
|
|
|
10.0.255.2 65002 00:14:59 Establ | 2 2
|
|
|
|
10.0.255.3 65003 00:12:56 Establ | 1 1
|
2015-04-06 23:47:08 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
## Reset, Reset, and Reset
|
|
|
|
|
|
|
|
Various reset operations are supported.
|
|
|
|
|
2016-01-08 14:09:27 +09:00
|
|
|
```bash
|
2015-04-21 21:25:54 +09:00
|
|
|
$ gobgp neighbor 10.0.255.1 reset
|
|
|
|
$ gobgp neighbor 10.0.255.1 softreset
|
|
|
|
$ gobgp neighbor 10.0.255.1 softresetin
|
|
|
|
$ gobgp neighbor 10.0.255.1 softresetout
|
|
|
|
```
|
|
|
|
|
2018-03-30 13:51:51 +09:00
|
|
|
You can know more about [CLI command syntax](cli-command-syntax.md).
|