frr.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Frr | dn42 wiki</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="robots" content="index, follow">
  8. <meta name="keywords" content="dn42,wiki,routing,bgp">
  9. <link rel="canonical" href="https://dn42.obl.ong/howto/frr.html">
  10. <link rel="icon" type="image/x-icon" href="/favicon.ico">
  11. <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
  12. <link rel="author" type="text/html" href="/docs/people">
  13. <link rel="stylesheet" href="/css/normalize.css">
  14. <link rel="stylesheet" href="/css/simple.min.css">
  15. <link rel="stylesheet" href="/css/style.css">
  16. <link rel="stylesheet" href="/css/menu.css">
  17. </head>
  18. <body>
  19. <header>
  20. <b>dn42 wiki / Frr</b>
  21. <div id="dn42_header">
  22. <p><a href="/"><img src="/dn42.png" alt="dn42" /></a></p>
  23. </div>
  24. </header>
  25. <main>
  26. <p>To quote from <a href="https://frrouting.org/">https://frrouting.org/</a>:</p>
  27. <blockquote>
  28. <p>FRRouting (FRR) is a free and open source Internet routing protocol suite for Linux and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM, LDP, BFD, Babel, PBR, OpenFabric and VRRP, with alpha support for EIGRP and NHRP.</p>
  29. </blockquote>
  30. <p>It features a similar configuration style to Cisco IOS.</p>
  31. <h3 id="installation">Installation</h3>
  32. <p>Install the <code class="language-plaintext highlighter-rouge">frr</code> and <code class="language-plaintext highlighter-rouge">frr-pythontools</code> package on your favourite Linux/BSD distribution. For BGP RPKI support, also install <code class="language-plaintext highlighter-rouge">frr-rpki</code>. <em>Make sure you are using FRR version 8.5 or greater for IPv6 link local peerings.</em></p>
  33. <ul>
  34. <li>More installation options: <a href="https://docs.frrouting.org/en/latest/installation.html">https://docs.frrouting.org/en/latest/installation.html</a></li>
  35. <li>releases: <a href="https://frrouting.org/release/">https://frrouting.org/release/</a></li>
  36. </ul>
  37. <p>If your distribution doesn’t have the latest FRR version, check the releases page. FRR supplies Debian packages, RPM packages and Snaps.</p>
  38. <h2 id="configuration">Configuration</h2>
  39. <p>Important cofiguration files:</p>
  40. <ul>
  41. <li><code class="language-plaintext highlighter-rouge">/etc/frr/daemons</code>: daemons that will be started</li>
  42. <li><code class="language-plaintext highlighter-rouge">/etc/frr/vtysh.conf</code>: configuration for the VTY shell</li>
  43. <li><code class="language-plaintext highlighter-rouge">/etc/frr/frr.conf</code>: configuration for the daemons</li>
  44. <li><code class="language-plaintext highlighter-rouge">/etc/frr/${DAEMON}.conf</code>: configuration for a single daemon (deprecated)</li>
  45. </ul>
  46. <p>It this guide, only BGP will be set up using the shared <code class="language-plaintext highlighter-rouge">/etc/frr/frr.conf</code>.</p>
  47. <h3 id="daemons">Daemons</h3>
  48. <p>First, setup <code class="language-plaintext highlighter-rouge">/etc/frr/daemons</code>. As stated previously. this file specifies which daemons will be started.</p>
  49. <div class="language-diff highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="gd">--- /etc/frr/daemons
  50. </span><span class="gi">+++ /etc/frr/daemons
  51. </span><span class="p">@@ -14,7 +14,7 @@</span>
  52. #
  53. # The watchfrr, zebra and staticd daemons are always started.
  54. #
  55. <span class="gd">-bgpd=no
  56. </span><span class="gi">+bgpd=yes
  57. </span> ospfd=no
  58. ospf6d=no
  59. ripd=no
  60. </code></pre></div></div>
  61. <h3 id="vty-shell">VTY shell</h3>
  62. <p>To use the VTY shell, <code class="language-plaintext highlighter-rouge">/etc/frr/vtysh.conf</code> needs to be set up. <em>The <code class="language-plaintext highlighter-rouge">hostname</code> and <code class="language-plaintext highlighter-rouge">banner motd</code> also need to be entered there manually to be persistant.</em></p>
  63. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>service integrated-vtysh-config
  64. </code></pre></div></div>
  65. <p>Unprivileged users need to be in the <code class="language-plaintext highlighter-rouge">frrvty</code> group to use <code class="language-plaintext highlighter-rouge">vtysh</code>.</p>
  66. <p>The VTY shell can be used to interact with running daemons and configure them. Changes made in the VTY shell can be written to <code class="language-plaintext highlighter-rouge">/etc/frr/frr.conf</code> using the <code class="language-plaintext highlighter-rouge">write</code> command. To enter configuration mode use the <code class="language-plaintext highlighter-rouge">configure</code> command. To get information about the available commands, press <code class="language-plaintext highlighter-rouge">?</code>.</p>
  67. <h3 id="zebra">Zebra</h3>
  68. <p>Before configuring BGP, a few other things need to be set up. First, create a <a href="https://docs.frrouting.org/en/latest/filter.html#ip-prefix-list">prefix-list</a> for the dn42 prefixes. That will be used to filter out non-dn42 routes to be announced to BGP. For that, open <code class="language-plaintext highlighter-rouge">/etc/frr/frr.conf</code> or <code class="language-plaintext highlighter-rouge">vtysh</code> in configuration mode and add:</p>
  69. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ip prefix-list dn42 seq 1 deny 172.22.166.0/24 le 32
  70. ip prefix-list dn42 seq 1001 permit 172.20.0.0/24 ge 28 le 32
  71. ip prefix-list dn42 seq 1002 permit 172.21.0.0/24 ge 28 le 32
  72. ip prefix-list dn42 seq 1003 permit 172.22.0.0/24 ge 28 le 32
  73. ip prefix-list dn42 seq 1004 permit 172.23.0.0/24 ge 28 le 32
  74. ip prefix-list dn42 seq 1100 permit 172.20.0.0/14 ge 21 le 29
  75. ip prefix-list dn42 seq 2001 permit 10.100.0.0/14 le 32
  76. ip prefix-list dn42 seq 2002 permit 10.127.0.0/16 le 32
  77. ip prefix-list dn42 seq 2003 permit 10.0.0.0/8 ge 15 le 24
  78. ip prefix-list dn42 seq 3001 permit 172.31.0.0/16 le 32
  79. ip prefix-list dn42 seq 9999 deny 0.0.0.0/0 le 32
  80. !
  81. ipv6 prefix-list dn42v6 seq 1001 permit fd00::/8 ge 44 le 64
  82. ipv6 prefix-list dn42v6 seq 9999 deny ::/0 le 128
  83. </code></pre></div></div>
  84. <p>This prefix list can be created yourself by following the instructions for Quagga in the <code class="language-plaintext highlighter-rouge">data/filter.txt</code> and <code class="language-plaintext highlighter-rouge">data/filter6.txt</code> files from the registry.</p>
  85. <p>Next create a <a href="https://docs.frrouting.org/en/latest/routemap.html">route-map</a>, which will be used for doing the actual filtering later.</p>
  86. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>route-map dn42 permit 5
  87. match ip address prefix-list dn42
  88. set src &lt;IPv4 address of the node&gt;
  89. exit
  90. !
  91. route-map dn42v6 permit 5
  92. match ipv6 address prefix-list dn42v6
  93. set src &lt;IPv6 address of the node&gt;
  94. exit
  95. </code></pre></div></div>
  96. <h3 id="bgp">BGP</h3>
  97. <p>With the configuration of the daemons file and Zebra done, BGP can now be configured.</p>
  98. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>router bgp &lt;AS of the network&gt;
  99. neighbor &lt;IPv4 peer address&gt; remote-as &lt;Peer AS&gt;
  100. neighbor &lt;IPv6 peer address&gt; remote-as &lt;Peer AS&gt;
  101. ! In case an IPv6 link local address is used to peer
  102. neighbor &lt;IPv6 peer address&gt; interface &lt;Peer interface&gt;
  103. !
  104. address-family ipv4 unicast
  105. network &lt;Your IPv4 subnet&gt;
  106. neighbor &lt;IPv4 peer address&gt; activate
  107. neighbor &lt;IPv4 peer address&gt; route-map dn42 in
  108. neighbor &lt;IPv4 peer address&gt; route-map dn42 out
  109. exit
  110. !
  111. address-family ipv6 unicast
  112. network &lt;Your IPv6 subnet&gt;
  113. neighbor &lt;IPv6 peer address&gt; activate
  114. neighbor &lt;IPv6 peer address&gt; route-map dn42v6 in
  115. neighbor &lt;IPv6 peer address&gt; route-map dn42v6 out
  116. exit
  117. exit
  118. </code></pre></div></div>
  119. <p><strong>Note</strong>: to advertise your prefixes, you will also have to have the full prefix assigned to an interface on the system.</p>
  120. <p>With everything configured, the BGP session should come up. In the normal VTY shell mode the status of BGP peerings can be checked using the <code class="language-plaintext highlighter-rouge">show bgp summary</code> command.</p>
  121. <h3 id="complete-configuration-example">Complete configuration example</h3>
  122. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>router bgp &lt;Your AS here&gt;
  123. neighbor &lt;Peer IPv4&gt; remote-as &lt;Peer AS&gt;
  124. neighbor &lt;Peer IPv6&gt; remote-as &lt;Peer AS&gt;
  125. ! In case an IPv6 link local address is used to peer
  126. neighbor &lt;Peer IPv6&gt; interface &lt;Peer interface&gt;
  127. !
  128. address-family ipv4 unicast
  129. network &lt;Your IPv4 subnet&gt;
  130. neighbor &lt;IPv4 peer address&gt; activate
  131. neighbor &lt;IPv4 peer address&gt; route-map dn42 in
  132. neighbor &lt;IPv4 peer address&gt; route-map dn42 out
  133. exit
  134. !
  135. address-family ipv6 unicast
  136. network &lt;Your IPv6 subnet&gt;
  137. neighbor &lt;IPv6 peer address&gt; activate
  138. neighbor &lt;IPv6 peer address&gt; route-map dn42v6 in
  139. neighbor &lt;IPv6 peer address&gt; route-map dn42v6 out
  140. exit
  141. exit
  142. !
  143. ip prefix-list dn42 seq 1 deny 172.22.166.0/24 le 32
  144. ip prefix-list dn42 seq 1001 permit 172.20.0.0/24 ge 28 le 32
  145. ip prefix-list dn42 seq 1002 permit 172.21.0.0/24 ge 28 le 32
  146. ip prefix-list dn42 seq 1003 permit 172.22.0.0/24 ge 28 le 32
  147. ip prefix-list dn42 seq 1004 permit 172.23.0.0/24 ge 28 le 32
  148. ip prefix-list dn42 seq 1100 permit 172.20.0.0/14 ge 21 le 29
  149. ip prefix-list dn42 seq 2001 permit 10.100.0.0/14 le 32
  150. ip prefix-list dn42 seq 2002 permit 10.127.0.0/16 le 32
  151. ip prefix-list dn42 seq 2003 permit 10.0.0.0/8 ge 15 le 24
  152. ip prefix-list dn42 seq 3001 permit 172.31.0.0/16 le 32
  153. ip prefix-list dn42 seq 9999 deny 0.0.0.0/0 le 32
  154. !
  155. ipv6 prefix-list dn42v6 seq 1001 permit fd00::/8 ge 44 le 64
  156. ipv6 prefix-list dn42v6 seq 9999 deny ::/0 le 128
  157. !
  158. route-map dn42 permit 5
  159. match ip address prefix-list dn42
  160. set src &lt;IPv4 address of the node&gt;
  161. exit
  162. !
  163. route-map dn42v6 permit 5
  164. match ipv6 address prefix-list dn42v6
  165. set src &lt;IPv6 address of the node&gt;
  166. exit
  167. </code></pre></div></div>
  168. <h2 id="further-reading">Further reading</h2>
  169. <h3 id="general-things">General things</h3>
  170. <ul>
  171. <li>FRR documentation: <a href="https://docs.frrouting.org/en/latest">https://docs.frrouting.org/en/latest</a></li>
  172. <li>FRR source code: <a href="https://github.com/frrouting/frr">https://github.com/frrouting/frr</a></li>
  173. </ul>
  174. <h3 id="configuration-tipps">Configuration tipps</h3>
  175. <ul>
  176. <li>Use <a href="https://docs.frrouting.org/en/latest/bgp.html#peer-groups">peer groups</a> (<em>Strongly recommended to limit the work neede to add new peers or change general configuration for may peers.</em>)</li>
  177. <li><code class="language-plaintext highlighter-rouge">tab</code> and <code class="language-plaintext highlighter-rouge">?</code> are your best friends in the VTY shell</li>
  178. <li>Use <code class="language-plaintext highlighter-rouge">find REGEX</code> in the VTY shell to find certain commands</li>
  179. </ul>
  180. <div id="menu-container" class="menu-container">
  181. <hr>
  182. <div id="menu" class="menu">
  183. <ul>
  184. <li><a href="/Home">Home</a>
  185. <ul>
  186. <li><a href="/howto/Getting-Started">Getting Started</a></li>
  187. <li><a href="/howto/Registry-Authentication">Registry Authentication</a></li>
  188. <li><a href="/howto/Address-Space">Address Space</a></li>
  189. <li><a href="/howto/BGP-communities">BGP communities</a></li>
  190. <li><a href="/FAQ">FAQ</a></li>
  191. </ul>
  192. </li>
  193. <li>How-To
  194. <ul>
  195. <li><a href="/howto/wireguard">Wireguard</a></li>
  196. <li><a href="/howto/openvpn">Openvpn</a></li>
  197. <li><a href="/howto/IPsec-with-PublicKeys">IPsec With Public Keys</a></li>
  198. <li><a href="/howto/tinc">Tinc</a></li>
  199. <li><a href="/howto/GRE-on-FreeBSD">GRE on FreeBSD</a></li>
  200. <li><a href="/howto/GRE-on-OpenBSD">GRE on OpenBSD</a></li>
  201. <li><a href="/howto/IPv6-Multicast">IPv6 Multicast (PIM-SM)</a></li>
  202. <li><a href="/howto/multicast">SSM Multicast</a></li>
  203. <li><a href="/howto/mpls">MPLS</a></li>
  204. <li><a href="/howto/Bird2">Bird2</a></li>
  205. <li><a href="/howto/frr">FRRouting</a></li>
  206. <li><a href="/howto/OpenBGPD">OpenBGPD</a></li>
  207. <li><a href="/howto/mikrotik">Mikrotik RouterOS</a></li>
  208. <li><a href="/howto/EdgeOS-Config">EdgeRouter</a></li>
  209. <li><a href="/howto/Static-routes-on-Windows">Static routes on Windows</a></li>
  210. <li><a href="/howto/networksettings">Universal Network Requirements</a></li>
  211. <li><a href="/howto/vyos1.4.x">VyOS</a></li>
  212. <li><a href="/howto/nixos">NixOS</a></li>
  213. </ul>
  214. </li>
  215. <li>Services
  216. <ul>
  217. <li><a href="/services/IRC">IRC</a></li>
  218. <li><a href="/services/Whois">Whois registry</a></li>
  219. <li><a href="/services/DNS">DNS</a></li>
  220. <li><a href="/services/IX-Collection">IX Collection</a></li>
  221. <li><a href="/services/Clearnet-Domains">Public DNS</a></li>
  222. <li><a href="/services/Looking-Glasses">Looking Glasses</a></li>
  223. <li><a href="/services/Automatic-Peering">Automatic Peering</a></li>
  224. <li><a href="/services/Repository-Mirrors">Repository Mirrors</a></li>
  225. <li><a href="/services/Distributed-Wiki">Distributed Wiki</a></li>
  226. <li><a href="/services/Certificate-Authority">Certificate Authority</a></li>
  227. <li><a href="/services/Route-Collector">Route Collector</a></li>
  228. </ul>
  229. </li>
  230. <li>Internal
  231. <ul>
  232. <li><a href="/internal/Internal-Services">Internal services</a></li>
  233. <li><a href="/internal/Interconnections">Interconnections</a></li>
  234. <li><a href="/internal/APIs">APIs</a></li>
  235. <li><a href="/internal/ShowAndTell">Show and Tell</a></li>
  236. <li><a href="/internal/Historical-Services">Historical services</a></li>
  237. </ul>
  238. </li>
  239. <li>Historical
  240. <ul>
  241. <li><a href="/historical/Bird">Bird 1</a></li>
  242. <li><a href="/historical/Quagga">Quagga</a></li>
  243. </ul>
  244. </li>
  245. <li>External Tools
  246. <ul>
  247. <li><a href="https://paste.dn42.us">Paste Board</a></li>
  248. <li><a href="https://git.dn42.dev">Git Repositories</a></li>
  249. </ul>
  250. </li>
  251. </ul>
  252. <hr />
  253. </div>
  254. </div>
  255. </main>
  256. <footer><div class="center">
  257. <div id="dn42_footer">
  258. <table>
  259. <tbody>
  260. <tr>
  261. <td>Hosted by: <a href="mailto:dn42@burble.com">BURBLE-MNT</a>, <a href="mailto:nurtic-vibe@grmml.net">GRMML-MNT</a>, <a href="mailto:xuu@dn42.us">XUU-MNT</a>, <a href="mailto:janeric@ortgies.it">JAN-MNT</a>, <a href="mailto:lare@lare.cc">LARE-MNT</a>, <a href="mailto:danny@saru.moe">SARU-MNT</a>, <a href="mailto:androw95220@gmail.com">ANDROW-MNT</a>, <a href="mailto:dn42@mk16.de">MARK22K-MNT</a></td>
  262. <td>Accessible via: <a href="https://wiki.dn42">dn42</a>, <a href="https://dn42.dev/">dn42.dev</a>, <a href="https://dn42.eu/">dn42.eu</a>, <a href="https://wiki.dn42.us/">wiki.dn42.us</a>, <a href="https://dn42.de/">dn42.de</a> (IPv6-only), <a href="https://dn42.cc/">dn42.cc</a> (wiki-ng), <a href="https://dn42.wiki/">dn42.wiki</a>, <a href="https://dn42.pp.ua/">dn42.pp.ua</a>, <a href="https://dn42.obl.ong/">dn42.obl.ong</a></td>
  263. </tr>
  264. </tbody>
  265. </table>
  266. </div>
  267. </div>
  268. </footer>
  269. </body>
  270. </html>