Linux/CentOS: How to force FTP/SSH to use a particular ethernet adapter

ethernet, linux, networking

Solution

Perhaps you can set up a special route for the servers you intend to connect to? Have a look at the route command, or the "ip route" command.

EDIT: This seems to contain an example of what I'm saying: http://www.cyberciti.biz/faq/howto-linux-configuring-default-route-with-ipcommand/

Specifically:

Type the following command to sent all packets to the local enter code herenetwork 192.168.1.0 directly through the device eth0:, enter

ip route add 192.168.1.0/24 dev eth0

Problem

We have a CentOS server with 2 ethernet adapters. Both of these adapters have access to the internet and both can be used to connect to remote sites. Is there a way to know which ethernet adapter will be used when connecting to an FTP server or connecting via SSH to another server? If so, is there a way to force it to use a particular adapter without disabling any?

Original source