summaryrefslogtreecommitdiffhomepage
path: root/docs/sources/mrt.md
blob: 85a311f10b933db9715c33394fe573eeaea21eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# MRT

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).

## Contents
- [Inject routes from MRT table v2 records](#section0)
- [Dump updates in MRT BGP4MP format](#section1)
    - [Configuration](#section1.1)

## <a name="section0"> Inject routes from MRT table v2 records
Route injection can be done by
```bash
$ gobgp mrt inject global <dumpfile> [<number of prefix to inject>]
```

## <a name="section1"> Dump updates in MRT BGP4MP format

### <a name="section1.1"> Configuration

With the following configuration, gobgpd continuously dumps BGP update
messages to `/tmp/updates.dump` file in the BGP4MP format.

```toml
[global.config]
as = 64512
router-id = "10.0.255.254"

[[neighbors]]
  [neighbors.config]
    peer-as = 65001
    neighbor-address = "10.0.255.1"

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "updates"
    file-name = "/tmp/updates.dump"

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "table"
    file-name = "/tmp/table.dump"
    dump-interval = 60
```

Also gobgpd supports log rotation; a new dump file is created
periodically, and the old file is renamed to a different name.  With
the following configuration, gobgpd creates a new dump file every 180
seconds such as `/tmp/20160510.1546.dump`. The format of a name can be
specified in golang's
[time](https://golang.org/pkg/time/#pkg-constants) package's format.

```toml
[global.config]
as = 64512
router-id = "10.0.255.254"

[[neighbors]]
  [neighbors.config]
    peer-as = 65001
    neighbor-address = "10.0.255.1"

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "updates"
    file-name = "/tmp/log/20060102.1504.dump"
    rotation-interval = 180
```

## <a name="section1"> Dump the RIB in MRT TABLE_DUMPv2 format

### <a name="section1.1"> Configuration

With the following configuration, gobgpd continuously dumps routes in
the global rib to `/tmp/table.dump` file in the TABLE_DUMPv2 format
every 60 seconds.


```toml
[global.config]
as = 64512
router-id = "10.0.255.254"

[[neighbors]]
  [neighbors.config]
    peer-as = 65001
    neighbor-address = "10.0.255.1"

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "table"
    file-name = "/tmp/table.dump"
    dump-interval = 60
```

With a route server configuration, gobgpd can dump routes in each
peer's RIB.


```toml
[global.config]
  as = 64512
  router-id = "192.168.255.1"

[[neighbors]]
  [neighbors.config]
    neighbor-address = "10.0.255.1"
    peer-as = 65001
    auth-password = "hoge1"
  [neighbors.transport.config]
    passive-mode = true
  [neighbors.route-server.config]
    route-server-client = true

[[neighbors]]
  [neighbors.config]
    neighbor-address = "10.0.255.2"
    peer-as = 65002
    auth-password = "hoge2"
  [neighbors.transport.config]
    passive-mode = true
  [neighbors.route-server.config]
    route-server-client = true

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "table"
    file-name = "/tmp/table-1.dump"
    table-name = "10.0.255.1"
    dump-interval = 60

[[mrt-dump]]
  [mrt-dump.config]
    dump-type = "table"
    file-name = "/tmp/table-2.dump"
    table-name = "10.0.255.2"
    dump-interval = 60
```