LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help forwarding traffic from 1 host to another (https://www.linuxquestions.org/questions/linux-newbie-8/help-forwarding-traffic-from-1-host-to-another-4175459822/)

offroadaz 04-27-2013 06:19 PM

Help forwarding traffic from 1 host to another
 
I have a host acting like a socks proxy. I want to forward all of my traffic from that host to another and out to the internet.


I used this command on the first host (host A) to setup the socks proxy
ssh -f -N -D 0.0.0.0:1080 localhost
iptables -A INPUT --src 1.2.3.4 -p tcp --dport 1080 -j ACCEPT (1.2.3.4 is not my IP, just put it up for privacy)
iptables -A INPUT -p tcp --dport 1080 -j REJECT

I want to forward all of my traffic from host A, through another linux system and out to the internet.

I thought I could do an SSH tunnel from host A through host B. But Im too much of a n00b to get it working correctly

Any help?

acid_kewpie 04-28-2013 12:57 PM

ssh port forwarding doesn't need iptables updates. the entire point is that the traffic moves between the systems within the ssh connection on port 22. 1080 won't EVER be seen on your network.

You need a way to make the traffic use the proxy. It's not going to magically jump in it. That's usually browser settings, but only relates to web traffic that way. There are tools like socksify which can push non proxyable (??) traffic into a socks proxy, if that's what you really need.

lleb 04-28-2013 01:51 PM

Quote:

Originally Posted by acid_kewpie (Post 4940632)
ssh port forwarding doesn't need iptables updates. the entire point is that the traffic moves between the systems within the ssh connection on port 22. 1080 won't EVER be seen on your network.

question here, if you are setting up a reverse ssh connection does that not use a different port other then 22?

ssh -L is what im thinking about here, or am i way off base?
Quote:

You need a way to make the traffic use the proxy. It's not going to magically jump in it. That's usually browser settings, but only relates to web traffic that way. There are tools like socksify which can push non proxyable (??) traffic into a socks proxy, if that's what you really need.
in that case could he not just set the gateway /etc/resolv.conf to point to the socks proxy servers IP?

acid_kewpie 04-28-2013 01:55 PM

The specified port is what's use locally, or remotely, on the loopback interface. You can have 10 local tunnels and 10 reverse tunnels, but the traffic will only ever flow over port 22 between the two systems.

No, you couldn't as you need to be socks aware, and connect to a specific TCP port.

lleb 04-28-2013 06:12 PM

thanks for clearing that up.


All times are GMT -5. The time now is 07:31 PM.