Networking Forums

Networking Forums > Computer Networking > Linux Networking > Proxy and iptables

Reply
Thread Tools Display Modes

Proxy and iptables

 
 
Francesc Llop
Guest
Posts: n/a

 
      11-20-2003, 09:29 AM
I'am having problems using squid and iptables.

I use squid proxy on a debian linux server.
This server is the gateway for my intranet.
I also use iptables to set up port forwarding like this:

iptables -t nat -A PREROUTING -p tcp -d $local_ip --dport 5901 -j DNAT --to
$mywebserver_ip:4662

iptables -t nat -A POSTROUTING -p tcp -d $mywebserver_ip:80 -s 0/0 --dport
5901 -j SNAT --to $local_ip

From other linux workstation i use a web browser.
if i want go to http://myproxyserver:5901 it only works if i don't use the
proxy configuration of my browser . Otherwise if i configure my web browser
to use a proxy the proxy server returns a Connection Failed error.

Anyone knows how can i resolve this.


thanks
FLL.


 
Reply With Quote
 
 
 
 
Erik Saarts
Guest
Posts: n/a

 
      04-21-2004, 07:57 AM
Francesc Llop wrote:
> I'am having problems using squid and iptables.
>
> I use squid proxy on a debian linux server.
> This server is the gateway for my intranet.
> I also use iptables to set up port forwarding like this:
>
> iptables -t nat -A PREROUTING -p tcp -d $local_ip --dport 5901 -j DNAT --to
> $mywebserver_ip:4662
>
> iptables -t nat -A POSTROUTING -p tcp -d $mywebserver_ip:80 -s 0/0 --dport
> 5901 -j SNAT --to $local_ip
>
> From other linux workstation i use a web browser.
> if i want go to http://myproxyserver:5901 it only works if i don't use the
> proxy configuration of my browser . Otherwise if i configure my web browser
> to use a proxy the proxy server returns a Connection Failed error.
>
> Anyone knows how can i resolve this.
>
>
> thanks
> FLL.


Hello,

PREROUTING chain is NOT used for locally generated packets (ie, for
squid ones). You need to add similar rule for OUTPUT chain, something
like this:

iptables -A OUTPUT -t nat --dst $local_ip -p tcp --dport 80 -j DNAT --to
$mywebserver_ip:4662

If iptables gives you "Invalid argument on such rule", you need either
newer version of iptables or some option to be compiled in kernel
(for example 2.6 serie kernels have that "NAT of local connections"
option).

Hope this helps,
Erik

 
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables proxy on a single interface Monterey IT Guy Linux Networking 0 02-08-2007 10:16 PM
iptables, proxy ftp via frox jacob.saxberg@gmail.com Linux Networking 0 04-06-2006 01:20 PM
iptables proxy two ips for one host Fritz Bayer Linux Networking 2 07-12-2004 06:50 AM
IPTABLES, router, and proxy server... Edward Cho [387036] Linux Networking 0 06-24-2004 02:57 AM
iptables transparent proxy Cameron Kerr Linux Networking 7 06-14-2004 08:57 AM



1 2 3 4 5 6 7 8 9 10 11