Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7
Accepted Solution

mDNS/bonjour forwarding

I see that the arp-proxy will forward ARP requests to other networks, is there a way to have mDNS/Bonjour requests also forwarded across networks?  (specifically, different subnets, not just bridged ethernet networks).

 


Accepted Solutions
New Member
Posts: 1
Registered: ‎01-28-2013
Kudos: 8
Solutions: 1

Re: mDNS/bonjour forwarding


@UBNT-ancheng wrote:

If you install the Debian package, let us know if it works. If it solves the problem and doesn't cause other problems, maybe we can include it at some point. Thanks.



Just wanted to say that this has been running with no adverse effects for me. In avahi-daemon.conf, just set:

...
[reflector]
enable-reflector=yes

and optionally configure allowed interfaces and it's good to go.

View solution in original post


All Replies
Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7

Re: mDNS/bonjour forwarding

[ Edited ]

To answer my own question, it looks like an mDNS repeater/reflector is needed, avahi-daemon appears to be able to do it:

 

http://cs.potsdam.edu/cgi-bin/man/man2html?5+avahi-daemon.conf#lbAH

 

Also, here's an interesting looking open source project that implements an mDNS repeater:

 

https://bitbucket.org/geekman/mdns-repeater/src

 

Looking here, I see there is a toolchain that I can build it with, but then where does it go? (/config to avoid upgrade/erasure?) and how does it get started.

 

@UBNT-ancheng, any chance you would would consider including this, or avahi-daemon in the EdgeOS image?

 

Thanks.

Highlighted
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding

Looks like there's a debian package for that: http://packages.debian.org/squeeze/avahi-daemon

EdgeMAX Router Software Development
Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7

Re: mDNS/bonjour forwarding


@UBNT-stig wrote:

Looks like there's a debian package for that: http://packages.debian.org/squeeze/avahi-daemon


That's perfect.  If I install it, what happens when I upgrade to a new release of EdgeOS?

 

Thanks!

 

Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding


@snowball wrote:

@UBNT-stig wrote:

Looks like there's a debian package for that: http://packages.debian.org/squeeze/avahi-daemon


That's perfect.  If I install it, what happens when I upgrade to a new release of EdgeOS?

 

Thanks!

 


When you upgrade the additional debians are gone.  I'll re-post a script that I posted in the beta forum about this.

EdgeMAX Router Software Development
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding

[ Edited ]
I'm planning to test the beta version but first I have one question:

I have modded the lighttpd config and installed some Debian packages. Will they be changed in any way or will they work as I have set them up ?

I update nearly every day to our nightly build, so I know it's a hassle to re-install debian packages. So what I do is place the following script in /config/scripts/post-config.d/install_my_packages

ubnt@RTR5:/config/scripts/post-config.d$ cat install_my_packages.sh
#!/bin/bash

doneit='/var/lib/my_packages'
packages='screen rsync iftop iptraf mtr-tiny bmon'

if [ -e $doneit ]; then
exit 0;
fi

apt-get update
apt-get install -y $packages
if [ $? == 0 ]; then
echo package install successful
touch $doneit
else
echo package install failed
fi
exit 0


Things to note:
1) The entire /config directory gets copied to the new image, so that's a good place to put things like scripts, openvpn keys, etc.
2) Every executable in /config/scripts/post-config.d directory get run after boot-up and configuration is complete.
3) After booting into the 2nd image, you still can get access to your modified lighty config with:

root@RTR5:/etc/lighttpd# cp /root.dev/w.o/etc/lighttpd/lighttpd.conf .
EdgeMAX Router Software Development
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding

Hmm the "if" statements seems to have gotten munged in that post.

EdgeMAX Router Software Development
Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding


@UBNT-stig wrote:

Hmm the "if" statements seems to have gotten munged in that post.


Ok, fixed now.

EdgeMAX Router Software Development
Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7

Re: mDNS/bonjour forwarding


@UBNT-stig wrote:
2) Every executable in /config/scripts/post-config.d directory get run after boot-up and configuration is complete.

 

So 'post-config' is run at boot to apply the config?  (not specifically after an upgrade).  If so I'd be afraid to put something like an apt-get install in the boot-path, at the least, I'd want to put some checks in to see if the packages were already installed etc.

 


@UBNT-stig wrote:
3) After booting into the 2nd image, you still can get access to your modified lighty config with:
root@RTR5:/etc/lighttpd# cp /root.dev/w.o/etc/lighttpd/lighttpd.conf .

 I assume /root.dev/w.o *always* contains the previously installed image?

 

New Member
Posts: 9
Registered: ‎10-30-2012
Kudos: 3

Re: mDNS/bonjour forwarding

Proxy-arp does not forward arp requests. It answers request made to other addreses than it's own.

Established Member
Posts: 1,547
Registered: ‎08-20-2012
Kudos: 834
Solutions: 20

Re: mDNS/bonjour forwarding

Is there any way to make this steps to be done automatically when upgrading via the WebGUI ? Or at least as an option to select the directories / files that has to be copied / symlinked to the new version ?

Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7

