Community discussions

MikroTik App
 
theprojectgroup
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
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 224.0.0.251, 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:
- https://github.com/TheMickeyMike/docker ... r-mikrotik
- https://github.com/geekman/mdns-repeater
- https://github.com/monstrenyatko/docker-mdns-repeater
- https://github.com/TheMickeyMike/docker ... r-mikrotik

Wireshark capture
Here you can see the mDNS query of an iPhone in vlan11-guest (192.168.66.103) which discovers an Airplay receiver (Belkin Soundform Connect with Name Neumann KH 120) in vlan1 (192.168.99.122):
wireshark.png
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 192.168.99.111 mask 255.255.255.0 net 192.168.99.0
mdns-repeater: dev eth0.11 addr 192.168.66.114 mask 255.255.255.0 net 192.168.66.0
192.168.66.103 (45 bytes) -> eth0.1
192.168.66.103 (45 bytes) -> eth0.1
192.168.66.103 (90 bytes) -> eth0.1
192.168.99.122 (281 bytes) -> eth0.11
192.168.66.103 (45 bytes) -> eth0.1
192.168.99.122 (343 bytes) -> eth0.11
192.168.99.122 (424 bytes) -> eth0.11
192.168.66.103 (45 bytes) -> eth0.1

Configuration
- MikroTik hAP AX3 with container enabled (https://help.mikrotik.com/docs/display/ROS/Container)
- bridge with vlan-filertering=yes (https://help.mikrotik.com/docs/display/ ... 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=172.17.0.3/24 comment="docker mdns-repeater interface for vlan 1 and 11" gateway=172.17.0.1 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=https://registry-1.docker.io 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 
/container
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

Firewall
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=192.168.99.122 log=yes log-prefix="vlan11-guest > AirPlay Belkin"

 4    ;;; from vlan11-guest > vlan1 Airplay Apple TV
      chain=Forward_vlan11_guest action=accept dst-address=192.168.99.104 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=192.168.99.249 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.
 
alibloke
Frequent Visitor
Frequent Visitor
Posts: 51
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
 
pronet
just joined
Posts: 5
Joined: Tue Mar 27, 2018 11:35 am

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

Wed May 31, 2023 12:39 pm

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
If you need some binaries, I have them "baked" and uploaded..

1. Download them from: https://github.com/proNET-Southtirol/do ... k/releases

2. Upload the *.tar file into the root directory of your Mikrotik with Winbox, or SCP..

3. On container creation use the following line (example for x64 CHR installation):
/container
add file=mdns_amd64.tar 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

Greetings from Italy!
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Fri Jun 09, 2023 4:36 pm

Hi! I have uploaded the mdns.arm64.tar file to my Mikrotik (a RB5009), but I get an error when I run the following command:

add file=mdns_arm64.tar comment="mDNS-repeater for VLANs 1 & 20" envlist=repeater_envs hostname
=mdns-repeater interface=VETH-mDNS-Repeater logging=yes root-dir=usb1-part1/mdns-repeater start-on-boot=yes

I have already set up the VETH as named above
I have a usb1-part1 directory showing under files

Can you let me know if you have any suggestions? Thanks!
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Fri Jun 09, 2023 4:38 pm

failure: could not add

is the error message I am getting
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Fri Jun 09, 2023 10:37 pm

I got it installed into the regular disk1 of the RB5009 router...

However, I am having a problem getting a client on the guest network to see the printer or apple music devices on the main network. If I execute the following step, I no longer get out to the internet while connected to the main network (I do get out to the internet on guest network).

/interface vlan
add comment="vlan1 LAN" interface=bridge1 name=vlan1-lan vlan-id=1

Whether the vlan1 is enabled or disabled, I do not see the printers/airplay on the main network while in guest mode. Whether the vlan1 is enabled disabled, Bridge-Vlans shows a vlan1, but I am not able to modify or remove that...

mDNS has a status "running" in containers...
 
alex234
just joined
Posts: 3
Joined: Thu Jul 13, 2023 10:11 pm

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

Thu Jul 13, 2023 10:37 pm

I have successfully installed the software onto the regular disk1 of the RB5009 router. However, I am encountering an issue where a client on the guest network is unable to detect the printer or Apple music devices on the main network. To troubleshoot this problem, I attempted to execute the following steps:

/interface vLan
add comment="vlan1 LAN" interface=bridge1 name=vlan1-lan vlan-id=1

After performing this step, I noticed that I could no longer access the internet while connected to the main network, although internet access was still available on the guest network.

I have tried enabling and disabling the vlan1, but regardless of its status, I am unable to see the printers or Airplay devices on the main network while in guest mode. Additionally, the Bridge-Vlans section displays a vlan1, but I am unable to make any modifications or remove it.

In the container settings, the mDNS status is shown as "running."
Last edited by alex234 on Mon Mar 11, 2024 12:18 pm, edited 2 times in total.
 
intania
just joined
Posts: 2
Joined: Mon Jul 31, 2023 8:41 am

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

Sat Aug 19, 2023 8:28 am

Work very well, Thank You
 
smileyk
just joined
Posts: 1
Joined: Tue Oct 31, 2023 6:53 am

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

Mon Jan 15, 2024 7:21 am

Hi there, thank you so much for this container. Got it working on a CHR, very happy with it.

One observation I had is when this container eth0.x eth0.y eth0.z will separately obtain IP via DHCP under the same MAC address. And this MAC address changes every time the RouterOS is rebooted. This mean a static lease cannot be assigned to it - is there anyway to fix the MAC address (survive reboots) after it has been assigned the first time?
 
mantouboji
newbie
Posts: 40
Joined: Mon Aug 01, 2022 2:21 pm

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

Mon Jan 15, 2024 5:13 pm

eth0 not eth0.1
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Mon Feb 12, 2024 11:20 pm

I have been using this with success - thanks!

I have a question though - right now I have VLAN 10 - home, VLAN 20 - guests and VLAN 30 - IoT. I currently have the AirPlay type devices in 20 and share with 10 - using eth0.10, eth0.20

When I tried moving the devices to 30 and sharing with 10 and 20, I couldn’t get it to work although I tagged all VLANs with the Veth interface and modified the config to eth0.10, eth0.20, eth0.30. I changed the order to but that doesn’t seem to work either.

Any suggestions? Thanks again.
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Tue Feb 13, 2024 4:35 pm

I figured it out - I had to stop the container first, make the changes, make sure that the previous DHCP reservations were cleared, rebooted... Some combination of this got it to work! I am not a network person.
 
nightraven
just joined
Posts: 1
Joined: Thu Nov 09, 2023 1:18 am

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

Sun Mar 10, 2024 1:58 am

I needed to make allow rule both ways - from VLAN1 (iPhone) to VLAN2 (Samsung TV) and the other way around. If I do not do this, Samsung TV AirPlay does not play anything, so I might as well just add TV to VLAN1 ... Just wanted to share this with you so you don't waste X hours debugging like I did. Or did I misconfig something?

EDIT: checked the logs now, Samsung TV sends one UDP packet with connection status new to my iPhone before streaming starts.
Last edited by nightraven on Sun Mar 10, 2024 2:07 am, edited 2 times in total.
 
alex234
just joined
Posts: 3
Joined: Thu Jul 13, 2023 10:11 pm

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

Mon Mar 11, 2024 12:19 pm

One observation I've made is that each time the RouterOS is rebooted, the container with interfaces eth0.x, eth0.y, and eth0.z obtains separate IP addresses via DHCP but under the same MAC address. As the MAC address changes with each reboot, it's not possible to assign a static lease to it. Is there a way to preserve the MAC address (even after reboots) once it has been initially assigned?
Last edited by alex234 on Sat Mar 16, 2024 5:13 pm, edited 1 time in total.
 
alex234
just joined
Posts: 3
Joined: Thu Jul 13, 2023 10:11 pm

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

Mon Mar 11, 2024 12:19 pm

I see, you currently have VLAN 10 for home, VLAN 20 for guests, and VLAN 30 for IoT devices. You've placed your AirPlay type devices in VLAN 20 and are sharing them with VLAN 10 using eth0.10 and eth0.20.
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Mon Mar 11, 2024 12:45 pm

I figured it out above and am able to have the devices in VLAN 30 and share to VLAN 10 and 20. Thanks.
 
pfturner
just joined
Posts: 10
Joined: Fri Jun 09, 2023 4:31 pm

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

Thu Mar 14, 2024 4:01 pm

I'd like to have my Rokus, house speakers and printer on VLAN 30, so that's what I've set them to DHCP-wise. To get the mDNS repeater to work on my set up:

Native VLAN 1 - Mgmt
VLAN 10 - Personal use
VLAN 20 - Guests
VLAN 30 - IoT

I have eth0.10 eth0.20 eth 0.30 in the environment setting

I have no problem setting and using my devices on VLAN10, VLAN20 and VLAN30. However, I'd kind of like to collapse out the VLAN10 and just use the native VLAN, since I don't let others on the native VLAN or VLAN10. When I try to insert eth0.1 or eth0 in the environment setting, I do not get an IP address assigned to the mDNS repeater in that IP range.

Any ideas? Thanks!

Who is online

Users browsing this forum: No registered users and 3 guests