Rclone server webdav bind to ipv6

What is the problem you are having with rclone?

  • If I start rclone webdav server with default add it will bind to ipv4
netstat -nlp | grep rclone
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      23889/rclone  
  • If I start rclone webdav server with another port it will bind to ipv6
netstat -nlp | grep rclone
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8081                 :::*                    LISTEN      24010/rclone 
  • If I define an IP address (e.g. --addr 192.168.1.1:8081) it work as expected.
  • Is this the desired behavior or a bug?
    • I'd expect that something like --addr :::8081 bind to ipv6.
  • How can I bind to ipv4?

What is your rclone version (output from rclone version)

I installed the latest version to make sure it's not a bug which is already fixed, but tried with 1.56 too.

rclone v1.56.1

  • os/version: debian 10.10 (64 bit)
  • os/kernel: 4.19.0-17-amd64 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.8
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

I used the following two command to start with default values and with port 8081:

rclone serve webdav /tmp/
2021/09/22 12:19:42 NOTICE: Local file system at /tmp/: WebDav Server started on http://localhost:8080/
rclone serve webdav --addr 0.0.0.0:8081 /tmp/
2021/09/22 12:20:37 NOTICE: Local file system at /tmp/: WebDav Server started on http://0.0.0.0:8081/

The rclone config contents with secrets removed.

No config file

A log from the command with the -vv flag

rclone -vv serve webdav /tmp/
2021/09/22 12:22:02 DEBUG : rclone: Version "v1.56.1" starting with parameters ["rclone" "-vv" "serve" "webdav" "/tmp/"]
2021/09/22 12:22:02 DEBUG : Creating backend with remote "/tmp/"
2021/09/22 12:22:02 DEBUG : Using config file from "/home/john/.config/rclone/rclone.conf"
2021/09/22 12:22:02 INFO  : Local file system at /tmp/: poll-interval is not supported by this remote
2021/09/22 12:22:02 NOTICE: Local file system at /tmp/: WebDav Server started on http://localhost:8080/
rclone -vv serve webdav --addr 0.0.0.0:8081 /tmp/
2021/09/22 12:21:52 DEBUG : rclone: Version "v1.56.1" starting with parameters ["rclone" "-vv" "serve" "webdav" "--addr" "0.0.0.0:8081" "/tmp/"]
2021/09/22 12:21:52 DEBUG : Creating backend with remote "/tmp/"
2021/09/22 12:21:52 DEBUG : Using config file from "/home/john/.config/rclone/rclone.conf"
2021/09/22 12:21:52 INFO  : Local file system at /tmp/: poll-interval is not supported by this remote
2021/09/22 12:21:52 NOTICE: Local file system at /tmp/: WebDav Server started on http://0.0.0.0:8081/

The default binds to localhost:8080 which you saw which I personally would expect and the second binds to 8081 and if you have IPV6, it'll bind to that.

If you need a particular IP or want IPV4, just use the bind command specify it.

Looks to be what's I'd expect anyway.

So it's possible to listen on a port (e.g. 8081) on all IPv6 addresses, but it's not possible to listen on a port on all IPv4 addresses.

So it's possible to listen on a port (e.g. 8081) on all IPv6 addresses, but it's not possible to listen on a port on all IPv4 addresses.

I think that is correct.

It could be made configurable - if there are enough good reasons to warrant it, a feature request is made, and someone picks it up... :slight_smile:

The network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
For TCP networks, if the host in the address parameter is empty or a literal unspecified IP address, Listen listens on all available unicast and anycast IP addresses of the local system. To only use IPv4, use network "tcp4"
(net package - net - pkg.go.dev)

Doesn't your second do just that? It's bound on 0.0.0.0 on port 8181 right?

felix@gemini:~$ rclone serve webdav --addr 0.0.0.0:8585 GD:
2021/09/22 09:05:53 NOTICE: Google drive root '': WebDav Server started on http://0.0.0.0:8585/
^Z
[1]+  Stopped                 rclone serve webdav --addr 0.0.0.0:8585 GD:
felix@gemini:~$ netstat -an | grep 8585
tcp        0      0 0.0.0.0:8585            0.0.0.0:*               LISTEN

I did some other tests and it's ok. Even if the netstat command output tcp6 the server is reachable on all ipv4 addresses.

So it work as expected.

No, it's bound to :::8081:

tcp6       0      0 :::8081                 :::*                    LISTEN      24010/rclone 

This is what confused me. But seems to be ok, reachable on all ipv4 too.

That's normal output on a system with IPV6 enabled as anything on IPV6 will be also on IPV4 for backwards compatibility.

Ah, sorry. I interpreted the issue as: it's not possible to listen on a port on all IPv4 addresses [only].

This is just an artifact of netstat - it is bound to IPv4 too as you'll see if you try telnet

$ rclone serve webdav --addr :8888 .
$ netstat -tuanp | grep rclone
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8888                 :::*                    LISTEN      2650835/rclone      
$ telnet 127.0.0.1 8888
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^C^]
telnet> quit
Connection closed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.