I'm not able to detect incoming connections from Nextcloud sync clients via netstat on my server.

I have a server in my LAN, running Nextcloud with MySQL in docker containers. I use multiple Nextcloud Clients (Linux, macOS and iOS), everything is working fine.

I want to check if clients are connected to my server on host level. With netstat I'm able to see if a client is connected via the Nextcloud web UI, but I don't recognize connections of the Nextcloud sync client.

Does anyone know the netstat parameter I'm missing? Any hint is welcome.

BR Stefan


The connections are probably DNATed to the containers. That means the host is now acting as a router between "outside" and the containers. netstat will not display those connections. You will need additional tools for the missing flows.

One such tool is conntrack, which queries conntrack about tracked connections. Using this command with option -j:

conntrack -L -j

will display only NATed connections, thus showing the current active established flows between the containers and outside and complementing the output of netstat.

If you want an output similar to netstat you could try if available netstat-nat which more or less relies on the same mechanism.

An other method, to run in a loop, would be to query Docker (using docker directly on the host) about each container's main pid and use the result to access the container's network, to run an usual netstat. This has the advantage of displaying certain states not showing anymore with conntrack (like CLOSE_WAIT, usually a symptom of problems on an application).

Given a running Docker container named containername, this should get all its network connections, as seen from its own point of view, even if the container itself lacks any useful command for this:

nsenter --target $(docker inspect --format '{{.State.Pid}}' containername) --net netstat -utn
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.