I'm using ethernet for a webserver and for an ethernet CV/gate expander using OSC. I would like to make it as plug and play as possible, but I don't want to set static IP's or run a DHCP server on the Bela. Static IPs can collide with a DHCP server, and a DHCP server probably gives trouble if there is another DHCP server also present..
As for the webserver running on the Bela, I've solved this by having it listen to any http requests made over IPv6. The user types in bela.local
and this address points either to an IPv4 when a DHCP server is present, or to the Bela's (IPv6) link-local address. Either way, with or without router, the user can reach the webserver.
For OSC, I'm having the CV/gate expander send messages to bela.local
every now and then, the Bela pulls the IP address from the received OSC message and uses that to send messages back. This approach only works when the devices are on a network with a DHCP server, as OSC currently only works with IPv4. If IPv6 were also supported, this situation would work even without a DHCP present. When plugging the Bela directly into the CV/gate expander, I can see both devices always get an IPv6 address.
The IPv4 and IPv6 API seem similar on a first glance. It says here that the IPv6 can also handle IPv4 stuff as an IPv6 can contain an IPv4.
Pd netsend supports IPv6 since 0.51 and also works when you specify bela.local
as address to send OSC to. As far as I can tell getifaddrs
is used to lookup the IP corresponding to bela.local
. I found an example here.
I have to focus on some other stuff due to Dutch Modular Fest next week, and I'm okay with bringing a router, but maybe I can have a look at this in the future because IPv6 would make it plug and play for the musicians.