mDNS between VLANs with just bridge filters - Look Mum, no containers!

This setup sounds interesting, but I’m having trouble setting up the basics even before the MAC VLANs. I’m quite new. How would I set up my tagged/untagged ports if I want to be able to use mDNS and SSDP between VLAN 40 and VLAN 1400? In my setup, I need a DHCP server on VLAN 40 and VLAN 1400 is a DHCP client that has a DHCP server on the main router that I do not control, but I know I receive mDNS and SSDP packets from it. I got it working by adding yet another RouterBoard running OpenWrt with Avahi-daemon and SMCRoute, but SMCRoute has not shown to be reliable.

I tried setting this up but ended up locking myself out when enabling VLAN filtering on the main bridge. What can I do from now? Is it possible to set up this with my situation with this second router that is not mine?

RouterOS really needs an mDNS solution out of the box (both as multicast and Wide Area Bonjour). These hacks that pop time to time are ridiculous, traps and troubles for novices that tarnish Mikrotik’s reputation…

This comment above should be pasted on every mDNS related topic.

Well the DNS-SD part could have been done by simply allowing a PTR RR in the /ip/dns/static YEARS ago. Being able to statically configure mDNS be useful, but cannot even do that. Frustrating.

100%

Sure. Of course no-one would look for ways to do this with containers or bridge-filter rules if there was a built in utility. As for hackiness the bridge-filter method is literally doing exactly what a user space program would do anyway (and probably run faster as it happens in kernel space) but you get to make this sausage yourself. Nothing wrong with that. Making your own sausages is what Mikrotik is about vs going to the supermarket and buying some ready made fancy looking overpriced red wine and garlic sausage that just ends up being full of gristle and repeating on you all day leaving you wondering just WTF is in it.

One quick way Mikrotik could make it work is to allow 224.0.0.251 to be relayed in PIM-SM. I have tried addresses 224.0.0.250 and 224.0.0.252 as static GMPs and they show up on the other routers UIB tables but not 224.0.0.251 - it’s deliberately excluded by the looks of things. Allowing PIM-SM to deal with it may or may not work and probably would make some users here very, very angry (which we’d know about as they’d tell everyone) because it breaks some kind of standard.

Anyway, Mikrotik have mentioned somewhere a new DNS application is in the works and may have mDNS repeating in it - I am sure I saw it posted while ago. Until then…

LOL re sausage analogy. I tend to agree your filter approach is doing what something in user space would do. So other than being more confusing than making a French Soufflé… it arguably faster than some built-in thing.



That’s actually odd that .250 and .252 show up. If one is pandemic about the specs, it’s the entire 224.0.0 subnet that shouldn’t be forwarded per the spec.
e.g. RFC-5771 says

  1. Local Network Control Block (224.0.0/24)

Address> es > in the Local Network Control Block are used for protocol
control traffic that is > not forwarded off link> . Examples of this
type of use include OSPFIGP All Routers (224.0.0.5) [RFC2328].

IMHO Application-level problems need application-level solutions. I did not look into the mDNS spec sufficiently, but I would not take for granted that reflection does not involve some alteration of the packet under certain circumstances.

Not all the user space mDNS repeaters do the same thing - some are pretty basic like AVAHI and other other one on Github I looked at does a SCRNAT modification on the MAC address too but it also inspects the packet to see if it’s an originator or a replier which you can’t do with Mikrotik bridge rules. I repeat myself, you can also use the bridge filter rules to only allow certain MACs to be repeated as well as rate limit and time-of-day limit them.

I think it’s great you can make something like an mDNS repeater in Mikrotik from rules and interfaces. It’s what all the levers and knobs are for and it’ll work on any ROS device.

True. But should still be built-in to /ip/dns stuff… And Mikrotik @normis said they’re working on it & “be a while”… so we’re 1 year into that, perhaps 2025 we’ll see it :wink:.

