LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 06-14-2010, 11:51 PM   #1
asifbasha
Member
 
Registered: Feb 2009
Posts: 98

Rep: Reputation: 15
Iptables with squid


Hai to all

i have the following ip assignments

fedora (iptables)
eth0 -private :192.168.1.1
eth1 -public : 186.117.50.6

squid proxy
192.168.1.10:3128

my clients range

192.168.2.0/24

how can i make my clients to browse internet only from proxy server

my network is NAT 'ed .

Please specify a iptable rule to allow internet access for my clients to browse ONLY if they come through proxy server .
 
Old 06-15-2010, 04:20 AM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,656
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
add something like this to ip tables...
Code:
....................
        #EXT_IF=ppp0 change to household network Apr15-2010
	EXT_IF=eth0
	INT_IF=eth1
	INT_NET=192.168.0.2/24

....................
## --- NAT --- ##
#

	# Enable masquerade

	$IPTABLES -A POSTROUTING -t nat -o $EXT_IF -j MASQUERADE

#
## -- Transparent proxy to Squid --- ##
#

	$IPTABLES -t nat -A PREROUTING -i $INT_IF -p tcp --dport 80 -j REDIRECT --to-port 3128
and make sure the port is the same in /etc/squid/squid.conf...
Code:
# Squid normally listens to port 3128
http_port 192.168.0.2:3128 transparent
#http_port 3128
and add transparent at the end.

in /etc/sysctl.conf,
Code:
net.ipv4.conf.all.forwarding = 1  #hacked
I don't use ipv6 so, I can't comment on that.

A site that has helped me in the past is

http://www.linuxhomenetworking.com/


I set both konqueror (kde4) and firefox to use the local proxy on this machine.

Hope this gives you something to look up.

Cheers Glenn

Last edited by GlennsPref; 06-15-2010 at 04:43 AM. Reason: add transparent to squid
 
  


Reply



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
IPTables + Squid vaibhavs Linux - Newbie 2 05-08-2009 11:14 AM
squid + iptables nomankhn Linux - Networking 0 06-16-2006 02:33 AM
iptables+squid alcor Linux - Networking 1 11-02-2005 05:13 PM
squid + iptables varun_saa Mandriva 10 02-11-2005 09:27 PM
iptables and squid batfink Linux - Networking 3 09-15-2003 02:51 PM

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

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