Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two NICs. I want to use one (eth0) for connecting to Host_A using SSH and the other (eth1) for everything else.

I also run a Socks proxy through that SSH connection to Host_A. All traffic through that proxy should also use eth0 (the same as the ssh connection itself).

How do I set this up?

EDIT: Forgot to mention that the two NICs are connected to different networks.

EDIT 2: After adding the route to Host_A, the new default route and deleting the old default route I can successfully connect using ssh to Host_A. (Thanks @MariusMatutiae)

It does however take "forever" for the password prompt to appear. With only eth0 active it appears much faster.

I can also not use the SOCKS5 proxy I create by specifying -D 8080 when connecting.

share|improve this question
up vote 1 down vote accepted

Let us call IP1 the IP address of the router on eth1, and IP0 the IP address of the router on eth0. Then these two commands

 sudo route add default  gw IP1
 sudo route add -host IP_of_Host_A gw IP0

assures that all of your applications will go the best way, i.e., the one with the smallest metric, and you can force ssh to use eth0 by means of, (assuming that eth0 has IP address xxx.yyy.www.zzz):

  ssh -b xxx.yyy.www.zzz me@IP_Host_A
share|improve this answer
Thanks for your answer. Unfortunately it didn't work for me. I've updated my question with some information I really should have remembered to include from the start! – Tobbe Nov 19 '13 at 9:05
@Tobbe Edited my answer to reflect your changes – MariusMatutiae Nov 19 '13 at 9:45
Had to delete my old default route (it was using eth0). Other than that this works! – Tobbe Nov 19 '13 at 10:51
One more thing however; Would it be possible to make it possible to use the host name when connecting through ssh instead of the IP address? And use, for example, instead of when specifying the route? I want this to be able to handle a Host_A that doesn't have a static IP address. – Tobbe Nov 19 '13 at 10:54
Still one thing that doesn't work, and that's the SOCKS5 proxy ssh -D 8080 -b xxx.yyy.www.zzz me@IP_Host_A – Tobbe Nov 19 '13 at 11:33

You must log in to answer this question.

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