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
newbie
Posts: 44
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: 3
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: 3
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: 3
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: 1
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 step:

/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."
 
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

Who is online

Users browsing this forum: No registered users and 2 guests