EdgeOS-Config.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>EdgeOS | 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/EdgeOS-Config.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 / EdgeOS</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. <h1 id="edgeos">EdgeOS</h1>
  27. <p>This document describes some possibilities for connecting to dn42 using an Ubiquiti EdgeRouter:</p>
  28. <ul>
  29. <li>IPv4/IPv6 tunnel via:
  30. <ul>
  31. <li>OpenVPN - support built into EdgeOS already - covered below</li>
  32. <li>IPsec/IKEv2 - support built into EdgeOS already - not covered here</li>
  33. <li>QuickTun - see <a href="https://github.com/neilalexander/vyatta-quicktun">vyatta-quicktun package</a> - not covered here</li>
  34. </ul>
  35. </li>
  36. <li>Route exchange using BGP</li>
  37. <li>DNS resolution for the .dn42 TLD</li>
  38. </ul>
  39. <h2 id="first-steps">First Steps</h2>
  40. <ol>
  41. <li>Create the required objects in the Registry - see <a href="/howto/Getting-Started">Getting Started</a></li>
  42. <li>Find a peer - ask nicely in <a href="/services/IRC">IRC</a>!</li>
  43. <li>Get the following details:
  44. <ul>
  45. <li>Tunnel configuration (OpenVPN, IPsec, QuickTun)</li>
  46. <li>AS numbers</li>
  47. </ul>
  48. </li>
  49. </ol>
  50. <h3 id="tunnel-configuration">Tunnel Configuration</h3>
  51. <h3 id="openvpn">OpenVPN</h3>
  52. <p>Using the below as examples:</p>
  53. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Own ASN: AS111111
  54. Own IPv4 Space: 172.AA.AA.64/27
  55. Own IPv6 Space: fdBB:BBBB:CCCC::/48
  56. Own IPv4 If-Address: 172.AA.AA.65
  57. Own IPv6 If-Address: fdBB:BBBB:CCCC::1
  58. Peer OpenVPN Remote Address: 172.X.X.X //that's the peers OpenVPN IF IP
  59. Peer OpenVPN Remote Host: X.X.X.Y //that's the peers clearnet IP
  60. Peer OpenVPN IP for you: fdAA::BBB/64
  61. Peer OpenVPN IP: fdAA::CC
  62. Peer OpenVPN Port: 1194
  63. Peer OpenVPN encryption: aes256
  64. Peer ASN: AS222222
  65. Peer BGP Neighbour IPv4: Z.Z.Z.Z
  66. Peer BGP Neighbour IPv6: fdAA::CC
  67. </code></pre></div></div>
  68. <h4 id="copy-openvpn-key-to-the-edgerouter">Copy OpenVPN key to the EdgeRouter</h4>
  69. <p>Copy the VPN key to <code class="language-plaintext highlighter-rouge">/config/auth/SomeSharedKey.key</code>:</p>
  70. <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo cat</span> <span class="o">&gt;</span> /config/auth/SomeSharedKey.key
  71. </code></pre></div></div>
  72. <p>Paste the key in the terminal window, hit return once and kill <code class="language-plaintext highlighter-rouge">cat</code> with CTRL+C. Then type <code class="language-plaintext highlighter-rouge">exit</code>.</p>
  73. <h4 id="create-ipv4-openvpn-interface">Create IPv4 OpenVPN Interface</h4>
  74. <p>Create the OpenVPN virtual interface, i.e. using <code class="language-plaintext highlighter-rouge">vtun0</code>:</p>
  75. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>configure
  76. set interfaces openvpn vtun0
  77. set interfaces openvpn vtun0 mode site-to-site
  78. set interfaces openvpn vtun0 local-port 1194
  79. set interfaces openvpn vtun0 remote-port 1194
  80. set interfaces openvpn vtun0 local-address 172.AA.AA.65
  81. set interfaces openvpn vtun0 remote-address 172.X.X.X
  82. set interfaces openvpn vtun0 remote-host X.X.X.Y
  83. set interfaces openvpn vtun0 shared-secret-key-file /config/auth/SomeSharedKey.key
  84. set interfaces openvpn vtun0 encryption aes256
  85. set interfaces openvpn vtun0 openvpn-option "--comp-lzo" //if your peer support compression
  86. commit
  87. save
  88. exit
  89. </code></pre></div></div>
  90. <p>The OpenVPN tunnel should now be up and running.</p>
  91. <p>Check it with:</p>
  92. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show interfaces openvpn
  93. show interfaces openvpn detail
  94. show openvpn status site-to-site
  95. </code></pre></div></div>
  96. <h3 id="create-bgp-session">Create BGP Session</h3>
  97. <h4 id="open-firewall">Open Firewall</h4>
  98. <p>You need to open the firewall to local for the tunnel Interface on port 179/tcp</p>
  99. <h4 id="configure-the-bgp-neighbor">Configure the BGP Neighbor</h4>
  100. <p>When entering AS numbers, do not include the “AS” prefix, i.e. enter AS111111 as just 111111.</p>
  101. <p>Build the BGP session with your peer:</p>
  102. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>configure
  103. set protocols bgp 111111 neighbor Z.Z.Z.Z remote-as 222222
  104. set protocols bgp 111111 neighbor Z.Z.Z.Z soft-reconfiguration inbound
  105. set protocols bgp 111111 neighbor Z.Z.Z.Z update-source 172.AA.AA.65
  106. commit
  107. save
  108. </code></pre></div></div>
  109. <p>Check that the BGP session has come up:</p>
  110. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show ip bgp summary
  111. </code></pre></div></div>
  112. <h4 id="create-blackhole-route">Create Blackhole Route</h4>
  113. <p>so bgp can announce the route</p>
  114. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>set protocols static route 172.AA.AA.64/27 blackhole
  115. commit
  116. save
  117. </code></pre></div></div>
  118. <h4 id="announce-route-to-bgp">Announce Route to BGP</h4>
  119. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>set protocols bgp 111111 network 172.A.A.64/27
  120. commit
  121. save
  122. exit
  123. </code></pre></div></div>
  124. <p>You should now be able to see networks being advertised to your peer:</p>
  125. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>show ip bgp neighbors Z.Z.Z.Z advertised-routes
  126. </code></pre></div></div>
  127. <h3 id="set-dns-forwarding">Set DNS Forwarding</h3>
  128. <p>Try to ping <code class="language-plaintext highlighter-rouge">172.23.0.53</code> (anycast DNS resolver). If you get a response then you are good to continue.</p>
  129. <p>Add the DNS forwarder:</p>
  130. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>configure
  131. set service dns forwarding options server=/23.172.in-addr.arpa/172.23.0.53
  132. set service dns forwarding options server=/22.172.in-addr.arpa/172.23.0.53
  133. set service dns forwarding options server=/dn42/172.23.0.53
  134. commit
  135. save
  136. exit
  137. </code></pre></div></div>
  138. <h3 id="create-nat-rule">Create NAT rule</h3>
  139. <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>set service nat rule 5013 outbound-interface vtun0
  140. set service nat rule 5013 type masquerade
  141. set service nat rule 5013 description "Masquerade for dn42"
  142. </code></pre></div></div>
  143. <p>You should now be able to access .dn42 domains.</p>
  144. <div id="menu-container" class="menu-container">
  145. <hr>
  146. <div id="menu" class="menu">
  147. <ul>
  148. <li><a href="/Home">Home</a>
  149. <ul>
  150. <li><a href="/howto/Getting-Started">Getting Started</a></li>
  151. <li><a href="/howto/Registry-Authentication">Registry Authentication</a></li>
  152. <li><a href="/howto/Address-Space">Address Space</a></li>
  153. <li><a href="/howto/BGP-communities">BGP communities</a></li>
  154. <li><a href="/FAQ">FAQ</a></li>
  155. </ul>
  156. </li>
  157. <li>How-To
  158. <ul>
  159. <li><a href="/howto/wireguard">Wireguard</a></li>
  160. <li><a href="/howto/openvpn">Openvpn</a></li>
  161. <li><a href="/howto/IPsec-with-PublicKeys">IPsec With Public Keys</a></li>
  162. <li><a href="/howto/tinc">Tinc</a></li>
  163. <li><a href="/howto/GRE-on-FreeBSD">GRE on FreeBSD</a></li>
  164. <li><a href="/howto/GRE-on-OpenBSD">GRE on OpenBSD</a></li>
  165. <li><a href="/howto/IPv6-Multicast">IPv6 Multicast (PIM-SM)</a></li>
  166. <li><a href="/howto/multicast">SSM Multicast</a></li>
  167. <li><a href="/howto/mpls">MPLS</a></li>
  168. <li><a href="/howto/Bird2">Bird2</a></li>
  169. <li><a href="/howto/frr">FRRouting</a></li>
  170. <li><a href="/howto/OpenBGPD">OpenBGPD</a></li>
  171. <li><a href="/howto/mikrotik">Mikrotik RouterOS</a></li>
  172. <li><a href="/howto/EdgeOS-Config">EdgeRouter</a></li>
  173. <li><a href="/howto/Static-routes-on-Windows">Static routes on Windows</a></li>
  174. <li><a href="/howto/networksettings">Universal Network Requirements</a></li>
  175. <li><a href="/howto/vyos1.4.x">VyOS</a></li>
  176. <li><a href="/howto/nixos">NixOS</a></li>
  177. </ul>
  178. </li>
  179. <li>Services
  180. <ul>
  181. <li><a href="/services/IRC">IRC</a></li>
  182. <li><a href="/services/Whois">Whois registry</a></li>
  183. <li><a href="/services/DNS">DNS</a></li>
  184. <li><a href="/services/IX-Collection">IX Collection</a></li>
  185. <li><a href="/services/Clearnet-Domains">Public DNS</a></li>
  186. <li><a href="/services/Looking-Glasses">Looking Glasses</a></li>
  187. <li><a href="/services/Automatic-Peering">Automatic Peering</a></li>
  188. <li><a href="/services/Repository-Mirrors">Repository Mirrors</a></li>
  189. <li><a href="/services/Distributed-Wiki">Distributed Wiki</a></li>
  190. <li><a href="/services/Certificate-Authority">Certificate Authority</a></li>
  191. <li><a href="/services/Route-Collector">Route Collector</a></li>
  192. </ul>
  193. </li>
  194. <li>Internal
  195. <ul>
  196. <li><a href="/internal/Internal-Services">Internal services</a></li>
  197. <li><a href="/internal/Interconnections">Interconnections</a></li>
  198. <li><a href="/internal/APIs">APIs</a></li>
  199. <li><a href="/internal/ShowAndTell">Show and Tell</a></li>
  200. <li><a href="/internal/Historical-Services">Historical services</a></li>
  201. </ul>
  202. </li>
  203. <li>Historical
  204. <ul>
  205. <li><a href="/historical/Bird">Bird 1</a></li>
  206. <li><a href="/historical/Quagga">Quagga</a></li>
  207. </ul>
  208. </li>
  209. <li>External Tools
  210. <ul>
  211. <li><a href="https://paste.dn42.us">Paste Board</a></li>
  212. <li><a href="https://git.dn42.dev">Git Repositories</a></li>
  213. </ul>
  214. </li>
  215. </ul>
  216. <hr />
  217. </div>
  218. </div>
  219. </main>
  220. <footer><div class="center">
  221. <div id="dn42_footer">
  222. <table>
  223. <tbody>
  224. <tr>
  225. <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>
  226. <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>
  227. </tr>
  228. </tbody>
  229. </table>
  230. </div>
  231. </div>
  232. </footer>
  233. </body>
  234. </html>