Community discussions

MikroTik App
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 91
Joined: Tue Feb 21, 2017 11:40 pm

HowTo: mDNS-repeater on MikroTik using container / Docker

Sat Mar 04, 2023 10:32 pm

I didn't find a howto on the forum so I wanted to share something back.

Apple Airplay or Airprint clients use multicast DNS to discover speakers & printers on the network.
mDNS uses the IP address, which is "administratively scoped" and does not leave the subnet.

"mdns-repeater" is a multicast DNS repeater for Linux which forwards / repeats mDNS-packets (UDP 5353) between broadcast domains.

This is all based on the great work of:
- ... r-mikrotik
- ... r-mikrotik

Wireshark capture
Here you can see the mDNS query of an iPhone in vlan11-guest ( which discovers an Airplay receiver (Belkin Soundform Connect with Name Neumann KH 120) in vlan1 (
mdns-repeater debug output (-d) in container
/container/shell number=1
/bin/mdns-repeater -f -d eth0.1 eth0.11
mdns-repeater: dev eth0.1 addr mask net
mdns-repeater: dev eth0.11 addr mask net (45 bytes) -> eth0.1 (45 bytes) -> eth0.1 (90 bytes) -> eth0.1 (281 bytes) -> eth0.11 (45 bytes) -> eth0.1 (343 bytes) -> eth0.11 (424 bytes) -> eth0.11 (45 bytes) -> eth0.1

- MikroTik hAP AX3 with container enabled (
- bridge with vlan-filertering=yes ( ... switchchip)
- vlan1 = default lan with Airplay & Airprint receivers
- vlan11-guest = guest VLAN for guests 
- added the container interface (veth-trunk) to the bridge and configured as tagged members (PVID is irrelevant) of vlan1 and vlan11
### Interface VETH setup for container ###
# Give it any IP address from a space you'll never use
# The interface must have an IP assigned, otherwise the container wouldn't start ;-P
/interface veth
add address= comment="docker mdns-repeater interface for vlan 1 and 11" gateway= name=veth-trunk

### VLAN & Bridge Setup ###
/interface vlan
add comment="vlan1 LAN" interface=bridge1 name=vlan1-lan vlan-id=1
add comment="vlan11 Guest" interface=bridge1 name=vlan11-guest vlan-id=11

/interface bridge port
add bridge=bridge1 comment="docker mdns-repeater interface for vlan 1 and 11 PVID DOESN'T MATTER!" interface=veth-trunk

/interface bridge vlan
add bridge=bridge1 comment="vlan1 LAN" tagged=bridge1,vlan1-lan,veth-trunk vlan-ids=1
add bridge=bridge1 comment="vlan11 Guest" tagged=bridge1,vlan11-guest,ether1,ether2,veth-trunk vlan-ids=11

### Container Setup ###
# Limit RAM usage
/container config
set ram-high=256.0MiB registry-url= tmpdir=usb1-part1/pull

# set vlan interfaces for container: eth0.1 = vlan1, eth0.11 = vlan11
/container envs
add comment="mdns-repeater (FLO-254)" key=REPEATER_INTERFACES name=repeater_envs value="eth0.1 eth0.11"

# External USB-SSD: usb1-part1 
add comment="mdns-repeater for vlan 1 & 11 " envlist=repeater_envs hostname=mdns-repeater interface=veth-trunk logging=yes root-dir=usb1-part1/mdns-repeater start-on-boot=yes

Your clients should now be able to discover printers & speakers but can't connect without allow rules in the firewall:
/ip/firewall/filter/print chain=Forward_vlan11_guest

 3    ;;; from vlan11-guest > vlan1 Airplay Belkin Soundform
      chain=Forward_vlan11_guest action=accept dst-address= log=yes log-prefix="vlan11-guest > AirPlay Belkin"

 4    ;;; from vlan11-guest > vlan1 Airplay Apple TV
      chain=Forward_vlan11_guest action=accept dst-address= log=yes log-prefix="vlan11-guest > AirPlay Apple TV"

 5    ;;; from vlan11-guest > vlan1 KLARtext HP LJ P1102w - Internet Printing Protocol (IPP)
      chain=Forward_vlan11_guest action=accept protocol=tcp dst-address= dst-port=631 log=yes log-prefix="vlan11-guest > KLARtext"
You do not have the required permissions to view the files attached to this post.
Posts: 36
Joined: Fri Jun 03, 2016 12:13 am

Re: HowTo: mDNS-repeater on MikroTik using container / Docker

Sat Mar 18, 2023 10:40 am

A few things missing here:
- You don't include adding the gateway IP or which interface to assign it to
- You don't include any information about the docker image, which one it is or how to build it

Who is online

Users browsing this forum: No registered users and 6 guests