Disable ipv6 usage / force ipv4 only

Hi,

is it possible to force rclone to use ipv4 only?

Before you ask: There IS a reason. I have DUAL-WAN. One with ipv4/6 dual-stack and one with ipv4 only. Since switching to GDRIVE rclone is using ipv6 with google. This however means that all outgoing connections are ONLY going through the first WAN line and the second one stays empty.

Sure I could try to disable IPv6 completely on the FreeBSD server but this is not as easy as it sounds and has other problems attached to it.

Regards,
JP

In Linux I would edit /etc/gai.conf to solve this problem, however that probably won’t work for go programs anyway.

I can’t think of any easy way to do this in rclone.

You could put some fake entries in /etc/hosts for Google’s endpoints. Use -vv with -dump-headers to work out what they are.

maybe?

https://unix.stackexchange.com/questions/210982/bind-unix-program-to-specific-network-interface

Edit: freebsd. Oops.

Does not seem to work with FreeBSD. Already looked into that. Will take a look at -dump-headers… I have seen so many programs with -4 / -6 switches that I simply assumed that you could easily provide something similar. If this is not easily possible in Go I am screwed then.

1 Like

What about deploying a ipv4 only DNS server (dnsmasq for example) and forcing rclone to use it. There are several ways to force it potentially using iptables or even something like docker. Not an ideal approach but…

Docker may be able to solve this without even a DNS server.

Running it from a jail with an IPv4 only currently which seems to do the trick at least party. Will look into dnsmasq.

I too would like rclone to run ipv4-only. Would you mind elaborating a bit on how your setup a chroot jail with ipv4?

I setup a basic jail with ezjail and assigned it a static IPv4 only.