LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2013, 07:19 PM   #1
offroadaz
LQ Newbie
 
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Question 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?

Last edited by offroadaz; 04-27-2013 at 07:20 PM.
 
Old 04-28-2013, 01:57 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
Old 04-28-2013, 02:51 PM   #3
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
Quote:
Originally Posted by acid_kewpie View Post
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?
 
Old 04-28-2013, 02:55 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.
 
1 members found this post helpful.
Old 04-28-2013, 07:12 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
thanks for clearing that up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding ping packets from one 1st host to 2nd host via 2rd host sachee Linux - Networking 1 09-25-2011 02:51 PM
Forwarding traffic to another machine eaglefly Linux - Networking 6 09-19-2011 03:33 PM
TCP traffic forwarding shathil Linux - Networking 1 09-05-2009 11:46 PM
Forwarding traffic between 2 NICs! muzzamil.luqman Linux - Networking 4 12-08-2005 06:18 PM
Forwarding local traffic to remote host: kernel development sl_king Programming 1 08-25-2005 07:53 PM


All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration