diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/LinuxDocTools.pm | 2 | ||||
-rw-r--r-- | doc/Makefile | 73 | ||||
-rw-r--r-- | doc/bird.conf.example | 3 | ||||
-rw-r--r-- | doc/bird.conf.example2 | 341 | ||||
-rw-r--r-- | doc/bird.sgml | 1555 |
5 files changed, 1467 insertions, 507 deletions
diff --git a/doc/LinuxDocTools.pm b/doc/LinuxDocTools.pm index 51d4a04c..39bb401d 100644 --- a/doc/LinuxDocTools.pm +++ b/doc/LinuxDocTools.pm @@ -372,6 +372,8 @@ sub process_file } } # + + local $ENV{PATH} = "$ENV{PATH}:/usr/lib/linuxdoc-tools"; my($precmd) = "|sgmlpre output=$global->{format} $global->{define}"; # diff --git a/doc/Makefile b/doc/Makefile index 70b73943..f36642be 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,50 +1,49 @@ -root-rel=../ -dir-name=doc - -ifneq ($(wildcard ../Rules),) -include ../Rules -else -srcdir=$(shell cd $(root-rel) ; pwd) -srcdir_abs=$(srcdir) -endif - # Force rebuilds -.PHONY: prog.sgml bird.sgml +.PHONY: progspell docs progdocs userdocs + +doc-srcdir := $(shell cd $(s) && pwd) +sgml2 := $(doc-srcdir)/sgml2 docs: progdocs userdocs -progdocs: prog.html prog.ps -userdocs: bird.html bird.pdf -prog.sgml: - $(srcdir)/tools/progdoc $(srcdir_abs) +doc-fmt = $(1): $(o)prog.$(1) $(o)bird.$(1) +$(call doc-fmt,html) +$(call doc-fmt,dvi) +$(call doc-fmt,ps) +$(call doc-fmt,pdf) -%.html: %.sgml - ./sgml2html $< +progdocs: $(o)prog.html $(o)prog.pdf +userdocs: $(o)bird.html $(o)bird.pdf +progspell: $(o)prog.spell -%.dvi: %.tex - latex $< - latex $< +$(o)prog.sgml: $(srcdir)/tools/progdoc $(objdir)/.dir-stamp + $(srcdir)/tools/progdoc $(srcdir) $@ -%.ps: %.dvi - dvips -D600 -ta4 -o $@ $< +$(o)%.sgml: $(s)%.sgml $(objdir)/.dir-stamp + cp $< $@ -%.pdf: %.tex - pdflatex $< - pdflatex $< +$(o)%.html: $(o)%.sgml + cd $(dir $@) && $(sgml2)html $(notdir $<) -%.tex: %.sgml - ./sgml2latex --output=tex $< +$(o)%.tex: $(o)%.sgml + cd $(dir $@) && $(sgml2)latex --output=tex $(notdir $<) + +$(o)%.dvi: $(o)%.tex + cd $(dir $@) && TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex latex $(notdir $<) + cd $(dir $@) && TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex latex $(notdir $<) + +$(o)%.ps: $(o)%.dvi + dvips -D600 -ta4 -o $@ $< -%.txt: %.sgml - ./sgml2txt $< +$(o)%.pdf: $(o)%.tex + TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex pdflatex -output-directory=$(dir $@) $< + TEXINPUTS=$(TEXINPUTS):$(doc-srcdir)/tex pdflatex -output-directory=$(dir $@) $< -progspell: prog.sgml - sed -f prog-spell.sed <prog.sgml >prog.spell - ispell prog.spell +$(o)%.txt: $(o)%.sgml + cd $(dir $@) && $(sgml2)txt $(notdir $<) -clean: - rm -f *.tex *.dvi *.log *.txt *.aux *.toc *.spell - rm -f prog.sgml +$(o)prog.spell: $(o)prog.sgml $(s)prog-spell.sed + sed -f $(lastword $^) <$< >$@ + ispell $@ -distclean: clean - rm -f *.html *.ps +$(call clean,prog.spell $(addprefix *.,html dvi ps pdf sgml tex txt aux log toc)) diff --git a/doc/bird.conf.example b/doc/bird.conf.example index bbfe0020..62c65ce9 100644 --- a/doc/bird.conf.example +++ b/doc/bird.conf.example @@ -1,5 +1,6 @@ /* - * This is an example configuration file. + * This is an example configuration file + * (for version 1.x.x, obsolete) */ # Yes, even shell-like comments work... diff --git a/doc/bird.conf.example2 b/doc/bird.conf.example2 new file mode 100644 index 00000000..d7048b64 --- /dev/null +++ b/doc/bird.conf.example2 @@ -0,0 +1,341 @@ +/* + * This is an example configuration file for MB-BGP setting + */ + + +log "bird.log" all; +# debug protocols all; + +router id 192.168.1.1; + +ipv4 table master4; +ipv6 table master6; + +ipv4 table mcast4; +ipv6 table mcast6; + +ipv4 table mtab4; +ipv6 table mtab6; + +vpn4 table vpntab4; +vpn6 table vpntab6; + +vpn4 table vpn4mc; +vpn6 table vpn6mc; + +flow4 table flowtab4; +flow6 table flowtab6; + + +protocol device { + scan time 10; +} + +protocol kernel kernel4 { + scan time 20; + + ipv4 { + export all; + }; +} + +protocol kernel kernel6 { + scan time 20; + + ipv6 { + export all; + }; +} + + +protocol static static4 { + ipv4; + + route 10.10.0.0/24 via 192.168.1.2; + route 10.10.1.0/24 via 192.168.1.2 { bgp_large_community.add((10,20,30)); bgp_large_community.add((10,(20*3),10)); }; +} + +protocol static static6 { + ipv6; + + route 2001:db8:10:10::/64 via 2001:db8:1:1::10; + route 2001:db8:10:11::/64 via 2001:db8:1:1::10; + + route 2001:db8:1:1::/64 via fe80::ec9b:67ff:fe60:fd5d % ve1; +} + +# VPNv4 routes with MPLS labels +protocol static statvpn4 { + vpn4; + + route 10:10 10.20.0.0/24 via 192.168.1.2 mpls 210; + route 10:10 10.20.1.0/24 via 192.168.1.2 mpls 210; + route 10:20 10.20.0.0/24 via 192.168.1.2 mpls 220; + route 10:20 10.20.1.0/24 via 192.168.1.2 mpls 220; +} + +protocol static statvpn6 { + vpn6; + + route 10:10 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/210; + route 10:10 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/210; + route 10:20 2001:db8:20:10::/64 via 2001:db8:1:1::10 mpls 200/220; + route 10:20 2001:db8:20:11::/64 via 2001:db8:1:1::10 mpls 200/220; +} + +# RFC 5575 flow specification +protocol static flowstat4 { + flow4; + + route flow4 { + dst 10.0.0.0/8; + proto = 23; + dport > 24 && < 30 || 40..50,60..70,80; + sport > 24 && < 30 || = 40 || 50,60..70,80; + icmp type 80; + icmp code 90; + tcp flags 0x03/0x0f; + length 2048..65535; + dscp = 63; + fragment dont_fragment, is_fragment || !first_fragment; + }; + + route flow4 { + dst 11.0.0.0/8; + proto = 0x12; + sport > 0x5678 && < 0x9abc || 0xdef0 || 0x1234,0x5678,0x9abc..0xdef0; + dport = 50; + tcp flags 0x000/0xf00; + }; + + route flow4 { + dst 12.0.0.0/32; + tcp flags ! 0/0x999; + }; + + route flow4 { + dst 220.0.254.0/24; + tcp flags 0x99/0x999; + }; + + route flow4 { + dst 220.0.254.192/28; + tcp flags ! 0xfff/0xfff; + }; + + route flow4 { + dst 15.0.0.0/8; + tcp flags ! 0x999/0x999; + }; +} + +protocol static flowstat6 { + flow6; + + route flow6 { + dst fec0:1122:3344:5566::1/128; + src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63; + next header = 23; + sport 24..30, 42 || 50,60,70..80; + dport = 50; + tcp flags 0x03/0x0f, !0/0xff || 0x33/0x33; + fragment !is_fragment || !first_fragment; + label 0xaaaa/0xaaaa && 0x33/0x33; + }; + + route flow6 { + dst fec0:1122:3344:5566::1/128; + src ::1:1234:5678:9800:0/101 offset 63; + next header = 23; + dport = 50; + sport > 24 && < 30 || = 40 || = 50 || = 60 || >= 70 && <= 80; + tcp flags 0x3/0x3 && 0x0/0xc; + }; +} + + +protocol pipe { + table master4; + peer table mcast4; + import none; + export where source = RTS_OSPF; +} + +protocol pipe { + table master6; + peer table mcast6; + import none; + export where source = RTS_OSPF; +} + +protocol ospf v2 ospf4 { +# ecmp; + + ipv4 { + import all; +# export where source = RTS_STATIC; + }; + + area 0 { + interface "ve0" { stub; }; + interface "ve1" { hello 5; type ptp; }; + interface "ve2" { hello 5; type bcast; ttl security; }; + interface "ve3" { hello 5; type bcast; ttl security; }; + }; +} + + +protocol ospf v3 ospf6 { +# ecmp; + + ipv6 { + import all; +# export where source = RTS_STATIC; + }; + + area 0 { + interface "ve0" { stub; }; + interface "ve1" { hello 5; type ptp; }; + interface "ve2" { hello 5; type bcast; }; + }; +} + +protocol bgp { + local 192.168.11.1 as 1000; + neighbor 192.168.11.2 as 2000; +# local 192.168.1.1 as 1000; +# neighbor 192.168.2.1 as 2000; +# multihop; +# rr client; +# strict bind; +# debug all; + + # regular IPv4 unicast (1/1) + ipv4 { + # connects to master4 table by default + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; + }; + + # regular IPv6 unicast (2/1) + ipv6 { + # connects to master6 table by default + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; +# next hop address 2001:db8:1:1::1; + }; + + # IPv4 multicast topology (1/2) + ipv4 multicast { + # explicit IPv4 table + table mcast4; + import all; + export all; + }; + + # IPv6 multicast topology (2/2) + ipv6 multicast { + # explicit IPv6 table + table mcast6; + import all; + export all; +# next hop address 2001:db8:1:1::1; + }; + + # IPv4 with MPLS labels (1/4) + ipv4 mpls { + # explicit IPv4 table + table mtab4; + import all; + export all; + }; + + # IPv6 with MPLS labels (2/4) + ipv6 multicast { + # explicit IPv6 table + table mtab6; + import all; + export all; + # allows IPv4 next hops (6PE) + # extended next hop; + }; + + # VPNv4 with MPLS labels (1/128) + vpn4 mpls { + # connects to vpntab4 table by default + import all; + export all; + }; + + # VPNv6 with MPLS labels (2/128) + vpn6 mpls { + # connects to vpntab6 table by default + import all; + export all; + }; + + # VPNv4 multicast topology (1/129) + vpn4 multicast { + table vpn4mc; + import all; + export all; + }; + + # VPNv6 multicast topology (2/129) + vpn6 multicast { + table vpn6mc; + import all; + export all; + }; + + # IPv4 Flowspec (1/133) + flow4 { + # connects to flowtab4 table by default + import all; + export all; + }; + + # IPv6 Flowspec (2/133) + flow6 { + # connects to flowtab6 table by default + import all; + export all; + }; +} + +protocol bgp { + local 192.168.1.1 as 1000; + neighbor 192.168.3.1 as 1000; + multihop; + rr client; + + ipv4 { + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; + }; + + ipv6 { + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; + next hop address 2001:db8:1:1::1; + }; +} + +protocol bgp { + local 2001:db8:1:1::1 as 1000; + neighbor 2001:db8:4:1::1 as 1000; + multihop; + rr client; + + ipv4 { + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; + next hop address 192.168.4.1; + }; + + ipv6 { + import all; + export where source ~ [ RTS_STATIC, RTS_BGP ]; + }; +} + diff --git a/doc/bird.sgml b/doc/bird.sgml index d9200f26..c725081a 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1,7 +1,7 @@ <!doctype birddoc system> <!-- - BIRD documentation + BIRD 2.0 documentation This documentation can have 4 forms: sgml (this is master copy), html, ASCII text and dvi/postscript (generated from sgml using sgmltools). You should always @@ -20,11 +20,12 @@ configuration - something in config which is not keyword. <book> -<title>BIRD User's Guide +<title>BIRD 2.0 User's Guide <author> Ondrej Filip <it/<feela@network.cz>/, Pavel Machek <it/<pavel@ucw.cz>/, Martin Mares <it/<mj@ucw.cz>/, +Jan Matejka <it/<mq@jmq.cz>/, Ondrej Zajicek <it/<santiago@crfreenet.org>/ </author> @@ -88,8 +89,9 @@ supports: <item>both IPv4 and IPv6 protocols <item>multiple routing tables <item>the Border Gateway Protocol (BGPv4) - <item>the Routing Information Protocol (RIPv2) + <item>the Routing Information Protocol (RIPv2, RIPng) <item>the Open Shortest Path First protocol (OSPFv2, OSPFv3) + <item>the Babel Routing Protocol <item>the Router Advertisements for IPv6 hosts <item>a virtual protocol for exchange of routes between different routing tables on a single host @@ -112,11 +114,10 @@ developed and tested under Linux 2.0 to 2.6, and then ported to FreeBSD, NetBSD and OpenBSD, porting to other systems (even non-UNIX ones) should be relatively easy due to its highly modular architecture. -<p>BIRD supports either IPv4 or IPv6 protocol, but have to be compiled separately -for each one. Therefore, a dualstack router would run two instances of BIRD (one -for IPv4 and one for IPv6), with completely separate setups (configuration -files, tools ...). - +<p>BIRD 1.x supported either IPv4 or IPv6 protocol, but had to be compiled separately +for each one. BIRD~2 supports both of them with a possibility of further extension. +BIRD~2 supports Linux at least 3.16, FreeBSD 10, NetBSD 7.0, and OpenBSD 5.8. +Anyway, it will probably work well also on older systems. <sect>Installing BIRD <label id="install"> @@ -133,8 +134,7 @@ and Perl, installing BIRD should be as easy as: </code> <p>You can use <tt>./configure --help</tt> to get a list of configure -options. The most important ones are: <tt/--enable-ipv6/ which enables building -of an IPv6 version of BIRD, <tt/--with-protocols=/ to produce a slightly smaller +options. The most important ones are: <tt/--with-protocols=/ to produce a slightly smaller BIRD executable by configuring out routing protocols you don't use, and <tt/--prefix=/ to install BIRD to a place different from <file>/usr/local</file>. @@ -217,47 +217,42 @@ is generally easy -- BIRD needs just the standard library, privileges to read the config file and create the control socket and the CAP_NET_* capabilities. -<chapt>About routing tables +<chapt>Architecture +<label id="architecture"> + +<sect>Routing tables <label id="routing-tables"> -<p>BIRD has one or more routing tables which may or may not be synchronized with -OS kernel and which may or may not be synchronized with each other (see the Pipe -protocol). Each routing table contains a list of known routes. Each route -consists of: +<p>The heart of BIRD is a routing table. BIRD has several independent routing tables; +each of them contains routes of exactly one <m/nettype/ (see below). There are two +default tables -- <cf/master4/ for IPv4 routes and <cf/master6/ for IPv6 routes. +Other tables must be explicitly configured. + +<p> +These routing tables are not kernel forwarding tables. No forwarding is done by +BIRD. If you want to forward packets using the routes in BIRD tables, you may +use the Kernel protocol (see below) to synchronize them with kernel FIBs. + +<p> +Every nettype defines a (kind of) primary key on routes. Every route source can +supply one route for every possible primary key; new route announcement replaces +the old route from the same source, keeping other routes intact. BIRD always +chooses the best route for each primary key among the known routes and keeps the +others as suboptimal. When the best route is retracted, BIRD re-runs the best +route selection algorithm to find the current best route. + +<p> +The global best route selection algorithm is (roughly) as follows: <itemize> - <item>network prefix this route is for (network address and prefix - length -- the number of bits forming the network part of the - address; also known as a netmask) - <item>preference of this route - <item>IP address of router which told us about this route - <item>IP address of router we should forward the packets to using this - route - <item>other attributes common to all routes - <item>dynamic attributes defined by protocols which may or may not be - present (typically protocol metrics) + <item>Preferences of the routes are compared. + <item>Source protocol instance preferences are compared. + <item>If source protocols are the same (e.g. BGP vs. BGP), the protocol's route selection algorithm is invoked. + <item>If source protocols are different (e.g. BGP vs. OSPF), result of the algorithm is undefined. </itemize> -Routing table maintains multiple entries for a network, but at most one entry -for one network and one protocol. The entry with the highest preference is used -for routing (we will call such an entry the <it/selected route/). If there are -more entries with the same preference and they are from the same protocol, the -protocol decides (typically according to metrics). If they aren't, an internal -ordering is used to break the tie. You can get the list of route attributes in -the Route attributes section. - -<p>Each protocol is connected to a routing table through two filters which can -accept, reject and modify the routes. An <it/export/ filter checks routes passed -from the routing table to the protocol, an <it/import/ filter checks routes in -the opposite direction. When the routing table gets a route from a protocol, it -recalculates the selected route and broadcasts it to all protocols connected to -the table. The protocols typically send the update to other routers in the -network. Note that although most protocols are interested in receiving just -selected routes, some protocols (e.g. the <cf/Pipe/ protocol) receive and -process all entries in routing tables (accepted by filters). - -<p><label id="dsc-table-sorted">Usually, a routing table just chooses a selected route -from a list of entries for one network. But if the <cf/sorted/ option is +<p><label id="dsc-table-sorted">Usually, a routing table just chooses a selected +route from a list of entries for one network. But if the <cf/sorted/ option is activated, these lists of entries are kept completely sorted (according to preference or some protocol-dependent metric). This is needed for some features of some protocols (e.g. <cf/secondary/ option of BGP protocol, which allows to @@ -268,6 +263,116 @@ selected route that cannot be described using comparison and ordering). Minor advantage is that routes are shown sorted in <cf/show route/, minor disadvantage is that it is slightly more computationally expensive. +<sect>Routes and network types +<label id="routes"> + +<p>BIRD works with several types of routes. Some of them are typical IP routes, +others are better described as forwarding rules. We call them all routes, +regardless of this difference. + +<p>Every route consists of several attributes (read more about them in the +<ref id="route-attributes" name="Route attributes"> section); the common for all +routes are: + +<itemize> + <item>IP address of router which told us about this route + <item>Source protocol instance + <item>Route preference + <item>Optional attributes defined by protocols +</itemize> + +<p>Other attributes depend on nettypes. Some of them are part of the primary key, these are marked (PK). + +<sect1>IPv4 and IPv6 routes +<label id="ip-routes"> + +<p>The traditional routes. Configuration keywords are <cf/ipv4/ and <cf/ipv6/. + +<itemize> + <item>(PK) Route destination (IP prefix together with its length) + <item>Route next hops (see below) +</itemize> + +<sect1>VPN IPv4 and IPv6 routes +<label id="vpn-routes"> + +<p>Routes for IPv4 and IPv6 with VPN Route Distinguisher (<rfc id="4364">). +Configuration keywords are <cf/vpn4/ and <cf/vpn6/. + +<itemize> + <item>(PK) Route destination (IP prefix together with its length) + <item>(PK) Route distinguisher (according to <rfc id="4364">) + <item>Route next hops +</itemize> + +<sect1>Route Origin Authorization for IPv4 and IPv6 +<label id="roa-routes"> + +<p>These entries can be used to validate route origination of BGP routes. +A ROA entry specifies prefixes which could be originated by an AS number. +Their keywords are <cf/roa4/ and <cf/roa6/. + +<itemize> + <item>(PK) IP prefix together with its length + <item>(PK) Matching prefix maximal length + <item>(PK) AS number +</itemize> + +<sect1>Flowspec for IPv4 and IPv6 +<label id="flow-routes"> + +<p>Flowspec rules are a form of firewall and traffic flow control rules +distributed mostly via BGP. These rules may help the operators stop various +network attacks in the beginning before eating up the whole bandwidth. +Configuration keywords are <cf/flow4/ and <cf/flow6/. + +<itemize> + <item>(PK) IP prefix together with its length + <item>(PK) Flow definition data + <item>Flow action (encoded internally as BGP communities according to <rfc id="5575">) +</itemize> + +<sect1>MPLS switching rules +<label id="mpls-routes"> + +<p>This nettype is currently a stub before implementing more support of <rfc id="3031">. +BIRD currently does not support any label distribution protocol nor any label assignment method. +Only the Kernel, Pipe and Static protocols can use MPLS tables. +Configuration keyword is <cf/mpls/. + +<itemize> + <item>(PK) MPLS label + <item>Route next hops +</itemize> + +<sect1>Route next hops +<label id="route-next-hop"> + +<p>This is not a nettype. The route next hop is a complex attribute common for many +nettypes as you can see before. Every next hop has its assigned device +(either assumed from its IP address or set explicitly). It may have also +an IP address and an MPLS stack (one or both independently). +Maximal MPLS stack depth is set (in compile time) to 8 labels. + +<p>Every route (when eligible to have a next hop) can have more than one next hop. +In that case, every next hop has also its weight. + +<sect>Protocols and channels +<label id="protocols-concept"> + +<p>BIRD protocol is an abstract class of producers and consumers of the routes. +Each protocol may run in multiple instances and bind on one side to route +tables via channels, on the other side to specified listen sockets (BGP), +interfaces (Babel, OSPF, RIP), APIs (Kernel, Direct), or nothing (Static, Pipe). + +<p>There are also two protocols that do not have any channels -- BFD and Device. +Both of them are kind of service for other protocols. + +<p>Each protocol is connected to a routing table through a channel. Some protocols +support only one channel (OSPF, RIP), some protocols support more channels (BGP, Direct). +Each channel has two filters which can accept, reject and modify the routes. +An <it/export/ filter is applied to routes passed from the routing table to the protocol, +an <it/import/ filter is applied to routes in the opposite direction. <sect>Graceful restart <label id="graceful-restart"> @@ -304,10 +409,10 @@ variable number of options, they are grouped using the <cf/{ }/ brackets. Each option is terminated by a <cf/;/. Configuration is case sensitive. There are two ways how to name symbols (like protocol names, filter names, constants etc.). You can either use a simple string starting with a letter followed by any -combination of letters and numbers (e.g. "R123", "myfilter", "bgp5") or you can +combination of letters and numbers (e.g. <cf/R123/, <cf/myfilter/, <cf/bgp5/) or you can enclose the name into apostrophes (<cf/'/) and than you can use any combination -of numbers, letters. hyphens, dots and colons (e.g. "'1:strange-name'", -"'-NAME-'", "'cool::name'"). +of numbers, letters. hyphens, dots and colons (e.g. <cf/'1:strange-name'/, +<cf/'-NAME-'/, <cf/'cool::name'/). <p>Here is an example of a simple config file. It enables synchronization of routing tables with OS kernel, scans for new network interfaces every 10 seconds @@ -336,11 +441,19 @@ protocol rip { <label id="global-opts"> <p><descrip> - <tag><label id="opt-include">include "<m/filename/"</tag> - This statement causes inclusion of a new file. <m/Filename/ could also - be a wildcard, in that case matching files are included in alphabetic - order. The maximal depth is 8. Note that this statement could be used - anywhere in the config file, not just as a top-level option. + <tag><label id="opt-include">include "<m/filename/";</tag> + This statement causes inclusion of a new file. The <m/filename/ could + also be a wildcard, in that case matching files are included in + alphabetic order. The maximal depth is 8. Note that this statement can + be used anywhere in the config file, even inside other options, but + always on the beginning of line. In the following example, the first + semicolon belongs to the <cf/include/, the second to <cf/ipv6 table/. + If the <file/tablename.conf/ contains exactly one token (the name of the + table), this construction is correct: +<code> +ipv6 table +include "tablename.conf";; +</code> <tag><label id="opt-log">log "<m/filename/"|syslog [name <m/name/]|stderr all|{ <m/list of classes/ }</tag> Set logging of messages having the given class (either <cf/all/ or @@ -406,7 +519,7 @@ protocol rip { <cf><m/name2/</cf> You can run more than one instance of most protocols (like RIP or BGP). By default, no instances are configured. - <tag><label id="opt-template">template rip|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag> + <tag><label id="opt-template">template rip|ospf|bgp|<m/.../ [<m/name/ [from <m/name2/]] { <m>protocol options</m> }</tag> Define a protocol template instance called <m/name/ (or with a name like "bgp1" generated automatically if you don't specify any <m/name/). Protocol templates can be used to group common options when many @@ -423,25 +536,15 @@ protocol rip { <tag><label id="opt-router-id">router id <m/IPv4 address/</tag> Set BIRD's router ID. It's a world-wide unique identification of your - router, usually one of router's IPv4 addresses. Default: in IPv4 - version, the lowest IP address of a non-loopback interface. In IPv6 - version, this option is mandatory. + router, usually one of router's IPv4 addresses. Default: the lowest + IPv4 address of a non-loopback interface. <tag><label id="opt-router-id-from">router id from [-] [ "<m/mask/" ] [ <m/prefix/ ] [, <m/.../]</tag> - Set BIRD's router ID based on an IP address of an interface specified by - an interface pattern. The option is applicable for IPv4 version only. + Set BIRD's router ID based on an IPv4 address of an interface specified by + an interface pattern. See <ref id="proto-iface" name="interface"> section for detailed description of interface patterns with extended clauses. - <tag><label id="opt-listen-bgp">listen bgp [address <m/address/] [port <m/port/] [dual]</tag> - This option allows to specify address and port where BGP protocol should - listen. It is global option as listening socket is common to all BGP - instances. Default is to listen on all addresses (0.0.0.0) and port 179. - In IPv6 mode, option <cf/dual/ can be used to specify that BGP socket - should accept both IPv4 and IPv6 connections (but even in that case, - BIRD would accept IPv6 routes only). Such behavior was default in older - versions of BIRD. - <tag><label id="opt-graceful-restart">graceful restart wait <m/number/</tag> During graceful restart recovery, BIRD waits for convergence of routing protocols. This option allows to specify a timeout for the recovery to @@ -456,46 +559,35 @@ protocol rip { used for other commands and <cf/log/ is used in a log file. "<m/format1/" is a format string using <it/strftime(3)/ notation (see - <it/man strftime/ for details). <m/limit> and "<m/format2/" allow to - specify the second format string for times in past deeper than <m/limit/ - seconds. There are few shorthands: <cf/iso long/ is a ISO 8601 date/time - format (YYYY-MM-DD hh:mm:ss) that can be also specified using <cf/"%F %T"/. + <it/man strftime/ for details). It is extended to support sub-second + time part with variable precision (up to microseconds) using "%f" + conversion code (e.g., "%T.%3f" is hh:mm:ss.sss time). <m/limit/ and + "<m/format2/" allow to specify the second format string for times in + past deeper than <m/limit/ seconds. + + There are several shorthands: <cf/iso long/ is a ISO 8601 date/time + format (YYYY-MM-DD hh:mm:ss) that can be also specified using <cf/"%F + %T"/. Similarly, <cf/iso long ms/ and <cf/iso long us/ are ISO 8601 + date/time formats with millisecond or microsecond precision. <cf/iso short/ is a variant of ISO 8601 that uses just the time format (hh:mm:ss) for near times (up to 20 hours in the past) and the date - format (YYYY-MM-DD) for far times. This is a shorthand for - <cf/"%T" 72000 "%F"/. + format (YYYY-MM-DD) for far times. This is a shorthand for <cf/"%T" + 72000 "%F"/. And there are also <cf/iso short ms/ and <cf/iso short us/ + high-precision variants of that. - By default, BIRD uses the <cf/iso short/ format for <cf/route/ and - <cf/protocol/ times, and the <cf/iso long/ format for <cf/base/ and + By default, BIRD uses the <cf/iso short ms/ format for <cf/route/ and + <cf/protocol/ times, and the <cf/iso long ms/ format for <cf/base/ and <cf/log/ times. - In pre-1.4.0 versions, BIRD used an short, ad-hoc format for <cf/route/ - and <cf/protocol/ times, and a <cf/iso long/ similar format (DD-MM-YYYY - hh:mm:ss) for <cf/base/ and <cf/log/. These timeformats could be set by - <cf/old short/ and <cf/old long/ compatibility shorthands. - - <tag><label id="opt-table">table <m/name/ [sorted]</tag> - Create a new routing table. The default routing table is created - implicitly, other routing tables have to be added by this command. - Option <cf/sorted/ can be used to enable sorting of routes, see - <ref id="dsc-table-sorted" name="sorted table"> description for details. - - <tag><label id="opt-roa-table">roa table <m/name/ [ { <m/roa table options .../ } ]</tag> - Create a new ROA (Route Origin Authorization) table. ROA tables can be - used to validate route origination of BGP routes. A ROA table contains - ROA entries, each consist of a network prefix, a max prefix length and - an AS number. A ROA entry specifies prefixes which could be originated - by that AS number. ROA tables could be filled with data from RPKI (<rfc - id="6480">) or from public databases like Whois. ROA tables are - examined by <cf/roa_check()/ operator in filters. - - Currently, there is just one option, <cf>roa <m/prefix/ max <m/num/ as - <m/num/</cf>, which can be used to populate the ROA table with static - ROA entries. The option may be used multiple times. Other entries can be - added dynamically by <cf/add roa/ command. + <tag><label id="opt-table"><m/nettype/ table <m/name/ [sorted]</tag> + Create a new routing table. The default routing tables <cf/master4/ and + <cf/master6/ are created implicitly, other routing tables have to be + added by this command. Option <cf/sorted/ can be used to enable sorting + of routes, see <ref id="dsc-table-sorted" name="sorted table"> + description for details. <tag><label id="opt-eval">eval <m/expr/</tag> - Evaluates given filter expression. It is used by us for testing of filters. + Evaluates given filter expression. It is used by the developers for testing of filters. </descrip> @@ -513,10 +605,6 @@ disable it. An empty <m/switch/ is equivalent to <cf/on/ ("silence means agreement"). <descrip> - <tag><label id="proto-preference">preference <m/expr/</tag> - Sets the preference of routes generated by this protocol. Default: - protocol dependent. - <tag><label id="proto-disabled">disabled <m/switch/</tag> Disables the protocol. You can change the disable/enable status from the command line interface without needing to touch the configuration. @@ -547,58 +635,10 @@ agreement"). This option can be used to override global router id for a given protocol. Default: uses global router id. - <tag><label id="proto-import">import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/filter expression/</tag> - Specify a filter to be used for filtering routes coming from the - protocol to the routing table. <cf/all/ is shorthand for <cf/where true/ - and <cf/none/ is shorthand for <cf/where false/. Default: <cf/all/. - - <tag><label id="proto-export">export <m/filter/</tag> - This is similar to the <cf>import</cf> keyword, except that it works in - the direction from the routing table to the protocol. Default: <cf/none/. - - <tag><label id="proto-import-keep-filtered">import keep filtered <m/switch/</tag> - Usually, if an import filter rejects a route, the route is forgotten. - When this option is active, these routes are kept in the routing table, - but they are hidden and not propagated to other protocols. But it is - possible to show them using <cf/show route filtered/. Note that this - option does not work for the pipe protocol. Default: off. - - <tag><label id="proto-import-limit">import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> - Specify an import route limit (a maximum number of routes imported from - the protocol) and optionally the action to be taken when the limit is - hit. Warn action just prints warning log message. Block action discards - new routes coming from the protocol. Restart and disable actions shut - the protocol down like appropriate commands. Disable is the default - action if an action is not explicitly specified. Note that limits are - reset during protocol reconfigure, reload or restart. Default: <cf/off/. - - <tag><label id="proto-receive-limit">receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> - Specify an receive route limit (a maximum number of routes received from - the protocol and remembered). It works almost identically to <cf>import - limit</cf> option, the only difference is that if <cf/import keep - filtered/ option is active, filtered routes are counted towards the - limit and blocked routes are forgotten, as the main purpose of the - receive limit is to protect routing tables from overflow. Import limit, - on the contrary, counts accepted routes only and routes blocked by the - limit are handled like filtered routes. Default: <cf/off/. - - <tag><label id="proto-export-limit">export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag> - Specify an export route limit, works similarly to the <cf>import - limit</cf> option, but for the routes exported to the protocol. This - option is experimental, there are some problems in details of its - behavior -- the number of exported routes can temporarily exceed the - limit without triggering it during protocol reload, exported routes - counter ignores route blocking and block action also blocks route - updates of already accepted routes -- and these details will probably - change in the future. Default: <cf/off/. - <tag><label id="proto-description">description "<m/text/"</tag> This is an optional description of the protocol. It is displayed as a part of the output of 'show route all' command. - <tag><label id="proto-table">table <m/name/</tag> - Connect this protocol to a non-default routing table. - <tag><label id="proto-vrf">vrf "<m/text/"</tag> Associate the protocol with specific VRF. The protocol will be restricted to interfaces assigned to the VRF and will use sockets bound @@ -607,6 +647,12 @@ agreement"). <cf/table/ option. Note that the VRF support in BIRD and Linux kernel (4.11) is still in development and is currently problematic outside of multihop BGP. + + <tag><label id="proto-channel"><m/channel name/ [{<m/channel config/}]</tag> + Every channel must be explicitly stated. See the protocol-specific + configuration for the list of supported channel names. See the + <ref id="channel-opts" name="channel configuration section"> for channel + definition. </descrip> <p>There are several options that give sense only with certain protocols: @@ -635,8 +681,8 @@ agreement"). options, in that case for given interface the first matching interface option is used. - This option is allowed in Babel, BFD, Direct, OSPF, RAdv and RIP - protocols, but in OSPF protocol it is used in the <cf/area/ subsection. + This option is allowed in Babel, BFD, Device, Direct, OSPF, RAdv and RIP + protocols. In OSPF protocol it is used in the <cf/area/ subsection. Default: none. @@ -724,6 +770,90 @@ agreement"). </descrip> + +<sect>Channel options +<label id="channel-opts"> + +<p>Every channel belongs to a protocol and is configured inside its block. The +minimal channel config is empty, then it uses the default values. The name of +the channel implies its nettype. + +<descrip> + <tag><label id="proto-table">table <m/name/</tag> + Specify a table to which the channel is connected. Default: the first + table of given nettype. + + <tag><label id="proto-preference">preference <m/expr/</tag> + Sets the preference of routes generated by the protocol and imported + through this channel. Default: protocol dependent. + + <tag><label id="proto-import">import all | none | filter <m/name/ | filter { <m/filter commands/ } | where <m/boolean filter expression/</tag> + Specify a filter to be used for filtering routes coming from the + protocol to the routing table. <cf/all/ is for keeping all routes, + <cf/none/ is for dropping all routes. Default: <cf/all/. + + <tag><label id="proto-export">export <m/filter/</tag> + This is similar to the <cf>import</cf> keyword, except that it works in + the direction from the routing table to the protocol. Default: <cf/none/. + + <tag><label id="proto-import-keep-filtered">import keep filtered <m/switch/</tag> + Usually, if an import filter rejects a route, the route is forgotten. + When this option is active, these routes are kept in the routing table, + but they are hidden and not propagated to other protocols. But it is + possible to show them using <cf/show route filtered/. Note that this + option does not work for the pipe protocol. Default: off. + + <tag><label id="proto-import-limit">import limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> + Specify an import route limit (a maximum number of routes imported from + the protocol) and optionally the action to be taken when the limit is + hit. Warn action just prints warning log message. Block action discards + new routes coming from the protocol. Restart and disable actions shut + the protocol down like appropriate commands. Disable is the default + action if an action is not explicitly specified. Note that limits are + reset during protocol reconfigure, reload or restart. Default: <cf/off/. + + <tag><label id="proto-receive-limit">receive limit [<m/number/ | off ] [action warn | block | restart | disable]</tag> + Specify an receive route limit (a maximum number of routes received from + the protocol and remembered). It works almost identically to <cf>import + limit</cf> option, the only difference is that if <cf/import keep + filtered/ option is active, filtered routes are counted towards the + limit and blocked routes are forgotten, as the main purpose of the + receive limit is to protect routing tables from overflow. Import limit, + on the contrary, counts accepted routes only and routes blocked by the + limit are handled like filtered routes. Default: <cf/off/. + + <tag><label id="proto-export-limit">export limit [ <m/number/ | off ] [action warn | block | restart | disable]</tag> + Specify an export route limit, works similarly to the <cf>import + limit</cf> option, but for the routes exported to the protocol. This + option is experimental, there are some problems in details of its + behavior -- the number of exported routes can temporarily exceed the + limit without triggering it during protocol reload, exported routes + counter ignores route blocking and block action also blocks route + updates of already accepted routes -- and these details will probably + change in the future. Default: <cf/off/. +</descrip> + +<p>This is a trivial example of RIP configured for IPv6 on all interfaces: +<code> +protocol rip ng { + ipv6; + interface "*"; +} +</code> + +<p>And this is a non-trivial example. +<code> +protocol rip ng { + ipv6 { + table mytable6; + import filter { ... }; + export filter { ... }; + import limit 50; + }; + interface "*"; +} +</code> + <chapt>Remote control <label id="remote-control"> @@ -764,6 +894,7 @@ This argument can be omitted if there exists only a single instance. and protocol status, possibly giving verbose information, if <cf/all/ is specified. + <!-- TODO: Move these protocol-specific remote control commands to the protocol sections --> <tag><label id="cli-show-ospf-iface">show ospf interface [<m/name/] ["<m/interface/"]</tag> Show detailed information about OSPF interfaces. @@ -802,9 +933,8 @@ This argument can be omitted if there exists only a single instance. Show the list of symbols defined in the configuration (names of protocols, routing tables etc.). - <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table <m/t/] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [<m/options/]</tag> - Show contents of a routing table (by default of the main one or the - table attached to a respective protocol), that is routes, their metrics + <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table (<m/t/ | all)] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag> + Show contents of specified routing tables, that is routes, their metrics and (in case the <cf/all/ switch is given) all their attributes. <p>You can specify a <m/prefix/ if you want to print routes for a @@ -814,20 +944,31 @@ This argument can be omitted if there exists only a single instance. the selected one at the top, unless <cf/primary/ is given in which case only the selected route is shown. + <p>The <cf/show route/ command can process one or multiple routing + tables. The set of selected tables is determined on three levels: First, + tables can be explicitly selected by <cf/table/ switch, which could be + used multiple times, all tables are specified by <cf/table all/. Second, + tables can be implicitly selected by channels or protocols that are + arguments of several other switches (e.g., <cf/export/, <cf/protocol/). + Last, the set of default tables is used: <cf/master4/, <cf/master6/ and + each first table of any other network type. + <p>You can also ask for printing only routes processed and accepted by a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ } </cf> or matching a given condition (<cf>where <m/condition/</cf>). The <cf/export/, <cf/preexport/ and <cf/noexport/ switches ask for - printing of routes that are exported to the specified protocol. - With <cf/preexport/, the export filter of the protocol is skipped. - With <cf/noexport/, routes rejected by the export filter are printed - instead. Note that routes not exported to the protocol for other reasons + printing of routes that are exported to the specified protocol or + channel. With <cf/preexport/, the export filter of the channel is + skipped. With <cf/noexport/, routes rejected by the export filter are + printed instead. Note that routes not exported for other reasons (e.g. secondary routes or routes imported from that protocol) are not - printed even with <cf/noexport/. + printed even with <cf/noexport/. These switches also imply that + associated routing tables are selected instead of default ones. <p>You can also select just routes added by a specific protocol. - <cf>protocol <m/p/</cf>. + <cf>protocol <m/p/</cf>. This switch also implies that associated + routing tables are selected instead of default ones. <p>If BIRD is configured to keep filtered routes (see <cf/import keep filtered/ option), you can show them instead of routes by using @@ -837,27 +978,6 @@ This argument can be omitted if there exists only a single instance. number of networks, number of routes before and after filtering). If you use <cf/count/ instead, only the statistics will be printed. - <tag><label id="cli-show-roa">show roa [<m/prefix/ | in <m/prefix/ | for <m/prefix/] [as <m/num/] [table <m/t/]</tag> - Show contents of a ROA table (by default of the first one). You can - specify a <m/prefix/ to print ROA entries for a specific network. If you - use <cf>for <m/prefix/</cf>, you'll get all entries relevant for route - validation of the network prefix; i.e., ROA entries whose prefixes cover - the network prefix. Or you can use <cf>in <m/prefix/</cf> to get ROA - entries covered by the network prefix. You could also use <cf/as/ option - to show just entries for given AS. - - <tag><label id="cli-add-roa">add roa <m/prefix/ max <m/num/ as <m/num/ [table <m/t/]</tag> - Add a new ROA entry to a ROA table. Such entry is called <it/dynamic/ - compared to <it/static/ entries specified in the config file. These - dynamic entries survive reconfiguration. - - <tag><label id="cli-delete-roa">delete roa <m/prefix/ max <m/num/ as <m/num/ [table <m/t/]</tag> - Delete the specified ROA entry from a ROA table. Only dynamic ROA - entries (i.e., the ones added by <cf/add roa/ command) can be deleted. - - <tag><label id="cli-flush-roa">flush roa [table <m/t/]</tag> - Remove all dynamic ROA entries from a ROA table. - <tag><label id="cli-configure">configure [soft] ["<m/config file/"] [timeout [<m/num/]]</tag> Reload configuration from a given file. BIRD will smoothly switch itself to the new configuration, protocols are reconfigured if possible, @@ -931,7 +1051,6 @@ This argument can be omitted if there exists only a single instance. Evaluate given expression. </descrip> - <chapt>Filters <label id="filters"> @@ -1062,22 +1181,51 @@ foot). a shell pattern (represented also as a string). <tag><label id="type-ip">ip</tag> - This type can hold a single IP address. Depending on the compile-time - configuration of BIRD you are using, it is either an IPv4 or IPv6 - address. IP addresses are written in the standard notation - (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special operator - <cf>.mask(<M>num</M>)</cf> on values of type ip. It masks out all but - first <cf><M>num</M></cf> bits from the IP address. So + This type can hold a single IP address. The IPv4 addresses are stored as + IPv4-Mapped IPv6 addresses so one data type for both of them is used. + Whether the address is IPv4 or not may be checked by <cf>.is_ip4</cf> + which returns <cf/bool/. IP addresses are written in the standard + notation (<cf/10.20.30.40/ or <cf/fec0:3:4::1/). You can apply special + operator <cf>.mask(<M>num</M>)</cf> on values of type ip. It masks out + all but first <cf><M>num</M></cf> bits from the IP address. So <cf/1.2.3.4.mask(8) = 1.0.0.0/ is true. <tag><label id="type-prefix">prefix</tag> - This type can hold a network prefix consisting of IP address and prefix - length. Prefix literals are written as <cf><m/ipaddress//<m/pxlen/</cf>, + This type can hold a network prefix consisting of IP address, prefix + length and several other values. This is the key in route tables. + + Prefixes may be of several types, which can be determined by the special + operator <cf/.type/. The type may be: + + <cf/NET_IP4/ and <cf/NET_IP6/ prefixes hold an IP prefix. The literals + are written as <cf><m/ipaddress//<m/pxlen/</cf>, or <cf><m>ipaddress</m>/<m>netmask</m></cf>. There are two special - operators on prefixes: <cf/.ip/ which extracts the IP address from the + operators on these: <cf/.ip/ which extracts the IP address from the pair, and <cf/.len/, which separates prefix length from the pair. So <cf>1.2.0.0/16.len = 16</cf> is true. + <cf/NET_VPN4/ and <cf/NET_VPN6/ prefixes hold an IP prefix with VPN + Route Distinguisher (<rfc id="4364">). They support the same special + operators as IP prefixes, and also <cf/.rd/ which extracts the Route + Distinguisher. Their literals are written + as <cf><m/vpnrd/ <m/ipprefix/</cf> + + <cf/NET_ROA4/ and <cf/NET_ROA6/ prefixes hold an IP prefix range + together with an ASN. They support the same special operators as IP + prefixes, and also <cf/.maxlen/ which extracts maximal prefix length, + and <cf/.asn/ which extracts the ASN. + + <cf/NET_FLOW4/ and <cf/NET_FLOW6/ hold an IP prefix together with a + flowspec rule. Filters currently don't support flowspec parsing. + + <cf/NET_MPLS/ holds a single MPLS label and its handling is currently + not implemented. + + <tag><label id="type-vpnrd">vpnrd</tag> + This is a route distinguisher according to <rfc id="4364">. There are + three kinds of RD's: <cf><m/asn/:<m/32bit int/</cf>, <cf><m/asn4/:<m/16bit int/</cf> + and <cf><m/IPv4 address/:<m/32bit int/</cf> + <tag><label id="type-ec">ec</tag> This is a specialized type used to represent BGP extended community values. It is essentially a 64bit value, literals of this type are @@ -1174,6 +1322,10 @@ foot). <cf>192.168.0.0/16{16,24}</cf> and <cf>192.168.0.0/16 ge 24</cf> as <cf>192.168.0.0/16{24,32}</cf>. + It is possible to mix IPv4 and IPv6 prefixes/addresses in a prefix/ip set + but its behavior may change between versions without any warning; don't do + it unless you are more than sure what you are doing. (Really, don't do it.) + <tag><label id="type-enum">enum</tag> Enumeration types are fixed sets of possibilities. You can't define your own variables of such type, but some route attributes are of enumeration @@ -1196,7 +1348,7 @@ foot). <cf><m/P/.len</cf> returns the length of path <m/P/. - <cf><m/P/.empty</cf> resets path <m/P/ to empty path. + <cf><m/P/.empty</cf> makes the path <m/P/ empty. <cf>prepend(<m/P/,<m/A/)</cf> prepends ASN <m/A/ to path <m/P/ and returns the result. @@ -1225,8 +1377,6 @@ foot). expressions can also contain integer expressions enclosed in parenthesis and integer variables, for example <tt>[= * 4 (1+2) a =]</tt>. You can also use ranges, for example <tt>[= * 3..5 2 100..200 * =]</tt>. - There is also old (deprecated) syntax that uses / .. / instead of [= .. =] - and ? instead of *. <tag><label id="type-clist">clist</tag> Clist is similar to a set, except that unlike other sets, it can be @@ -1236,7 +1386,7 @@ foot). <cf><m/C/.len</cf> returns the length of clist <m/C/. - <cf><m/C/.empty</cf> resets clist <m/C/ to empty clist. + <cf><m/C/.empty</cf> makes the list <m/C/ empty. <cf>add(<m/C/,<m/P/)</cf> adds pair (or quad) <m/P/ to clist <m/C/ and returns the result. If item <m/P/ is already in clist <m/C/, it does @@ -1266,7 +1416,7 @@ foot). <cf/!˜/ membership operators) can be used to modify or test eclists, with ECs instead of pairs as arguments. - <tag/lclist/ + <tag><label id="type-lclist">lclist/</tag> Lclist is a data type used for BGP large community lists. Like eclists, lclists are very similar to clists, but they are sets of LCs instead of pairs. The same operations (like <cf/add/, <cf/delete/ or <cf/˜/ @@ -1274,13 +1424,12 @@ foot). lclists, with LCs instead of pairs as arguments. </descrip> - <sect>Operators <label id="operators"> <p>The filter language supports common integer operators <cf>(+,-,*,/)</cf>, parentheses <cf/(a*(b+c))/, comparison <cf/(a=b, a!=b, a<b, a>=b)/. -Logical operations include unary not (<cf/!/), and (<cf/&&/) and or +Logical operations include unary not (<cf/!/), and (<cf/&&/), and or (<cf/||/). Special operators include (<cf/˜/, <cf/!˜/) for "is (not) element of a set" operation - it can be used on element and set of elements of the same type (returning true if element is @@ -1311,11 +1460,11 @@ prefix and an ASN as arguments. <p>Filters support two control structures: conditions and case switches. -<p>Syntax of a condition is: <cf>if <M>boolean expression</M> then <m/command1/; -else <m/command2/;</cf> and you can use <cf>{ <m/command_1/; <m/command_2/; +<p>Syntax of a condition is: <cf>if <M>boolean expression</M> then <m/commandT/; +else <m/commandF/;</cf> and you can use <cf>{ <m/command1/; <m/command2/; <M>...</M> }</cf> instead of either command. The <cf>else</cf> clause may be -omitted. If the <cf><m>boolean expression</m></cf> is true, <m/command1/ is -executed, otherwise <m/command2/ is executed. +omitted. If the <cf><m>boolean expression</m></cf> is true, <m/commandT/ is +executed, otherwise <m/commandF/ is executed. <p>The <cf>case</cf> is similar to case from Pascal. Syntax is <cf>case <m/expr/ { else: | <m/num_or_prefix [ .. num_or_prefix]/: <m/statement/ ; [ @@ -1354,8 +1503,9 @@ clist for most purposes. <descrip> <tag><label id="rta-net"><m/prefix/ net</tag> - Network the route is talking about. Read-only. (See the chapter about - routing tables.) + The network prefix or anything else the route is talking about. The + primary key of the routing table. Read-only. (See the <ref id="routes" + name="chapter about routes">.) <tag><label id="rta-scope"><m/enum/ scope</tag> The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes @@ -1386,11 +1536,6 @@ clist for most purposes. <cf/RTS_OSPF_IA/, <cf/RTS_OSPF_EXT1/, <cf/RTS_OSPF_EXT2/, <cf/RTS_BGP/, <cf/RTS_PIPE/, <cf/RTS_BABEL/. - <tag><label id="rta-cast"><m/enum/ cast</tag> - Route type (Currently <cf/RTC_UNICAST/ for normal routes, - <cf/RTC_BROADCAST/, <cf/RTC_MULTICAST/, <cf/RTC_ANYCAST/ will be used in - the future for broadcast, multicast and anycast routes). Read-only. - <tag><label id="rta-dest"><m/enum/ dest</tag> Type of destination the packets should be sent to (<cf/RTD_ROUTER/ for forwarding to a neighboring router, @@ -1422,7 +1567,7 @@ clist for most purposes. 1 metric. </descrip> -<p>There also exist some protocol-specific attributes which are described in the +<p>There also exist protocol-specific attributes which are described in the corresponding protocol sections. @@ -1467,13 +1612,12 @@ networks. Babel is conceptually very simple in its operation and "just works" in its default configuration, though some configuration is possible and in some cases desirable. -<p>While the Babel protocol is dual stack (i.e., can carry both IPv4 and IPv6 -routes over the same IPv6 transport), BIRD presently implements only the IPv6 -subset of the protocol. No Babel extensions are implemented, but the BIRD -implementation can coexist with implementations using the extensions (and will -just ignore extension messages). +<p>The Babel protocol is dual stack; i.e., it can carry both IPv4 and IPv6 +routes over the same IPv6 transport. For sending and receiving Babel packets, +only a link-local IPv6 address is needed. -<p>The Babel protocol implementation in BIRD is currently in alpha stage. +<p>BIRD does not implement any Babel extensions, but will coexist with +implementations using extensions (and will just ignore extension messages). <sect1>Configuration <label id="babel-config"> @@ -1483,45 +1627,64 @@ other protocols, but supports the following per-interface configuration options: <code> protocol babel [<name>] { + ipv4 { <channel config> }; + ipv6 { <channel config> }; interface <interface pattern> { type <wired|wireless>; rxcost <number>; - hello interval <number>; - update interval <number>; + limit <number>; + hello interval <time>; + update interval <time>; port <number>; tx class|dscp <number>; tx priority <number>; rx buffer <number>; tx length <number>; check link <switch>; + next hop ipv4 <address>; + next hop ipv6 <address>; }; } </code> <descrip> + <tag><label id="babel-channel">ipv4|ipv6 <m/channel config/</tag> + The supported channels are IPv4 and IPv6. + <tag><label id="babel-type">type wired|wireless </tag> - This option specifies the interface type: Wired or wireless. Wired - interfaces are considered more reliable, and so the default hello - interval is higher, and a neighbour is considered unreachable after only - a small number of "hello" packets are lost. On wireless interfaces, - hello packets are sent more often, and the ETX link quality estimation - technique is used to compute the metrics of routes discovered over this - interface. This technique will gradually degrade the metric of routes - when packets are lost rather than the more binary up/down mechanism of - wired type links. Default: <cf/wired/. + This option specifies the interface type: Wired or wireless. On wired + interfaces a neighbor is considered unreachable after a small number of + Hello packets are lost, as described by <cf/limit/ option. On wireless + interfaces the ETX link quality estimation technique is used to compute + the metrics of routes discovered over this interface. This technique will + gradually degrade the metric of routes when packets are lost rather than + the more binary up/down mechanism of wired type links. Default: + <cf/wired/. <tag><label id="babel-rxcost">rxcost <m/num/</tag> - This specifies the RX cost of the interface. The route metrics will be - computed from this value with a mechanism determined by the interface - <cf/type/. Default: 96 for wired interfaces, 256 for wireless. - - <tag><label id="babel-hello">hello interval <m/num/</tag> - Interval at which periodic "hello" messages are sent on this interface, - in seconds. Default: 4 seconds. - - <tag><label id="babel-update">update interval <m/num/</tag> - Interval at which periodic (full) updates are sent. Default: 4 times the - hello interval. + This option specifies the nominal RX cost of the interface. The effective + neighbor costs for route metrics will be computed from this value with a + mechanism determined by the interface <cf/type/. Note that in contrast to + other routing protocols like RIP or OSPF, the <cf/rxcost/ specifies the + cost of RX instead of TX, so it affects primarily neighbors' route + selection and not local route selection. Default: 96 for wired interfaces, + 256 for wireless. + + <tag><label id="babel-limit">limit <m/num/</tag> + BIRD keeps track of received Hello messages from each neighbor to + establish neighbor reachability. For wired type interfaces, this option + specifies how many of last 16 hellos have to be correctly received in + order to neighbor is assumed to be up. The option is ignored on wireless + type interfaces, where gradual cost degradation is used instead of sharp + limit. Default: 12. + + <tag><label id="babel-hello">hello interval <m/time/ s|ms</tag> + Interval at which periodic Hello messages are sent on this interface, + with time units. Default: 4 seconds. + + <tag><label id="babel-update">update interval <m/time/ s|ms</tag> + Interval at which periodic (full) updates are sent, with time + units. Default: 4 times the hello interval. <tag><label id="babel-port">port <m/number/</tag> This option selects an UDP port to operate on. The default is to operate @@ -1551,6 +1714,16 @@ protocol babel [<name>] { routes received from them are withdrawn. It is possible that some hardware drivers or platforms do not implement this feature. Default: yes. + + <tag><label id="babel-next-hop-ipv4">next hop ipv4 <m/address/</tag> + Set the next hop address advertised for IPv4 routes advertised on this + interface. Default: the preferred IPv4 address of the interface. + + <tag><label id="babel-next-hop-ipv6">next hop ipv6 <m/address/</tag> + Set the next hop address advertised for IPv6 routes advertised on this + interface. If not set, the same link-local address that is used as the + source for Babel packets will be used. In normal operation, it should not + be necessary to set this option. </descrip> <sect1>Attributes @@ -1579,10 +1752,22 @@ protocol babel { # configured on local interfaces, plus re-distribute all routes received # from other babel peers. - export where (source = RTS_DEVICE) || (source = RTS_BABEL); + ipv4 { + export where (source = RTS_DEVICE) || (source = RTS_BABEL); + }; + ipv6 { + export where (source = RTS_DEVICE) || (source = RTS_BABEL); + }; } </code> +<sect1>Known issues +<label id="babel-issues"> + +<p>When retracting a route, Babel generates an unreachable route for a little +while (according to RFC). The interaction of this behavior with other protocols +is not well tested and strange things may happen. + <sect>BFD <label id="bfd"> @@ -1611,10 +1796,7 @@ the BFD session went down). advanced features like the echo mode or authentication are not implemented), IP transport for BFD as defined in <rfc id="5881"> and <rfc id="5883"> and interaction with client protocols as defined in <rfc id="5882">. - -<p>Note that BFD implementation in BIRD is currently a new feature in -development, expect some rough edges and possible UI and configuration changes -in the future. Also note that we currently support at most one protocol instance. +We currently support at most one protocol instance. <p>BFD packets are sent with a dynamic source port number. Linux systems use by default a bit different dynamic port range than the IANA approved one @@ -1825,17 +2007,41 @@ table it wishes to export along with complete path information (a list of AS'es the packet will travel through if it uses the particular route) in order to avoid routing loops. -<p>BIRD supports all requirements of the BGP4 standard as defined in -<rfc id="4271"> It also supports the community attributes (<rfc id="1997">), -capability negotiation (<rfc id="5492">), MD5 password authentication (<rfc -id="2385">), extended communities (<rfc id="4360">), route reflectors (<rfc -id="4456">), graceful restart (<rfc id="4724">), multiprotocol extensions -(<rfc id="4760">), 4B AS numbers (<rfc id="4893">), and 4B AS numbers in -extended communities (<rfc id="5668">). - +<sect1>Supported standards +<label id="bgp-standards"> -For IPv6, it uses the standard multiprotocol extensions defined in -<rfc id="4760"> and applied to IPv6 according to <rfc id="2545">. +<p> +<itemize> +<item> <rfc id="4271"> - Border Gateway Protocol 4 (BGP) +<item> <rfc id="1997"> - BGP Communities Attribute +<item> <rfc id="2385"> - Protection of BGP Sessions via TCP MD5 Signature +<item> <rfc id="2545"> - Use of BGP Multiprotocol Extensions for IPv6 +<item> <rfc id="2918"> - Route Refresh Capability +<item> <rfc id="3107"> - Carrying Label Information in BGP +<item> <rfc id="4360"> - BGP Extended Communities Attribute +<item> <rfc id="4364"> - BGP/MPLS IPv4 Virtual Private Networks +<item> <rfc id="4456"> - BGP Route Reflection +<item> <rfc id="4486"> - Subcodes for BGP Cease Notification Message +<item> <rfc id="4659"> - BGP/MPLS IPv6 Virtual Private Networks +<item> <rfc id="4724"> - Graceful Restart Mechanism for BGP +<item> <rfc id="4760"> - Multiprotocol extensions for BGP +<item> <rfc id="4798"> - Connecting IPv6 Islands over IPv4 MPLS +<item> <rfc id="5065"> - AS confederations for BGP +<item> <rfc id="5082"> - Generalized TTL Security Mechanism +<item> <rfc id="5492"> - Capabilities Advertisement with BGP +<item> <rfc id="5549"> - Advertising IPv4 NLRI with an IPv6 Next Hop +<item> <rfc id="5575"> - Dissemination of Flow Specification Rules +<item> <rfc id="5668"> - 4-Octet AS Specific BGP Extended Community +<item> <rfc id="6286"> - AS-Wide Unique BGP Identifier +<item> <rfc id="6608"> - Subcodes for BGP Finite State Machine Error +<item> <rfc id="6793"> - BGP Support for 4-Octet AS Numbers +<item> <rfc id="7313"> - Enhanced Route Refresh Capability for BGP +<item> <rfc id="7606"> - Revised Error Handling for BGP UPDATE Messages +<item> <rfc id="7911"> - Advertisement of Multiple Paths in BGP +<item> <rfc id="7947"> - Internet Exchange BGP Route Server +<item> <rfc id="8092"> - BGP Large Communities Attribute +<item> <rfc id="8203"> - BGP Administrative Shutdown Communication +</itemize> <sect1>Route selection rules <label id="bgp-route-select-rules"> @@ -1868,8 +2074,8 @@ determine immediate next hops for routes and to know their internal distances to boundary routers for the purpose of BGP route selection. In BIRD, there is usually one routing table used for both IGP routes and BGP routes. -<sect1>Configuration -<label id="bgp-config"> +<sect1>Protocol configuration +<label id="bgp-proto-config"> <p>Each instance of the BGP corresponds to one neighboring router. This allows to set routing policy and all the other parameters differently for each neighbor @@ -1924,58 +2130,22 @@ using the following configuration parameters: source address for the BGP session. Default: the address of the local end of the interface our neighbor is connected to. - <tag><label id="bgp-next-hop-self">next hop self</tag> - Avoid calculation of the Next Hop attribute and always advertise our own - source address as a next hop. This needs to be used only occasionally to - circumvent misconfigurations of other routers. Default: disabled. - - <tag><label id="bgp-next-hop-keep">next hop keep</tag> - Forward the received Next Hop attribute even in situations where the - local address should be used instead, like when the route is sent to an - interface with a different subnet. Default: disabled. - - <tag><label id="bgp-missing-lladdr">missing lladdr self|drop|ignore</tag> - Next Hop attribute in BGP-IPv6 sometimes contains just the global IPv6 - address, but sometimes it has to contain both global and link-local IPv6 - addresses. This option specifies what to do if BIRD have to send both - addresses but does not know link-local address. This situation might - happen when routes from other protocols are exported to BGP, or when - improper updates are received from BGP peers. <cf/self/ means that BIRD - advertises its own local address instead. <cf/drop/ means that BIRD - skips that prefixes and logs error. <cf/ignore/ means that BIRD ignores - the problem and sends just the global address (and therefore forms - improper BGP update). Default: <cf/self/, unless BIRD is configured as a - route server (option <cf/rs client/), in that case default is <cf/ignore/, - because route servers usually do not forward packets themselves. - - <tag><label id="bgp-gateway">gateway direct|recursive</tag> - For received routes, their <cf/gw/ (immediate next hop) attribute is - computed from received <cf/bgp_next_hop/ attribute. This option - specifies how it is computed. Direct mode means that the IP address from - <cf/bgp_next_hop/ is used if it is directly reachable, otherwise the - neighbor IP address is used. Recursive mode means that the gateway is - computed by an IGP routing table lookup for the IP address from - <cf/bgp_next_hop/. Note that there is just one level of indirection in - recursive mode - the route obtained by the lookup must not be recursive - itself, to prevent mutually recursive routes. - - Recursive mode is the behavior specified by the BGP - standard. Direct mode is simpler, does not require any routes in a - routing table, and was used in older versions of BIRD, but does not - handle well nontrivial iBGP setups and multihop. Recursive mode is - incompatible with <ref id="dsc-table-sorted" name="sorted tables">. Default: - <cf/direct/ for direct sessions, <cf/recursive/ for multihop sessions. - - <tag><label id="bgp-igp-table">igp table <m/name/</tag> - Specifies a table that is used as an IGP routing table. Default: the - same as the table BGP is connected to. + <tag><label id="bgp-strict-bind">strict bind <m/switch/</tag> + Specify whether BGP listening socket should be bound to a specific local + address (the same as the <cf/source address/) and associated interface, + or to all addresses. Binding to a specific address could be useful in + cases like running multiple BIRD instances on a machine, each using its + IP address. Note that listening sockets bound to a specific address and + to all addresses collide, therefore either all BGP protocols (of the + same address family and using the same local port) should have set + <cf/strict bind/, or none of them. Default: disabled. <tag><label id="bgp-check-link">check link <M>switch</M></tag> BGP could use hardware link state into consideration. If enabled, BIRD tracks the link state of the associated interface and when link disappears (e.g. an ethernet cable is unplugged), the BGP session is immediately shut down. Note that this option cannot be used with - multihop BGP. Default: disabled. + multihop BGP. Default: enabled for direct BGP, disabled otherwise. <tag><label id="bgp-bfd">bfd <M>switch</M></tag> BGP could use BFD protocol as an advisory mechanism for neighbor @@ -1996,7 +2166,7 @@ using the following configuration parameters: Note that full (ICMP protection, for example) <rfc id="5082"> support is provided by Linux only. Default: disabled. - <tag><label id="bgp-pass">password <m/string/</tag> + <tag><label id="bgp-password">password <m/string/</tag> Use this password for MD5 authentication of BGP sessions (<rfc id="2385">). When used on BSD systems, see also <cf/setkey/ option below. Default: no authentication. @@ -2017,6 +2187,21 @@ using the following configuration parameters: accepting incoming connections. In passive mode, outgoing connections are not initiated. Default: off. + <tag><label id="bgp-confederation">confederation <m/number/</tag> + BGP confederations (<rfc id="5065">) are collections of autonomous + systems that act as one entity to external systems, represented by one + confederation identifier (instead of AS numbers). This option allows to + enable BGP confederation behavior and to specify the local confederation + identifier. When BGP confederations are used, all BGP speakers that are + members of the BGP confederation should have the same confederation + identifier configured. Default: 0 (no confederation). + + <tag><label id="bgp-confederation-member">confederation member <m/switch/</tag> + When BGP confederations are used, this option allows to specify whether + the BGP neighbor is a member of the same confederation as the local BGP + speaker. The option is unnecessary (and ignored) for IBGP sessions, as + the same AS number implies the same confederation. Default: no. + <tag><label id="bgp-rr-client">rr client</tag> Be a route reflector and treat the neighbor as a route reflection client. Default: disabled. @@ -2039,24 +2224,6 @@ using the following configuration parameters: example does not prepend its AS number to AS PATH attribute and keeps MED attribute). Default: disabled. - <tag><label id="bgp-secondary">secondary <m/switch/</tag> - Usually, if an export filter rejects a selected route, no other route is - propagated for that network. This option allows to try the next route in - order until one that is accepted is found or all routes for that network - are rejected. This can be used for route servers that need to propagate - different tables to each client but do not want to have these tables - explicitly (to conserve memory). This option requires that the connected - routing table is <ref id="dsc-table-sorted" name="sorted">. Default: off. - - <tag><label id="bgp-add-paths">add paths <m/switch/|rx|tx</tag> - Standard BGP can propagate only one path (route) per destination network - (usually the selected one). This option controls the add-path protocol - extension, which allows to advertise any number of paths to a - destination. Note that to be active, add-path has to be enabled on both - sides of the BGP session, but it could be enabled separately for RX and - TX direction. When active, all available routes accepted by the export - filter are advertised to the neighbor. Default: off. - <tag><label id="bgp-allow-local-pref">allow bgp_local_pref <m/switch/</tag> A standard BGP implementation do not send the Local Preference attribute to eBGP neighbors and ignore this attribute if received from eBGP @@ -2091,16 +2258,16 @@ using the following configuration parameters: <tag><label id="bgp-graceful-restart">graceful restart <m/switch/|aware</tag> When a BGP speaker restarts or crashes, neighbors will discard all received paths from the speaker, which disrupts packet forwarding even - when the forwarding plane of the speaker remains intact. <rfc - id="4724"> specifies an optional graceful restart mechanism to - alleviate this issue. This option controls the mechanism. It has three - states: Disabled, when no support is provided. Aware, when the graceful - restart support is announced and the support for restarting neighbors - is provided, but no local graceful restart is allowed (i.e. - receiving-only role). Enabled, when the full graceful restart - support is provided (i.e. both restarting and receiving role). Note - that proper support for local graceful restart requires also - configuration of other protocols. Default: aware. + when the forwarding plane of the speaker remains intact. <rfc id="4724"> + specifies an optional graceful restart mechanism to alleviate this + issue. This option controls the mechanism. It has three states: + Disabled, when no support is provided. Aware, when the graceful restart + support is announced and the support for restarting neighbors is + provided, but no local graceful restart is allowed (i.e. receiving-only + role). Enabled, when the full graceful restart support is provided + (i.e. both restarting and receiving role). Restarting role could be also + configured per-channel. Note that proper support for local graceful + restart requires also configuration of other protocols. Default: aware. <tag><label id="bgp-graceful-restart-time">graceful restart time <m/number/</tag> The restart time is announced in the BGP graceful restart capability @@ -2147,13 +2314,6 @@ using the following configuration parameters: This option is relevant to IPv4 mode with enabled capability advertisement only. Default: on. - <tag><label id="bgp-route-limit">route limit <m/number/</tag> - The maximal number of routes that may be imported from the protocol. If - the route limit is exceeded, the connection is closed with an error. - Limit is currently implemented as <cf>import limit <m/number/ action - restart</cf>. This option is obsolete and it is replaced by - <ref id="proto-import-limit" name="import limit option">. Default: no limit. - <tag><label id="bgp-disable-after-error">disable after error <m/switch/</tag> When an error is encountered (either locally or by the other side), disable the instance automatically and wait for an administrator to fix @@ -2222,7 +2382,7 @@ using the following configuration parameters: <tag><label id="bgp-igp-metric">igp metric <m/switch/</tag> Enable comparison of internal distances to boundary routers during best - route selection. Default: on. + route selection. Default: on. <tag><label id="bgp-prefer-older">prefer older <m/switch/</tag> Standard route selection algorithm breaks ties by comparing router IDs. @@ -2241,6 +2401,113 @@ using the following configuration parameters: versions of BIRD). </descrip> +<sect1>Channel configuration +<label id="bgp-channel-config"> + +<p>BGP supports several AFIs and SAFIs over one connection. Every AFI/SAFI +announced to the peer corresponds to one channel. The table of supported AFI/SAFIs +together with their appropriate channels follows. + +<table loc="h"> +<tabular ca="l|l|l|r|r"> + <bf/Channel name/ | <bf/Table nettype/ | <bf/IGP table allowed/ | <bf/AFI/ | <bf/SAFI/ +@<hline> + <cf/ipv4/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 1 +@ <cf/ipv6/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 1 +@ <cf/ipv4 multicast/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 2 +@ <cf/ipv6 multicast/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 2 +@ <cf/ipv4 mpls/ | <cf/ipv4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 4 +@ <cf/ipv6 mpls/ | <cf/ipv6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 4 +@ <cf/vpn4 mpls/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 128 +@ <cf/vpn6 mpls/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 128 +@ <cf/vpn4 multicast/ | <cf/vpn4/ | <cf/ipv4/ and <cf/ipv6/ | 1 | 129 +@ <cf/vpn6 multicast/ | <cf/vpn6/ | <cf/ipv4/ and <cf/ipv6/ | 2 | 129 +@ <cf/flow4/ | <cf/flow4/ | --- | 1 | 133 +@ <cf/flow6/ | <cf/flow6/ | --- | 2 | 133 +</tabular> +</table> + +<p>BGP's channels have additional config options (together with the common ones): + +<descrip> + <tag><label id="bgp-next-hop-keep">next hop keep</tag> + Forward the received Next Hop attribute even in situations where the + local address should be used instead, like when the route is sent to an + interface with a different subnet. Default: disabled. + + <tag><label id="bgp-next-hop-self">next hop self</tag> + Avoid calculation of the Next Hop attribute and always advertise our own + source address as a next hop. This needs to be used only occasionally to + circumvent misconfigurations of other routers. Default: disabled. + + <tag><label id="bgp-next-hop-address">next hop address <m/ip/</tag> + Avoid calculation of the Next Hop attribute and always advertise this address + as a next hop. + + <tag><label id="bgp-missing-lladdr">missing lladdr self|drop|ignore</tag> + Next Hop attribute in BGP-IPv6 sometimes contains just the global IPv6 + address, but sometimes it has to contain both global and link-local IPv6 + addresses. This option specifies what to do if BIRD have to send both + addresses but does not know link-local address. This situation might + happen when routes from other protocols are exported to BGP, or when + improper updates are received from BGP peers. <cf/self/ means that BIRD + advertises its own local address instead. <cf/drop/ means that BIRD + skips that prefixes and logs error. <cf/ignore/ means that BIRD ignores + the problem and sends just the global address (and therefore forms + improper BGP update). Default: <cf/self/, unless BIRD is configured as a + route server (option <cf/rs client/), in that case default is <cf/ignore/, + because route servers usually do not forward packets themselves. + + <tag><label id="bgp-gateway">gateway direct|recursive</tag> + For received routes, their <cf/gw/ (immediate next hop) attribute is + computed from received <cf/bgp_next_hop/ attribute. This option + specifies how it is computed. Direct mode means that the IP address from + <cf/bgp_next_hop/ is used if it is directly reachable, otherwise the + neighbor IP address is used. Recursive mode means that the gateway is + computed by an IGP routing table lookup for the IP address from + <cf/bgp_next_hop/. Note that there is just one level of indirection in + recursive mode - the route obtained by the lookup must not be recursive + itself, to prevent mutually recursive routes. + + Recursive mode is the behavior specified by the BGP + standard. Direct mode is simpler, does not require any routes in a + routing table, and was used in older versions of BIRD, but does not + handle well nontrivial iBGP setups and multihop. Recursive mode is + incompatible with <ref id="dsc-table-sorted" name="sorted tables">. Default: + <cf/direct/ for direct sessions, <cf/recursive/ for multihop sessions. + + <tag><label id="bgp-igp-table">igp table <m/name/</tag> + Specifies a table that is used as an IGP routing table. The type of this + table must be as allowed in the table above. This option is allowed once + for every allowed table type. Default: the same as the main table + the channel is connected to (if eligible). + + <tag><label id="bgp-secondary">secondary <m/switch/</tag> + Usually, if an export filter rejects a selected route, no other route is + propagated for that network. This option allows to try the next route in + order until one that is accepted is found or all routes for that network + are rejected. This can be used for route servers that need to propagate + different tables to each client but do not want to have these tables + explicitly (to conserve memory). This option requires that the connected + routing table is <ref id="dsc-table-sorted" name="sorted">. Default: off. + + <tag><label id="bgp-add-paths">add paths <m/switch/|rx|tx</tag> + Standard BGP can propagate only one path (route) per destination network + (usually the selected one). This option controls the add-path protocol + extension, which allows to advertise any number of paths to a + destination. Note that to be active, add-path has to be enabled on both + sides of the BGP session, but it could be enabled separately for RX and + TX direction. When active, all available routes accepted by the export + filter are advertised to the neighbor. Default: off. + + <tag><label id="bgp-graceful-restart-c">graceful restart <m/switch/</tag> + Although BGP graceful restart is configured mainly by protocol-wide + <ref id="bgp-graceful-restart" name="options">, it is possible to + configure restarting role per AFI/SAFI pair by this channel option. + The option is ignored if graceful restart is disabled by protocol-wide + option. Default: off in aware mode, on in full mode. +</descrip> + <sect1>Attributes <label id="bgp-attr"> @@ -2332,23 +2599,40 @@ some of them (marked with `<tt/O/') are optional. <p><code> protocol bgp { - local as 65000; # Use a private AS number + local 198.51.100.14 as 65000; # Use a private AS number neighbor 198.51.100.130 as 64496; # Our neighbor ... multihop; # ... which is connected indirectly - export filter { # We use non-trivial export rules - if source = RTS_STATIC then { # Export only static routes - # Assign our community - bgp_community.add((65000,64501)); - # Artificially increase path length - # by advertising local AS number twice - if bgp_path ~ [= 65000 =] then - bgp_path.prepend(65000); - accept; - } - reject; + ipv4 { + export filter { # We use non-trivial export rules + if source = RTS_STATIC then { # Export only static routes + # Assign our community + bgp_community.add((65000,64501)); + # Artificially increase path length + # by advertising local AS number twice + if bgp_path ~ [= 65000 =] then + bgp_path.prepend(65000); + accept; + } + reject; + }; + import all; + next hop self; # advertise this router as next hop + igp table myigptable4; # IGP table for routes with IPv4 nexthops + igp table myigptable6; # IGP table for routes with IPv6 nexthops + }; + ipv6 { + export filter mylargefilter; # We use a named filter + import all; + missing lladdr self; + igp table myigptable4; # IGP table for routes with IPv4 nexthops + igp table myigptable6; # IGP table for routes with IPv6 nexthops + }; + ipv4 multicast { + import all; + export filter someotherfilter; + table mymulticasttable4; # Another IPv4 table, dedicated for multicast + igp table myigptable4; }; - import all; - source address 198.51.100.14; # Use a non-standard source address } </code> @@ -2358,7 +2642,7 @@ protocol bgp { <p>The Device protocol is not a real routing protocol. It doesn't generate any routes and it only serves as a module for getting information about network -interfaces from the kernel. +interfaces from the kernel. This protocol supports no channel. <p>Except for very unusual circumstances, you probably should include this protocol in the configuration since almost all other protocols require network @@ -2368,7 +2652,6 @@ interfaces to be defined for them to work with. <label id="device-config"> <p><descrip> - <tag><label id="device-scan-time">scan time <m/number/</tag> Time in seconds between two scans of the network interface list. On systems where we are notified about interface status changes @@ -2376,19 +2659,26 @@ interfaces to be defined for them to work with. list only in order to avoid confusion by lost notification messages, so the default time is set to a large value. - <tag><label id="device-primary">primary [ "<m/mask/" ] <m/prefix/</tag> - If a network interface has more than one network address, BIRD has to - choose one of them as a primary one. By default, BIRD chooses the - lexicographically smallest address as the primary one. - - This option allows to specify which network address should be chosen as - a primary one. Network addresses that match <m/prefix/ are preferred to - non-matching addresses. If more <cf/primary/ options are used, the first - one has the highest preference. If "<m/mask/" is specified, then such - <cf/primary/ option is relevant only to matching network interfaces. - - In all cases, an address marked by operating system as secondary cannot - be chosen as the primary one. + <tag><label id="device-iface">interface <m/pattern/ [, <m/.../]</tag> + + By default, the Device protocol handles all interfaces without any + configuration. Interface definitions allow to specify optional + parameters for specific interfaces. See <ref id="proto-iface" + name="interface"> common option for detailed description. Currently only + one interface option is available: + + <tag><label id="device-preferred">preferred <m/ip/</tag> + If a network interface has more than one IP address, BIRD chooses one of + them as a preferred one. Preferred IP address is used as source address + for packets or announced next hop by routing protocols. Precisely, BIRD + chooses one preferred IPv4 address, one preferred IPv6 address and one + preferred link-local IPv6 address. By default, BIRD chooses the first + found IP address as the preferred one. + + This option allows to specify which IP address should be preferred. May + be used multiple times for different address classes (IPv4, IPv6, IPv6 + link-local). In all cases, an address marked by operating system as + secondary cannot be chosen as the primary one. </descrip> <p>As the Device protocol doesn't generate any routes, it cannot have @@ -2397,8 +2687,10 @@ any attributes. Example configuration looks like this: <p><code> protocol device { scan time 10; # Scan the interfaces often - primary "eth0" 192.168.1.1; - primary 192.168.0.0/16; + interface "eth0" { + preferred 192.168.1.1; + preferred 2001:db8:1:10::1; + }; } </code> @@ -2408,7 +2700,8 @@ protocol device { <p>The Direct protocol is a simple generator of device routes for all the directly connected networks according to the list of interfaces provided by the -kernel via the Device protocol. +kernel via the Device protocol. The Direct protocol supports both IPv4 and IPv6 +channels. <p>The question is whether it is a good idea to have such device routes in BIRD routing table. OS kernel usually handles device routes for directly connected @@ -2452,6 +2745,8 @@ on Linux systems BIRD cannot change non-BIRD route in the kernel routing table. <p><code> protocol direct { + ipv4; + ipv6; interface "-arc*", "*"; # Exclude the ARCnets } </code> @@ -2490,6 +2785,9 @@ kernel protocols to the same routing table and changing route destination (gateway) in an export filter of a kernel protocol does not work. Both limitations can be overcome using another routing table and the pipe protocol. +<p>The Kernel protocol supports both IPv4 and IPv6 channels; only one of them +can be configured in each protocol instance. + <sect1>Configuration <label id="krt-config"> @@ -2507,13 +2805,6 @@ limitations can be overcome using another routing table and the pipe protocol. routing daemons or by the system administrator. This is possible only on systems which support identification of route authorship. - <tag><label id="krt-device-routes">device routes <m/switch/</tag> - Enable export of device routes to the kernel routing table. By default, - such routes are rejected (with the exception of explicitly configured - device routes from the static protocol) regardless of the export filter - to protect device routes in kernel routing table (managed by OS itself) - from accidental overwriting or erasing. - <tag><label id="krt-kernel-table">kernel table <m/number/</tag> Select which kernel table should this particular instance of the Kernel protocol work with. Available only on systems supporting multiple @@ -2528,7 +2819,7 @@ limitations can be overcome using another routing table and the pipe protocol. routes from other sources (e.g. kernel device routes). Metric 0 has a special meaning of undefined metric, in which either OS default is used, or per-route metric can be set using <cf/krt_metric/ attribute. Default: - 0 (undefined). + 32. <tag><label id="krt-graceful-restart">graceful restart <m/switch/</tag> Participate in graceful restart recovery. If this option is enabled and @@ -2618,14 +2909,18 @@ protocol kernel { # Primary routing table learn; # Learn alien routes from the kernel persist; # Don't remove routes on bird shutdown scan time 10; # Scan kernel routing table every 10 seconds - import all; - export all; + ipv4 { + import all; + export all; + }; } protocol kernel { # Secondary routing table - table auxtable; kernel table 100; - export all; + ipv4 { + table auxtable; + export all; + }; } </code> @@ -2669,15 +2964,23 @@ each router detects all changes. <sect1>Configuration <label id="ospf-config"> -<p>In the main part of configuration, there can be multiple definitions of OSPF -areas, each with a different id. These definitions includes many other switches -and multiple definitions of interfaces. Definition of interface may contain many -switches and constant definitions and list of neighbors on nonbroadcast -networks. +<p>First, the desired OSPF version can be specified by using <cf/ospf v2/ or +<cf/ospf v3/ as a protocol type. By default, OSPFv2 is used. In the main part of +configuration, there can be multiple definitions of OSPF areas, each with a +different id. These definitions includes many other switches and multiple +definitions of interfaces. Definition of interface may contain many switches and +constant definitions and list of neighbors on nonbroadcast networks. + +<p>OSPFv2 needs one IPv4 channel. OSPFv3 needs either one IPv6 channel, or one +IPv4 channel (<rfc id="5838">). Therefore, it is possible to use OSPFv3 for both +IPv4 and Pv6 routing, but it is necessary to have two protocol instances anyway. +If no channel is configured, appropriate channel is defined with default +parameters. <code> -protocol ospf <name> { +protocol ospf [v2|v3] <name> { rfc1583compat <switch>; + rfc5838 <switch>; instance id <num>; stub router <switch>; tick <num>; @@ -2778,15 +3081,23 @@ protocol ospf <name> { This option controls compatibility of routing table calculation with <rfc id="1583">. Default value is no. + <tag><label id="ospf-rfc5838">rfc5838 <m/switch/</tag> + Basic OSPFv3 is limited to IPv6 unicast routing. The <rfc id="5838"> + extension defines support for more address families (IPv4, IPv6, both + unicast and multicast). The extension is enabled by default, but can be + disabled if necessary, as it restricts the range of available instance + IDs. Default value is yes. + <tag><label id="ospf-instance-id">instance id <m/num/</tag> When multiple OSPF protocol instances are active on the same links, they should use different instance IDs to distinguish their packets. Although it could be done on per-interface basis, it is often preferred to set one instance ID to whole OSPF domain/topology (e.g., when multiple instances are used to represent separate logical topologies on the same - physical network). This option specifies the default instance ID for all - interfaces of the OSPF instance. Note that this option, if used, must - precede interface definitions. Default value is 0. + physical network). This option specifies the instance ID for all + interfaces of the OSPF instance, but can be overridden by + <cf/interface/ option. Default value is 0 unless OSPFv3-AF extended + address families are used, see <rfc id="5838"> for that case. <tag><label id="ospf-stub-router">stub router <M>switch</M></tag> This option configures the router to be a stub router, i.e., a router @@ -2807,8 +3118,8 @@ protocol ospf <name> { (equal-cost multipath) routes. Such routes are used when there are several directions to the destination, each with the same (computed) cost. This option also allows to specify a limit on maximum number of - nexthops in one route. By default, ECMP is disabled. If enabled, - default value of the limit is 16. + nexthops in one route. By default, ECMP is enabled if supported by + Kernel. Default value of the limit is 16. <tag><label id="ospf-merge-external">merge external <M>switch</M></tag> This option specifies whether OSPF should merge external routes from @@ -3047,7 +3358,7 @@ protocol ospf <name> { are immediately considered unreachable and only the address of the iface (instead of whole network prefix) is propagated. It is possible that some hardware drivers or platforms do not implement this feature. - Default value is no. + Default value is yes. <tag><label id="ospf-bfd">bfd <M>switch</M></tag> OSPF could use BFD protocol as an advisory mechanism for neighbor @@ -3134,14 +3445,14 @@ network. This attribute is read-only. Default is <cf/ospf_metric2 = 10000/ and <p><code> protocol ospf MyOSPF { - rfc1583compat yes; - tick 2; - export filter { - if source = RTS_BGP then { - ospf_metric1 = 100; - accept; - } - reject; + ipv4 { + export filter { + if source = RTS_BGP then { + ospf_metric1 = 100; + accept; + } + reject; + }; }; area 0.0.0.0 { interface "eth*" { @@ -3209,7 +3520,8 @@ routes to be passed from a table declared as primary (i.e., the one the pipe is connected to using the <cf/table/ configuration keyword) to the secondary one (declared using <cf/peer table/) and vice versa, depending on what's allowed by the filters. Export filters control export of routes from the primary table to -the secondary one, import filters control the opposite direction. +the secondary one, import filters control the opposite direction. Both tables +must be of the same nettype. <p>The Pipe protocol may work in the transparent mode mode or in the opaque mode. In the transparent mode, the Pipe protocol retransmits all routes from @@ -3239,13 +3551,14 @@ exporting a selected subset of one table to another one. <sect1>Configuration <label id="pipe-config"> +<p>Essentially, the Pipe protocol is just a channel connected to a table on both +sides. Therefore, the configuration block for <cf/protocol pipe/ shall directly +include standard channel config options; see the example below. + <p><descrip> <tag><label id="pipe-peer-table">peer table <m/table/</tag> Defines secondary routing table to connect to. The primary one is selected by the <cf/table/ keyword. - - <tag><label id="pipe-mode">mode opaque|transparent</tag> - Specifies the mode for the pipe to work in. Default is transparent. </descrip> <sect1>Attributes @@ -3272,33 +3585,29 @@ Pipe protocol while decreasing their preferences and correcting their BGP paths to reflect the AS boundary crossing. <code> -table as1; # Define the tables -table as2; +ipv4 table as1; # Define the tables +ipv4 table as2; protocol kernel kern1 { # Synchronize them with the kernel - table as1; + ipv4 { table as1; export all; }; kernel table 1; } protocol kernel kern2 { - table as2; + ipv4 { table as2; export all; }; kernel table 2; } protocol bgp bgp1 { # The outside connections - table as1; + ipv4 { table as1; export all; }; local as 1; neighbor 192.168.0.1 as 1001; - export all; - import all; } protocol bgp bgp2 { - table as2; + ipv4 { table as2; export all; }; local as 2; neighbor 10.0.0.1 as 1002; - export all; - import all; } protocol pipe { # The Pipe @@ -3339,6 +3648,8 @@ addresses and choose a default route. BIRD implements router behavior as defined in <rfc id="4861">, router preferences and specific routes (<rfc id="4191">), and DNS extensions (<rfc id="6106">). +<p>The RAdv protocols supports just IPv6 channel. + <sect1>Configuration <label id="radv-config"> @@ -3507,7 +3818,6 @@ definitions, prefix definitions and DNS definitions: option above. Default: no. </descrip> - <p>Prefix specific options <descrip> @@ -3559,7 +3869,6 @@ definitions, prefix definitions and DNS definitions: valid DNS servers. Default: 3 * <cf/max ra interval/. </descrip> - <p>DNSSL specific options: <descrip> @@ -3597,10 +3906,10 @@ definitions, prefix definitions and DNS definitions: <label id="radv-exam"> <p><code> -table radv_routes; # Manually configured routes go here +ipv6 table radv_routes; # Manually configured routes go here protocol static { - table radv_routes; + ipv6 { table radv_routes; }; route 2001:0DB8:4000::/48 unreachable; route 2001:0DB8:4010::/48 unreachable; @@ -3613,8 +3922,7 @@ protocol static { protocol radv { propagate routes yes; # Propagate the routes from the radv_routes table - table radv_routes; - export all; + ipv6 { table radv_routes; export all; }; interface "eth2" { max ra interval 5; # Fast failover with more routers @@ -3680,10 +3988,15 @@ pretty much obsolete. It is still usable on very small networks. <label id="rip-config"> <p>RIP configuration consists mainly of common protocol options and interface -definitions, most RIP options are interface specific. +definitions, most RIP options are interface specific. RIPng (RIP for IPv6) +protocol instance can be configured by using <cf/rip ng/ instead of just +<cf/rip/ as a protocol type. + +<p>RIP needs one IPv4 channel. RIPng needs one IPv6 channel. If no channel is +configured, appropriate channel is defined with default parameters. <code> -protocol rip [<name>] { +protocol rip [ng] [<name>] { infinity <number>; ecmp <switch> [limit <number>]; interface <interface pattern> { @@ -3732,8 +4045,8 @@ protocol rip [<name>] { (equal-cost multipath) routes. Such routes are used when there are several directions to the destination, each with the same (computed) cost. This option also allows to specify a limit on maximum number of - nexthops in one route. By default, ECMP is disabled. If enabled, - default value of the limit is 16. + nexthops in one route. By default, ECMP is enabled if supported by + Kernel. Default value of the limit is 16. <tag><label id="rip-iface">interface <m/pattern/ [, <m/.../] { <m/options/ }</tag> Interface definitions specify a set of interfaces on which the @@ -3879,7 +4192,7 @@ protocol rip [<name>] { unplugged), neighbors are immediately considered unreachable and all routes received from them are withdrawn. It is possible that some hardware drivers or platforms do not implement this feature. - Default: no. + Default: yes. </descrip> <sect1>Attributes @@ -3888,8 +4201,8 @@ protocol rip [<name>] { <p>RIP defines two route attributes: <descrip> - <tag><label id="rta-rip-metric">int rip_metric/</tag> - RIP metric of the route (ranging from 0 to <cf/infinity/). When routes + <tag>int <cf/rip_metric/</tag> + RIP metric of the route (ranging from 0 to <cf/infinity/). When routes from different RIP instances are available and all of them have the same preference, BIRD prefers the route with lowest <cf/rip_metric/. When a non-RIP route is exported to RIP, the default metric is 1. @@ -3906,8 +4219,10 @@ protocol rip [<name>] { <p><code> protocol rip { - import all; - export all; + ipv4 { + import all; + export all; + }; interface "eth*" { metric 2; port 1520; @@ -3921,6 +4236,185 @@ protocol rip { </code> +<sect>RPKI + +<sect1>Introduction + +<p>The Resource Public Key Infrastructure (RPKI) is mechanism for origin +validation of BGP routes (RFC 6480). BIRD supports only so-called RPKI-based +origin validation. There is implemented RPKI to Router (RPKI-RTR) protocol (RFC +6810). It uses some of the RPKI data to allow a router to verify that the +autonomous system announcing an IP address prefix is in fact authorized to do +so. This is not crypto checked so can be violated. But it should prevent the +vast majority of accidental hijackings on the Internet today, e.g. the famous +Pakastani accidental announcement of YouTube's address space. + +<p>The RPKI-RTR protocol receives and maintains a set of ROAs from a cache +server (also called validator). You can validate routes (RFC 6483) using +function <cf/roa_check()/ in filter and set it as import filter at the BGP +protocol. BIRD should re-validate all of affected routes after RPKI update by +RFC 6811, but we don't support it yet! You can use a BIRD's client command +<cf>reload in <m/bgp_protocol_name/</cf> for manual call of revalidation of all +routes. + +<sect1>Supported transports +<p> +<itemize> + <item>Unprotected transport over TCP uses a port 323. The cache server + and BIRD router should be on the same trusted and controlled network + for security reasons. + <item>SSHv2 encrypted transport connection uses the normal SSH port + 22. +</itemize> + +<sect1>Configuration + +<p>We currently support just one cache server per protocol. However you can +define more RPKI protocols generally. + +<code> +protocol rpki [<name>] { + roa4 { table <tab>; }; + roa6 { table <tab>; }; + remote <ip> | "<domain>" [port <num>]; + port <num>; + refresh [keep] <num>; + retry [keep] <num>; + expire [keep] <num>; + transport tcp; + transport ssh { + bird private key "</path/to/id_rsa>"; + remote public key "</path/to/known_host>"; + user "<name>"; + }; +} +</code> + +<p>Alse note that you have to specify the ROA channel. If you want to import +only IPv4 prefixes you have to specify only roa4 channel. Similarly with IPv6 +prefixes only. If you want to fetch both IPv4 and even IPv6 ROAs you have to +specify both channels. + +<sect2>RPKI protocol options +<p> +<descrip> + <tag>remote <m/ip/ | "<m/hostname/" [port <m/num/]</tag> Specifies + a destination address of the cache server. Can be specified by an IP + address or by full domain name string. Only one cache can be specified + per protocol. This option is required. + + <tag>port <m/num/</tag> Specifies the port number. The default port + number is 323 for transport without any encryption and 22 for transport + with SSH encryption. + + <tag>refresh [keep] <m/num/</tag> Time period in seconds. Tells how + long to wait before next attempting to poll the cache using a Serial + Query or a Reset Query packet. Must be lower than 86400 seconds (one + day). Too low value can caused a false positive detection of + network connection problems. A keyword <cf/keep/ suppresses updating + this value by a cache server. + Default: 3600 seconds + + <tag>retry [keep] <m/num/</tag> Time period in seconds between a failed + Serial/Reset Query and a next attempt. Maximum allowed value is 7200 + seconds (two hours). Too low value can caused a false positive + detection of network connection problems. A keyword <cf/keep/ + suppresses updating this value by a cache server. + Default: 600 seconds + + <tag>expire [keep] <m/num/</tag> Time period in seconds. Received + records are deleted if the client was unable to successfully refresh + data for this time period. Must be in range from 600 seconds (ten + minutes) to 172800 seconds (two days). A keyword <cf/keep/ + suppresses updating this value by a cache server. + Default: 7200 seconds + + <tag>transport tcp</tag> Unprotected transport over TCP. It's a default + transport. Should be used only on secure private networks. + Default: tcp + + <tag>transport ssh { <m/SSH transport options.../ }</tag> It enables a + SSHv2 transport encryption. Cannot be combined with a TCP transport. + Default: off +</descrip> + +<sect3>SSH transport options +<p> +<descrip> + <tag>bird private key "<m>/path/to/id_rsa</m>"</tag> + A path to the BIRD's private SSH key for authentication. + It can be a <cf><m>id_rsa</m></cf> file. + + <tag>remote public key "<m>/path/to/known_host</m>"</tag> + A path to the cache's public SSH key for verification identity + of the cache server. It could be a path to <cf><m>known_host</m></cf> file. + + <tag>user "<m/name/"</tag> + A SSH user name for authentication. This option is a required. +</descrip> + +<sect1>Examples +<sect2>BGP origin validation +<p>Policy: Don't import <cf/ROA_INVALID/ routes. +<code> +roa4 table r4; +roa6 table r6; + +protocol rpki { + debug all; + + roa4 { table r4; }; + roa6 { table r6; }; + + # Please, do not use rpki-validator.realmv6.org in production + remote "rpki-validator.realmv6.org" port 8282; + + retry keep 5; + refresh keep 30; + expire 600; +} + +filter peer_in_v4 { + if (roa_check(r4, net, bgp_path.last) = ROA_INVALID) then + { + print "Ignore invalid ROA ", net, " for ASN ", bgp_path.last; + reject; + } + accept; +} + +protocol bgp { + debug all; + local as 65000; + neighbor 192.168.2.1 as 65001; + ipv4 { import filter peer_in_v4; }; +} +</code> + +<sect2>SSHv2 transport encryption +<p> +<code> +roa4 table r4; +roa6 table r6; + +protocol rpki { + debug all; + + roa4 { table r4; }; + roa6 { table r6; }; + + remote 127.0.0.1 port 2345; + transport ssh { + bird private key "/home/birdgeek/.ssh/id_rsa"; + remote public key "/home/birdgeek/.ssh/known_hosts"; + user "birdgeek"; + }; + + # Default interval values +} +</code> + + <sect>Static <label id="static"> @@ -3932,21 +4426,10 @@ return packets as undeliverable if they are in your IP block, you don't have any specific destination for them and you don't want to send them out through the default route to prevent routing loops). -<p>There are five types of static routes: `classical' routes telling to forward -packets to a neighboring router, multipath routes specifying several (possibly -weighted) neighboring routers, device routes specifying forwarding to hosts on a -directly connected network, recursive routes computing their nexthops by doing -route table lookups for a given IP, and special routes (sink, blackhole etc.) -which specify a special action to be done instead of forwarding the packet. - -<p>When the particular destination is not available (the interface is down or -the next hop of the route is not a neighbor at the moment), Static just -uninstalls the route from the table it is connected to and adds it again as soon -as the destination becomes adjacent again. - <p>There are three classes of definitions in Static protocol configuration -- global options, static route definitions, and per-route options. Usually, the definition of the protocol contains mainly a list of static routes. +Static routes have no specific attributes. <p>Global options: @@ -3965,32 +4448,169 @@ definition of the protocol contains mainly a list of static routes. <p>Route definitions (each may also contain a block of per-route options): -<descrip> - <tag><label id="static-route-via-ip">route <m/prefix/ via <m/ip/</tag> - Static route through a neighboring router. For link-local next hops, - interface can be specified as a part of the address (e.g., - <cf/via fe80::1234%eth0/). +<sect1>Regular routes; MPLS switching rules - <tag><label id="static-route-via-mpath">route <m/prefix/ multipath via <m/ip/ [weight <m/num/] [bfd <m/switch/] [via <m/.../]</tag> - Static multipath route. Contains several nexthops (gateways), possibly - with their weights. +<p>There exist several types of routes; keep in mind that <m/prefix/ syntax is +<ref id="type-prefix" name="dependent on network type">. - <tag><label id="static-route-via-iface">route <m/prefix/ via <m/"interface"/</tag> - Static device route through an interface to hosts on a directly - connected network. +<descrip> + <tag>route <m/prefix/ via <m/ip/|<m/"interface"/ [mpls <m/num/[/<m/num/[/<m/num/[...]]]]</tag> + Next hop routes may bear one or more <ref id="route-next-hop" name="next hops">. + Every next hop is preceded by <cf/via/ and configured as shown. - <tag><label id="static-route-recursive">route <m/prefix/ recursive <m/ip/</tag> - Static recursive route, its nexthop depends on a route table lookup for - given IP address. + <tag>route <m/prefix/ recursive <m/ip/ [mpls <m/num/[/<m/num/[/<m/num/[...]]]]</tag> + Recursive nexthop resolves the given IP in the configured IGP table and + uses that route's next hop. The MPLS stacks are concatenated; on top is + the IGP's nexthop stack and on bottom is this route's stack. - <tag><label id="static-route-drop">route <m/prefix/ blackhole|unreachable|prohibit</tag> + <tag>route <m/prefix/ blackhole|unreachable|prohibit</tag> Special routes specifying to silently drop the packet, return it as unreachable or return it as administratively prohibited. First two targets are also known as <cf/drop/ and <cf/reject/. </descrip> -<p>Per-route options: +<p>When the particular destination is not available (the interface is down or +the next hop of the route is not a neighbor at the moment), Static just +uninstalls the route from the table it is connected to and adds it again as soon +as the destination becomes adjacent again. + +<sect1>Route Origin Authorization + +<p>The ROA config is just <cf>route <m/prefix/ max <m/int/ as <m/int/</cf> with no nexthop. + +<sect1>Flowspec +<label id="flowspec-network-type"> + +<p>The flow specification are rules for routers and firewalls for filtering +purpose. It is described by <rfc id="5575">. There are 3 types of arguments: +<m/inet4/ or <m/inet6/ prefixes, bitmasks matching expressions and numbers +matching expressions. + +Bitmasks matching is written using <m/value/<cf>/</cf><m/mask/ or +<cf/!/<m/value/<cf>/</cf><m/mask/ pairs. It means that <cf/(/<m/data/ <cf/&/ +<m/mask/<cf/)/ is or is not equal to <m/value/. + +Numbers matching is a matching sequence of numbers and ranges separeted by a +commas (<cf/,/) (e.g. <cf/10,20,30/). Ranges can be written using double dots +<cf/../ notation (e.g. <cf/80..90,120..124/). An alternative notation are +sequence of one or more pairs of relational operators and values separated by +logical operators <cf/&&/ or <cf/||/. Allowed relational operators are <cf/=/, +<cf/!=/, <cf/</, <cf/<=/, <cf/>/, <cf/>=/, <cf/true/ and <cf/false/. + +<sect2>IPv4 Flowspec + +<p><descrip> + <tag><label id="flow-dst">dst <m/inet4/</tag> + Set a matching destination prefix (e.g. <cf>dst 192.168.0.0/16</cf>). + Only this option is mandatory in IPv4 Flowspec. + + <tag><label id="flow-src">src <m/inet4/</tag> + Set a matching source prefix (e.g. <cf>src 10.0.0.0/8</cf>). + + <tag><label id="flow-proto">proto <m/numbers-match/</tag> + Set a matching IP protocol numbers (e.g. <cf/proto 6/). + + <tag><label id="flow-port">port <m/numbers-match/</tag> + Set a matching source or destination TCP/UDP port numbers (e.g. + <cf>port 1..1023,1194,3306</cf>). + + <tag><label id="flow-dport">dport <m/numbers-match/</tag> + Set a mating destination port numbers (e.g. <cf>dport 49151</cf>). + + <tag><label id="flow-sport">sport <m/numbers-match/</tag> + Set a matching source port numbers (e.g. <cf>sport = 0</cf>). + + <tag><label id="flow-icmp-type">icmp type <m/numbers-match/</tag> + Set a matching type field number of an ICMP packet (e.g. <cf>icmp type + 3</cf>) + + <tag><label id="flow-icmp-code">icmp code <m/numbers-match/</tag> + Set a matching code field number of an ICMP packet (e.g. <cf>icmp code + 1</cf>) + <tag><label id="flow-tcp-flags">tcp flags <m/bitmask-match/</tag> + Set a matching bitmask for TCP header flags (aka control bits) (e.g. + <cf>tcp flags 0x03/0x0f;</cf>). The maximum length of mask is 12 bits + (0xfff). + + <tag><label id="flow-length">length <m/numbers-match/</tag> + Set a matching packet length (e.g. <cf>length > 1500;</cf>) + + <tag><label id="flow-dscp">dscp <m/numbers-match/</tag> + Set a matching DiffServ Code Point number (e.g. <cf>length > 1500;</cf>). + + <tag><label id="flow-fragment">fragment <m/fragmentation-type/</tag> + Set a matching type of packet fragmentation. Allowed fragmentation + types are <cf/dont_fragment/, <cf/is_fragment/, <cf/first_fragment/, + <cf/last_fragment/ (e.g. <cf>fragment is_fragment && + !dont_fragment</cf>). +</descrip> + +<p><code> +protocol static { + flow4; + + route flow4 { + dst 10.0.0.0/8; + port > 24 && < 30 || 40..50,60..70,80 && >= 90; + tcp flags 0x03/0x0f; + length > 1024; + dscp = 63; + fragment dont_fragment, is_fragment || !first_fragment; + }; +} +</code> + +<sect2>Differences for IPv6 Flowspec + +<p>Flowspec IPv6 are same as Flowspec IPv4 with a few exceptions. +<itemize> + <item>Prefixes <m/inet6/ can be specified not only with prefix length, + but with prefix <cf/offset/ <m/num/ too (e.g. + <cf>::1234:5678:9800:0000/101 offset 64</cf>). Offset means to don't + care of <m/num/ first bits. + <item>IPv6 Flowspec hasn't mandatory any flowspec component. + <item>In IPv6 packets, there is a matching the last next header value + for a matching IP protocol number (e.g. <cf>next header 6</cf>). + <item>It is not possible to set <cf>dont_fragment</cf> as a type of + packet fragmentation. +</itemize> + +<p><descrip> + <tag><label id="flow6-dst">dst <m/inet6/ [offset <m/num/]</tag> + Set a matching destination IPv6 prefix (e.g. <cf>dst + ::1c77:3769:27ad:a11a/128 offset 64</cf>). + + <tag><label id="flow6-src">src <m/inet6/ [offset <m/num/]</tag> + Set a matching source IPv6 prefix (e.g. <cf>src fe80::/64</cf>). + + <tag><label id="flow6-next-header">next header <m/numbers-match/</tag> + Set a matching IP protocol numbers (e.g. <cf>next header != 6</cf>). + + <tag><label id="flow6-label">label <m/bitmask-match/</tag> + Set a 20-bit bitmask for matching Flow Label field in IPv6 packets + (e.g. <cf>label 0x8e5/0x8e5</cf>). +</descrip> + +<p><code> +protocol static { + flow6 { table myflow6; }; + + route flow6 { + dst fec0:1122:3344:5566:7788:99aa:bbcc:ddee/128; + src 0000:0000:0000:0001:1234:5678:9800:0000/101 offset 63; + next header = 23; + sport > 24 && < 30 || = 40 || 50,60,70..80; + dport = 50; + tcp flags 0x03/0x0f, !0/0xff || 0x33/0x33; + fragment !is_fragment || !first_fragment; + label 0xaaaa/0xaaaa && 0x33/0x33; + }; +} +</code> + +<sect1>Per-route options +<p> <descrip> <tag><label id="static-route-bfd">bfd <m/switch/</tag> The Static protocol could use BFD protocol for next hop liveness @@ -4016,16 +4636,14 @@ definition of the protocol contains mainly a list of static routes. exported to the OSPF protocol. </descrip> -<p>Static routes have no specific attributes. - -<p>Example static config might look like this: +<sect1>Example static config <p><code> protocol static { - table testable; # Connect to a non-default routing table + ipv4 { table testable; }; # Connect to a non-default routing table check link; # Advertise routes only if link is up route 0.0.0.0/0 via 198.51.100.130; # Default route - route 10.0.0.0/8 multipath # Multipath route + route 10.0.0.0/8 # Multipath route via 198.51.100.10 weight 2 via 198.51.100.20 bfd # BFD-controlled next hop via 192.0.2.1; @@ -4056,7 +4674,6 @@ versions of BIRD: <itemize> <item>Opaque LSA's <item>Route aggregation and flap dampening -<item>Multipath routes <item>Multicast routing protocols <item>Ports to other systems </itemize> |