LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-17-2009, 06:05 PM   #1
Tuxqi
Member
 
Registered: Apr 2009
Posts: 49

Rep: Reputation: 2
iptables for proxy server


Ok been searching online and all the different pages have basically made me dizzy.

Forgive the crudeness of the drawing but this is how I am planning to set up the network:
http://img232.imageshack.us/img232/995/networkrough.jpg

So would like help on what the correct iptables rules should be to allow internet through the lan on eth0 so it can connect to the proxy\dansguardian\etc and send it on to the router via eth1.


or am I making a mistake on how I am setting this up?
 
Old 04-18-2009, 10:55 AM   #2
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
hi,

no, the scenario is good. you just need an iptables redirection on LAN interface to intercept the browser request to enter the squidguard port.

assuming your squidguard on port 8080 and, eth0 as LAN intf (as root):
#/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

unless you know how to do an interface bridging - i think the most easiest method is to do a double NAT.

so - create another NAT on eth1 :
#/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE.

HTH.
 
Old 04-18-2009, 02:02 PM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Are you planning to setup your proxy as a transparent proxy? then "rossonieri#1" suggestion is ok, if not i think you dont need this prerouting rule
 
Old 04-18-2009, 04:18 PM   #4
Tuxqi
Member
 
Registered: Apr 2009
Posts: 49

Original Poster
Rep: Reputation: 2
Thanks for the replys, I will have to try this later when got some other things sorted.


Altough it all seems a bit to simple. I can mend PCs fine.. but networking is an area I'm not very knowledgeable at. Is there anything I am forgetting or don't know that I need to do to get this set up to work? Or is all I need the two iptable rules on the proxy server?
 
Old 04-19-2009, 01:25 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
You *need* very little on the proxy server. If you wish, you can add filtering rules. I have one small quibble with rossonieri#1's post. When your IP addresses are stable (as your's appear to be -- contrasted with, for example, dialup) I believe it would be preferred to use SNAT instead of MASQUERADE. Although MASQUERADE will work, albeit less optimally. (See iptables' man page or the NAT-HOWTO.)

Last edited by blackhole54; 04-19-2009 at 01:27 AM.
 
  


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
Multiple ip proxy server iptables. SuperJohnSmith Linux - Networking 10 11-22-2010 06:12 AM
Proxy and Client talk, proxy isn't returning/retrieving requests (iptables problem?) mjhvg Linux - Newbie 0 03-12-2009 02:15 AM
iptables rule to ignore squid proxy server satish Linux - Networking 4 07-02-2008 07:26 AM
how can I force port 80 to a proxy server using iptables scheney Linux - Security 1 10-21-2005 01:25 PM
Iptables Firewall & Proxy Server chrisfirestar Linux - Security 22 12-22-2003 09:30 AM

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

All times are GMT -5. The time now is 08:30 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