<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ampr.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yo2loj</id>
	<title>44Net Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ampr.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yo2loj"/>
	<link rel="alternate" type="text/html" href="https://wiki.ampr.org/wiki/Special:Contributions/Yo2loj"/>
	<updated>2026-04-15T23:26:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Ampr-map&amp;diff=1687</id>
		<title>Ampr-map</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Ampr-map&amp;diff=1687"/>
		<updated>2025-09-06T21:08:25Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Viewing the map ==&lt;br /&gt;
&lt;br /&gt;
We have a visual map of the AMPR network available, on which users can choose to voluntarily publish their callsign/locator, which is then shown on a vector map of the world.&lt;br /&gt;
Generally, the positions will time out after 1 hour.&lt;br /&gt;
&lt;br /&gt;
On click on the dots on the map, additional information will be shown: type, IP, locator and seconds since the last information received.&lt;br /&gt;
&lt;br /&gt;
No information are permanently stored on the server side.&lt;br /&gt;
&lt;br /&gt;
To opt out, just stop sending position reports...&lt;br /&gt;
&lt;br /&gt;
Some technical info:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;The server uses the following incoming ports:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- ampr-ripd uses UDP/59001,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- amprd uses UDP/59002,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- all other http requests use TCP/59001&amp;lt;br&amp;gt;&lt;br /&gt;
Map events sent to your browser are in json format and use websockets or event-stream as a fallback.&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The map can be reached via these URLs:&lt;br /&gt;
&lt;br /&gt;
 http://www.yo2loj.ro/ampr-map/&lt;br /&gt;
 http://yo2loj.ampr.org/ampr-map/&lt;br /&gt;
&lt;br /&gt;
== Sending the location to the map ==&lt;br /&gt;
&lt;br /&gt;
Depending on your system setup and node type, there are 5 methods to get your positions on the map.&lt;br /&gt;
&lt;br /&gt;
Please replace the callsign and position with your own in the given examples.&lt;br /&gt;
&lt;br /&gt;
Position reports are case insensitive and will all be converted to upper case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 1. ampr-ripd:&lt;br /&gt;
&lt;br /&gt;
Add the parameter &#039;-L &amp;lt;callsign@&amp;lt;locator&amp;gt;&#039; to the ampr-ripd command line.&lt;br /&gt;
&lt;br /&gt;
 ampr-ripd [...other parameters...] -L N0CALL-T@kn01aa&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as green dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 2. amprd:&lt;br /&gt;
&lt;br /&gt;
Add your locator in the configuration file, under your interface section:&lt;br /&gt;
&lt;br /&gt;
 call_home = N0CALL-T@KN05or&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as blue dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 3. Mikrotik routers&lt;br /&gt;
&lt;br /&gt;
Set up a cyclic job to run a script in which you request a specific URL, using the command, e.g. every 5 minutes:&lt;br /&gt;
&lt;br /&gt;
 /tool fetch mode=http url=&amp;quot;&amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/mikrotik?id=N0CALL-T@kn01aa&amp;lt;/nowiki&amp;gt;&amp;quot; keep-result=no&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as pink dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 4. &#039;Radio&#039; positions&lt;br /&gt;
&lt;br /&gt;
These positions are dedicated to stations not directly reachable via 44net, and are sent out by other systems in their name.&lt;br /&gt;
&lt;br /&gt;
To do this, do a periodic fetch on the following URL:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/radio_gateway?id=n0call-t@kn01aa&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For radio stations, the position time-out is 3 hours.&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as yellow antenna symbols.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 5. Generic position reports&lt;br /&gt;
&lt;br /&gt;
For other (generic) systems, do a periodic fetch on the following URL:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/generic?id=n0call-t@kn01aa&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as grey dots.&lt;br /&gt;
&lt;br /&gt;
== Map Server Source Code ==&lt;br /&gt;
&lt;br /&gt;
The map server&#039;s source code can be found in the AMPR GIT repository:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://git.ampr.org/yo2loj/ampr-map-server&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Reference]]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Services&amp;diff=1266</id>
		<title>Services</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Services&amp;diff=1266"/>
		<updated>2024-08-28T21:34:06Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: Link update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Maintainer !! Service Name!! URL/IP !! Service Type !! Description !! Other Information&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||[[Portal]] ||  https://portal.ampr.org || HTTPS || Used to request allocations, manage user profile information, [[Gateway]] entries, [[Encap.txt]] preferences and ampr.org DNS entries|| NONE&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||Website ||  https://www.ampr.org || HTTPS || AMPRNet Main Page|| NONE&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||Wiki ||  https://wiki.ampr.org || HTTPS || This Wiki|| NONE&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||44Net discussion group ||  https://ardc.groups.io/g/44net || HTTPS || AMPR discussion group|| NONE&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||ARDC announcements ||  https://ardc.groups.io/g/main || HTTPS || ARDC announcements|| NONE&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||AMPRNet Gateway [[Amprgw|(AMPRGW)]] || amprgw.ucsd.edu/169.228.34.84 || IP and IPENCAP [[Tunnel]]|| Routes traffic between the public internet and AMPRNet hosts connected via the IPIP mesh and originates [[RIP]] packets || Gateways use IP Protocol 4 (IPENCAP) to receive traffic via AMPRGW. Allocation must be registered in the [[Portal]] with a ampr.org DNS entry, and gateways must run an AMPRNet routing protocol (i.e. [[RIP]]44 or [[munge script]])&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||[[RIP]]44 || provided via [https://en.wikipedia.org/wiki/Broadcasting_%28networking%29 broadcast] from 44.0.0.1 to all [[gateway]]s registered in the [[portal]] || Routing Information (modified RIPv2 protocol) || distributed by main AMPRNet Router to multicast address 224.0.0.9|| 1.) an enabled IPENCAP tunnel, and 2.) [[ampr-ripd]] or [[rip44d]] must be running and properly configured on your registered gateway&lt;br /&gt;
