UDP Multicast between macOS and Linux

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
mhixson
Posts: 3
Joined: 7. Jun 2022, 01:57

UDP Multicast between macOS and Linux

Post by mhixson »

I have the following setup.

- macOS 12.4 (host)
- VirtualBox 6.1.34 r150636 (Qt5.6.3)
- CentOS 7 (guest)
- Macbook Pro on wifi network
- CentOS 7 virtual machine running in VirtualBox on Macbook
- Native x86 Linux app running in the CentOS VM that uses UDP multicast to connect to a Java app
- Java app runs on Linux and macOS

The problem: Running the native and Java apps both within the CentOS 7 VM can see each other just fine, however they cannot see each other when the Java app is running on the same Macbook outside of the VM on macOS.

I have tried many variations of networking modes, numbers of network adapters, and various settings in an attempt to get the VM and my Macbook on the same subnet. Within the VirtualBox settings it looks like we're forced to use the 192.168.56.* subnet for host-only networking so I setup my DHCP server to give out IP addresses in that range. I have gotten the VM configured to use 192.168.56.3 and my Macbook 192.168.56.20. They still cannot ping each other nor does the multicast connection between the apps work.
Another option that the VirtualBox docs suggest is to used bridged networking to connect host and guest operating systems, but I found forum posts saying that this is now broken for macOS.

Has anyone setup such an environment for UDP multicast between apps? Would appreciate any help you can offer.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: UDP Multicast between macOS and Linux

Post by scottgus1 »

mhixson wrote:host-only networking
Take a look at how host-only works, see Virtualbox Networks: In Pictures: Host-Only Adapter
mhixson wrote:I setup my DHCP server to give out IP addresses in that range.
If this was the physical LAN, it wouldn't help and may hinder the communication.

Host-only has its own channel between the host and the VMs, independent of the host computer's physical or Wi-Fi networks.
mhixson wrote:my Macbook 192.168.56.20.
This should have been the Host-Only adapter made by Virtualbox, not the Mac's physical adapters, and Virtualbox can set this address, see the main Virtualbox window, File menu, Host Network Manager.

Host-Only can also set DHCP IP addresses or allow static IPs, see the Host Network Manager.
mhixson
Posts: 3
Joined: 7. Jun 2022, 01:57

Re: UDP Multicast between macOS and Linux

Post by mhixson »

Are you saying that multicast UDP should be working between my macOS host and CentOS guest using host-only networking?

Does the Mac's physical networking interface matter at all, as in wifi vs wired Ethernet? (I would hope that it wouldn't matter.)
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: UDP Multicast between macOS and Linux

Post by scottgus1 »

mhixson wrote:Are you saying that multicast UDP should be working between my macOS host and CentOS guest using host-only networking?
I am not entirely sure about the multicast UDP part, but Host-Only will give you a private network between the host and the VM, independent of the host's physical or Wi-Fi LAN.
mhixson wrote:Does the Mac's physical networking interface matter at all
For Host-Only, no. You should see a Host-Only Ethernet adapter in the host's list of network adapters available. The apps in the VM and the host can talk to each other over the Host-Only adapter.
mhixson
Posts: 3
Joined: 7. Jun 2022, 01:57

Re: UDP Multicast between macOS and Linux

Post by mhixson »

scottgus1 wrote:
mhixson wrote:my Macbook 192.168.56.20.
This should have been the Host-Only adapter made by Virtualbox, not the Mac's physical adapters, and Virtualbox can set this address, see the main Virtualbox window, File menu, Host Network Manager.
No, this was my Mac's wifi IP after setting my router to give out IPs in the 192.168.56.* range. I did this because I thought UDP multicast needed hosts to be on the same subnet.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: UDP Multicast between macOS and Linux

Post by fth0 »

mhixson wrote:UDP multicast
Did you allow promiscuous mode in the VM network settings?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: UDP Multicast between macOS and Linux

Post by scottgus1 »

mhixson wrote:my Mac's wifi IP after setting my router to give out IPs in the 192.168.56.* range
Definitely not going to work with Host-Only. Host-Only works with ... wait for it ... the host only. You've got things all conflated.

Set your LAN back to what it was, and ensure that the physical/Wi-Fi network is back to working well again and not using the 192.168.56.# IP range. Use the Host Network Manager to delete the existing Host-Only network and make a new one. Set the VM to use it. The VM should either get a 192.168.56.# IP address or it can use a static 192.168.56.# IP address. If you go with static IP, use a higher IP address number so the VM doesn't conflict with the Host-Only DHCP server.

Your host app can find the VM service at the VM's Host-Only 192.168.56.# IP address. VM apps can get host services at 192.168.56.1.
Post Reply