Ah I see what you mean, and yes using only one interface at a time works as expected, with the .local address working in both cases, and sudo hostname -I returning only the currently enabled interface's IP address.Easy. Disable one, then the other.
Test 1: Enable wifi.Pull the ethernet cable out of the RPi.
Test 2: Disable wifi.Insert the ethernet cable into the RPi.
I re-enabled wifi after testing just ethernet (test 2) and then rebooted, and annoyingly the .local address resolved to the wifi interface again.
While disabling wifi would work to force avahi to only use the ethernet interface, I think just blacklisting the wifi interface in the avahi-daemon config file would be a better fallback solution if we can't come up with anything better. This is because then I can still connect to the pi if I need to disconnect ethernet for some reason, and in that scenario with wifi connected but wifi blacklisted on avahi, I will just have to ssh into the pi using the wifi's IP address instead of the .local address, and then undo the avahi blacklist to restore normal functionality.
But as I said, that would be the sort of "default" solution, and ideally I want to find a way to have it use the ethernet port or not automatically for the .local address.
One thing that did intrigue me a bit is that when I ping the .local address (as I showed in my previous post), it pings an ipv6 address, instead of the ipv4 addresses shown with hostname -I and other commands. Could the .local address using ipv6 be a possible reason as to why the .local interface selection isn't working as expected, or is it completely unrelated?
Statistics: Posted by Snelso91 — Sat Jan 25, 2025 11:11 pm