Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have 2 network connections (eth0 & rausb0) on my linux server. Both are internet facing.
Eth0 has ip address 192.168.0.10 and is a hardwired to a router connected a cable modem.
Rausb0 has ip address 192.168.1.10 and is wirelessly connected to a different router/access point which has internet through a different cable modem.
The routing table has the default gateway as 192.168.0.1, on interface eth0.
I want to run a socks proxy which will accept connections on eth0, and forward them out of rausb0 for the outgoing connections.
I am using the 3proxy socks proxy (http://3proxy.ru) with the following syntax:
socks -ieth0 -erausb0 -p1080
The syntax for -i and -e (via socks --help) is:
-iIP ip address or internal interface (clients are expected to connect)
-eIP ip address or external interface (outgoing connection will have this)
However, socks proxied connections through port 8083 are being forwarded out of eth0.
I expect there to be an iptables rule (perhaps -j SNAT) that would enforce that these outgoing connections use rausb0.
Please note that I only want the SOCKS PROXY to make outgoing connections on rausb0, but the SSH connections need to use the eth0 as the gateway.
The syntax for -i and -e (via socks --help) is:
-iIP ip address or internal interface (clients are expected to connect)
-eIP ip address or external interface (outgoing connection will have this)
However, socks proxied connections through port 8083 are being forwarded out of eth0.
Any ideas?
Tell please, does your proxy send traffic to port 1080, as you asked it to do "-p1080"?
Well, essentially what I want is for the socks proxy to send forwarded connections through a different interface than what the OS finds as the first default gateway in the routing table.
I just want to suggest to look at normal socks proxy, which can send traffic to different GW.
Because problem is - your "proxy" has to use different GW from default. And that should be stated in its configuration file.
Thanks everybody for the replies, I will need to read up on iproute2 marking and rerouting, which I know nothing about and won't have time to research today.
nimnull22: I thought I WAS using a socks proxy (3proxy) that can send traffic to a different gateway. If you know of one that does that, let me know.
You know, I have read through its web site documentation, and did not found anything about routing.
But you have to keep in mind that to establish outgoing connection to internet any program need to specify a GW.
As long as you I suppose have only one GW in your routing table, even if socks sends them to "rausb0", wont go any farther, because interface mask is 255.255.255.0, and "rausb0" knows only about its network, which is 192.168.1.xxx.
From that point you definitely need iprouter2, to at least create two GW system. You can start from here: http://lartc.org/howto/
Second question, how to mark connection which should be routed to another GW. You can't use incoming connection, because they terminate on your sock proxy and sock will start new connection from it self to relay requests. You can mark outgoing socks connection only by destination port, because destination IP and sources port can vary. And here also there is a problem, because socks proxy can connect to any ports and any IP, socks can relay not only http.
So I hope our community will give you suggestion, how to state, that everything what comes out of socks proxy should be routed to another GW. Right now I don't know.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.