From 2b0aba54e162f589931b13b50f932b04cb373e16 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Mon, 10 Aug 2015 00:35:14 +0900 Subject: docs: update mrt document Signed-off-by: ISHIDA Wataru --- README.md | 2 +- docs/sources/mrt.md | 119 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 95 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index fce20c5f..db48802c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ No dependency hell (library, package, etc) thanks to Go. * [Route Server](https://github.com/osrg/gobgp/blob/master/docs/sources/route-server.md) * [Policy Filter](https://github.com/osrg/gobgp/blob/master/docs/sources/filter.md) * [EVPN](https://github.com/osrg/gobgp/blob/master/docs/sources/evpn.md) - * [MRT Route Injector](https://github.com/osrg/gobgp/blob/master/docs/sources/mrt.md) + * [MRT](https://github.com/osrg/gobgp/blob/master/docs/sources/mrt.md) ## Community, discussion and support 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` +## 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 +``` + +## 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 ` and filename format by `-f ` +```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` ) | + +### 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 + +## Inject routes from MRT table v2 records +Route injection can be done by +```bash +$ gobgp mrt inject global [] ``` -- cgit v1.2.3