Openvpn – How to make Bonjour (mDNS) work over OpenVPN

bonjouropenvpnvpn

I have a server running Debian 8. Recently I installed OpenVPN on it using this tutorial. Everything is working nicely. I tested on my macbook using the Tunnelblick client. Used Google to check my IP, connected to the VPN checked again and it changed to the same IP as my servers LAN. So I know that's all good.

My problem is that the File Shares on all the computers (all OSX's AFP protocol) on that LAN do not show up on my Finders sidebar while I'm connected through the VPN. Am able to connect to them manually using Finder's "Connect to Server" tool by connecting to afp://192.168.0.100 and that works nicely. So I'm assuming it's a problem with Bonjour.

From my research I've found out that Bonjour (mDNS) does not broadcast to different subnets. So I ran ifconfig on my macbook while connected through the VPN. it was 192.168.43.206. All of the computers on the network I'm connecting to are 192.168.0.10 to 192.168.0.200. So I'm guessing that's the source of my problem?

I think my solution might be to switch my OpenVPN config to "bridge" mode? I read some forums and articles which pointed to this as the solution, But I'm not even sure if I've diagnosed my problem correctly. And I haven't really grasped with Bridge mode setting.

Hoping someone can give me some clarity.

Best Answer

IIUC, the problem with mDNS/Bonjour is that it's implemented using the so-called multicasting, and multicast packets do not automatically crosss network boundaries (due to both the protocol's design and the design of Linux).

You might want to use something like smcroute to tunnel multicast traffic between all the networks your OpenVPN instance connects.

See this for more info, and this in general.

Another possibility is to switch OpenVPN from tun mode to tap. Unfortunately, this has its repercussions which must be considered thoroughly before implementing.