Container on Mikrotik¶
0. Brief¶
From Mikrotik ROS 7.4 Beta 4, Mikrotik add new feature of Container.
Configurations are based on Mikrotik RouterOS 7.13.1 .
1. Enable Container mode¶
Login Terminal in RouterOS, with following commands:
You will need to confirm the device-mode with a press of the reset button, or a cold reboot, if using container on X86.
2. Create network¶
Bridge Mode¶
(1). Add bridge veth interface for the container:¶
(2). Create a bridge for containers and add veth to it:¶
/interface/bridge/add name=containers
/ip/address/add address=172.17.0.1/24 interface=containers
/interface/bridge/port add bridge=containers interface=veth1
(3). Setup NAT for outgoing traffic:¶
Host Mode¶
(1). Add host veth interface for the container:¶
(2). Add veth to LAN bridge¶
3. Define mounts (optional):¶
4. Add container image¶
From an external library¶
(1). Set registry-url¶
(2). Pull image¶
/container/add remote-image=dashdreams/smartdns:latest interface=veth1 \
root-dir=/smartdns hostname=smartdns mounts=smartdns workdir=/root
Import image from PC¶
/container/add file=smartdns.tar interface=veth1 root-dir=/smartdns \
hostname=smartdns mounts=smartdns workdir=/root
5. Start container¶
6. Forward ports to internal container (optional)¶
Ports can be forwarded using dst-nat (where 192.168.88.1 routers IP address):
/ip firewall nat
add action=dst-nat chain=dstnat dst-address=192.168.88.1 dst-port=5353 protocol=tcp to-addresses=172.17.0.2 to-ports=53
Notes¶
How to get a local container image:
docker pull dashdreams/smartdns:latest@sha256:XXXXXXXXXXXXXXXXXXXXXXX
docker save dashdreams/smartdns > smartdns.tar
REF¶
[1]. https://help.mikrotik.com/docs/display/ROS/Container
[2]. http://www.irouteros.com/?p=2712