Re: mDNS/bonjour forwarding

[ Edited ]

@rdahlin wrote:

Is there any way to make this steps to be done automatically when upgrading via the WebGUI ? Or at least as an option to select the directories / files that has to be copied / symlinked to the new version ?


@UBNT-stig, at least can we have a /config/scripts/post-upgrade scripts directory that can contain scripts to be executed exectly once *AFTER* the ERL has been upgraded to a new version.  That way, I don't have to keep calling apt-get install each time the system boots.

Established Member
Posts: 1,211
Registered: ‎06-14-2012
Kudos: 1008
Solutions: 80
Contributions: 9

Re: mDNS/bonjour forwarding


@snowball wrote:
@UBNT-stig, at least can we have a /config/scripts/post-upgrade scripts directory that can contain scripts to be executed exectly once *AFTER* the ERL has been upgraded to a new version.  That way, I don't have to keep calling apt-get install each time the system boots.

You could hack the script to put in a lock file on first run.  Subsequent runs will check and exit.

 

if [ ! -e /var/lock/install.lck ]
	do stuff
	touch /var/lock/install.lck
else
	end.
fi

 

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: mDNS/bonjour forwarding


snowball wrote:@UBNT-ancheng, any chance you would would consider including this, or avahi-daemon in the EdgeOS image?

 


It's certainly possible to include the Debian package, but I remember seeing mDNS causing some issues last time I tried something related. If you install the Debian package, let us know if it works. If it solves the problem and doesn't cause other problems, maybe we can include it at some point. Thanks.

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: mDNS/bonjour forwarding


@snowball wrote:

So 'post-config' is run at boot to apply the config?  (not specifically after an upgrade).  If so I'd be afraid to put something like an apt-get install in the boot-path, at the least, I'd want to put some checks in to see if the packages were already installed etc.

 

I assume /root.dev/w.o *always* contains the previously installed image?


Regarding "post-config.d", it is used to run customized tasks at every boot after the configuration is done. Think of it as something like "rc.local". So yeah you won't want to put something in there that installs packages.

 

After the system boots up, the /root.dev/w.o directory contains the "user modifications" of the previously installed version. However, this could change if you do an upgrade, or change the default boot image, but have not rebooted yet. So for example, don't put symlinks in your scripts etc. that point to things in the directory as it might not work.

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: mDNS/bonjour forwarding


@snowball wrote:

@rdahlin wrote:

Is there any way to make this steps to be done automatically when upgrading via the WebGUI ? Or at least as an option to select the directories / files that has to be copied / symlinked to the new version ?


@UBNT-stig, at least can we have a /config/scripts/post-upgrade scripts directory that can contain scripts to be executed exectly once *AFTER* the ERL has been upgraded to a new version.  That way, I don't have to keep calling apt-get install each time the system boots.


Yeah that is a good idea! And it should be straightforward to implement. Thanks for the feedback.

Previous Employee
Posts: 13,551
Registered: ‎06-10-2011
Kudos: 5474
Solutions: 1656
Contributions: 2

Re: mDNS/bonjour forwarding

[ Edited ]

@mrjester wrote:

You could hack the script to put in a lock file on first run.  Subsequent runs will check and exit.

 

Yeah that's possible too. Just note that /var/lock is "tmpfs", i.e., it's actually in memory and not preserved across reboots. So if trying this, the lock file can be placed in "/etc" for example.

Established Member
Posts: 1,211
Registered: ‎06-14-2012
Kudos: 1008
Solutions: 80
Contributions: 9

Re: mDNS/bonjour forwarding


@UBNT-ancheng wrote:

Yeah that's possible too. Just note that /var/lock is "tmpfs", i.e., it's actually in memory and not preserved across reboots. So if trying this, the lock file can be placed in "/etc" for example.


Good catch sir.

Regular Member
Posts: 453
Registered: ‎03-15-2012
Kudos: 129
Solutions: 7

Re: mDNS/bonjour forwarding

[ Edited ]

@UBNT-ancheng wrote:

@snowball wrote:
@UBNT-stig, at least can we have a /config/scripts/post-upgrade scripts directory that can contain scripts to be executed exectly once *AFTER* the ERL has been upgraded to a new version.  That way, I don't have to keep calling apt-get install each time the system boots.

Yeah that is a good idea! And it should be straightforward to implement. Thanks for the feedback.


 

Excellent!  You might even consider passing in as arguments or environment variables any salient details such as a the /root.dev/w.o/ path to the previous install etc. so that scripts won't get broken if you change something in the future.

 

Thanks!

Previous Employee
Posts: 10,504
Registered: ‎06-09-2011
Kudos: 3141
Solutions: 945
Contributions: 16

Re: mDNS/bonjour forwarding

[ Edited ]

@snowball wrote:
So 'post-config' is run at boot to apply the config?  (not specifically after an upgrade).  If so I'd be afraid to put something like an apt-get install in the boot-path, at the least, I'd want to put some checks in to see if the packages were already installed etc.

If you look at the script, the 1st thing it does is check if it's already be done once.  If so it exits.
EdgeMAX Router Software Development