So I have a computer running Debian Stretch; it needs to network to a Raspberry Pi on eth0 using a static IP (e.g. 192.168.0.x), while being able to grab files via sftp using a mobile broadband modem (wwx.... ; and that's a dynamic IP, e.g. 10.73.28.x).

The problem is, as soon as the two computers are connected and eth0 is up, sftp works no longer, as it seems to try to connect using eth0. How can I force it to use a different network interface, such as wlan or modem?

For example, this works for ping if I have the server's IP and don't need DNS:

ping -I wwx58... 81.169.bla.bla

So I tried this:

sftp -o BindAddress=10.73.bla.bla -q [email protected]: <<<"ls -la"

But it still doesn't select the interface, or something is not working:

Couldn't read packet: Connection reset by peer

2 Answers 2


Configure the eth0 interface via /etc/network/interfaces, e.g.:

auto eth0
iface eth0 inet static

Any interfaces defined via that file will be ignored by NetworkManager, so NetworkManager will still attempt to establish a connection via the other interface.

As the eth0 interface, configured as above, does noet have a gateway (default route) set, that will be configured on the other interface and sftp and any other connection to other networks than should work fine.


Sounds like your routes are misconfigured. What gives ip route?

It also sounds like eth0 should have no default route (nmcli connection modify "$ETH0PROFILE" ipv4.never-default yes) and a static address (nmcli connection modify "$ETH0PROFILE" ipv4.method manual ipv4.addresses

You may alternatively set ipv4.route-metric to ensure wwx gets the better default route.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .