summaryrefslogtreecommitdiffhomepage
path: root/docs/sources
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sources')
-rw-r--r--docs/sources/mrt.md119
1 files changed, 94 insertions, 25 deletions
diff --git a/docs/sources/mrt.md b/docs/sources/mrt.md
index 98a441b0..3a3ac6df 100644
--- a/docs/sources/mrt.md
+++ b/docs/sources/mrt.md
@@ -1,51 +1,120 @@
-# MRT route injector
+# MRT
-This page explains how to inject MRT routes to gobgp.
+This page explains how to play with GoBGP's MRT feature.
## Prerequisites
Assume you finished [Getting Started](https://github.com/osrg/gobgp/blob/master/docs/sources/getting-started.md).
-## Install GoMRT
+## Contents
+- [Configuration](#section0)
+- [Dump MRT table v2 records](#section1)
+ - [Dump neighbor's local table](#section1.1)
+- [Inject routes from MRT table v2 records](#section2)
-In addition to gobgpd and gobgp, you have to install `gomrt`
+## <a name="section0"> Configuration
+You don't need any special configuration for MRT feature.
+This page assume the configuration below.
+
+```toml
+[Global]
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.0.1"
+ PeerAs = 65001
+```
+
+## <a name="section1">Dump MRT Table v2 Records
+
+Instant dump can be done like below
```bash
-$ go get github.com/osrg/gobgp/gomrt
+$ gobgp mrt dump rib global
+mrt dump: rib_ipv4_20150809_233952
+$ ls -la rib*
+rib_ipv4_20150809_233952
```
-## Configuration
+To dump ipv6 routes, type
-you don't need any special configuration for mrt
+```bash
+$ gobgp mrt dump rib global -a ipv6
+mrt dump: rib_ipv6_20150809_234012
+```
+If you want to dump periodically, specify dump interval (unit is second)
+```bash
+# dump hourly. this will block
+$ gobgp mrt dump rib global $((60*60))
+mrt dump: rib_ipv4_20150809_234438
+...
```
-$ cat gobgpd.conf
-[Global]
- [Global.GlobalConfig]
- As = 64512
- RouterId = "192.168.255.1"
-[Neighbors]
- [[Neighbors.NeighborList]]
- [Neighbors.NeighborList.NeighborConfig]
- NeighborAddress = "10.0.255.1"
- PeerAs = 65001
+You can change output directory by `-o <outdir>` and filename format by `-f <format>`
+```bash
+# change the output directory and the filename of dumps
+$ gobgp mrt dump rib global -o /dump/here -f mydailydump_{{.Y}}_{{.M}}_{{.D}} $((60*60*24))
+mrt dump: /dump/here/rib_2015_08_09
+...
```
-## Start GoBGP
+Filename format is same as golang [text/template](http://golang.org/pkg/text/template/) package template.
+Below is the supported variables you can use.
+
+| value | meaning |
+|:---------------------:|:---------------------------------------------:|
+| {{.Y}} | Year (e.g. 2015) |
+| {{.M}} | Month (e.g. 08) |
+| {{.D}} | Day (e.g. 09) |
+| {{.H}} | Hour (e.g. 23) |
+| {{.Min}} | Minute (e.g. 47) |
+| {{.Sec}} | Second (e.g. 10) |
+| {{.Af}} | Address Family ( `ipv4` \| `ipv6` \| `l2vpn`) |
+| {{.NeighborAddress }} | Neighbor Address (e.g. 10.0.0.1) |
+| {{.Resource}} | Resource ( `global` \| `local` ) |
+
+### <a name="section1.1"> Dump neighbor's local table
+GoBGP supports multiple RIB for route server [feature](https://github.com/osrg/gobgp/blob/master/docs/sources/route-server.md).
+GoBGP can also dump these tables which is local to neighbors
```bash
-$ sudo -E gobgpd -f gobgpd.conf
-{"level":"info","msg":"Peer 10.0.255.1 is added","time":"2015-04-06T20:32:28+09:00"}
-{"level":"info","msg":"Peer 10.0.255.2 is added","time":"2015-04-06T20:32:28+09:00"}
+$ gobgp mrt dump rib neighbor 10.0.0.1 -o /dump/local $((60*60))
+rpc error: code = 2 desc = "no local rib for 10.0.0.1"
```
-## Inject MRT Routes!
+Oops! Before trying this feature, you must enable route server feature.
+Configuration is something like below.
-Currently gomrt supports TABLE_DUMP_V2 format ([RFC6396](https://tools.ietf.org/html/rfc6396)).
-You can get the Internet full route dump from [here](http://archive.routeviews.org/)
+```
+$ cat gobgpd.conf
+[Global]
+ [Global.GlobalConfig]
+ As = 64512
+ RouterId = "192.168.255.1"
+[Neighbors]
+ [[Neighbors.NeighborList]]
+ [Neighbors.NeighborList.NeighborConfig]
+ NeighborAddress = "10.0.0.1"
+ PeerAs = 65001
+ [Neighbors.NeighborList.RouteServer]
+ [Neighbors.NeighborList.RouteServer.RouteServerConfig]
+ RouteServerClient = true
+```
+
+OK, let's try again.
+```bash
+$ gobgp mrt dump rib neighbor 10.0.0.1 -o /dump/local
+mrt dump: /dump/local/rib_10.0.0.1_20150809_234543
```
-$ gomrt -i rib.20150617.2000
+
+## <a name="section2"> Inject routes from MRT table v2 records
+Route injection can be done by
+```bash
+$ gobgp mrt inject global <dumpfile> [<number of prefix to inject>]
```