OpenWrt Forum Archive

Topic: How to create a proxy server without using 3rd party applications ?

The content of this topic has been archived on 25 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,
I would like to create a proxy server without using 3rd party applications, so how can I accomplish that is it possible to do that via iptables ?
I tried the following rule and it didn't work
iptables -t nat -A PREROUTING -i br-lan -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128
When I go and set proxy IP and port on my laptop the proxy doesn't work
I need internet to work on port 3128 how can I do that ?
Thanks

(Last edited by MikeZak on 31 Aug 2016, 18:29)

If you want to use a proxy in browser, you need to install a proxy application, port forward works only as a dumb port forward, it is not a proxy. Proxy needs a bit of intelligence, because it needs to accepts commands like http connect etc.

I think we need more information about what are you trying to accomplish with this.

eduperez wrote:

I think we need more information about what are you trying to accomplish with this.

I am trying to port forward because I need internet connection on another port

MikeZak wrote:
eduperez wrote:

I think we need more information about what are you trying to accomplish with this.

I am trying to port forward because I need internet connection on another port

Sorry, but I still do not understand what you are trying to do or why...

MikeZak wrote:

Hello,
I would like to create a proxy server without using 3rd party applications, so how can I accomplish that is it possible to do that via iptables ?
I tried the following rule and it didn't work
iptables -t nat -A PREROUTING -i br-lan -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1:3128

It's not possible. iptables are not a http proxy server. You need a http proxy server (in transparent mode) running in 3128 port to make that rule work. OpenWRT support several http proxys easily, like squid.

MikeZak wrote:
eduperez wrote:

I think we need more information about what are you trying to accomplish with this.

I am trying to port forward because I need internet connection on another port

If the problem is that your internet connection block port 80 outgoing connections then you need run the http proxy in a internet server, out of the router. You can't use another port for http internet connections without a external http proxy server.

eduperez wrote:

Sorry, but I still do not understand what you are trying to do or why...

Right, he should rather tell us what he is trying to do.

Thank you all for helping me, I solved my problem by adding a new router and using it as a gateway instead a proxy server

The discussion might have continued from here.