[NextcloudPi] Android uploads/downloads fail when trying to sync files in my home wifi

ncp
android

#1

Hey everyone,
I just started my own NextcloudPi using @nachoparker fabulous image. It works fine, but due to my routers not-supporting of NAT loopback I had to use dnsmasq to configure the Pi as DNS server. I followed the steps given on this website (link) and it works fine on Windows after configuring it accordingly.

But for some reason my android device doesn’t get a proper connection to the NextcloudPi, even after giving it at static IP and configuring the Pi as primary DNS server for it.

Opening the domain of the NextcloudPi in the android browser doesn’t load the login site properly (other websites are working fine).

In the app file changes (made in Windows) are being displayed but downloading files and uploading images results in “Connection error”.

If I’m using other peoples wifi or mobile data, syncing both ways works fine…

Anyone else having the same problem or knows how to solve this?

Nextcloud 12.0.3, Android 6.0.1, App-Version 2.0.0


#2

any chance your DNS are catched by Android? have you tried rebooting the phone?


#3

Tried rebooting, still the same problem…

What I noticed is that if I use the dig command in the Pi, it doesn’t show the IP adress that the Pi is supposed to have but 127.0.0.1 instead. But if I dig my own domain it’s showing the right IP adress (192.168.1.24) for it… Is there a configuration error?
Either way - if I point the the DNS server of my android device to 127.0.0.1 it still does not upload/download files correctly (even not after reboot)…

pi@nextcloudpi:~ $ dig foursquare.com

; <<>> DiG 9.10.3-P4-Raspbian <<>> foursquare.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10861
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;foursquare.com.                        IN      A

;; ANSWER SECTION:
foursquare.com.         23      IN      A       151.101.64.154
foursquare.com.         23      IN      A       151.101.0.154
foursquare.com.         23      IN      A       151.101.128.154
foursquare.com.         23      IN      A       151.101.192.154

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Dec 01 11:14:26 UTC 2017
;; MSG SIZE  rcvd: 107

pi@nextcloudpi:~ $ dig <<hidden>>.ddns.net

; <<>> DiG 9.10.3-P4-Raspbian <<>> <<hidden>>.ddns.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11326
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
` <<hidden>>.ddns.net              IN      A`

;; ANSWER SECTION:
<<hidden>>.ddns.net.       0       IN      A       192.168.1.24

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Dec 01 11:19:47 UTC 2017
;; MSG SIZE  rcvd: 50

#4

Edit: I had to set up the Pi completly new (I managed to crash it when moving data to a malfunctioning harddrive)
and am now having also trouble to connect properly to the nextcloud through windows (application and browser)… Through a VPN the connection is okay, but still kind of unstable…

How can I check if dnsmasq is working correctly?


#5

For now I have a work-around:
I installed the Nextcloud dev application parallel to the normal app on my smartphone, but put in my IP adress instead of my domain. Like this it works fine, uploading and syncing without a problem.
I also logged into the windows app with a second instance using the IP adress and paused the domain-linked-sync in the program.

Like this I can use the IP-adress-based instances when I am at home and the domain-based-instances when I’m out of the house.

Still this is far from ideal. If anyone finds out, how to make sure that dnsmasq is working correctly, that would help a lot!


#6

I would use dig from a Linux computer, as in

https://ownyourbits.com/2017/03/09/dnsmasq-as-dns-cache-server-for-nextcloudpi-and-raspbian/

Also, check the dnsmasq logs


#7

Unfortunately the RaspberryPi is the only Linux system I have…
How can I check the dnsmasq logs?


#8

maybe you will find some info in

systemctl status dnsmasq

#9

Doesn’t look too promising…

pi@nextcloudpi:~ $ systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-12-07 10:53:05 UTC; 4 days ago
 Main PID: 4441 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
       └─4441 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service