|-&lt;br /&gt;
| AMPR ||[[Encap.txt]] || N/A || Routing Information (EMAIL/FTP/HTTP)|| routing information for download|| file must be must be parsed by a self-developed [[munge script]]&lt;br /&gt;
|-&lt;br /&gt;
| Various Operators||[[Ampr.org]] DNS and Reverse DNS (44.in-addr.arpa) ||&lt;br /&gt;
ns.ardc.net&amp;lt;br /&amp;gt;&lt;br /&gt;
a.gw4.uk&amp;lt;br /&amp;gt;&lt;br /&gt;
ns2.us.ardc.net&amp;lt;br /&amp;gt;&lt;br /&gt;
ns1.de.ardc.net&amp;lt;br /&amp;gt;&lt;br /&gt;
(These hosts are authoritative for AMPR.ORG and most of the &#039;[0-191].44.in-addr.arpa&#039; reverse zones.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
44.0.0.0/9 thru 44.128.0.0/10 hosts may use dns-mdc.ampr.org (44.60.44.3) as a recursive DNS server. It also has a copy of HAMWAN.ORG&amp;lt;br /&amp;gt;&lt;br /&gt;
srv.kz2x.ampr.org (44.44.48.29) is a recursive resolver available to 44.0.0.0/9 and 44.128.0.0/10&amp;lt;br /&amp;gt;&lt;br /&gt;
|| DNS || name resolution services||&lt;br /&gt;
|-&lt;br /&gt;
| Various Operators||Network Tools||&lt;br /&gt;
http://whatismyip.ampr.org&amp;lt;br /&amp;gt;&lt;br /&gt;
http://yo2loj.ampr.org/nettools.php&amp;lt;br /&amp;gt;&lt;br /&gt;
http://kb3vwg-010.ampr.org/tools&amp;lt;br /&amp;gt;&lt;br /&gt;
http://speedtest.ampr.org&amp;lt;br /&amp;gt;&lt;br /&gt;
 || HTTP|| source IP checker, speed test, Ping, Traceroute, etc.|| &#039;&#039;&#039;kb3vwg-010.ampr.org&#039;&#039;&#039; only available from hosts with an AMPRNet IP address&lt;br /&gt;
|-&lt;br /&gt;
| Various Operators ||Network Time Protocol || ntp.vk2hff.ampr.org (Stratum 1, AU)&amp;lt;br /&amp;gt;time.kz2x.ampr.org (Stratum 1, US)&amp;lt;br /&amp;gt;kb3vwg-001.ampr.org (Stratum 2, US)&amp;lt;br /&amp;gt;gw-44-137.pi9noz.ampr.org (Stratum 2)|| NTP|| Stratum 2 Network Time Server - References US, Canadian and Mexican|| &#039;&#039;&#039;kb3vwg-001.ampr.org&#039;&#039;&#039; only available from hosts with an AMPRNet IP address&amp;lt;br /&amp;gt;&#039;&#039;&#039;time.kz2x.ampr.org&#039;&#039;&#039; only available from hosts with an AMPRNet IP address&lt;br /&gt;
|-&lt;br /&gt;
| N1URO  ||AMPRNet/RF faxing || http://wiki.ampr.org/wiki/axMail-FAX || Facsimile || Online IP based Facsimile service. You have the ability to send emergency communications from packet via Fax. || [http://axmail.sourceforge.net axMail-FAX] Sofware is here.&lt;br /&gt;
|-&lt;br /&gt;
| [http://allstarlink.org AllStar Link] || AllStar || http://allstarlink.org || Linking of repeaters || AllStar Link core network services are provided via redundant datacenters using 44net IP space.  || [https://wiki.allstarlink.org/wiki/Main_Page ASL wiki]&lt;br /&gt;
|-&lt;br /&gt;
| N2NOV and G1FEF || Hub_NA and Hub_EU for WWconvers Chat System || 44.68.41.2:3600&amp;lt;br /&amp;gt;convers.g1fef.co.uk:3600 || Telnet || Only connections from other 44Net addresses allowed using port 3600. Stations like JNOS with a built-in local chat server can link to it.&amp;lt;br /&amp;gt; Individuals without a local chat portal can use an IRC client to a public IP address that must be arranged with the owner. || None&lt;br /&gt;
|-&lt;br /&gt;
| N2NOV || AMPRNet NE US Regional Portal || http://n2nov.ampr.org/hamgate.html || HTTP || AMPRNet NE US Regional Portal || None&lt;br /&gt;
|-&lt;br /&gt;
| [https://flscg.org/ FSG]|| HamWAN Remote || https://flscg.org/2022/04/hamwan-remote/ || VPN/BGP || We provide a VPN based remote site connection to [https://flscg.org/hamwan/ HamWAN Tampa] and can announce your IP space.  Performance of over 1gbit/s is possible and we provide an local connection point for amateurs in the South Eastern United States. || https://wiki.w9cr.net/index.php/HamWAN_Remote_Site &lt;br /&gt;
|-&lt;br /&gt;
| [https://hamwan.org HamWAN]||HamWAN Open Peering||https://hamwan.org/Labs/Open%20Peering%20Policy.html||BGP/IPSec(AH)||We provide IPsec VPN w/ BGP peering + Internet announcing.||&lt;br /&gt;
|-}&lt;br /&gt;
&lt;br /&gt;
Services previously available on AMPRNet but no longer actively supported can be viewed on the [[Services/Historic|Historic Services]] page.&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Ampr-map&amp;diff=1265</id>
		<title>Ampr-map</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Ampr-map&amp;diff=1265"/>
		<updated>2024-08-28T21:31:17Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Viewing the map ==&lt;br /&gt;
&lt;br /&gt;
We have a visual map of the AMPR network available, on which users can choose to voluntarily publish their callsign/locator, which is then shown on a vector map of the world.&lt;br /&gt;
Generally, the positions will time out after 1 hour.&lt;br /&gt;
&lt;br /&gt;
On click on the dots on the map, additional information will be shown: type, IP, locator and seconds since the last information received.&lt;br /&gt;
&lt;br /&gt;
No information are permanently stored on the server side.&lt;br /&gt;
&lt;br /&gt;
To opt out, just stop sending position reports...&lt;br /&gt;
&lt;br /&gt;
Some technical info:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;i&amp;gt;The server uses the following incoming ports:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- ampr-ripd uses UDP/59001,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- amprd uses UDP/59002,&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;- all other http requests use TCP/59001&amp;lt;br&amp;gt;&lt;br /&gt;
Map events sent to your browser are in json format and use websockets or event-stream as a fallback.&amp;lt;/i&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The map can be reached via these URLs:&lt;br /&gt;
&lt;br /&gt;
 http://www.yo2loj.ro/ampr-map/&lt;br /&gt;
 http://yo2loj.ampr.org/ampr-map/&lt;br /&gt;
&lt;br /&gt;
== Sending the location to the map ==&lt;br /&gt;
&lt;br /&gt;
Depending on your system setup and node type, there are 5 methods to get your positions on the map.&lt;br /&gt;
&lt;br /&gt;
Please replace the callsign and position with your own in the given examples.&lt;br /&gt;
&lt;br /&gt;
Position reports are case insensitive and will all be converted to upper case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 1. ampr-ripd:&lt;br /&gt;
&lt;br /&gt;
Add the parameter &#039;-L &amp;lt;callsign@&amp;lt;locator&amp;gt;&#039; to the ampr-ripd command line.&lt;br /&gt;
&lt;br /&gt;
 ampr-ripd [...other parameters...] -L N0CALL-T@kn01aa&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as green dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 2. amprd:&lt;br /&gt;
&lt;br /&gt;
Add your locator in the configuration file, under your interface section:&lt;br /&gt;
&lt;br /&gt;
 call_home = N0CALL-T@KN05or&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as blue dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 3. Mikrotik routers&lt;br /&gt;
&lt;br /&gt;
Set up a cyclic job to run a script in which you request a specific URL, using the command, e.g. every 5 minutes:&lt;br /&gt;
&lt;br /&gt;
 /tool fetch mode=http url=&amp;quot;&amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/mikrotik?id=N0CALL-T@kn01aa&amp;lt;/nowiki&amp;gt;&amp;quot; keep-result=no&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as pink dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 4. &#039;Radio&#039; positions&lt;br /&gt;
&lt;br /&gt;
These positions are dedicated to stations not directly reachable via 44net, and are sent out by other systems in their name.&lt;br /&gt;
&lt;br /&gt;
To do this, do a periodic fetch on the following URL:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/radio_gateway?id=n0call-t@kn01aa&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For radio stations, the position time-out is 3 hours.&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as yellow antenna symbols.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; 5. Generic position reports&lt;br /&gt;
&lt;br /&gt;
For other (generic) systems, do a periodic fetch on the following URL:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://44.182.21.1:59001/generic?id=n0call-t@kn01aa&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Positions will be shown as grey dots.&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1179</id>
		<title>Archive/Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1179"/>
		<updated>2024-08-13T13:14:31Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* How to connect to the 44Net */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the AMPRNet Wiki.&lt;br /&gt;
&lt;br /&gt;
44Net is shorthand for Internet network 44 (44.0.0.0/9 &amp;amp; 44.128.0.0/10), also known as AMPRNet. Since its allocation to amateur radio in the mid-1980s, the network has been used by amateur radio operators to conduct scientific research and to experiment with digital communications over radio. The goals are to of advance the state of the art of Amateur Radio networking, and to educate amateur radio operators in these techniques.&lt;br /&gt;
&lt;br /&gt;
To request an assignment of IPv4 addresses see below.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Starting points ==&lt;br /&gt;
* [[Quickstart]] guide for getting onto the 44Net&lt;br /&gt;
* Basic information about 44Net and the [[ampr.org]] domain&lt;br /&gt;
* [[Services]] available on 44Net&lt;br /&gt;
* If you are looking to get an IP assignment from ARDC please read the [[Portal]] page.&lt;br /&gt;
* Frequently Asked Questions (FAQ) [[FAQ]]&lt;br /&gt;
* [[Getting started with Linux and packet radio]]&lt;br /&gt;
* [[Networks that use 44Net]]&lt;br /&gt;
&lt;br /&gt;
== How to connect to the 44Net ==&lt;br /&gt;
&lt;br /&gt;
* Instructions for [[Setting up a gateway on Linux|setting up a Linux gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on MikroTik Routers|setting up a gateway on MikroTik Routers running ROS6]].&lt;br /&gt;
* Instructions for [[Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64|setting up a gateway on MikroTik Routers running ROS7 using a container on arm32, arm64 and x86-64]]&lt;br /&gt;
* Instructions for [[Setting up a gateway on OpenBSD|setting up an OpenBSD gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on Cisco Routers|setting up a  gateway on Cisco Routers]].&lt;br /&gt;
* Instructions for [[setting up a gateway on OpenWRT|setting up a gateway on OpenWRT]].&lt;br /&gt;
* Instructions for [[setting up a gateway on Ubiquiti EdgeRouter|setting up a gateway on Ubiquiti EdgeRouter]].&lt;br /&gt;
* Instructions for [[setting up a gateway on a VyOS instance|setting up a gateway on a VyOS instance]].&lt;br /&gt;
* Instructions for [[Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X|Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X]].&lt;br /&gt;
* Instructions for [[Announcing_your_allocation_directly|directly announcing your assignment via your Internet Service Provider (ISP)]].&lt;br /&gt;
* Instructions for [[OH7LZB_VPN|Accessing 44Net via VPN]] (experimental).&lt;br /&gt;
* &amp;lt;b&amp;gt;[[Why can&#039;t I just route my AMPRNet allocation directly myself ?]]&amp;lt;/b&amp;gt;&lt;br /&gt;
* If you already operate a [[gateway]] please ensure you have registered on the [[portal]] and &amp;quot;claimed&amp;quot; your [[gateway]].&lt;br /&gt;
* After your gateway is operational, consider &#039;&#039;&#039;[[Firewalls]]&#039;&#039;&#039; and other best practices&lt;br /&gt;
&lt;br /&gt;
== Groups.io ==&lt;br /&gt;
We are now on Groups.io  Please consider joining https://ardc.groups.io/g/44net&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
To keep up-to-date on AMPRNet information please consider joining the [[44Net mailing list]].&lt;br /&gt;
&lt;br /&gt;
== Contribute! ==&lt;br /&gt;
If you wish to contribute to the wiki, please send an email to &amp;lt;tt&amp;gt;wiki (at) ampr.org&amp;lt;/tt&amp;gt; introducing yourself. Please specify your full name and your amateur radio callsign. A login will then be created for you.&lt;br /&gt;
&lt;br /&gt;
== Terms of Service ==&lt;br /&gt;
Use of AMPRNet address space is governed by these [https://www.ampr.org/terms-of-service/ Terms of Service]&lt;br /&gt;
&lt;br /&gt;
== Other useful features ==&lt;br /&gt;
* Instruction on using the [[ampr-map]] position reporting&lt;br /&gt;
&lt;br /&gt;
== All Pages ==&lt;br /&gt;
[https://wiki.ampr.org/wiki/Special:AllPages Here&#039;s a list of all pages currently on the 44Net Wiki]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32,_arm64_and_x86-64&amp;diff=1178</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32,_arm64_and_x86-64&amp;diff=1178"/>
		<updated>2024-08-13T13:13:49Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: Yo2loj moved page Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64 to Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64: Comma in the URL breaks some clients&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64]]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1177</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1177"/>
		<updated>2024-08-13T13:13:49Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: Yo2loj moved page Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64 to Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64: Comma in the URL breaks some clients&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source code is available in git.ampr.org: https://git.ampr.org/yo2loj/ampr-ros7-container/-/tree/main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;The address shall be set on an interface OUTSIDE OF THE VRF&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
or even on the loopback interface:&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=lo&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rules:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=vrf-ampr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up additional firewall rules &amp;amp; stuff, but if you do not enable internet forwarding, you should be pretty safe being exposed only to AMPR partners.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot; for forwarded and &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf-ampr&amp;lt;/span&amp;gt;&amp;quot; for local outgoing data.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1175</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1175"/>
		<updated>2024-08-13T06:17:29Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Container configuration parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source code is available in git.ampr.org: https://git.ampr.org/yo2loj/ampr-ros7-container/-/tree/main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;The address shall be set on an interface OUTSIDE OF THE VRF&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
or even on the loopback interface:&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=lo&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rules:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=vrf-ampr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up additional firewall rules &amp;amp; stuff, but if you do not enable internet forwarding, you should be pretty safe being exposed only to AMPR partners.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot; for forwarded and &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf-ampr&amp;lt;/span&amp;gt;&amp;quot; for local outgoing data.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1174</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1174"/>
		<updated>2024-08-12T12:27:02Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Container configuration parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source code is available in git.ampr.org: https://git.ampr.org/yo2loj/ampr-ros7-container/-/tree/main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;The address shall be set on an interface OUTSIDE OF THE VRF&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
or even on the loopback interface:&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=lo&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rules:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=vrf-ampr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up additional firewall rules &amp;amp; stuff, but if you do not enable internet forwarding, you should be pretty safe being exposed only to AMPR partners.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1173</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1173"/>
		<updated>2024-08-12T11:55:48Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Container configuration parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source code is available in git.ampr.org: https://git.ampr.org/yo2loj/ampr-ros7-container/-/tree/main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;The address shall be set on an interface OUTSIDE OF THE VRF&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
or even on the loopback interface:&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=lo&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1172</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1172"/>
		<updated>2024-08-09T21:05:34Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source code is available in git.ampr.org: https://git.ampr.org/yo2loj/ampr-ros7-container/-/tree/main&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1171</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1171"/>
		<updated>2024-08-09T08:44:02Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;YourLANInterface&amp;gt;&amp;lt;/span&amp;gt; dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1170</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1170"/>
		<updated>2024-08-08T23:51:48Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1169</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1169"/>
		<updated>2024-08-08T22:22:49Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router 5 minutes set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1168</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1168"/>
		<updated>2024-08-08T22:21:47Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration and final touches&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
First, create a simple accept routing filter to be used by RIP:&lt;br /&gt;
 /routing filter rule add chain=rip-ampr-in disabled=no rule=&amp;quot;accept;&amp;quot;&lt;br /&gt;
Next, create a RIP instance for your VRF using the above filter and the defined VRF:&lt;br /&gt;
 /routing rip instance add afi=ipv4 in-filter-chain=rip-ampr-in name=rip-ampr vrf=vrf-ampr&lt;br /&gt;
And now add a passive (receive only) interface to our instance:&lt;br /&gt;
 /routing rip interface-template add instance=rip-ampr interfaces=bridge-ampr-gw mode=passive&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 3: Firewall rules, Filter, NAT and Mangle ==&lt;br /&gt;
&lt;br /&gt;
Now we need to forward out IPIP tunnels to the container, and extract our data from the VRF.&lt;br /&gt;
For our convenience we will set up an address list to handle AMPR space as one entity&lt;br /&gt;
(if you already have such a list on the router, you can use it)&lt;br /&gt;
 /ip firewall address-list&lt;br /&gt;
 add address=44.0.0.0/9 list=ampr_addr&lt;br /&gt;
 add address=44.128.0.0/10 list=ampr_addr&lt;br /&gt;
Also, we can use an interface list called WAN for the internet access interfaces (like the one in the default config).&lt;br /&gt;
If you prefer individual interfaces, you can of course use them in your rules.&lt;br /&gt;
&lt;br /&gt;
Filters are needed to allow data input and forward to/from the router.&lt;br /&gt;
Accept RIP from the VRF:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;RIP via VRF&amp;quot; dst-port=520 in-interface=vrf-ampr protocol=udp&lt;br /&gt;
Accept input from the AMPR address space to the router (important for ping and traceroute):&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=input comment=&amp;quot;AMPR via Tunnels&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr \&lt;br /&gt;
    src-address-list=ampr_addr&lt;br /&gt;
And we need to accept some forwarding for the IPIP tunnels, from VRF to our AMPR space and between AMPR hosts:&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from ISP&amp;quot; in-interface-list=Internet protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;IPIP Tunnels from VRF&amp;quot; in-interface=vrf-ampr protocol=ipencap&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;VRF to AMPR&amp;quot; dst-address-list=ampr_addr in-interface=vrf-ampr&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;AMPR to AMPR&amp;quot; dst-address-list=ampr_addr src-address-list=ampr_addr&lt;br /&gt;
&lt;br /&gt;
Next, we need to forward incoming IPIP traffic to our container (note that WAN interface list, use your interface if you like):&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=dst-nat chain=dstnat comment=&amp;quot;NAT ENCAP&amp;quot; in-interface-list=WAN protocol=ipencap \&lt;br /&gt;
    to-addresses=172.17.0.2&lt;br /&gt;
&lt;br /&gt;
Now to be able to traverse int and from the VRF, we need some mangle rules.&lt;br /&gt;
&lt;br /&gt;
Incoming IPIP traffic will be marked with the vrf routing mark:&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP incoming to VRF&amp;quot; in-interface-list=Internet \&lt;br /&gt;
    new-routing-mark=vrf-ampr passthrough=no protocol=ipencap&lt;br /&gt;
Outgoing IPIP traffic will be marked for the main routing table (or the one you need to reach your ISP)&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR IPIP outgoing via ISP&amp;quot; in-interface=vrf-ampr \&lt;br /&gt;
    new-routing-mark=main passthrough=no protocol=ipencap&lt;br /&gt;
Traffic to our local router IPs will be directed via our bridge&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=route chain=prerouting comment=&amp;quot;AMPR VRF route local&amp;quot; dst-address-type=local in-interface=vrf-ampr \&lt;br /&gt;
    passthrough=no route-dst=172.17.0.1&lt;br /&gt;
And finally, the incoming AMPR traffic will go to the main routing table&lt;br /&gt;
 /ip firewall mangle&lt;br /&gt;
 add action=mark-routing chain=prerouting comment=&amp;quot;AMPR VRF forward&amp;quot; in-interface=vrf-ampr new-routing-mark=main\&lt;br /&gt;
    passthrough=no&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 4 - Container environment setup ==&lt;br /&gt;
This step prepares the environment variables for the container.&lt;br /&gt;
&lt;br /&gt;
/container envs&lt;br /&gt;
 add comment=&amp;quot;My subnets, as defined in the portal&amp;quot; key=AMPR_SUBNETS name=ampr-cfg value=\&lt;br /&gt;
    44.128.0.0/24,44.128.1.0/24&lt;br /&gt;
 add comment=&amp;quot;Default gateway is AMPRGW instead of Internet&amp;quot; key=ALL_VIA_AMPRGW name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Forward internet traffic&amp;quot; key=FORWARD_INTERNET name=ampr-cfg value=0&lt;br /&gt;
 add comment=&amp;quot;Call home callsign and locator&amp;quot; key=CALL_HOME name=ampr-cfg value=test@AA00aa&lt;br /&gt;
 add comment=&amp;quot;Ignored subnets in RIP&amp;quot; key=IGNORED_SUBNETS name=ampr-cfg value=44.128.0.0/16&lt;br /&gt;
&lt;br /&gt;
Just paste them into the console or import the rsc script as it is. You will edit those later.&lt;br /&gt;
&lt;br /&gt;
The rsc file is here: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 5 - Container installation ==&lt;br /&gt;
Now you need to download the container which fits your architecture.&lt;br /&gt;
The following rsc files will install a script which, when run will import and install the container.&lt;br /&gt;
The same scripts will update and replace the container if run again.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Of course, instead of the script, you can download the appropriate tar container files yourself:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm32.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  http://yo2loj.ro/containers/ampr-arm64.tar&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
and install them manually. Please set them to use the env variables &amp;quot;ampr-cfg&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Or, you can compile and pack the container yourself from source. At the time of writing, the current version is 1.2.0:&lt;br /&gt;
 http://yo2loj.ro/containers/ampr-container-1.2.0-release.tgz&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Step 6 - Container configuration and final touches ==&lt;br /&gt;
&lt;br /&gt;
You need to edit your env variables &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;according to the description given in the new router setup&amp;lt;/span&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Start your container and wait 5 min. You should see AMPR routes showing up in the VRF&#039;s routing table&lt;br /&gt;
(Some 840 of them if ALL_VIA_AMPRGW is not enabled, otherwise you will get only 2 routes, 44.0.0.0/9 and 44.128.0.0/10).&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
Now, activate the use of the whole system.&lt;br /&gt;
Set up a routing rule set to force all outgoing AMPR traffic to do a lookup in the VRF routing table:&lt;br /&gt;
 /routing rule&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.0.0.0/9 table=vrf-ampr&lt;br /&gt;
 add action=lookup disabled=yes dst-address=44.128.0.0/10 table=vrf-ampr&lt;br /&gt;
If no route is found in that table, the lookup will continue via the main table towards your default route.&lt;br /&gt;
&lt;br /&gt;
Your local AMPR network and additional routing will go into the main table and the lookup will be done AFTER passing through the VRF&#039;s routing table.&lt;br /&gt;
This means that a matching route in the VRF, including a default 0.0.0.0/0 will take precedence over any route defined in the main table.&lt;br /&gt;
&lt;br /&gt;
Also, if you want to access the AMPR network from a LAN not using AMPR addresses, you need to set up a forwarding rule and a SRC-NAT one:&lt;br /&gt;
&lt;br /&gt;
 /ip firewall filter&lt;br /&gt;
 add action=accept chain=forward comment=&amp;quot;from LAN&amp;quot; in-interface=LAN dst-address-list=ampr_addr&lt;br /&gt;
and&lt;br /&gt;
 /ip firewall nat&lt;br /&gt;
 add action=src-nat chain=srcnat comment=&amp;quot;NAT to AMPR&amp;quot; dst-address-list=Ampr out-interface=bridge-ampr-gw \&lt;br /&gt;
    src-address-list=!ampr_addr to-addresses=&amp;lt;your router&#039;s AMPR ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional Info ==&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1167</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1167"/>
		<updated>2024-08-08T21:08:45Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request. This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version. Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file. Upload it to your router and restart. This will install the package onto the router. After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Installation script ==&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1166</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1166"/>
		<updated>2024-08-08T21:05:47Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Info&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1165</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1165"/>
		<updated>2024-08-08T21:05:00Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* New router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;New router set up&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1164</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1164"/>
		<updated>2024-08-08T21:04:17Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Configuration on an existing working router */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h1&amp;gt;Configuration on an existing working router - 6 steps&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 1 - Bridge, VETH, VRF and interface setup&lt;br /&gt;
 2 - RIP setup&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle&lt;br /&gt;
 4 - Container environment setup&lt;br /&gt;
 5 - Container installation (architecture dependent)&lt;br /&gt;
 6 - Container configuration&lt;br /&gt;
&lt;br /&gt;
== Preliminary: prepare the router to accept containers ==&lt;br /&gt;
First, you need to install container support on your router.&lt;br /&gt;
In a console issue:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The system will want you to do a hard reset at this point to confirm the request.&lt;br /&gt;
This means you need physical access to the device.&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the container package for your firmware version.&lt;br /&gt;
Download the &amp;quot;extra&amp;quot; firmware package from MikroTik for your FW version and extract the &amp;quot;container-7.x.y-&amp;lt;arch&amp;gt;.npk&amp;quot; file.&lt;br /&gt;
Upload it to your router and restart. This will install the package onto the router.&lt;br /&gt;
After restart, you will have a new option available: /containers&lt;br /&gt;
&lt;br /&gt;
== Step 1: Bridge, VETH, VRF and interface setup ==&lt;br /&gt;
&lt;br /&gt;
First create a bridge which will be used for your containr. Let&#039;s call it &#039;bridge-ampr-gw&#039;:&lt;br /&gt;
 /interface bridge add comment=&amp;quot;AMPR container&amp;quot; name=bridge-ampr-gw&lt;br /&gt;
Assign a network to it. The typical docker IP will be ok:&lt;br /&gt;
 /ip address add address=172.17.0.1/24 interface=bridge-ampr-gw&lt;br /&gt;
Create a virtual ethernet interface for the container itself (call it veth-ampr):&lt;br /&gt;
 /interface veth add name=veth-ampr address=172.17.0.2/24 comment=&amp;quot;AMPR container interface&amp;quot; \&lt;br /&gt;
    gateway=172.17.0.1&lt;br /&gt;
Add the VETH port to the bridge we created above:&lt;br /&gt;
 /interface bridge port add bridge=bridge-ampr-gw interface=veth-ampr&lt;br /&gt;
Because of a kernel anomaly preventing proper userspace IPIP handling, we need to filter icmp messages on the bridge from the container itself:&lt;br /&gt;
 /interface bridge filter add action=drop chain=input in-interface=veth-ampr ip-protocol=icmp \&lt;br /&gt;
    mac-protocol=ip src-address=172.17.0.2/32&lt;br /&gt;
Now we create a vrf called &amp;quot;vrf-ampr&amp;quot; and add the bridge to it:&lt;br /&gt;
 /ip vrf add interfaces=bridge-ampr-gw name=vrf-ampr&lt;br /&gt;
&lt;br /&gt;
All the above steps are available here as a rsc file: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
&lt;br /&gt;
== Step 2: RIP setup ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1163</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1163"/>
		<updated>2024-08-08T12:43:53Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* New router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the default firewall rule as they are.&lt;br /&gt;
Alternatively, you can start with a completely empty router, with only a active internet connection.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1162</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1162"/>
		<updated>2024-08-07T15:00:09Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;ARM32&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik &amp;lt;b&amp;gt;x86-64&amp;lt;/b&amp;gt; devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1161</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1161"/>
		<updated>2024-08-07T14:55:37Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 MikroTik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
MikroTik ARM64 devices:&lt;br /&gt;
 Routers: CCR2004, CCR2116, CCR2216, RB5009&lt;br /&gt;
 Switches: CRS520&lt;br /&gt;
 Wireless &amp;amp; 5G: Netmetal ax, LHG-LTE6, ATL-LTE18&lt;br /&gt;
 SOHO: hAP-ax2, cAP-ax, hAP-ax3, Chateau-ax&lt;br /&gt;
 Others: AMPERE&lt;br /&gt;
&lt;br /&gt;
MikroTik ARM32 devices:&lt;br /&gt;
 Routers: L009, RB3011, RB4011, RB1100AHx4, &lt;br /&gt;
 Switches: CRS305, CRS309, CRS310, CRS317, CRS320, CRS326, CRS328&lt;br /&gt;
 Wireless &amp;amp; 5G: SXTsq-5ac, NetBox-5ax, LHGXL-5ac&lt;br /&gt;
 SOHO: hAP-ax lite, hap-ac2, cAP-ac, wAP-ac, cAPXL-ac, hAP-ac3, Chateau&lt;br /&gt;
 Routerboard: L11UG, L23UGSR, RB450Gx4&lt;br /&gt;
&lt;br /&gt;
MikroTik x86-64 devices:&lt;br /&gt;
 Others: Cloud Hosted Router&lt;br /&gt;
&lt;br /&gt;
Containers are not available on MIPSBE, MMIPS, SMIPS, TILE or PPC architectures.&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiB&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1160</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1160"/>
		<updated>2024-08-07T14:28:22Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1159</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1159"/>
		<updated>2024-08-07T14:27:07Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Additional optional configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
You may notice that on an external traceroute your router&#039;s IP address will show up as 172.17.0.1.&lt;br /&gt;
To fix this small glitch, you need to modify your existing &amp;quot;rip-ampr-in&amp;quot; RIP input filter rule to provide the correct preferred source address.&lt;br /&gt;
&lt;br /&gt;
Modify the existing rule from&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
to set your router&#039;s local AMPR IP as its preferred source&lt;br /&gt;
 set pref-src 44.128.0.1;&lt;br /&gt;
 accept;&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1158</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1158"/>
		<updated>2024-08-07T14:21:46Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Container configuration parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1).&lt;br /&gt;
&lt;br /&gt;
For a single address:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt; interface=bridge&lt;br /&gt;
&lt;br /&gt;
For a subnet:&lt;br /&gt;
 /ip address add address=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1/24&amp;lt;/span&amp;gt; interface=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&amp;lt;interface name&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And your src-nat NAT rule:&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1157</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1157"/>
		<updated>2024-08-07T14:14:17Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* New router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&lt;br /&gt;
 AMPR: Now update your container envs and start the container&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1):&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1156</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1156"/>
		<updated>2024-08-07T14:08:26Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Container configuration parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1):&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;Please note that for your firewall rules the incoming interface from the tunnels is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;vrf_ampr&amp;lt;/span&amp;gt;&amp;quot; and the outgoing interface is &amp;quot;&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;bridge-ampr-gw&amp;lt;/span&amp;gt;&amp;quot;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1155</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1155"/>
		<updated>2024-08-07T13:58:29Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Next, you need to set up a local AMPR LAN on your router router, or, if you have only a single IP address assigned, add it to one of your router&#039;s interfaces with a /32 netmask&lt;br /&gt;
Anyway, you need to add a src-nat rule to the router&#039;s IP address to get your traffic flowing (let&#039;s assume its 44.128.0.1):&lt;br /&gt;
 /ip firewall nat add action=src-nat chain=srcnat out-interface=bridge-ampr-gw to-addresses=&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;44.128.0.1&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Additional optional configuration ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1154</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1154"/>
		<updated>2024-08-07T13:47:55Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM32&amp;lt;/span&amp;gt; -  ampr_arm32.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ARM64&amp;lt;/span&amp;gt; -  ampr_arm64.rsc&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CHRx86&amp;lt;/span&amp;gt; - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import &amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;ampr_arm32.rsc&amp;lt;/span&amp;gt;&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR: Script finished successful&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1153</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1153"/>
		<updated>2024-08-07T13:44:25Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* New router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 ARM32 -  ampr_arm32.rsc&lt;br /&gt;
 ARM64 -  ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/ampr_arm32.rsc&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import ampr_arm32.rsc&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 AMPR: Script finished successful&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description given below.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
If logging/debugging is not needed anymore, please disable it by clicking on the container and unchecking te logging box.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1152</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1152"/>
		<updated>2024-08-07T13:42:10Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* New router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
As a prerequisite, get your internet connection working based on the default mikrotik configuration.&lt;br /&gt;
Basically set up your ISP uplink either via DHCP or by setting up a PPPoE or similar connection.&lt;br /&gt;
Leave the firewall rule as they are.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik.&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
&lt;br /&gt;
Next we need to install the container according to your hardware.&lt;br /&gt;
Please chose the correct setup script variant:&lt;br /&gt;
&lt;br /&gt;
 ARM32 -  ampr_arm32.rsc&lt;br /&gt;
 ARM64 -  ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - ampr_x86_64.rsc&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
The example assumes you use an arm32 device. Please use the proper one...&lt;br /&gt;
&lt;br /&gt;
Open a route console window.&lt;br /&gt;
&lt;br /&gt;
1. Check is the remote server is available:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; ping yo2loj.ro&lt;br /&gt;
  SEQ HOST                                     SIZE TTL TIME       STATUS                    &lt;br /&gt;
    0 89.33.44.100                               56  58 10ms574us &lt;br /&gt;
    1 89.33.44.100                               56  58 9ms141us  &lt;br /&gt;
    2 89.33.44.100                               56  58 9ms5us    &lt;br /&gt;
    sent=3 received=3 packet-loss=0% min-rtt=9ms5us avg-rtt=9ms573us max-rtt=10ms574us&lt;br /&gt;
&lt;br /&gt;
2. Download the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; /tool fetch url=&amp;quot;http://yo2loj.ro/containers/ampr_arm32.rsc&amp;quot;&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 5KiBC-z pause]&lt;br /&gt;
       total: 5KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
&lt;br /&gt;
3. Run the configuration script&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import ampr_arm32.rsc&lt;br /&gt;
 AMPR: Creating bridge and VRF&lt;br /&gt;
 AMPR: Setting up RIP&lt;br /&gt;
 AMPR: Creating container envs&lt;br /&gt;
 AMPR: Setting up firewall rules&lt;br /&gt;
 AMPR: Creating container update script&lt;br /&gt;
 AMPR: Creating routing rules&lt;br /&gt;
 AMPR: Installing container&lt;br /&gt;
 No container is installed&lt;br /&gt;
      status: finished&lt;br /&gt;
  downloaded: 366KiB&lt;br /&gt;
       total: 366KiB&lt;br /&gt;
    duration: 1s&lt;br /&gt;
 AMPR: Script finished successful&lt;br /&gt;
&lt;br /&gt;
Your container is now installed.&lt;br /&gt;
You need to configure its environment variables according to the description give.&lt;br /&gt;
&lt;br /&gt;
After configuration is complete, go to &amp;quot;containers&amp;quot; and star it up.&lt;br /&gt;
It should show &amp;quot;running&amp;quot; and you should see it&#039;s messages in the log window.&lt;br /&gt;
&lt;br /&gt;
After at most 5 minutes, you should get the tunnel routes in your vrf, and your gateway should be fully up and running.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1151</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1151"/>
		<updated>2024-08-07T10:59:15Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;Please hold your horses - changing the script for default config&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On a brand new router, clear its configuration completely...&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1150</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1150"/>
		<updated>2024-08-07T10:57:54Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* Brand new router set up */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
On a brand new router, clear its configuration completely...&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1149</id>
		<title>Archive/Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1149"/>
		<updated>2024-08-07T10:45:46Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* How to connect to the 44Net */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the AMPRNet Wiki.&lt;br /&gt;
&lt;br /&gt;
44Net is shorthand for Internet network 44 (44.0.0.0/9 &amp;amp; 44.128.0.0/10), also known as AMPRNet. Since its allocation to amateur radio in the mid-1980s, the network has been used by amateur radio operators to conduct scientific research and to experiment with digital communications over radio. The goals are to of advance the state of the art of Amateur Radio networking, and to educate amateur radio operators in these techniques.&lt;br /&gt;
&lt;br /&gt;
To request an assignment of IPv4 addresses see below.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Starting points ==&lt;br /&gt;
* [[Quickstart]] guide for getting onto the 44Net&lt;br /&gt;
* Basic information about 44Net and the [[ampr.org]] domain&lt;br /&gt;
* [[Services]] available on 44Net&lt;br /&gt;
* If you are looking to get an IP assignment from ARDC please read the [[Portal]] page.&lt;br /&gt;
* Frequently Asked Questions (FAQ) [[FAQ]]&lt;br /&gt;
* [[Getting started with Linux and packet radio]]&lt;br /&gt;
* [[Networks that use 44Net]]&lt;br /&gt;
&lt;br /&gt;
== How to connect to the 44Net ==&lt;br /&gt;
&lt;br /&gt;
* Instructions for [[Setting up a gateway on Linux|setting up a Linux gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on MikroTik Routers|setting up a gateway on MikroTik Routers running ROS6]].&lt;br /&gt;
* Instructions for [[Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64|setting up a gateway on MikroTik Routers running ROS7 using a container on arm32, arm64 and x86-64]]&lt;br /&gt;
* Instructions for [[Setting up a gateway on OpenBSD|setting up an OpenBSD gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on Cisco Routers|setting up a  gateway on Cisco Routers]].&lt;br /&gt;
* Instructions for [[setting up a gateway on OpenWRT|setting up a gateway on OpenWRT]].&lt;br /&gt;
* Instructions for [[setting up a gateway on Ubiquiti EdgeRouter|setting up a gateway on Ubiquiti EdgeRouter]].&lt;br /&gt;
* Instructions for [[setting up a gateway on a VyOS instance|setting up a gateway on a VyOS instance]].&lt;br /&gt;
* Instructions for [[Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X|Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X]].&lt;br /&gt;
* Instructions for [[Announcing_your_allocation_directly|directly announcing your assignment via your Internet Service Provider (ISP)]].&lt;br /&gt;
* Instructions for [[OH7LZB_VPN|Accessing 44Net via VPN]] (experimental).&lt;br /&gt;
* &amp;lt;b&amp;gt;[[Why can&#039;t I just route my AMPRNet allocation directly myself ?]]&amp;lt;/b&amp;gt;&lt;br /&gt;
* If you already operate a [[gateway]] please ensure you have registered on the [[portal]] and &amp;quot;claimed&amp;quot; your [[gateway]].&lt;br /&gt;
* After your gateway is operational, consider &#039;&#039;&#039;[[Firewalls]]&#039;&#039;&#039; and other best practices&lt;br /&gt;
&lt;br /&gt;
== Groups.io ==&lt;br /&gt;
We are now on Groups.io  Please consider joining https://ardc.groups.io/g/44net&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
To keep up-to-date on AMPRNet information please consider joining the [[44Net mailing list]].&lt;br /&gt;
&lt;br /&gt;
== Contribute! ==&lt;br /&gt;
If you wish to contribute to the wiki, please send an email to &amp;lt;tt&amp;gt;wiki (at) ampr.org&amp;lt;/tt&amp;gt; introducing yourself. Please specify your full name and your amateur radio callsign. A login will then be created for you.&lt;br /&gt;
&lt;br /&gt;
== Terms of Service ==&lt;br /&gt;
Use of AMPRNet address space is governed by these [https://www.ampr.org/terms-of-service/ Terms of Service]&lt;br /&gt;
&lt;br /&gt;
== Other useful features ==&lt;br /&gt;
* Instruction on using the [[ampr-map]] position reporting&lt;br /&gt;
&lt;br /&gt;
== All Pages ==&lt;br /&gt;
[https://wiki.ampr.org/wiki/Special:AllPages Here&#039;s a list of all pages currently on the 44Net Wiki]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1148</id>
		<title>Archive/Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1148"/>
		<updated>2024-08-07T10:45:13Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the AMPRNet Wiki.&lt;br /&gt;
&lt;br /&gt;
44Net is shorthand for Internet network 44 (44.0.0.0/9 &amp;amp; 44.128.0.0/10), also known as AMPRNet. Since its allocation to amateur radio in the mid-1980s, the network has been used by amateur radio operators to conduct scientific research and to experiment with digital communications over radio. The goals are to of advance the state of the art of Amateur Radio networking, and to educate amateur radio operators in these techniques.&lt;br /&gt;
&lt;br /&gt;
To request an assignment of IPv4 addresses see below.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Starting points ==&lt;br /&gt;
* [[Quickstart]] guide for getting onto the 44Net&lt;br /&gt;
* Basic information about 44Net and the [[ampr.org]] domain&lt;br /&gt;
* [[Services]] available on 44Net&lt;br /&gt;
* If you are looking to get an IP assignment from ARDC please read the [[Portal]] page.&lt;br /&gt;
* Frequently Asked Questions (FAQ) [[FAQ]]&lt;br /&gt;
* [[Getting started with Linux and packet radio]]&lt;br /&gt;
* [[Networks that use 44Net]]&lt;br /&gt;
&lt;br /&gt;
== How to connect to the 44Net ==&lt;br /&gt;
&lt;br /&gt;
* Instructions for [[Setting up a gateway on Linux|setting up a Linux gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on MikroTik Routers|setting up a gateway on MikroTik Routers running ROS6]].&lt;br /&gt;
* Instructions for [[Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64|setting up a gateway on a MikroTik routers running ROS7 using a container on arm32, arm64 and x86-64]]&lt;br /&gt;
* Instructions for [[Setting up a gateway on OpenBSD|setting up an OpenBSD gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on Cisco Routers|setting up a  gateway on Cisco Routers]].&lt;br /&gt;
* Instructions for [[setting up a gateway on OpenWRT|setting up a gateway on OpenWRT]].&lt;br /&gt;
* Instructions for [[setting up a gateway on Ubiquiti EdgeRouter|setting up a gateway on Ubiquiti EdgeRouter]].&lt;br /&gt;
* Instructions for [[setting up a gateway on a VyOS instance|setting up a gateway on a VyOS instance]].&lt;br /&gt;
* Instructions for [[Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X|Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X]].&lt;br /&gt;
* Instructions for [[Announcing_your_allocation_directly|directly announcing your assignment via your Internet Service Provider (ISP)]].&lt;br /&gt;
* Instructions for [[OH7LZB_VPN|Accessing 44Net via VPN]] (experimental).&lt;br /&gt;
* &amp;lt;b&amp;gt;[[Why can&#039;t I just route my AMPRNet allocation directly myself ?]]&amp;lt;/b&amp;gt;&lt;br /&gt;
* If you already operate a [[gateway]] please ensure you have registered on the [[portal]] and &amp;quot;claimed&amp;quot; your [[gateway]].&lt;br /&gt;
* After your gateway is operational, consider &#039;&#039;&#039;[[Firewalls]]&#039;&#039;&#039; and other best practices&lt;br /&gt;
&lt;br /&gt;
== Groups.io ==&lt;br /&gt;
We are now on Groups.io  Please consider joining https://ardc.groups.io/g/44net&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
To keep up-to-date on AMPRNet information please consider joining the [[44Net mailing list]].&lt;br /&gt;
&lt;br /&gt;
== Contribute! ==&lt;br /&gt;
If you wish to contribute to the wiki, please send an email to &amp;lt;tt&amp;gt;wiki (at) ampr.org&amp;lt;/tt&amp;gt; introducing yourself. Please specify your full name and your amateur radio callsign. A login will then be created for you.&lt;br /&gt;
&lt;br /&gt;
== Terms of Service ==&lt;br /&gt;
Use of AMPRNet address space is governed by these [https://www.ampr.org/terms-of-service/ Terms of Service]&lt;br /&gt;
&lt;br /&gt;
== Other useful features ==&lt;br /&gt;
* Instruction on using the [[ampr-map]] position reporting&lt;br /&gt;
&lt;br /&gt;
== All Pages ==&lt;br /&gt;
[https://wiki.ampr.org/wiki/Special:AllPages Here&#039;s a list of all pages currently on the 44Net Wiki]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1147</id>
		<title>Archive/Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1147"/>
		<updated>2024-08-07T10:41:24Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: /* How to connect to the 44Net */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the AMPRNet Wiki.&lt;br /&gt;
&lt;br /&gt;
44Net is shorthand for Internet network 44 (44.0.0.0/9 &amp;amp; 44.128.0.0/10), also known as AMPRNet. Since its allocation to amateur radio in the mid-1980s, the network has been used by amateur radio operators to conduct scientific research and to experiment with digital communications over radio. The goals are to of advance the state of the art of Amateur Radio networking, and to educate amateur radio operators in these techniques.&lt;br /&gt;
&lt;br /&gt;
To request an assignment of IPv4 addresses see below.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Starting points ==&lt;br /&gt;
* [[Quickstart]] guide for getting onto the 44Net&lt;br /&gt;
* Basic information about 44Net and the [[ampr.org]] domain&lt;br /&gt;
* [[Services]] available on 44Net&lt;br /&gt;
* If you are looking to get an IP assignment from ARDC please read the [[Portal]] page.&lt;br /&gt;
* Frequently Asked Questions (FAQ) [[FAQ]]&lt;br /&gt;
* [[Getting started with Linux and packet radio]]&lt;br /&gt;
* [[Networks that use 44Net]]&lt;br /&gt;
&lt;br /&gt;
== How to connect to the 44Net ==&lt;br /&gt;
&lt;br /&gt;
* Instructions for [[Setting up a gateway on Linux|setting up a Linux gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on MikroTik Routers|setting up a  gateway on MikroTik Routers running ROS6]].&lt;br /&gt;
* Instructions for [[Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64|Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64]]&lt;br /&gt;
* Instructions for [[Setting up a gateway on OpenBSD|setting up an OpenBSD gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on Cisco Routers|setting up a  gateway on Cisco Routers]].&lt;br /&gt;
* Instructions for [[setting up a gateway on OpenWRT|setting up a gateway on OpenWRT]].&lt;br /&gt;
* Instructions for [[setting up a gateway on Ubiquiti EdgeRouter|setting up a gateway on Ubiquiti EdgeRouter]].&lt;br /&gt;
* Instructions for [[setting up a gateway on a VyOS instance|setting up a gateway on a VyOS instance]].&lt;br /&gt;
* Instructions for [[Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X|Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X]].&lt;br /&gt;
* Instructions for [[Announcing_your_allocation_directly|directly announcing your assignment via your Internet Service Provider (ISP)]].&lt;br /&gt;
* Instructions for [[OH7LZB_VPN|Accessing 44Net via VPN]] (experimental).&lt;br /&gt;
* &amp;lt;b&amp;gt;[[Why can&#039;t I just route my AMPRNet allocation directly myself ?]]&amp;lt;/b&amp;gt;&lt;br /&gt;
* If you already operate a [[gateway]] please ensure you have registered on the [[portal]] and &amp;quot;claimed&amp;quot; your [[gateway]].&lt;br /&gt;
* After your gateway is operational, consider &#039;&#039;&#039;[[Firewalls]]&#039;&#039;&#039; and other best practices&lt;br /&gt;
&lt;br /&gt;
== Groups.io ==&lt;br /&gt;
We are now on Groups.io  Please consider joining https://ardc.groups.io/g/44net&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
To keep up-to-date on AMPRNet information please consider joining the [[44Net mailing list]].&lt;br /&gt;
&lt;br /&gt;
== Contribute! ==&lt;br /&gt;
If you wish to contribute to the wiki, please send an email to &amp;lt;tt&amp;gt;wiki (at) ampr.org&amp;lt;/tt&amp;gt; introducing yourself. Please specify your full name and your amateur radio callsign. A login will then be created for you.&lt;br /&gt;
&lt;br /&gt;
== Terms of Service ==&lt;br /&gt;
Use of AMPRNet address space is governed by these [https://www.ampr.org/terms-of-service/ Terms of Service]&lt;br /&gt;
&lt;br /&gt;
== Other useful features ==&lt;br /&gt;
* Instruction on using the [[ampr-map]] position reporting&lt;br /&gt;
&lt;br /&gt;
== All Pages ==&lt;br /&gt;
[https://wiki.ampr.org/wiki/Special:AllPages Here&#039;s a list of all pages currently on the 44Net Wiki]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1146</id>
		<title>Archive/Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Archive/Main_Page&amp;diff=1146"/>
		<updated>2024-08-07T10:40:25Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: changing link title to avoid confusion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the AMPRNet Wiki.&lt;br /&gt;
&lt;br /&gt;
44Net is shorthand for Internet network 44 (44.0.0.0/9 &amp;amp; 44.128.0.0/10), also known as AMPRNet. Since its allocation to amateur radio in the mid-1980s, the network has been used by amateur radio operators to conduct scientific research and to experiment with digital communications over radio. The goals are to of advance the state of the art of Amateur Radio networking, and to educate amateur radio operators in these techniques.&lt;br /&gt;
&lt;br /&gt;
To request an assignment of IPv4 addresses see below.&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Starting points ==&lt;br /&gt;
* [[Quickstart]] guide for getting onto the 44Net&lt;br /&gt;
* Basic information about 44Net and the [[ampr.org]] domain&lt;br /&gt;
* [[Services]] available on 44Net&lt;br /&gt;
* If you are looking to get an IP assignment from ARDC please read the [[Portal]] page.&lt;br /&gt;
* Frequently Asked Questions (FAQ) [[FAQ]]&lt;br /&gt;
* [[Getting started with Linux and packet radio]]&lt;br /&gt;
* [[Networks that use 44Net]]&lt;br /&gt;
&lt;br /&gt;
== How to connect to the 44Net ==&lt;br /&gt;
&lt;br /&gt;
* Instructions for [[Setting up a gateway on Linux|setting up a Linux gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on MikroTik Routers|setting up a  gateway on MikroTik Routers running ROS6]].&lt;br /&gt;
* Instructions for [[Setting up a gateway on OpenBSD|setting up an OpenBSD gateway]]&lt;br /&gt;
* Instructions for [[setting up a gateway on Cisco Routers|setting up a  gateway on Cisco Routers]].&lt;br /&gt;
* Instructions for [[setting up a gateway on OpenWRT|setting up a gateway on OpenWRT]].&lt;br /&gt;
* Instructions for [[setting up a gateway on Ubiquiti EdgeRouter|setting up a gateway on Ubiquiti EdgeRouter]].&lt;br /&gt;
* Instructions for [[setting up a gateway on a VyOS instance|setting up a gateway on a VyOS instance]].&lt;br /&gt;
* Instructions for [[Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X|Installing ampr-ripd on a Ubiquiti EdgeRouter or EdgeRouter X]].&lt;br /&gt;
* Instructions for [[Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64|Setting up a gateway in a ROS7 Mikrotik router container on arm32, arm64 and x86-64]]&lt;br /&gt;
* Instructions for [[Announcing_your_allocation_directly|directly announcing your assignment via your Internet Service Provider (ISP)]].&lt;br /&gt;
* Instructions for [[OH7LZB_VPN|Accessing 44Net via VPN]] (experimental).&lt;br /&gt;
* &amp;lt;b&amp;gt;[[Why can&#039;t I just route my AMPRNet allocation directly myself ?]]&amp;lt;/b&amp;gt;&lt;br /&gt;
* If you already operate a [[gateway]] please ensure you have registered on the [[portal]] and &amp;quot;claimed&amp;quot; your [[gateway]].&lt;br /&gt;
* After your gateway is operational, consider &#039;&#039;&#039;[[Firewalls]]&#039;&#039;&#039; and other best practices&lt;br /&gt;
&lt;br /&gt;
== Groups.io ==&lt;br /&gt;
We are now on Groups.io  Please consider joining https://ardc.groups.io/g/44net&lt;br /&gt;
&lt;br /&gt;
== Mailing List ==&lt;br /&gt;
To keep up-to-date on AMPRNet information please consider joining the [[44Net mailing list]].&lt;br /&gt;
&lt;br /&gt;
== Contribute! ==&lt;br /&gt;
If you wish to contribute to the wiki, please send an email to &amp;lt;tt&amp;gt;wiki (at) ampr.org&amp;lt;/tt&amp;gt; introducing yourself. Please specify your full name and your amateur radio callsign. A login will then be created for you.&lt;br /&gt;
&lt;br /&gt;
== Terms of Service ==&lt;br /&gt;
Use of AMPRNet address space is governed by these [https://www.ampr.org/terms-of-service/ Terms of Service]&lt;br /&gt;
&lt;br /&gt;
== Other useful features ==&lt;br /&gt;
* Instruction on using the [[ampr-map]] position reporting&lt;br /&gt;
&lt;br /&gt;
== All Pages ==&lt;br /&gt;
[https://wiki.ampr.org/wiki/Special:AllPages Here&#039;s a list of all pages currently on the 44Net Wiki]&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1145</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1145"/>
		<updated>2024-08-07T09:39:12Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container does not save anything to disk (which would be a bad idea on the router&#039;s flash memory), so the AMPR routes are lost on container or router restart, and you need to wait the now classical 5 minutes. But this should be no problem on a 24/7 on router.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1144</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1144"/>
		<updated>2024-08-07T09:36:45Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it...&lt;br /&gt;
Start the container, sit back and wait 5 minutes for the routes to show up in your vrf.&lt;br /&gt;
&lt;br /&gt;
Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1143</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1143"/>
		<updated>2024-08-06T15:14:04Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
&lt;br /&gt;
Now edit the Route-&amp;gt;filter rip-ampr-in to point to your preferred source address (your router&#039;s AMPR IP address:&lt;br /&gt;
&lt;br /&gt;
 (Winbox is your friend)&lt;br /&gt;
&lt;br /&gt;
...and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1142</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1142"/>
		<updated>2024-08-06T14:40:41Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
All available files are here: http://yo2loj.ro/containers/&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1141</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1141"/>
		<updated>2024-08-06T14:38:53Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1140</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1140"/>
		<updated>2024-08-06T14:38:31Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1139</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1139"/>
		<updated>2024-08-06T14:37:08Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (The same thing causing the need of a kernel filter in amprd. This is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1138</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1138"/>
		<updated>2024-08-06T14:35:48Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (this is fixed in newer kernel releases but it will take a while for it to make its way into ROS). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1137</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1137"/>
		<updated>2024-08-06T14:35:01Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
The container itself needs to sit behind a bridge due to a kernel bug in the version used by Mikrotik which sends out &amp;quot;Port unreachable&amp;quot; ICMP messages on incoming IPIP traffic if it is handled in user space (this is fixed in newer releases). Bridge filtering is used to mask those messages.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1136</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1136"/>
		<updated>2024-08-06T14:27:19Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture.&lt;br /&gt;
&lt;br /&gt;
First you need to enable container support according to the info provided by Mikrotik:&lt;br /&gt;
&lt;br /&gt;
Enable container mode&lt;br /&gt;
In a console type in:&lt;br /&gt;
 /system/device-mode/update container=yes&lt;br /&gt;
The device will ask you to reset it by hand (you can not do this remotely).&lt;br /&gt;
Next step is to install the container package for your firmware verion by downloading the complete package from Mikrotik, unpack it and upload the package called gontainer and reboot the router.&lt;br /&gt;
&lt;br /&gt;
Next, get the appropiate install script for your architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1135</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1135"/>
		<updated>2024-08-06T14:22:13Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== Limitations ==&lt;br /&gt;
The router does not forward multicast frames at all, nor does it send out broadcasts.&lt;br /&gt;
Incoming broadcasts are accepted and forwarded to the local VRF.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1134</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1134"/>
		<updated>2024-08-06T14:08:09Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
Unfortunately, containers are not available on Mips, Tile or PowerPC devices.&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1133</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1133"/>
		<updated>2024-08-06T14:00:01Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  ARM32:  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  ARM64:  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  x86_64: http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
	<entry>
		<id>https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1132</id>
		<title>Setting up a gateway in a ROS7 Mikrotik router container on arm32 arm64 and x86-64</title>
		<link rel="alternate" type="text/html" href="https://wiki.ampr.org/w/index.php?title=Setting_up_a_gateway_in_a_ROS7_Mikrotik_router_container_on_arm32_arm64_and_x86-64&amp;diff=1132"/>
		<updated>2024-08-06T13:59:15Z</updated>

		<summary type="html">&lt;p&gt;Yo2loj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Setting up a gateway in a ROS7 Mikrotik router running in a container on arm and arm64 models and x86-64 CHR&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;&#039;&#039;&#039;This is an experimental software build for the &#039;enthusiasts&#039; out there.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Info ==&lt;br /&gt;
&lt;br /&gt;
These are the steps for setting up a fully functional AMPR gateway on an arm/arm64 Mikrotik router&lt;br /&gt;
Tested and found working on CRS2116 and RB3011 for now.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red;&amp;quot;&amp;gt;&#039;&#039;&#039;NOTE: THE SETUP SCRIPT DOES NOT SECURE YOUR ROUTER. YOU NEED TO SET UP FIREWALL RULES YOURSELF.&#039;&#039;&#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General concept ==&lt;br /&gt;
Mikrotik routers running ROS 7 (7.15.3 being current at the time of writing) based on arm and arm64 processor, as well as CHR setups are able to run software containers (similar to docker).&lt;br /&gt;
This opens the possibility to host a virtualized gateway in such a container, allowing a simple and efficient setup on modern systems.&lt;br /&gt;
&lt;br /&gt;
The gateway will be hosted in a VRF on the router, providing gateway services using policy routing.&lt;br /&gt;
&lt;br /&gt;
As a concept, the container has a single VETH interface which will decapsulate all incoming IPIP traffic from the tunnels, and encapsulate all outgoing traffic towards them.&lt;br /&gt;
The container itself is isolated behind a bridge and offers some basic filtering function (e.g. restrict access from internet hosts).&lt;br /&gt;
It will receive the RIPv2 broadcasts from the AMPR gateway and provide the obtained routes as RIP broadcasts to the router itself inside the mentioned VRF.&lt;br /&gt;
&lt;br /&gt;
== Initial steps ==&lt;br /&gt;
&lt;br /&gt;
The steps to be taken depend on the fact if you set up a new router or want to add the container to an existing running one.&lt;br /&gt;
&lt;br /&gt;
== New router set up ==&lt;br /&gt;
&lt;br /&gt;
For a new router setup, please download the automatic setup script depending go your router architecture:&lt;br /&gt;
&lt;br /&gt;
 ARM32 - http://yo2loj.ro/containers/ampr_arm32.rsc&lt;br /&gt;
 ARM64 - http://yo2loj.ro/containers/ampr_arm64.rsc&lt;br /&gt;
 CHRx86 - http://yo2loj.ro/containers/ampr-x86-64.tar&lt;br /&gt;
&lt;br /&gt;
After clearing your router config (no default configuration), drag and drop the file to your file window.&lt;br /&gt;
Open a console and execute the command, using the proper file name downloaded above:&lt;br /&gt;
 [admin@MikroTik] &amp;gt; import file-name=ampr_arm32.rsc&lt;br /&gt;
The system should state that the script was successfully executed.&lt;br /&gt;
Now set up an internet connection (the router being blank, like e.g. add a dhcp client to eth1, and wait for it to get an IP address.&lt;br /&gt;
With your internet connection working, navigate to /system scripts and execute the script &#039;install_ampr_container&#039;:&lt;br /&gt;
 [admin@MikroTik] /system/script&amp;gt; run install_ampr_container&lt;br /&gt;
This step will download the binary container to your local storage (you need some 1-2 MB of free space on the device) depending on your system architecture and set it up.&lt;br /&gt;
If the script fails for some reason, please just run it again.&lt;br /&gt;
&lt;br /&gt;
After the container is created, open your log and then start your container by selecting it and pressing the &#039;Start&#039; button in your Winbox.&lt;br /&gt;
It should switch from &amp;quot;stopped&amp;quot; to &amp;quot;running&amp;quot; and stay running.&lt;br /&gt;
Now you have the container installed, stop it for now, and it is time to configure it.&lt;br /&gt;
&lt;br /&gt;
== Container configuration parameters ==&lt;br /&gt;
You need to adapt the pre-existing container environment variables to your particular gateway before starting it again.&lt;br /&gt;
The following ENV parameters are preset in Container-&amp;gt; Envs:&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;AMPR_SUBNETS&amp;lt;/span&amp;gt; - holds your local subnets as defined in the portal, as comma separated list of &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; tupples, e.g. &amp;quot;44.128.0.0/24,44.128.1.0/24&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;ALL_VIA_AMPRGW&amp;lt;/span&amp;gt; - enables forwarding of all AMPR destinations via AMPRGW, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;FORWARD_INTERNET&amp;lt;/span&amp;gt; - enables forward of traffic from/to internet hosts, values are &amp;quot;0&amp;quot; or &amp;quot;1&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;IGNORED_SUBNETS&amp;lt;/span&amp;gt; - allows you to ignore specific subnets provided by RIP, by &amp;lt;SUBNET&amp;gt;/&amp;lt;MASK&amp;gt; or gateway address e.g. &amp;quot;44.128.0.0/16&amp;quot;&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: blue;&amp;quot;&amp;gt;CALL_HOME&amp;lt;/span&amp;gt; - the classic string, &amp;lt;CALLSIGN&amp;gt;@&amp;lt;LOCATOR&amp;gt; to show up on the map. You will get a yellow dot. e.g. &amp;quot;YO2LOJ@KN05OR&amp;quot;. Leaving the field empty disables call home.&lt;br /&gt;
&lt;br /&gt;
Please note that the provided default will allow you to play around, but will not provide a working set up.&lt;br /&gt;
&lt;br /&gt;
After finishing the configuration, add your internet interface to the interface list called &amp;quot;Internet&amp;quot;:&lt;br /&gt;
 /interface list member add interface=ether1 list=Internet&lt;br /&gt;
and enable the 2 disabled routing rules under Routing-&amp;gt;Rule:&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 0 disabled=no&lt;br /&gt;
 [admin@MikroTik] /routing/rule&amp;gt; set 1 disabled=no&lt;br /&gt;
&lt;br /&gt;
This should do it... Of course you need to set up firewall rules &amp;amp; stuff, but if you do not enable internet forward, you should be pretty safe.&lt;br /&gt;
&lt;br /&gt;
== Configuration on an existing working router ==&lt;br /&gt;
&lt;br /&gt;
Basically you need to do 6 steps by snooping around in the provided rsc files:&lt;br /&gt;
 1 - Bridge, VETH and VRF setup: http://yo2loj.ro/containers/1_ampr_bridge_vrf.rsc&lt;br /&gt;
 2 - RIP setup: http://yo2loj.ro/containers/2_rip.rsc&lt;br /&gt;
 3 - Firewall rules, Filter, NAT and Mangle: http://yo2loj.ro/containers/3_firewall.rsc&lt;br /&gt;
 4 - Container environment setup: http://yo2loj.ro/containers/4_container_env.rsc&lt;br /&gt;
 5 - Container installation, architecture dependent. Files hold the download and update script:&lt;br /&gt;
  http://yo2loj.ro/containers/5_container_arm32.rsc&lt;br /&gt;
  http://yo2loj.ro/containers/5_container_arm64.rsc&lt;br /&gt;
  http://yo2loj.ro/containers/5_container_x86_64.rsc&lt;br /&gt;
 6 - final routing rules: http://yo2loj.ro/containers/6_rules.rsc&lt;br /&gt;
&lt;br /&gt;
(Details are coming...)&lt;br /&gt;
&lt;br /&gt;
Rip Rip Hurray! de YO2LOJ&lt;/div&gt;</summary>
		<author><name>Yo2loj</name></author>
	</entry>
</feed>