github.com/osrg/gobgp@v2.0.0+incompatible/docs/sources/configuration.md (about) 1 # Configuration Example 2 3 ```toml 4 [global.config] 5 as = 1 6 router-id = "1.1.1.1" 7 # listen port (by default 179) 8 port = 1790 9 # to disable listening 10 # port = -1 11 12 # listen address list (by default "0.0.0.0" and "::") 13 local-address-list = ["192.168.10.1", "2001:db8::1"] 14 15 [global.apply-policy.config] 16 import-policy-list = ["policy1"] 17 default-import-policy = "reject-route" 18 export-policy-list = ["policy2"] 19 default-export-policy = "accept-route" 20 21 [[rpki-servers]] 22 [rpki-servers.config] 23 address = "210.173.170.254" 24 port = 323 25 26 [[bmp-servers]] 27 [bmp-servers.config] 28 address = "127.0.0.1" 29 port = 11019 30 route-monitoring-policy = "pre-policy" 31 statistics-timeout = 3600 32 33 [[vrfs]] 34 [vrfs.config] 35 name = "vrf1" 36 # If id is omitted, automatically assigned. 37 id = 1 38 rd = "65000:100" 39 # Each configuration for import and export RTs; 40 # import-rt-list 41 # export-rt-list 42 # are preferred than both-rt-list. 43 both-rt-list = ["65000:100"] 44 45 [[mrt-dump]] 46 [mrt-dump.config] 47 dump-type = "updates" 48 file-name = "/tmp/log/2006/01/02.1504.dump" 49 dump-interval = 180 50 51 [zebra] 52 [zebra.config] 53 enabled = true 54 url = "unix:/var/run/quagga/zserv.api" 55 redistribute-route-type-list = ["connect"] 56 version = 2 # version used in Quagga on Ubuntu 16.04 57 58 [[neighbors]] 59 [neighbors.config] 60 peer-as = 2 61 auth-password = "password" 62 neighbor-address = "192.168.10.2" 63 # override global.config.as value 64 local-as = 1000 65 remove-private-as = "all" 66 # To enable peer group setting, uncomment the following 67 #peer-group = "my-peer-group" 68 [neighbors.as-path-options.config] 69 allow-own-as = 1 70 replace-peer-as = true 71 [neighbors.timers.config] 72 connect-retry = 5 73 hold-time = 9 74 keepalive-interval = 3 75 [neighbors.transport.config] 76 passive-mode = true 77 local-address = "192.168.10.1" 78 remote-port = 2016 79 ttl = 64 # default value on Linux 80 [neighbors.ebgp-multihop.config] 81 enabled = true 82 multihop-ttl = 100 83 [neighbors.route-reflector.config] 84 route-reflector-client = true 85 route-reflector-cluster-id = "192.168.0.1" 86 [neighbors.add-paths.config] 87 send-max = 8 88 receive = true 89 [neighbors.graceful-restart.config] 90 enabled = true 91 notification-enabled = true 92 long-lived-enabled = true 93 # graceful restart restart time 94 restart-time = 20 95 [[neighbors.afi-safis]] 96 [neighbors.afi-safis.config] 97 afi-safi-name = "ipv4-unicast" 98 [neighbors.afi-safis.prefix-limit.config] 99 max-prefixes = 1000 100 shutdown-threshold-pct = 80 101 [neighbors.afi-safis.mp-graceful-restart.config] 102 enabled = true 103 [neighbors.afi-safis.long-lived-graceful-restart.config] 104 enabled = true 105 # long lived graceful restart restart time 106 restart-time = 100000 107 [neighbors.afi-safis.add-paths.config] 108 # override neighbors.add-paths.config 109 receive = true 110 send-max = 8 111 [[neighbors.afi-safis]] 112 [neighbors.afi-safis.config] 113 afi-safi-name = "ipv6-unicast" 114 [[neighbors.afi-safis]] 115 [neighbors.afi-safis.config] 116 afi-safi-name = "ipv4-labelled-unicast" 117 [[neighbors.afi-safis]] 118 [neighbors.afi-safis.config] 119 afi-safi-name = "ipv6-labelled-unicast" 120 [[neighbors.afi-safis]] 121 [neighbors.afi-safis.config] 122 afi-safi-name = "l3vpn-ipv4-unicast" 123 [[neighbors.afi-safis]] 124 [neighbors.afi-safis.config] 125 afi-safi-name = "l3vpn-ipv6-unicast" 126 [[neighbors.afi-safis]] 127 [neighbors.afi-safis.config] 128 afi-safi-name = "l2vpn-evpn" 129 [[neighbors.afi-safis]] 130 [neighbors.afi-safis.config] 131 afi-safi-name = "rtc" 132 [[neighbors.afi-safis]] 133 [neighbors.afi-safis.config] 134 afi-safi-name = "ipv4-encap" 135 [[neighbors.afi-safis]] 136 [neighbors.afi-safis.config] 137 afi-safi-name = "ipv6-encap" 138 [[neighbors.afi-safis]] 139 [neighbors.afi-safis.config] 140 afi-safi-name = "ipv4-flowspec" 141 [[neighbors.afi-safis]] 142 [neighbors.afi-safis.config] 143 afi-safi-name = "ipv6-flowspec" 144 [[neighbors.afi-safis]] 145 [neighbors.afi-safis.config] 146 afi-safi-name = "opaque" 147 [neighbors.apply-policy.config] 148 import-policy-list = ["policy1"] 149 default-import-policy = "reject-route" 150 export-policy-list = ["policy2"] 151 default-export-policy = "accept-route" 152 in-policy-list = ["policy3"] 153 default-in-policy = "reject-route" 154 [neighbors.route-server.config] 155 route-server-client = true 156 # To enable TTL Security, uncomment the following. 157 # Please note that this feature is mututally exclusive with 158 # "neighbors.ebgp-multihop.config". 159 #[neighbors.ttl-security.config] 160 # enabled = true 161 # ttl-min = 255 # 255 means directly connected 162 163 [[peer-groups]] 164 [peer-groups.config] 165 peer-group-name = "my-peer-group" 166 peer-as = 65000 167 [[peer-groups.afi-safis]] 168 [peer-groups.afi-safis.config] 169 afi-safi-name = "ipv4-unicast" 170 171 [[dynamic-neighbors]] 172 [dynamic-neighbors.config] 173 prefix = "20.0.0.0/24" 174 peer-group = "my-peer-group" 175 176 [[defined-sets.prefix-sets]] 177 prefix-set-name = "ps0" 178 [[defined-sets.prefix-sets.prefix-list]] 179 ip-prefix = "10.0.0.0/8" 180 masklength-range = "24..32" 181 [[defined-sets.neighbor-sets]] 182 neighbor-set-name = "ns0" 183 neighbor-info-list = ["192.168.10.2", "172.13.0.0/24"] 184 [[defined-sets.bgp-defined-sets.community-sets]] 185 community-set-name = "cs0" 186 community-list = ["100:100"] 187 [[defined-sets.bgp-defined-sets.ext-community-sets]] 188 ext-community-set-name = "es0" 189 ext-community-list = ["rt:100:100", "soo:200:200"] 190 [[defined-sets.bgp-defined-sets.as-path-sets]] 191 as-path-set-name = "as0" 192 as-path-list = ["^100", "200$"] 193 [[defined-sets.bgp-defined-sets.large-community-sets]] 194 large-community-set-name = "ls0" 195 large-community-list = ["100:100:100", "200:200:200"] 196 197 [[policy-definitions]] 198 name = "policy1" 199 [[policy-definitions.statements]] 200 [policy-definitions.statements.conditions.match-prefix-set] 201 prefix-set = "ps0" 202 match-set-options = "any" 203 [policy-definitions.statements.conditions.match-neighbor-set] 204 neighbor-set = "ns0" 205 match-set-options = "invert" 206 [policy-definitions.statements.conditions.bgp-conditions.match-community-set] 207 community-set = "cs0" 208 match-set-options = "all" 209 [policy-definitions.statements.conditions.bgp-conditions.match-large-community-set] 210 large-community-set = "ls0" 211 match-set-options = "all" 212 [policy-definitions.statements.actions.bgp-actions.set-as-path-prepend] 213 as = "last-as" 214 repeat-n = 5 215 [policy-definitions.statements.actions] 216 route-disposition = "accept-route" 217 [[policy-definitions.statements]] 218 [policy-definitions.statements.conditions.bgp-conditions.match-ext-community-set] 219 ext-community-set = "es0" 220 [policy-definitions.statements.actions] 221 route-disposition = "reject-route" 222 223 [[policy-definitions]] 224 name = "policy2" 225 [[policy-definitions.statements]] 226 [policy-definitions.statements.conditions.bgp-conditions.match-as-path-set] 227 as-path-set = "as0" 228 [policy-definitions.statements.actions] 229 route-disposition = "accept-route" 230 [policy-definitions.statements.actions.bgp-actions.set-community] 231 options = "add" 232 [policy-definitions.statements.actions.bgp-actions.set-community.set-community-method] 233 communities-list = ["100:200"] 234 235 [[policy-definitions]] 236 name = "policy3" 237 [[policy-definitions.statements]] 238 [policy-definitions.statements.conditions.bgp-conditions.match-as-path-set] 239 as-path-set = "as0" 240 [policy-definitions.statements.actions] 241 route-disposition = "accept-route" 242 [policy-definitions.statements.actions.bgp-actions.set-community] 243 options = "add" 244 [policy-definitions.statements.actions.bgp-actions.set-community.set-community-method] 245 communities-list = ["100:200"] 246 [[policy-definitions.statements]] 247 [policy-definitions.statements.conditions.match-prefix-set] 248 prefix-set = "ps0" 249 match-set-options = "invert" 250 [policy-definitions.statements.actions] 251 route-disposition = "accept-route" 252 [policy-definitions.statements.actions.bgp-actions.set-ext-community] 253 options = "replace" 254 [policy-definitions.statements.actions.bgp-actions.set-ext-community.set-ext-community-method] 255 communities-list = ["soo:100:200", "rt:300:400"] 256 [[policy-definitions.statements]] 257 [policy-definitions.statements.conditions.match-neighbor-set] 258 neighbor-set = "ns0" 259 [policy-definitions.statements.actions] 260 route-disposition = "accept-route" 261 [policy-definitions.statements.actions.bgp-actions.set-ext-community] 262 options = "remove" 263 [policy-definitions.statements.actions.bgp-actions.set-ext-community.set-ext-community-method] 264 communities-list = ["soo:500:600", "rt:700:800"] 265 [[policy-definitions.statements]] 266 [policy-definitions.statements.conditions.bgp-conditions] 267 next-hop-in-list = [ 268 "10.0.100.1/32" 269 ] 270 [policy-definitions.statements.actions] 271 route-disposition = "accept-route" 272 273 [[policy-definitions]] 274 name = "route-type-policy" 275 [[policy-definitions.statements]] 276 # this statement matches with locally generated routes 277 [policy-definitions.statements.conditions.bgp-conditions] 278 route-type = "local" 279 [policy-definitions.statements.actions] 280 route-disposition = "accept-route" 281 [[policy-definitions.statements]] 282 # this statement matches with routes from iBGP peers 283 [policy-definitions.statements.conditions.bgp-conditions] 284 route-type = "internal" 285 [policy-definitions.statements.actions] 286 route-disposition = "accept-route" 287 [[policy-definitions.statements]] 288 # this statement matches with routes from eBGP peers 289 [policy-definitions.statements.conditions.bgp-conditions] 290 route-type = "external" 291 [policy-definitions.statements.actions] 292 route-disposition = "accept-route" 293 294 [[policy-definitions]] 295 name = "large-communty-policy" 296 [[policy-definitions.statements]] 297 # this statement adds specified large communities 298 [policy-definitions.statements.actions] 299 route-disposition = "accept-route" 300 [policy-definitions.statements.actions.bgp-actions.set-large-community] 301 options = "add" 302 [policy-definitions.statements.actions.bgp-actions.set-large-community.set-large-community-method] 303 communities-list = ["100:200:300"] 304 [[policy-definitions.statements]] 305 # this statement adds specified large communities 306 [policy-definitions.statements.actions] 307 route-disposition = "accept-route" 308 [policy-definitions.statements.actions.bgp-actions.set-large-community] 309 options = "replace" 310 [policy-definitions.statements.actions.bgp-actions.set-large-community.set-large-community-method] 311 communities-list = ["100:200:300"] 312 [[policy-definitions.statements]] 313 # this statement removes specified large communities 314 # regular expression is also supported 315 [policy-definitions.statements.actions] 316 route-disposition = "accept-route" 317 [policy-definitions.statements.actions.bgp-actions.set-large-community] 318 options = "remove" 319 [policy-definitions.statements.actions.bgp-actions.set-large-community.set-large-community-method] 320 communities-list = ["100:200:300", "^200:"] 321 ```