Binding Rclone To Second NIC

I can’t seem to get the --bind option to work correctly. I’m using cloudplow and set

"--bind": "192.168.2.7",

in config.json under “rclone_extras” but it didn’t seem to be doing anything, so I attempted to run it manually and it still didn’t do anything.

This is the normal command string that cloudplow runs which works perfectly

/usr/bin/rclone copy /mnt/local/Media/ google:/Media/ --config=/home/bran/.config/rclone/rclone.conf --checkers=16 --drive-chunk-size=64M --skip-links --stats=60s --transfers=8 --verbose=1 --exclude=**partial~ --exclude=**_HIDDEN~ --exclude=.unionfs/** --exclude=.unionfs-fuse/**

If I try this, it doesn’t upload at all

/usr/bin/rclone copy /mnt/local/Media/ google:/Media/ --config=/home/bran/.config/rclone/rclone.conf --checkers=16 --drive-chunk-size=64M --skip-links --stats=60s --transfers=8 --verbose=1 --exclude=**partial~ --exclude=**_HIDDEN~ --exclude=.unionfs/** --exclude=.unionfs-fuse/** --bind=192.168.2.7

I currently have two ISPs, one has crappy upload (Spectrum), the other less crappy (FIOS, capped at 60 Mbps). By default everything is using my Spectrum connection since it’s gigabit down. The IP for that connection is 192.168.1.7 (NIC name: enp6s0), I would like to move uploading to my FIOS connection (192.168.2.7, enp7s0)

The NIC I’m trying to bind to has internet access, so I’m not sure what the issue is…

Can you try that same command with -vv on it and share the output? You can remove the verbose=1.

Can you also try to ping out the second interface and validate the routing works?

Example:

root@gemini:~# ping -I enp1s0 google.com
PING google.com (172.217.7.142) from 192.168.1.30 enp1s0: 56(84) bytes of data.
64 bytes from iad30s08-in-f142.1e100.net (172.217.7.142): icmp_seq=1 ttl=56 time=10.6 ms
64 bytes from iad30s08-in-f142.1e100.net (172.217.7.142): icmp_seq=2 ttl=56 time=12.0 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 10.667/11.341/12.015/0.674 ms
root@gemini:~# ping -I enp2s0 google.com
ping: Warning: source address might be selected on device other than enp2s0.
PING google.com (172.217.7.142) from 192.168.1.30 enp2s0: 56(84) bytes of data.
^C
--- google.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3063ms

My second interface is down so it doesn’t work.

Here’s the ping output

[bran@server ~]$ ping -I enp7s0 google.com
PING google.com (172.217.10.78) from 192.168.2.7 enp7s0: 56(84) bytes of data.
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=1 ttl=56 time=116 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=2 ttl=56 time=181 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=3 ttl=56 time=114 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=4 ttl=56 time=172 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=5 ttl=56 time=110 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=6 ttl=56 time=175 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=7 ttl=56 time=112 ms
64 bytes from lga34s14-in-f14.1e100.net (172.217.10.78): icmp_seq=8 ttl=56 time=171 ms
^C
--- google.com ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 16ms
rtt min/avg/max/mdev = 110.382/143.891/181.248/31.124 ms

Apparently it’s a token error, are tokens tied to public IPs or something? Why would it work when I don’t specify the IP, but give me token errors when I do?

[bran@server ~]$ /usr/bin/rclone copy /mnt/local/Media/ google:/Media/ --config=/home/bran/.config/rclone/rclone.conf --checkers=16 --drive-chunk-size=64M --skip-links --stats=60s --transf
ers=8 --exclude=partial~ --exclude=_HIDDEN~ --exclude=.unionfs/** --exclude=.unionfs-fuse/** --bind=192.168.2.7 -vv
2019/03/05 18:56:07 DEBUG : rclone: Version "v1.46" starting with parameters ["/usr/bin/rclone" "copy" "/mnt/local/Media/" "google:/Media/" "--config=/home/bran/.config/rclone/rclone.conf"
"--checkers=16" "--drive-chunk-size=64M" "--skip-links" "--stats=60s" "--transfers=8" "--exclude=partial~" "--exclude=_HIDDEN~" "--exclude=.unionfs/**" "--exclude=.unionfs-fuse/**" "--bind=
192.168.2.7" "-vv"]
2019/03/05 18:56:07 DEBUG : Using config file from "/home/bran/.config/rclone/rclone.conf"
2019/03/05 18:57:07 DEBUG : pacer: Rate limited, sleeping for 1.110629247s (1 consecutive low level retries)
2019/03/05 18:57:07 DEBUG : pacer: low level retry 1/10 (error Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%
2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27Media%27%29+and+mimeTy
pe%3D%27application%2Fvnd.google-apps.folder%27: dial tcp 192.168.2.7:0->172.217.3.106:443: i/o timeout)
2019/03/05 18:58:07 DEBUG : pacer: Rate limited, sleeping for 2.741318738s (2 consecutive low level retries)
2019/03/05 18:58:07 DEBUG : pacer: low level retry 2/10 (error Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%
2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27Media%27%29+and+mimeTy
pe%3D%27application%2Fvnd.google-apps.folder%27: dial tcp 192.168.2.7:0->172.217.10.106:443: i/o timeout)
2019/03/05 18:58:07 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 18:59:07 DEBUG : google: Token refresh failed try 1/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.10.77:443: i/o timeout
2019/03/05 18:59:08 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 19:00:08 DEBUG : google: Token refresh failed try 2/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout
2019/03/05 19:00:09 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 19:01:09 DEBUG : google: Token refresh failed try 3/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout
2019/03/05 19:01:10 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 19:02:10 DEBUG : google: Token refresh failed try 4/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout
2019/03/05 19:02:11 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 19:03:11 DEBUG : google: Token refresh failed try 5/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout
2019/03/05 19:03:12 DEBUG : pacer: Rate limited, sleeping for 4.417100293s (3 consecutive low level retries)
2019/03/05 19:03:12 DEBUG : pacer: low level retry 3/10 (error Get https://www.googleapis.com/drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%
2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27Media%27%29+and+mimeTy
pe%3D%27application%2Fvnd.google-apps.folder%27: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout)
2019/03/05 19:03:12 DEBUG : google: Loaded invalid token from config file - ignoring
2019/03/05 19:04:12 DEBUG : google: Token refresh failed try 1/5: Post https://accounts.google.com/o/oauth2/token: dial tcp 192.168.2.7:0->172.217.12.205:443: i/o timeout
2019/03/05 19:04:13 DEBUG : google: Loaded invalid token from config file - ignoring

It shows IO errors for that IP, but I have no problem pinging it

[bran@server ~]$ ping -I enp7s0 172.217.10.106
PING 172.217.10.106 (172.217.10.106) from 192.168.2.7 enp7s0: 56(84) bytes of data.
64 bytes from 172.217.10.106: icmp_seq=1 ttl=56 time=131 ms
64 bytes from 172.217.10.106: icmp_seq=2 ttl=56 time=68.9 ms
64 bytes from 172.217.10.106: icmp_seq=3 ttl=56 time=127 ms
64 bytes from 172.217.10.106: icmp_seq=4 ttl=56 time=64.9 ms
^C
--- 172.217.10.106 ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 11ms
rtt min/avg/max/mdev = 64.869/97.764/130.594/30.942 ms

Maybe try taking your other interface down and see if it routes correctly.

Just for fun, can you ping that IP “172.217.3.106” out of that interface? It seems to be not letting the rclone traffic out but the ping to google definitely did work.

You mentioned you have two interfaces setup. How did you set that up? What does your netstat -rn look like?

I see no problem with routing, anything bound to that IP works…except for rclone for some reason, which complains of token errors, of all things. I use the other interface for pretty much everything else and don’t really want to take it down.

I must’ve misremembered the IP, but the output is in the above post, all is well, no issues.

I have the two NICs configured with static IPs via systemd-networkd

Here’s the netstat output

[bran@server ~]$ sudo netstat -rn
[sudo] password for bran:  
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 enp6s0
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 enp7s0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U         0 0          0 br-c59bc46dba9d
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 enp6s0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 enp7s0

The error you are getting is that rclone can’t get out that interface.

I use a second interface for my VPN and have a few more steps to get routing to work.

What OS?

I used this way back when I was using 2 interfaces to make sure the routing worked properly. This would work on Ubuntu/Debian.

Interesting…I’m using Arch Linux, not really sure how to adapt that permanently to systemd-networkd.

I’m not sure as I don’t use it.

Can you try

curl --interface 192.168.2.7 https://www.googleapis.com/drive/v3/files

that will simulate what rclone does. It should return a JSON error saying it needs authentication.

Using the NIC IP failed with “protocol not supported” but using the NIC name worked though

[bran@server ~]$ sudo curl --interface enp7s0 https://www.googleapis.com/drive/v3/files           
{
“error”: {
 “errors”: [
  {
   “domain”: “usageLimits”,
   “reason”: “dailyLimitExceededUnreg”,
   “message”: “Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.”,
   “extendedHelp”: “https://code.google.com/apis/console
  }
 ],
 “code”: 403,
 “message”: “Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.”
}
}

Hmm, that’s goofy as if ping / curl are all working out that interface, I can’t imagine why rclone wouldn’t.

Are you able to try a test and grab a tcpdump on that interface and see if it’s actually going out?

Just for the hell of it, I tried to use the NIC name instead of the IP for the --bind option and got this strange error:

–bind: Expecting 1 IP address for “enp7s0” but got 2

I just noticed that both of my NICs have IPv6 addresses…yet I never setup IPv6 on these, they’re static IPs.

3: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether 34:97:f6:5b:b0:b4 brd ff:ff:ff:ff:ff:ff
   inet 192.168.2.7/24 brd 192.168.2.255 scope global enp7s0
      valid_lft forever preferred_lft forever
   inet6 fe80::3697:f6ff:fe5b:b0b4/64 scope link  
      valid_lft forever preferred_lft forever

Sure, I’ll make a dump,

I wonder if it’s something related to ip v6. I have that disabled on my Debian box.

Here’s the capture: https://drive.google.com/file/d/1254chTFwfcKtuWBfSMqXM4qlZmb0R2g1/view?usp=sharing

I did a few other things on that interface as well such as pinging an IP and running rclone with the bind option.

I just deleted the IPv6 address from that NIC yet it still gives me the error about it finding two IPs, wtf?

–bind: Expecting 1 IP address for “enp7s0” but got 2

3: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
   link/ether 34:97:f6:5b:b0:b4 brd ff:ff:ff:ff:ff:ff
   inet 192.168.2.7/24 brd 192.168.2.255 scope global enp7s0
      valid_lft forever preferred_lft forever

Any chance you can just do the rclone thing and upload that? I can’t figure out if it was something else or not.

Sure, here ya go: https://drive.google.com/file/d/1r0pcNCAWzBy2a7M8vfyegzsiAM-ZFf4X/view?usp=sharing

Yeah, it never goes out that interface at all. In the other packet capture, you can see the ping go out. I’m not sure offhand what that would be though…

Which OS are you using?

Can you run rclone in one terminal window and in another run netstat -tuanp | grep rclone and see if rclone is binding the outgoing addresses to the local correct IP?

rclone tried to do a DNS lookup of "enp7s0” and got 2 items back is what it is complaining about! A strange error I agree!