0

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 credentialse@81.169.bla.bla: <<<"ls -la"

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

Couldn't read packet: Connection reset by peer
0

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

auto eth0
iface eth0 inet static
    address 192.168.0.123
    netmask 255.255.255.0

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 192.168.0.0/24 should work fine.

0

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 192.168.24.5/24).

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

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.