Ok I see, so then does that imply that the IP address avahi responds with (to the .local "query") changes depending on which of the 2 interfaces the mDNS query is received on?Avahi doesn't regularly send out packets, that would mean every device with avahi does that and this would be highly inefficient. Avahi listens on a defined mDNS broadcast address for someone asking 'who is pi.local' and then responds to that packet, quite likely on the same interface that the packet arribed at.
In which case, I'm not sure how I can force my computer to always send the the .local query to the eth interface first before it gets to the wifi interface?
Also wouldn't that imply there is a sort of race condition - in other words whichever interface happens to receive the broadcast packet/query first is the one that responds, in which case it could be highly random depending on network latency etc?
But in my case connecting to the .local address seems to consistently connect me to the wifi interface.
I should note that my PC that is initiating the ssh or sftp connection is also connected to the LAN via ethernet, although I don't think this would make much difference to which of the 2 interfaces on the pi receives the query first, since both are on the same LAN/subnet afaik. If anything, I would expect the ethernet interface to receive the packet first, since the ping from my PC to the eth interface is <1ms, whereas the ping to the wifi interface can vary and can be 17ms or higher.
Sure, I also get both IPs listed, with the eth IP listed first:TryMine shows both IPs if both are up, listing the eth0 interface first.Code:
sudo hostname -I
Or only the one that is up if the other is down.
Code:
$ sudo hostname -I192.168.1.62 192.168.1.63
Can you elaborate on what you mean by you can connect to either interface using ssh with the .local address?I can connect to either interface using this from my Ubuntu box.Code:
ssh raspberrypi.local
How can you "choose" which interface you connect to when you are only using a single .local address?
Every time I use sftp for example, I seem to get a slow connection/low bandwidth (wifi), which is how I noticed in the first place that .local wasn't using ethernet even though it was plugged in.
Also, if I directly ping the .local address, it always gets routed to the wifi interface's ipv6 address:
Code:
C:\WINDOWS\system32>ping p1s-cam.localPinging p1s-cam.local [fe80::1502:1d1c:8906:11c6%26] with 32 bytes of data:Reply from fe80::1502:1d1c:8906:11c6%26: time=2msReply from fe80::1502:1d1c:8906:11c6%26: time=4msReply from fe80::1502:1d1c:8906:11c6%26: time=3msReply from fe80::1502:1d1c:8906:11c6%26: time=11msPing statistics for fe80::1502:1d1c:8906:11c6%26: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 2ms, Maximum = 11ms, Average = 5ms
Statistics: Posted by Snelso91 — Sat Jan 25, 2025 10:13 pm