Tell me more ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a machine with two public IP addresses on two interfaces. This machine is running sshd. Is there a way to specify, when creating a tunnel with a SOCKS interface (i.e. -D), which interface to use for outgoing connections?

share|improve this question
2  
technically that's not an sshd question, since once the packet exits the tunnel into the remote machine's IP stack, it's at the mercy of the routing table on that machine, subject to modification by any ipf/iptables rules that may be in place. i'd tag this question with whatever firewall type your remote system uses, and I bet you can find an answer, even if it's as simple as adding specific routing table entries for specific destinations. – Tim Kennedy Aug 6 '12 at 4:22

1 Answer

What happens when you use -b?

 -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
         address.
share|improve this answer
But I want to specify the source address of connections on the remote machine. I tried -b but it doesn't seem to do anything. – Cactus Apr 8 '12 at 4:28
You can do per flow routing, can't you? On remote machine make a rule in your firewall configuration to use specific gateway. (It works with OpenBSD's PF openbsd.org/faq/pf/pools.html#outgoing, so I guess there should be a way to do it with Linux iptables). – Jiri Xichtkniha Apr 10 '12 at 12:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.