Page 1 of 1

LAN plugin: SMB2 stopped working after router change

Posted: 2019-11-30, 20:15 UTC
by KeyJ
So far, I used the LAN plugin (v3.09) to connect to my Windows 10 machine and upload data there, and it worked fine. Yesterday I switched routers (Telekom Speedport W724V Type B to AVM FritzBox 7590), and the first test also worked; however, today I couldn't connect any longer. The error message in the UI is truncated, the full message is in the log file: (IPv6 prefixes have been anonymized)
LAN:SMB2 CONNECT:failed to connect to blacky.fritz.box/2003:e7:272x:xxxx:1841:41e0:99eb:61dd (port 445) from /2003:e7:272x:xxxx:251b:3052:349c:4c6e (port 41289) after 5000ms: isConnected failed: EHOSTUNREACH (No route to host)
Some parts of the message make sense, others don't: The "from" address is in fact my mobile's IPv6 address, and the IPv6 address it tries to connect to actually doesn't exist, so the "Host Unreachable" error is understandable. What I don't get though is
  • Where does it get that invalid address from?
  • Why does it try to use IPv6 anyway? The share I connect to is configured as "192.168.1.26/TheShareName", i.e. an explicit IPv4 address, not even a hostname.
  • Why does it reverse-lookup the IP? blacky.fritz.box is, in fact, the correct hostname for the machine, but I never asked the client to use it.
  • Why does all of this happen only after the switch to a different router? (And why didn't it happen for the first try with said router?) Is it just coincidence?
Any ideas? ;) It still works with SMBv1, but I'd rather use SMBv2 like before ...

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-02, 08:50 UTC
by ghisler(Author)
The plugin makes both a DNS lookup and a SMB name resolution for the configured server name. Apparently the fritzbox is returning this invalid IP address for one of them. But it shouldn't make a DNS lookup for IP addresses at all. I have a 7490 and SMB works, so it could also be a configuration problem: The Fritzbox has a feature to isolate clients, so they cannot connect with each other (just to the internet). Please make sure that this isn't enabled.

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-02, 19:41 UTC
by KeyJ
You're right, the router indeed returned an invalid primary IPv6 address for the host. After disconnecting the affected machine from the network and reconnecting, it got itself another new IPv6 address, registered that at the router (which updated the primary IPv6 address for the host as a result), and SMB2 started to work again. I'll keep an eye on that; it's certainly not TC's fault. Nevertheless, I think it's somewhat surprising that the LAN plugin deals with hostname lookups and IPv6 when it's configured to access a host via a specific IPv4 address ...
The Fritzbox has a feature to isolate clients, so they cannot connect with each other (just to the internet). Please make sure that this isn't enabled.
That was my first idea too, but no; both devices are on the "may talk to each other" list, and both RDP and SMB1 worked.

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-03, 20:20 UTC
by KeyJ
I tried again today, and now the LAN plugin stubbornly insists on using the 6th of 8 IPv6 addresses returned by the router's DNS server. The problem: That address, too, is no longer in use. (The router's web interface doesn't even list that address any longer; but it's definitely still there in the AAAA records, just not on the top position.) The reconnection trick didn't work either, as the plugin always used the same wrong/old address again. Does it cache the resolved DNS addresses somewhere? I force-quit TC and the LAN plugin apps, disabled and re-enabled WiFi, rebooted the whole phone ... and it still comes up with the same old address :(

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-03, 20:46 UTC
by KeyJ
To shed some light on why the LAN plugin might select the wrong address, look at that: (unrelevant lines omitted, comments added)

Code: Select all

me@my-linux-box:~$ dig @192.168.1.254 blacky any
;; ANSWER SECTION:
blacky.	9	IN	AAAA	2003:e7:2726:7400:4091:6de:e3:5774 <- OK
blacky.	9	IN	AAAA	2003:e7:2726:7400:241a:9ed6:6395:2cea <- old
blacky.	9	IN	AAAA	2003:e7:2726:7400:4dc:7194:58a3:f1f6 <- old
blacky.	9	IN	AAAA	2003:e7:2726:7400:3851:7867:7ca1:73b0 <- old
blacky.	9	IN	AAAA	2003:e7:2726:7400:1987:ea77:e88:d48a <- old
blacky.	9	IN	AAAA	2003:e7:2726:7400:bd90:58cf:2b5c:4121 <- TC-LANs favorite address, but old too
blacky.	9	IN	A	192.168.1.26
blacky.	9	IN	AAAA	2003:e7:2726:7400:1841:41e0:99eb:61dd <- very old
blacky.	9	IN	AAAA	2003:e7:2726:7400:b833:ddab:82bd:c7ca <- OK
The order in which the router puts the DNS records in the response is quite peculiar, so say the least ... but there should not be anything wrong with that. The interesting part is that the IPv4 address is put somewhere in the middle of the response, and the wrong IPv6 address that TC-LAN insists on is the one directly preceding that. I couldn't find the DNS lookup code in jCIFS, but is it possible that it's written in a way that it iterates over the records, overwrites the IPv6 address every time, and then stops when it has both a valid IPv4 and IPv6 address? That would explain why the LAN plugin picks that address and can't be convinced to do anything else ...

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-04, 00:14 UTC
by Usher
All networking services on both server and client sides use some kind of cache to work effectively. For example there is a cache for DHCP (with MAC and IP address paired) and DNS (with domain name and IP address paired). If your system tries to connect to another network, which can use already known data in another way, you may need to flush these caches. This operation may require Administrator (root) rights.
For example:
If disconnecting and reconnecting with GUI tools isn't successful in Windows, I would recommend using ipconfig -flushdns and ipconfig -renew comands.
In Linux and other Unix-like systems you can also use similar GUI tools or run ifcfg command with proper parameters.
In Android you can use GUI tools as well, but command line isn't available by default.

Did you try to disconnect and reconnect your Android device or force refreshing network settings in any way?
For example, did you turn network off on your Android device before disconnecting from the old router and turn network on after connecting to a new router?
Did you do the same for your Windows box?

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-04, 08:37 UTC
by KeyJ
As said, I deactivated and reactivated the network connection on the Windows machine, rebooted the phone, ... to no avail. The extra IPv6 addresses aren't in the client DNS caches, they are in the *router's* cache, which can't be cleared. There's no option in the UI to disable the AAAA records in the router's DNS either (or I just didn't find it); if there was any, I'd have tried that.

Re: LAN plugin: SMB2 stopped working after router change

Posted: 2019-12-04, 14:35 UTC
by Usher
2KeyJ
You can change MAC for your network card in Windows. Just trying to be helpful…