Dec 07 10:53:05 nextcloudpi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 07 10:53:05 nextcloudpi dnsmasq[4433]: dnsmasq: syntax check OK.
Dec 07 10:53:05 nextcloudpi dnsmasq[4441]: started, version 2.76 cachesize 150
Dec 07 10:53:05 nextcloudpi dnsmasq[4441]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Dec 07 10:53:05 nextcloudpi dnsmasq[4441]: DNS service limited to local subnets
Dec 07 10:53:05 nextcloudpi dnsmasq[4441]: using nameserver 8.8.4.4#53
Dec 07 10:53:05 nextcloudpi dnsmasq[4441]: read /etc/hosts - 5 addresses
Dec 07 10:53:05 nextcloudpi dnsmasq[4442]: Too few arguments.
Dec 07 10:53:05 nextcloudpi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

#10

It works quite fine for me after reboot. Syncing without any problem between my computer and phone. Mine is Samsung Galaxy S7 with Android 7.0


#11

Then see if there’s an alternative to dig for Android. There has to be. It should be a matter of pointing your DNS to the pi, it’s really no more complicated that that.


#12

I found out how to use dig command in windows. Its included in BIND which anyone else with the same problem can find here: https://www.isc.org/downloads/.
When trying to dig a domain at first it only showed results where the secondary DNS server (8.8.8.8) was active. So I opened up the NextcloudPiPanel an re-ran dnsmasq. Now its working both in Windows and Android!

systemctl status dnsmasq shows the following:

pi@nextcloudpi:~ $ systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-12-12 12:39:29 UTC; 1h 24min ago
  Process: 5607 ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf (code=exited, status=0/SUCCESS)
  Process: 5663 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
  Process: 5656 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 5653 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 5662 (dnsmasq)
   CGroup: /system.slice/dnsmasq.service
           └─5662 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service

Dec 12 12:39:29 nextcloudpi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 12 12:39:29 nextcloudpi dnsmasq[5653]: dnsmasq: syntax check OK.
Dec 12 12:39:29 nextcloudpi dnsmasq[5662]: started, version 2.76 cachesize 150
Dec 12 12:39:29 nextcloudpi dnsmasq[5662]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Dec 12 12:39:29 nextcloudpi dnsmasq[5662]: DNS service limited to local subnets
Dec 12 12:39:29 nextcloudpi dnsmasq[5662]: using nameserver 8.8.4.4#53
Dec 12 12:39:29 nextcloudpi dnsmasq[5662]: read /etc/hosts - 5 addresses
Dec 12 12:39:29 nextcloudpi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

Now dig command looks like this:

D:\Eigene Daten\Programme\BIND9.10.6.x64>dig faz.net

; <<>> DiG 9.10.6 <<>> faz.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33565
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;faz.net.                       IN      A

;; ANSWER SECTION:
faz.net.                21375   IN      A       40.118.6.229

;; Query time: 29 msec
;; SERVER: 192.168.1.24#53(192.168.1.24)
;; WHEN: Tue Dec 12 15:13:08 Mitteleuropõische Zeit 2017
;; MSG SIZE  rcvd: 52


D:\Eigene Daten\Programme\BIND9.10.6.x64>dig faz.net

; <<>> DiG 9.10.6 <<>> faz.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29258
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;faz.net.                       IN      A

;; ANSWER SECTION:
faz.net.                21367   IN      A       40.118.6.229

;; Query time: 4 msec
;; SERVER: 192.168.1.24#53(192.168.1.24)
;; WHEN: Tue Dec 12 15:13:16 Mitteleuropõische Zeit 2017
;; MSG SIZE  rcvd: 52

My browser still needs longer opening the domain of the Pi than the IP-address. I don’t know why (maybe some kind of cache). But for now I’m happy! Thanks everyone!


#13

It depends on the size of the data you need to sync as the speed of files transfer is very slow if you connect to WiFi , it will makes the connection fail or the Android transfer fail.


#14

You can easy to sync your phone data with your PC via wifi using an Android Manager, don’t worry the data loss.


#15

For me, I’d like to sync my files to my PC with transfer app, which enables me to transfer data between phone and PC via USB or wifi. All the phone contents can be transferred and without data loss.