2015-04-21 19:51:58 +09:00
# CLI command syntax
This page explains gobgp client command syntax.
2018-03-30 13:51:51 +09:00
## basic command pattern
2015-04-21 19:51:58 +09:00
2018-03-30 13:51:51 +09:00
``` shell
gobgp <subcommand> <object> opts...
```
2015-04-21 19:51:58 +09:00
2018-03-30 13:51:51 +09:00
gobgp has the following subcommands.
2015-04-21 19:51:58 +09:00
2018-03-30 13:51:51 +09:00
- [global ](#1-global-subcommand )
- [neighbor ](#2-neighbor-subcommand )
- [policy ](#3-policy-subcommand )
- [vrf ](#4-vrf-subcommand )
- [monitor ](#5-monitor-subcommand )
- [mrt ](#6-mrt-subcommand )
2015-04-21 19:51:58 +09:00
2018-03-30 13:51:51 +09:00
## 1. global subcommand
2015-04-21 19:51:58 +09:00
2016-03-16 18:08:43 +09:00
### 1.1 Global Configuration
2018-03-30 13:51:51 +09:00
2016-03-16 18:08:43 +09:00
#### syntax
2018-03-30 13:51:51 +09:00
2016-03-16 18:08:43 +09:00
``` shell
# configure global setting and start acting as bgp daemon
2016-04-25 23:52:21 +09:00
% gobgp global as <VALUE> router-id <VALUE> [ listen-port <VALUE>] [ listen-addresses <VALUE>...] [ mpls-label-min <VALUE>] [ mpls-label-max <VALUE>]
2016-03-16 18:08:43 +09:00
# delete global setting and stop acting as bgp daemon (all peer sessions will be closed)
% gobgp global del all
# show global setting
% gobgp global
```
### 1.2. Operations for Global-Rib - add/del/show -
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
#### - syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
# add Route
2015-06-17 15:49:25 +09:00
% gobgp global rib add <prefix> [ -a <address family>]
2015-04-21 19:51:58 +09:00
# delete a specific Route
2015-06-17 15:49:25 +09:00
% gobgp global rib del <prefix> [ -a <address family>]
2016-02-29 23:18:46 +09:00
# delete all locally generated routes
2016-02-13 08:39:17 +09:00
% gobgp global rib del all [ -a <address family>]
2015-04-21 19:51:58 +09:00
# show all Route information
2015-06-17 15:49:25 +09:00
% gobgp global rib [ -a <address family>]
2015-06-26 13:10:15 +09:00
# show a specific route information
2023-09-05 08:56:36 +00:00
% gobgp global rib [ <prefix>| <host>] [ rd <rd>] [ longer-prefixes| shorter-prefixes] [ -a <address family>]
2016-10-16 07:35:02 +00:00
# show table summary
% gobgp global rib summary [ -a <address family>]
2015-04-21 19:51:58 +09:00
```
2015-07-03 17:48:51 +09:00
#### - example
2018-03-30 13:51:51 +09:00
If you want to add routes with the address of the ipv4 to global rib:
2015-07-03 17:48:51 +09:00
``` shell
2015-11-10 11:48:49 -08:00
% gobgp global rib add 10.33.0.0/16 -a ipv4
2015-07-03 17:48:51 +09:00
```
2018-03-30 13:51:51 +09:00
If you want to remove routes with the address of the ipv6 from global rib:
2015-07-03 17:48:51 +09:00
``` shell
% gobgp global rib del 2001:123:123:1::/64 -a ipv6
```
2016-02-29 23:18:46 +09:00
#### more examples
2018-03-30 13:51:51 +09:00
2016-02-29 23:18:46 +09:00
``` shell
2016-03-11 03:28:59 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 origin igp
% gobgp global rib add -a ipv4 10.0.0.0/24 origin egp
2017-08-07 16:55:37 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 aspath 10,20,100.100
% gobgp global rib add -a ipv4 10.0.0.0/24 aspath "10 20 {30,40} 50"
2016-02-29 23:18:46 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 nexthop 20.20.20.20
% gobgp global rib add -a ipv4 10.0.0.0/24 med 10
% gobgp global rib add -a ipv4 10.0.0.0/24 local-pref 110
2016-05-29 09:33:32 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 community 100:100
% gobgp global rib add -a ipv4 10.0.0.0/24 community 100:100,200:200
% gobgp global rib add -a ipv4 10.0.0.0/24 community no-export
2016-10-08 05:42:08 -07:00
% gobgp global rib add -a ipv4 10.0.0.0/24 community blackhole
2016-02-29 23:18:46 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 aigp metric 200
2016-09-08 02:51:00 +00:00
% gobgp global rib add -a ipv4 10.0.0.0/24 large-community 100:100:100
% gobgp global rib add -a ipv4 10.0.0.0/24 large-community 100:100:100,200:200:200
2017-07-26 15:18:49 +09:00
% gobgp global rib add -a ipv4 10.0.0.0/24 identifier 10
2016-02-29 23:18:46 +09:00
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100/200
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100 nexthop 20.20.20.20
% gobgp global rib add -a ipv4-mpls 10.0.0.0/24 100 med 10
2016-11-02 00:28:32 -07:00
% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100:100
% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100.100:100
% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 10.10.10.10:100
% gobgp global rib add -a vpnv4 10.0.0.0/24 label 10 rd 100:100 rt 100:200
2016-03-18 14:42:59 +09:00
% gobgp global rib add -a opaque key hello value world
2016-02-29 23:18:46 +09:00
```
2015-07-03 17:48:51 +09:00
#### - option
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
The following options can be specified in the global subcommand:
2016-02-29 23:18:46 +09:00
| short |long | description | default |
|--------|---------------|--------------------------------------------|---------|
2022-10-16 22:35:13 +09:00
|a |address-family |specify any one from among `ipv4` , `ipv6` , `vpnv4` , `vpnv6` , `ipv4-labeled` , `ipv6-labeled` , `evpn` , `encap` , `rtc` , `ipv4-flowspec` , `ipv6-flowspec` , `l2vpn-flowspec` , `ipv4-mup` , `ipv6-mup` , `opaque` | `ipv4` |
2015-04-21 19:51:58 +09:00
2017-12-15 15:14:45 +09:00
Also, refer to the following for the detail syntax of each address family.
- `evpn` address family: [CLI Syntax for EVPN ](evpn.md#cli-syntax )
- `*-flowspec` address family: [CLI Syntax for Flow Specification ](flowspec.md#cli-syntax )
2022-10-16 22:35:13 +09:00
- `*-mup` address family: [CLI Syntax for SRv6 MUP ](srv6_mup.md#cli-syntax )
2015-04-21 19:51:58 +09:00
2018-03-30 13:51:51 +09:00
## 2. neighbor subcommand
2015-07-03 17:48:51 +09:00
### 2.1. Show Neighbor Status
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
#### - syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
# show neighbor's status as list
% gobgp neighbor
# show status of a specific neighbor
% gobgp neighbor <neighbor address>
```
2015-07-03 17:48:51 +09:00
### 2.2. Operations for neighbor - shutdown/reset/softreset/enable/disable -
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
#### - syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
2016-10-08 05:09:15 +00:00
# add neighbor
2022-09-02 15:38:44 +03:00
% gobgp neighbor add { <neighbor address> | interface <ifname> } as <as number> [ local-as <as number> | vrf <vrf-name> | route-reflector-client [ <cluster-id>] | route-server-client | allow-own-as <num> | remove-private-as ( all| replace) | replace-peer-as | ebgp-multihop-ttl <ttl>]
2016-10-08 05:09:15 +00:00
# delete neighbor
2019-03-05 18:06:56 +01:00
% gobgp neighbor del { <neighbor address> | interface <ifname> }
2015-06-17 15:49:25 +09:00
% gobgp neighbor <neighbor address> softreset [ -a <address family>]
% gobgp neighbor <neighbor address> softresetin [ -a <address family>]
% gobgp neighbor <neighbor address> softresetout [ -a <address family>]
2015-04-21 19:51:58 +09:00
% gobgp neighbor <neighbor address> enable
% gobgp neighbor <neighbor address> disable
2016-10-08 05:09:15 +00:00
% gobgp neighbor <neighbor address> reset
2015-04-21 19:51:58 +09:00
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
#### - option
2018-03-30 13:51:51 +09:00
The following options can be specified in the neighbor subcommand:
2015-07-03 17:48:51 +09:00
2016-02-29 23:18:46 +09:00
| short |long | description | default |
|--------|---------------|--------------------------------------------|---------|
2022-10-16 22:35:13 +09:00
|a |address-family |specify any one from among `ipv4` , `ipv6` , `vpnv4` , `vpnv6` , `ipv4-labeled` , `ipv6-labeld` , `evpn` , `encap` , `rtc` , `ipv4-flowspec` , `ipv6-flowspec` , `l2vpn-flowspec` , `ipv4-mup` , `ipv6-mup` , `opaque` | `ipv4` |
2015-04-21 19:51:58 +09:00
2015-07-03 17:48:51 +09:00
### 2.3. Show Rib - local-rib/adj-rib-in/adj-rib-out -
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
#### - syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
2015-06-26 13:10:15 +09:00
# show all routes in [local|adj-in|adj-out] table
% gobgp neighbor <neighbor address> [ local| adj-in| adj-out] [ -a <address family>]
# show a specific route in [local|adj-in|adj-out] table
2023-09-05 08:56:36 +00:00
% gobgp neighbor <neighbor address> [ local| adj-in| adj-out] [ <prefix>| <host>] [ rd <rd>] [ longer-prefixes| shorter-prefixes] [ -a <address family>]
2016-10-16 07:35:02 +00:00
# show table summary
% gobgp neighbor <neighbor address> [ local| adj-in| adj-out] summary [ -a <address family>]
2017-07-18 14:17:08 +09:00
# show RPKI detailed information in adj-in table
% gobgp neighbor <neighbor address> adj-in <prefix> validation
2015-04-21 19:51:58 +09:00
```
2015-07-03 17:48:51 +09:00
#### - example
2018-03-30 13:51:51 +09:00
If you want to show the local rib of ipv4 that neighbor(10.0.0.1) has:
2015-07-03 17:48:51 +09:00
``` shell
% gobgp neighbor 10.0.0.1 local -a ipv4
```
#### - option
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
The following options can be specified in the neighbor subcommand:
2016-02-29 23:18:46 +09:00
| short |long | description | default |
|--------|---------------|--------------------------------------------|---------|
2022-10-16 22:35:13 +09:00
|a |address-family |specify any one from among `ipv4` , `ipv6` , `vpnv4` , `vpnv6` , `ipv4-labeled` , `ipv6-labeld` , `evpn` , `encap` , `rtc` , `ipv4-flowspec` , `ipv6-flowspec` , `l2vpn-flowspec` , `ipv4-mup` , `ipv6-mup` ,, `opaque` | `ipv4` |
2015-07-03 17:48:51 +09:00
### 2.4. Operations for Policy - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
2015-10-19 20:04:42 +09:00
# show neighbor policy assignment
% gobgp neighbor <neighbor address> policy { in | import | export }
# add policies to specific neighbor policy
% gobgp neighbor <neighbor address> policy { in | import | export } add <policy name>... [ default { accept | reject } ]
# set policies to specific neighbor policy
% gobgp neighbor <neighbor address> policy { in | import | export } set <policy name>... [ default { accept | reject } ]
# remove attached policies from specific neighbor policy
% gobgp neighbor <neighbor address> policy { in | import | export } del <policy name>...
# remove all policies from specific neighbor policy
% gobgp neighbor <neighbor address> policy { in | import | export } del
2015-04-21 19:51:58 +09:00
```
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the import policy to neighbor(10.0.0.1):
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
% gobgp neighbor 10.0.0.1 policy import add policy1 policy2 default accept
2015-07-03 17:48:51 +09:00
```
2018-03-30 13:51:51 +09:00
You can specify multiple policy to neighbor separated by commas.
2015-07-03 17:48:51 +09:00
2018-03-30 13:51:51 +09:00
`default <policy action>` means the operation `{accept | reject}` in the case where the route does not match the conditions of the policy.
2015-07-03 17:48:51 +09:00
2018-03-30 13:51:51 +09:00
## 3. policy subcommand
2015-04-21 19:51:58 +09:00
2015-07-03 17:48:51 +09:00
### 3.1. Operations for PrefixSet - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
# add PrefixSet
2015-07-03 17:48:51 +09:00
% gobgp policy prefix add <prefix set name> <prefix> [ <mask length range>]
2015-10-19 20:04:42 +09:00
# delete a PrefixSet
% gobgp policy prefix del <prefix set name>
# delete a prefix from specific PrefixSet
% gobgp policy prefix del <prefix set name> <prefix> [ <mask length range>]
2015-04-21 19:51:58 +09:00
# show all PrefixSet information
% gobgp policy prefix
# show a specific PrefixSet
% gobgp policy prefix <prefix set name>
```
2015-06-17 15:49:25 +09:00
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the PrefixSet:
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy prefix add ps1 10.33.0.0/16 16..24
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
A PrefixSet it is possible to have multiple prefix, if you want to remove the PrefixSet to specify only PrefixSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy prefix del ps1
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
If you want to remove one element(prefix) of PrefixSet, to specify a prefix in addition to the PrefixSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy prefix del ps1 10.33.0.0/16
```
### 3.2. Operations for NeighborSet - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-04-21 19:51:58 +09:00
``` shell
# add NeighborSet
2017-12-11 16:41:59 +09:00
% gobgp policy neighbor add <neighbor set name> <neighbor address/prefix>
2015-10-19 20:04:42 +09:00
# delete a NeighborSet
% gobgp policy neighbor del <neighbor set name>
# delete a neighbor from a NeighborSet
% gobgp policy neighbor del <neighbor set name> <address>
2015-04-21 19:51:58 +09:00
# show all NeighborSet information
% gobgp policy neighbor
# show a specific NeighborSet information
% gobgp policy neighbor <neighbor set name>
```
2015-06-17 15:49:25 +09:00
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the NeighborSet:
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy neighbor add ns1 10.0.0.1
```
2018-03-30 13:51:51 +09:00
2017-12-11 16:41:59 +09:00
You can also specify a neighbor address range with the prefix representation:
2018-03-30 13:51:51 +09:00
2017-12-11 16:41:59 +09:00
``` shell
% gobgp policy neighbor add ns 10.0.0.0/24
2018-03-30 13:51:51 +09:00
```
2017-12-11 16:41:59 +09:00
A NeighborSet is possible to have multiple address, if you want to remove the NeighborSet to specify only NeighborSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy neighbor del ns1
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
If you want to remove one element(address) of NeighborSet, to specify a address in addition to the NeighborSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy prefix del ns1 10.0.0.1
```
### 3.3. Operations for AsPathSet - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-06-17 15:49:25 +09:00
``` shell
# add AsPathSet
2015-10-19 20:04:42 +09:00
% gobgp policy as-path add <aspath set name> <as path>
2015-06-17 15:49:25 +09:00
# delete a specific AsPathSet
2015-10-19 20:04:42 +09:00
% gobgp policy as-path del <aspath set name>
# delete an as-path from a AsPathSet
% gobgp policy as-path del <aspath set name> <as path>
2015-06-17 15:49:25 +09:00
# show all AsPathSet information
2015-10-19 20:04:42 +09:00
% gobgp policy as-path
2015-06-17 15:49:25 +09:00
# show a specific AsPathSet information
2015-10-19 20:04:42 +09:00
% gobgp policy as-path <aspath set name>
2015-06-17 15:49:25 +09:00
```
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the AsPathSet:
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
% gobgp policy as-path add ass1 ^65100
2015-07-03 17:48:51 +09:00
```
2015-08-06 19:43:35 +09:00
You can specify the position using regexp-like expression as follows:
2018-03-30 13:51:51 +09:00
- From: `^65100` means the route is passed from AS 65100 directly.
- Any: `_65100_` means the route comes through AS 65100.
- Origin: `_65100$` means the route is originated by AS 65100.
- Only: `^65100$` means the route is originated by AS 65100 and comes from it directly.
2015-08-06 19:43:35 +09:00
Further you can specify the consecutive aspath and use regexp in each element as follows:
2018-03-30 13:51:51 +09:00
- `^65100_65001`
- `65100_[0-9]+_.*$`
- `^6[0-9]_5.*_65.?00$`
2015-07-03 17:48:51 +09:00
An AsPathSet it is possible to have multiple as path, if you want to remove the AsPathSet to specify only AsPathSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
% gobgp policy as-path del ass1
2015-07-03 17:48:51 +09:00
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
If you want to remove one element(as path) of AsPathSet, to specify an as path in addition to the AsPathSet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
% gobgp policy as-path del ass1 ^65100
2015-07-03 17:48:51 +09:00
```
### 3.4. Operations for CommunitySet - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-06-17 15:49:25 +09:00
``` shell
# add CommunitySet
% gobgp policy community add <community set name> <community>
# delete a specific CommunitySet
2015-10-19 20:04:42 +09:00
% gobgp policy community del <community set name>
# delete a community from a CommunitySet
% gobgp policy community del <community set name> <community>
2015-06-17 15:49:25 +09:00
# show all CommunitySet information
% gobgp policy community
# show a specific CommunitySet information
% gobgp policy community <community set name>
```
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the CommunitySet:
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy community add cs1 65100:10
```
2018-03-30 13:51:51 +09:00
You can specify the position using regexp-like expression as follows:
- `6[0-9]+:[0-9]+`
- `^[0-9]*:300$`
2015-07-03 17:48:51 +09:00
A CommunitySet it is possible to have multiple community, if you want to remove the CommunitySet to specify only CommunitySet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy neighbor del cs1
```
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
If you want to remove one element(community) of CommunitySet, to specify a address in addition to the CommunitySet name.
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
% gobgp policy prefix del cs1 65100:10
```
2015-06-17 15:49:25 +09:00
2015-07-15 19:29:37 +09:00
### 3.5. Operations for ExtCommunitySet - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-07-15 19:29:37 +09:00
``` shell
# add ExtCommunitySet
2015-10-19 20:04:42 +09:00
% gobgp policy ext-community add <extended community set name> <extended community>
2015-07-15 19:29:37 +09:00
# delete a specific ExtCommunitySet
2015-10-19 20:04:42 +09:00
% gobgp policy ext-community del <extended community set name>
# delete a ext-community from a ExtCommunitySet
% gobgp policy ext-community del <extended community set name> <extended community>
2015-07-15 19:29:37 +09:00
# show all ExtCommunitySet information
2015-10-19 20:04:42 +09:00
% gobgp policy ext-community
2015-07-15 19:29:37 +09:00
# show a specific ExtCommunitySet information
2015-10-19 20:04:42 +09:00
% gobgp policy ext-community <extended community set name>
2015-07-15 19:29:37 +09:00
```
2015-10-19 20:04:42 +09:00
#### Example
2018-03-30 13:51:51 +09:00
If you want to add the ExtCommunitySet:
2015-07-15 19:29:37 +09:00
``` shell
2015-10-19 20:04:42 +09:00
% gobgp policy ext-community add ecs1 RT:65100:10
2015-07-15 19:29:37 +09:00
```
2018-03-30 13:51:51 +09:00
Extended community set as `<SubType>:<Global Admin>:<LocalAdmin>` .
2015-07-15 19:29:37 +09:00
If you read the [RFC4360 ](https://tools.ietf.org/html/rfc4360 ) and [RFC7153 ](https://tools.ietf.org/html/rfc7153 ), you can know more about Extended community.
You can specify the position using regexp-like expression as follows:
2018-03-30 13:51:51 +09:00
- `RT:[0-9]+:[0-9]+`
- `SoO:10.0.10.10:[0-9]+`
2015-07-15 19:29:37 +09:00
However, regular expressions for subtype can not be used, to use for the global admin and local admin.
A ExtCommunitySet it is possible to have multiple extended community, if you want to remove the ExtCommunitySet to specify only ExtCommunitySet name.
2018-03-30 13:51:51 +09:00
2015-07-15 19:29:37 +09:00
``` shell
% gobgp policy neighbor del ecs1
```
2018-03-30 13:51:51 +09:00
2015-07-15 19:29:37 +09:00
If you want to remove one element(extended community) of ExtCommunitySet, to specify a address in addition to the ExtCommunitySet name.
2018-03-30 13:51:51 +09:00
2015-07-15 19:29:37 +09:00
``` shell
% gobgp policy prefix del ecs1 RT:65100:10
```
2016-10-06 05:38:00 +00:00
### 3.6. Operations for LargeCommunitySet - add/del/show -
2018-03-30 13:51:51 +09:00
2016-10-06 05:38:00 +00:00
#### Syntax
2018-03-30 13:51:51 +09:00
2016-10-06 05:38:00 +00:00
``` shell
# add LargeCommunitySet
% gobgp policy large-community add <set name> <large community>...
# delete a specific LargeCommunitySet
% gobgp policy large-community del <set name>
# delete a large-community from a LargeCommunitySet
% gobgp policy large-community del <set name> <large community>
# show all LargeCommunitySet information
% gobgp policy large-community
# show a specific LargeCommunitySet information
% gobgp policy large-community <set name>
```
#### Example
2018-03-30 13:51:51 +09:00
2016-10-06 05:38:00 +00:00
``` shell
% gobgp policy large-community add l0 100:100:100
% gobgp policy large-community add l0 ^100:
% gobgp policy large-community add l0 :100$
% gobgp policy large-community del l0 100:100:100
% gobgp policy large-community add l0 200:100:100
% gobgp policy large-community
% gobgp policy large-community set l0 100:100:100 200:200:200 300:300:300
```
### 3.7 Statement Operation - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
# mod statement
% gobgp policy statement { add | del } <statement name>
# mod a condition to a statement
2018-06-05 14:44:53 -07:00
% gobgp policy statement <statement name> { add | del | set } condition { { prefix | neighbor | as-path | community | ext-community | large-community } <set name> [ { any | all | invert } ] | as-path-length <len> { eq | ge | le } | rpki { valid | invalid | not-found } | next-hop-in-list <next-hop>[ , <next-hop2>, ...] | afi-safi-in { <afi-safi>... } }
2015-10-19 20:04:42 +09:00
# mod an action to a statement
2019-11-08 09:34:00 +08:00
% gobgp policy statement <statement name> { add | del | set } action { reject | accept | { community | ext-community | large-community } { add | remove | replace } <value>... | med { add | sub | set } <value> | local-pref <value> | as-prepend { <asn> | last-as } <repeat-value> | next-hop { <next-hop> | self | unchanged } }
2015-10-19 20:04:42 +09:00
# show all statements
% gobgp policy statement
# show a specific statement
% gobgp policy statement <statement name>
2015-07-03 17:48:51 +09:00
```
2015-06-17 15:49:25 +09:00
2016-10-06 05:38:00 +00:00
### 3.8 Policy Operation - add/del/show -
2018-03-30 13:51:51 +09:00
2015-10-19 20:04:42 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-07-03 17:48:51 +09:00
``` shell
2015-10-19 20:04:42 +09:00
# mod policy
% gobgp policy { add | del | set } <policy name> [ <statement name>...]
# show all policies
% gobgp policy
# show a specific policy
% gobgp policy <policy name>
2015-07-03 17:48:51 +09:00
```
2018-03-30 13:51:51 +09:00
## 4. vrf subcommand
2015-08-10 03:45:21 +09:00
### 4.1 Add/Delete/Show VRF
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
``` shell
# add vrf
% gobgp vrf add <vrf name> rd <rd> rt { import| export| both} <rt>...
# del vrf
% gobgp vrf del <vrf name>
# show vrf
% gobgp vrf
```
#### Example
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
``` shell
% gobgp vrf add vrf1 rd 10.100:100 rt both 10.100:100 import 10.100:101 export 10.100:102
% gobgp vrf
Name RD Import RT Export RT
2015-10-11 06:36:07 +09:00
vrf1 10.100:100 10.100:100, 10.100:101 10.100:100, 10.100:102
2015-08-10 03:45:21 +09:00
% gobgp vrf del vrf1
% gobgp vrf
Name RD Import RT Export RT
```
### 4.2 Add/Delete/Show VRF routes
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
``` shell
# add routes to vrf
2017-12-05 14:13:25 +09:00
% gobgp vrf <vrf name> rib add <prefix> [ -a <address family>]
2015-08-10 03:45:21 +09:00
# del routes from vrf
2017-12-05 14:13:25 +09:00
% gobgp vrf <vrf name> rib del <prefix> [ -a <address family>]
2015-08-10 03:45:21 +09:00
# show routes in vrf
2017-12-05 14:13:25 +09:00
% gobgp vrf <vrf name> rib [ -a <address family>]
2015-08-10 03:45:21 +09:00
```
#### Example
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
``` shell
% gobgp vrf vrf1 rib add 10.0.0.0/24
% gobgp vrf vrf1 rib add 2001::/64 -a ipv6
% gobgp vrf vrf1 rib
Network Next Hop AS_PATH Age Attrs
10.100:100:10.0.0.0/24 0.0.0.0 00:00:40 [ { Origin: i} { Extcomms: [ 10.100:100] , [ 10.100:101] } ]
% gobgp vrf vrf1 rib -a ipv6
Network Next Hop AS_PATH Age Attrs
10.100:100:2001::/64 :: 00:00:00 [ { Origin: i} { Extcomms: [ 10.100:100] , [ 10.100:101] } ]
% gobgp vrf vrf1 rib del 10.0.0.0/24
% gobgp vrf vrf1 rib del 2001::/64
```
2018-03-30 13:51:51 +09:00
## 5. monitor subcommand
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
### 5.1 monitor global rib
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
#### Syntax
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
``` shell
# monitor global rib
2018-01-11 11:00:15 +09:00
% gobgp monitor global rib [ -a <address family>] [ --current]
2015-08-10 03:45:21 +09:00
```
#### Example
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
``` shell
[ TERM1]
% gobgp monitor global rib
[ ROUTE] 10.0.0.0/24 via 0.0.0.0 aspath [ ] attrs [ { Origin: i} ]
[ TERM2]
# monitor command blocks. add routes from another terminal
% gobgp global rib add 10.0.0.0/24
```
### 5.2 monitor neighbor status
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
#### Syntax
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
``` shell
# monitor neighbor status
2018-01-11 11:00:15 +09:00
% gobgp monitor neighbor [ --current]
2015-08-10 03:45:21 +09:00
# monitor specific neighbor status
2018-01-11 11:00:15 +09:00
% gobgp monitor neighbor <neighbor address> [ --current]
2015-08-10 03:45:21 +09:00
```
#### Example
2018-01-11 11:00:15 +09:00
2015-08-10 03:45:21 +09:00
``` shell
[ TERM1]
% gobgp monitor neighbor
2018-01-11 11:00:15 +09:00
[ NEIGH] 192.168.10.2 fsm: BGP_FSM_IDLE admin: down
[ NEIGH] 192.168.10.2 fsm: BGP_FSM_ACTIVE admin: up
[ NEIGH] 192.168.10.2 fsm: BGP_FSM_OPENSENT admin: up
[ NEIGH] 192.168.10.2 fsm: BGP_FSM_OPENCONFIRM admin: up
[ NEIGH] 192.168.10.2 fsm: BGP_FSM_ESTABLISHED admin: up
2015-08-10 03:45:21 +09:00
[ TERM2]
% gobgp neighbor 192.168.10.2 disable
% gobgp neighbor 192.168.10.2 enable
```
2018-01-11 11:00:15 +09:00
### 5.3 monitor Adj-RIB-In
#### Syntax
``` shell
# monitor Adj-RIB-In
% gobgp monitor adj-in [ -a <address family>] [ --current]
# monitor Adj-RIB-In for specific neighbor
% gobgp monitor adj-in <neighbor address> [ -a <address family>] [ --current]
```
#### Example
``` shell
[ GoBGP1]
% gobgp monitor adj-in
[ ROUTE] 0:10.2.1.0/24 via 10.0.0.2 aspath [ 65002] attrs [ { Origin: ?} ]
[ DELROUTE] 0:10.2.1.0/24 via <nil> aspath [ ] attrs [ ]
[ GoBGP2]
% gobgp global rib -a ipv4 add 10.2.1.0/24
% gobgp global rib -a ipv4 del 10.2.1.0/24
```
2018-03-30 13:51:51 +09:00
## 6. mrt subcommand
2019-02-18 17:48:05 +09:00
### 6.1 inject mrt records
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
#### Syntax
2018-03-30 13:51:51 +09:00
2015-08-10 03:45:21 +09:00
``` shell
% gobgp mrt inject global <filename> [ <count>]
```
#### Example
2018-03-30 13:51:51 +09:00
see [MRT ](mrt.md ).