I want to connect remotely using SSH.

However, I'm not able to while my VPN is active, so I disconnect from the VPN and then connect using the other connection.

How can I force the connection through my other connection when connected to the VPN?

I'm using Windows 7 and PuTTY client.

  • 3
    Please add more information... Provide a routing table of your current machine, what your client OS is (linux, windows) – RomeNYRR Aug 13 '12 at 15:51

There are 2 options. First, you could modify your routes so that the SSH packets naturally go through the correct interface.

Or you could use the -b SSH option (or in a similar way the -B one):

     -b bind_address
             Use bind_address on the local machine as the source address of
             the connection.  Only useful on systems with more than one

It will bind your SSH client to a chosen local IP address, so that all packets will be emitted through the associated interface.

  • 1
    what's the second option? i'm curious! – Eliran Malka May 1 '16 at 14:59
  • 1
    It would also be helpful to know how to do the equivalent in PuTTY, since the question specified that client. – echristopherson Jun 15 '16 at 17:06
  • It looks like the -b option does not support an IPv6 IP. Am I correct? – Arya Oct 5 '17 at 18:30

The issue was with the route taken.

The solution was to update the routing table. I used the route command to add a new route specifying the correct interface and gateway.

The command looks like route add <destination> mask <netmask> <gateway> <interface>, for example:

route -p add mask IF 13

-p is for persistent so it remains there after reboot. IF is for interface and you can get this number from the command route print.


You must change the route towards your destination.

A previous answer stated that the -b or -B options can be used, but normally, if the VPN is activated this does not work because it reroutes the traffic towards any destination through the VPN network interface - generally named tun0.

Therefore, you must reconfigure the route taken to reach your destination. Let us call it <destination>, and <gate1> the IP address of the gateway (technically the address of the nexthop router) associated to the different interface that you want to use. With ip route, route being deprecated, this should be:

ip route add <destination> via <gate1>

An alternative is

ip route add <destination> via <gate1> dev <different interface>

but given that the address <gate1> is already associated with your different interface, here <different interface>, that changes nothing.

What matters here, is to specify that this is <gate1>, the gateway of your different interface, which has to be traversed, instead of that of the VPN.

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.