LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2009, 04:41 PM   #1
Vaelek
LQ Newbie
 
Registered: May 2009
Posts: 5

Rep: Reputation: 0
Question Routing traffic from one interface to another


I have what I imagine is a fairly simple problem to resolve, but I cannot seem to find anything that is actually helpful so I've now come here. Here's the situation...

My machine has 2 interfaces, 1 being wireless. What I want to do, is to be able to accept connections on the wireless interface, and route them out the other interface, basically a proxy. Every solution I've managed to find requires that the wireless interface be on an Ad-Hoc connection, and this is just not possible. Both interfaces ARE able to connect to the internet, but I need everything to route through the non-wireless one. I've tried srelay but can't find any documentation on configuring it anywhere. I've also seen suggestions using route / iptables, but again, nothing that I can translate into applying to my scenario, perhaps something like netcat? Any assistance would be greatly appreciated.

Thanks in advance!

-Vaelek
 
Old 05-06-2009, 04:56 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
you've got three things badly mixed up here... a router is NOT a proxy. Do you want to route or proxy? Or do you actually want to switch? do you have multiple subnets, or a single flat L2 domain excluding your internet connection? What you've stated as being able to accept connections doesn't really seem like a clear scenario to base a requirement on. Can you rephrase it in terms of actual use cases?
 
Old 05-06-2009, 05:02 PM   #3
Vaelek
LQ Newbie
 
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Ok, here's the situation.

I have a box with a wireless and a cellular connection. The wireless is connected to the enterprise network where I work. The cellular obviously to the cellular network. My goal is to proxy from the wireless to the cellular. Everything I have tried so far that even comes close to working, ends up routing the request back out the wireless network to the net rather than through the cellular interface. My original post was written rather hastily. Hopefully that clears it up.
 
Old 05-06-2009, 05:24 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
So you want the wireless interface to be a gateway (default router) for clients on its subnet?
 
Old 05-06-2009, 06:20 PM   #5
Vaelek
LQ Newbie
 
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
No, I need it to act as a proxy, preferably SOCKS.

It's like this... my actual PC is on a wired network. The wired network is bridged with the wireless network. I need to proxy through the wireless interface of my linux box through the cellular interface. I must retain my current gateway on the work PC. I've tried srelay, and I can get it to proxy, but it still sends the proxied requests out the wireless network.
 
Old 05-06-2009, 10:31 PM   #6
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
You're going to have to work with us on this -- I still can't make much sense out of what you are saying.

For starters:

Code:
   +-----------+
   |           |--192.168.0.3---------------((internet))
   |  Linux    |               |   
   |   Box     |             bridge
   |           |               |
   |           |--192.168.1.3--+
   +-----------+
         |
     192.168.2.3
         |                 * 192.168.0.3 == wired connection
         |                 * 192.168.1.3 == wifi connection
         |                 * 192.168.2.3 == cellular connection
         |
     ((internet))
Does that look right? (Ignore the specific RFC 1918 IP addresses; I presumed each interface was on a different subnet, and this diagram was intended to represent that.)
 
Old 05-07-2009, 03:21 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
Vague still, but if the only problem is that your SOCKS5 request leaves in the wrong direction, then the routing table should just need some tweaking to change the default route at that point.
 
Old 05-07-2009, 09:12 AM   #8
Vaelek
LQ Newbie
 
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anomie View Post
You're going to have to work with us on this -- I still can't make much sense out of what you are saying.

For starters:

Code:
   +-----------+
   |           |--192.168.0.3---------------((internet))
   |  Linux    |               |   
   |   Box     |             bridge
   |           |               |
   |           |--192.168.1.3--+
   +-----------+
         |
     192.168.2.3
         |                 * 192.168.0.3 == wired connection
         |                 * 192.168.1.3 == wifi connection
         |                 * 192.168.2.3 == cellular connection
         |
     ((internet))
Does that look right? (Ignore the specific RFC 1918 IP addresses; I presumed each interface was on a different subnet, and this diagram was intended to represent that.)
It's more like this, using the same legend:

Code:
 +----------+              +-------+---192.168.0.3-+-----((internet))
 |          |              |  Work |               |
 |  Linux   |              |   PC  |               |
 |   Box    |              +-------+             bridge
 |          |                                      |
 +-----+----+--------------------------192.168.1.3-+
       |
       |
   192.168.2.3
       |
       |
  ((internet))
 
Old 05-07-2009, 02:39 PM   #9
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
OK, (I think) I understand your diagram. You are running foo application on the Work PC, and you need to proxy certain requests from it through the Linux box (so that it leaves the 192.168.2.3 interface to the 'net).

So you need to:
  • Enable the Linux Box to be a gateway (so that after requests from the Work PC have passed through the bridge they can make their way to the 192.168.2.3 interface).
  • Run the proxy daemon and have it listen on the 192.168.2.3 interface.
  • Point foo's application settings on the Work PC to use 192.168.2.3:<port> as its proxy.

Do those steps sound right? If so, where are you falling down?

Last edited by anomie; 05-07-2009 at 02:40 PM.
 
Old 05-07-2009, 09:45 PM   #10
Vaelek
LQ Newbie
 
Registered: May 2009
Posts: 5

Original Poster
Rep: Reputation: 0
My problem was that the proxy was routing requests back out the wifi interface, using srelay. I can't find any docs for that though so I could be missing an option. I am currently trying to use 3proxy. When I use the socks option, I get just a blank page for everything. When I use the http proxy option, I get 502 bad gateway for everything.

another issue i see is that the ip of the cellular connection changes quite frequently. Everything I've tried so far I must specify an external ip, ideally I'd like to specify an interface.
 
Old 05-07-2009, 10:39 PM   #11
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by Vaelek
My problem was that the proxy was routing requests back out the wifi interface, using srelay.
Then you need to set up your Linux Box routing tables such that 192.168.0/24 requests get sent out the wifi interface, and all other traffic gets routed to the cellular network's gateway. (In other words, that will be your default router.)

Quote:
Originally Posted by Vaelek
another issue i see is that the ip of the cellular connection changes quite frequently. Everything I've tried so far I must specify an external ip, ideally I'd like to specify an interface.
In this case, you will likely have to set up the daemon to bind to all interfaces.
 
  


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
Routing web traffic to different IP? jvanv8 Linux - Networking 3 05-07-2009 05:05 AM
routing traffic from one interface to another a550ee Linux - Networking 0 07-08-2007 03:28 PM
routing traffic out different eth#?? cjs500 Linux - Networking 3 07-11-2005 12:59 AM
Routing traffic fuelinjection Linux - Networking 3 04-01-2005 05:51 PM
inbound traffic routing beowulfde Linux - Networking 2 02-20-2005 04:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:00 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
Open Source Consulting | Domain Registration