As a SOHO user for almost a decade all deviations I saw were almost exclusively to circumvent RouterOS’s mishaps. To that extent it’s great that the OS allows for that. However, I personally want it to be easily configure to follow the RFC specs and best practices as precisely as possible.

For whistles you can always run a linux box and do your sockets raw.

Hi, I managed to get everything working and it’s great! Just one thing, I can’t detect a device from one vlan to another with the device app…

if I go to the device’s IP (192.168.240.161) I can easily access it, but if I try from its app it doesn’t work…

I found this guide for other routers:
https://community.ui.com/questions/Howto-HDHomerun-discovery-on-different-LAN-segment/97db52c6-4add-4ba1-ab0d-27ee6f43db8f?page=1

as far as I understand it is enough to do a nat and mdns, but it doesn’t work… who can help me?

my rules as well as macvlan are:

add action=dst-nat chain=dstnat comment=HDHomeRUN disabled=yes dst-port=65001 in-interface-list=LAN protocol=udp \
    src-address-list=net_casa to-addresses=192.168.240.161 to-ports=65001
add action=dst-nat chain=dstnat comment=HDHomeRUN disabled=yes dst-port=65001 in-interface-list=LAN protocol=tcp \
    src-address-list=net_casa to-addresses=192.168.240.161 to-ports=65001

I suspect this will happen within the next few months.

Looks like you have been divining the tea leaves.

7.16 beta3 how has a shiny new mDNS repeater. Dunno if it’s as choice as the bridge method.

*) dns - added support for mDNS proxy (CLI only);

At present it seems bi-directional between all /ip/dns mDNS interfaces. So you can essentially create one mDNS zone for all specified interfaces. See http://forum.mikrotik.com/t/ros-7-16-rc4-mdns/177078/1

So if you want to get fine grained in what’s allowed or not allowed, that’s not possible today. With bridge filters, you can get down to the MAC address of what’s allowed or not.

Hi everyone, I’m trying to set up an device with this method,

I found a guide in this forum, for a non-mikrotik device:
https://community.ui.com/questions/Howto-HDHomerun-discovery-on-different-LAN-segment/97db52c6-4add-4ba1-ab0d-27ee6f43db8f?page=1

But I think I didn’t understand anything about how to set the rules with bridge filter…

Can someone either explain to me how to construct the rules or tell me where I’m going wrong?

I created the following rules:

/interface/bridge/filter/ print
Flags: X - disabled, I - invalid, D - dynamic 
 0   ;;; Allow mDNS only
     chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS 
     dst-mac-address=01:00:5E:00:00:FB/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=224.0.0.251/32 src-port=5353 
     dst-port=5353 ip-protocol=udp log=no log-prefix="forward MDNS" 

 1   ;;; Forward SSDP
     chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS 
     dst-mac-address=01:00:5E:7F:FF:FA/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=239.255.255.250/32 
     dst-port=1900 ip-protocol=udp log=no log-prefix="forward SSDP" 

 2  ;;; Forward HDHomeRun
     chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS 
     dst-mac-address=00:18:DD:25:15:2E/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=255.255.255.255/32 
     dst-port=65001 ip-protocol=udp log=no log-prefix="forward HDHomeRun" 

 3  ;;; Forward HDHomeRun
     chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS 
     dst-mac-address=00:18:DD:25:15:2E/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=192.168.0.255/32 dst-port=65001 
     ip-protocol=udp log=no log-prefix="forward HDHomeRun" 

 4   ;;; Drop all other L2 traffic
     chain=forward action=drop in-bridge=BR-mDNS out-bridge=BR-mDNS log=no log-prefix=""



/interface/bridge/nat/ print      
Flags: X - disabled, I - invalid, D - dynamic 
 0   ;;; mDNS - SNAT to Primary VLAN bridge
     chain=srcnat action=src-nat to-src-mac-address=F6:2C:EA:E2:08:97 
     dst-mac-address=01:00:5E:00:00:FB/FF:FF:FF:FF:FF:FF log=no log-prefix="NAT mdns" 

 1 X ;;; HDHomeRun- SNAT to Primary VLAN bridge
     chain=srcnat action=src-nat to-src-mac-address=F6:2C:EA:E2:08:97 
     dst-mac-address=00:18:DD:25:15:2E/FF:FF:FF:FF:FF:FF log=no log-prefix="NAT HDHomeRun" 

 2   ;;; SSDP - SNAT to Primary VLAN bridge
     chain=srcnat action=src-nat to-src-mac-address=F6:2C:EA:E2:08:97 
     dst-mac-address=01:00:5E:7F:FF:FA/FF:FF:FF:FF:FF:FF log=no log-prefix="NAT ssdp"



/ip/firewall/filter/ print
 8   ;;; HDHomeRun
      chain=input action=accept protocol=udp src-address=192.168.240.161 dst-port=65001 log=no log-prefix="" 

19   ;;; HDHomerun broadcasts
      chain=forward action=accept protocol=udp dst-address=192.168.0.255 dst-port=65001 log=no log-prefix="" 

20   ;;; HDHomerun broadcasts
      chain=forward action=accept protocol=udp dst-address=255.255.255.255 dst-port=65001 log=no log-prefix=""

00:18:DD:25:15:2E is the MAC of the device
192.168.240.161 is the IP of the device
192.168.240.0/24 is the vlan of the device
192.168.0.0/24 is the vlan where i’m and where i want to controll the device.

mDNS and SSDP are working good but HDHomeRun isn’t working, i also try mdns repeater from beta, but if i disable this method nothing works in mDNS

Thanks

Edit Dupe.

I don’t have a HDHomerun but it looks like it broadcasts as opposed to multicasts on UDP:65001. I’d try add these 2 lines. You mustn’t forget to MAC SRCNAT any frames being emitted by this technique otherwise it won’t work. You don’t need to accept HDHR on the input chain. Just disable or delete them. This is untested, I am just doing come copying and pasting here.

/interface/bridge/filter/
chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS
dst-mac-address=FF:FF:FF:FF:FF:FF/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=255.255.255.255/32
dst-port=65001 ip-protocol=udp log=no log-prefix=“forward HDHR”

/interface/bridge/nat/
chain=srcnat action=src-nat to-src-mac-address=F6:2C:EA:E2:08:97
dst-mac-address=FF:FF:FF:FF:FF:FF/FF:FF:FF:FF:FF:FF log=no log-prefix=“NAT HDHR”

Does anybody have a working setup with two interfaces in different VRFs?
It doesn’t work for me (C52iG-5HaxD2HaxD). I tried to add macvlan, ether-interface (not in the main VRF) to the mDNS-bridge. There are no frames/packets hit the bridge filter rules.

I also tried to upgrade to 7.16beta4 with new mDNS proxy feature. The same story.

Hello,
thank you so much for your reply, you are very kind. Unfortunately this method doesn’t work… But…

The first rule:

/interface/bridge/filter/
     chain=forward action=accept in-bridge=BR-mDNS out-bridge=BR-mDNS 
     dst-mac-address=FF:FF:FF:FF:FF:FF/FF:FF:FF:FF:FF:FF mac-protocol=ip dst-address=255.255.255.255/32 
     dst-port=65001 ip-protocol=udp log=no log-prefix="forward HDHR"

It seems to work well (I see that if I try to use the HdHomeRun’s app the rule runs the packages)

While the second one in my opinion is not exactly the right one…

/interface/bridge/nat/
     chain=srcnat action=src-nat to-src-mac-address=F6:2C:EA:E2:08:97 
     dst-mac-address=FF:FF:FF:FF:FF:FF/FF:FF:FF:FF:FF:FF log=no log-prefix="NAT HDHR"

The rule continually has packages running (also if i don’t do call to HdHomeRun)

Any other advice?