LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Routing all internet traffic through a proxy (https://www.linuxquestions.org/questions/linux-newbie-8/routing-all-internet-traffic-through-a-proxy-607655/)

dnoy 12-18-2007 12:44 PM

Routing all internet traffic through a proxy
 
Can anyone assist me to route all internet traffic trough a specific proxy (192.168.0.1).

Thanks,

acid_kewpie 12-18-2007 01:01 PM

that's not possible. routing is *not* proxying... it just doesn't make sense... if by "internet traffic" you actually mean web http traffic then you could use a transparent proxy redirecting port 80, but that's absolutely not a case of routing through a proxy.

http://www.faqs.org/docs/Linux-mini/...rentProxy.html

dnoy 12-18-2007 01:05 PM

youre right i just want to forward all internet based requests to a proxy since i cant make direct connections to the internet.

dnoy 12-18-2007 01:17 PM

is this the only way to redirect internet traffic to the internet?

AwesomeMachine 12-18-2007 01:48 PM

192.168.0.1 is a private IP that is used by many local area networks. If you're connected to a router, and the address of the router is 192.168.0.1, the router itself should give all the machines connected to it an IP address by DHCP. The router automatically routes traffic to and from the Internet if there is a modem plugged into it, and the Internet connection is active.

dnoy 12-18-2007 02:02 PM

What???? im not talking about a router. i need to redirect all traffic through a proxy. 192.168.0.1 is the address of the proxy

Tinkster 12-18-2007 02:29 PM

I suggest you go to wikipedia and read up on the words router and proxy,
then find out what 192.168.0.1 *really* is, and then come back with a
well-formed and thought-through question ....


Cheers,
Tink

acid_kewpie 12-18-2007 02:33 PM

all traffic != proxy.

dnoy 12-18-2007 03:03 PM

Tink,

Thanks but i dont need the re-education. I simply cannot make a direct connection to the internet and need to use a proxy for all traffic destined to the internet. So, again how do you do this in linux (debain). In my example 192.168.0.1 is the IP address of the proxy.

acid_kewpie 12-18-2007 03:38 PM

So, again you can NOT send "all traffic destined to the internet" through a proxy. that would include, ssh, ntp, imap, smtp, icmp and all sorts of stuff that goes on. I've already given you a reference to setting up a transparent web proxy filter, which will allow http and https traffic to go through a proxy, but you've said nothing whatsoever about your infrastructure, so i've no idea if it's the right thing to do or not. you've not even mentioned Linux at all...

dnoy 12-18-2007 04:06 PM

ok let me try again,

I have a machine that needs to use the internet for getting various things: rss feeds(http), http, https,etc ---mostly web traffic

i am using an app on my linux box called e107 for my web site. This site needs internet access for various things and since i dont have a direct connection nothing works. I also have debain and like to use apt-get. So i would like to pass everything through the proxy (http, ftp, https). I understand that some protocols will not work through the proxy (ssh, snmp, etc). On top of this i would also like to specify a specific user-agent that needs to be used to use the proxy.

Does that make sense?

Tinkster 12-18-2007 05:01 PM

Quote:

Originally Posted by dnoy (Post 2995043)
Tink,

Thanks but i dont need the re-education. I simply cannot make a direct connection to the internet and need to use a proxy for all traffic destined to the internet. So, again how do you do this in linux (debain). In my example 192.168.0.1 is the IP address of the proxy.

I don't know about that ;}

You apparently fail to distinguish between "ALL TRAFFIC" and
"ALL WEB-TRAFFIC", which makes all the difference on this.

The big deal will be whether name-resolution is going to magically
work, and whether that proxy (OS, Software, ... ?) will be happy
to let you through. Also depends on the application you're intending
to use, and whether it's proxy aware or not. If it's just after
a direct route and has no knowledge of proxies, and you're not in
charge of the gateway machine, you're screwed.

Quote:

i am using an app on my linux box called e107 for my web site. This site needs internet access for various things and since i dont have a direct connection nothing works. I also have debain and like to use apt-get. So i would like to pass everything through the proxy (http, ftp, https). I understand that some protocols will not work through the proxy (ssh, snmp, etc). On top of this i would also like to specify a specific user-agent that needs to be used to use the proxy.
User-agent? You can tell a proxy to prompt for a name/password.
What do you mean by user-agent in this context?


Cheers,
Tink

dnoy 12-18-2007 05:16 PM

look up user-agent string. Yes i could reconfigure the proxy but thats not the case. i need to leave the proxy as it is a use a predefined user agent. I think i might just have to tunnel my traffic to another machine that has a direct internet connection. I think that might be the only way to complete this task.


BTW, my DNS works so there is no resolve problem. The proxies also have DNS capabilities.

dnoy 12-24-2007 08:56 AM

Guys, i figured out how to direct all traffic through a proxy. This is probably not the only way but a way that i found useful. This is setting up a proxy setting in your environment variables.

First type env to see your environment. After this is complete you will need to type in export http_proxy=http://192.168.0.1:9021 or whatever ip and port you are using.

If anyone finds other ways please let me know. I would also like to know how to spoof a user agent if anyone knows.

acid_kewpie 12-24-2007 09:03 AM

yet again that is *NOT* all traffic by a long long way.... that is HTTP traffic only.

dnoy 12-24-2007 11:50 AM

acid_kewpie, youre right i just keep writing these posts too fast.

BTW, do you know a way to set the global environment so everything uses this?

So far i have edited the following with no luck:
/etc/profile
/etc/environment

I have an apache server that has rss fees setup and it needs to get those pages (http traffic). I have read other posts with no effective answers on implementing global environments so everyone will use it (www-data).

Again sorry for the all traffic

s3gfault 12-29-2007 08:15 AM

Quote:

Originally Posted by dnoy (Post 3000627)
acid_kewpie, youre right i just keep writing these posts too fast.

BTW, do you know a way to set the global environment so everything uses this?

So far i have edited the following with no luck:
/etc/profile
/etc/environment

I have an apache server that has rss fees setup and it needs to get those pages (http traffic). I have read other posts with no effective answers on implementing global environments so everyone will use it (www-data).

Again sorry for the all traffic

The OS is not proxy aware. Each application must have it's own support for using a proxy. Some applications may be checking your http_proxy enviroment variable, but i don't believe apache will. So even if you execute apache with, say,
Code:

HTTP_PROXY="hostname:port" httpd
command line your rss feeds will still be borked.

Luckily you should be able to load mod_proxy.so and maybe a few other modules (mod_proxy_http.so?) and set up proxy directives in httpd.conf. Check apache's documentation for this.

pgibsonorg 08-29-2011 07:16 AM

Quote:

Originally Posted by Tinkster (Post 2995009)
I suggest you go to wikipedia and read up on the words router and proxy,
then find out what 192.168.0.1 *really* is, and then come back with a
well-formed and thought-through question ....

I think it's very arrogant and annoying the way this question is shot down.
In terms that might be more understood:
I have a computer with 2 NIC's
I have dhcpd and a switch...
I want all traffic passing through this computer to be 'proxified' whether it's via tor, via vpn, or w/e, I want the traffic to not originate from my ISP.
How do I do this transparently with no configuration on the client side?

acid_kewpie 08-29-2011 12:27 PM

Quote:

Originally Posted by pgibsonorg (Post 4456064)
I think it's very arrogant and annoying the way this question is shot down.
In terms that might be more understood:
I have a computer with 2 NIC's
I have dhcpd and a switch...
I want all traffic passing through this computer to be 'proxified' whether it's via tor, via vpn, or w/e, I want the traffic to not originate from my ISP.
How do I do this transparently with no configuration on the client side?

please don't drag up dead threads, it gets very confusing. Please start a new thread for your own queries.

pgibsonorg 09-03-2011 03:03 PM

This post is the first or second hit in google for questions like this so it might be nice to have it answered here rather than in another post...
http://www.google.com/search?q=route...hrough+a+proxy

iobsd 10-11-2014 10:25 PM

Discouraged
 
As a person of authority within the UNIX / linux community, I believe it is moderator responsibility to help those with a lesser understanding of the subject than themselves. I was surprised in reading this form, I found the responses to be more degrading than educational. We need to get over our superiority complex, individual knowledge may vary and not everyone will be as educated as yourself. It is our responsibility as members of the UNIX / linux community to help educate those around us. Such behavior is counter-productive to those who wish to further their understanding.

samarth_math 09-17-2016 07:03 PM

Here's the answer :
 
https://samtinkers.wordpress.com/my-glossary-of-useful-commands/

sudo route add -net <network-address-to-bypass:172.22.0.0> netmask <as per netwok address : 255.255.0.0> gw <router/gateway-address :10.0.0.1> – to edit iptables to let packets addressed to a certain network go through the normal gateway, (useful for VPN where all traffic is routed through an external gateway)

hey, here's an answer. I used to use this in my college time.
Basically the gateway is where you enter the local IP of the thing you wanna direct your traffic to.

If you have a basic knowledge of networks, you'd figure out the first two parts. That's for directing only a part of your traffic through a gateway.

In order to direct ALL the traffic :


sudo route add default gw 192.168.0.1

opsec_ 02-07-2022 01:21 PM

Clarification
 
Quote:

Originally Posted by acid_kewpie (Post 2995078)
So, again you can NOT send "all traffic destined to the internet" through a proxy. that would include, ssh, ntp, imap, smtp, icmp and all sorts of stuff that goes on.

Just want to clarify for anyone stumbling upon this today. The quoted claim is just false. If I cite wikipedia:

Quote:

In computer networking, a proxy server is a server application that acts as an intermediary between a client requesting a resource and the server providing that resource.
hxxps://en.wikipedia.org/wiki/Proxy_server

This means a proxy can be used for *any* traffic you like. What the quoted person (and probably also the thread poster) was likely referring to is an under-category of a proxy: A HTTP(s) or SOCKS Proxy which indeed is only meant for specific HTTP traffic.
I know this post is 15 years old but I could not resist clarifying this, as this is still the first result appearing if someone searches "linux proxy route all traffic".

ondoho 02-08-2022 03:14 AM

Here's something else acid_kewpie wrote - 11 years ago:
Quote:

Originally Posted by acid_kewpie (Post 4456277)
please don't drag up dead threads, it gets very confusing. Please start a new thread for your own queries.

And what's with the hxxps in your post? Why would you obfuscate any link, let alone a wikipedia link?

boughtonp 02-08-2022 11:56 AM

Quote:

Originally Posted by ondoho (Post 6326924)
And what's with the hxxps in your post? Why would you obfuscate any link, let alone a wikipedia link?

Possibly because new users can get moderated if posts contains links.



All times are GMT -5. The time now is 10:23 PM.