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 11-03-2009, 08:53 AM   #1
vikram_cvk
Member
 
Registered: Jan 2004
Location: Hyderabad , India
Distribution: RHL 9
Posts: 42

Rep: Reputation: 15
Squid / IPTables configuration: Dynamic IP Address provided by ISP


I have a network with a broadband connection with dynamic ip address(external ip address provided by the ISP). How do I configure the squid proxy as the isp ip addresses is changing everytime we login. Please click on the following link to view our network diagram http://www.dotweb.in/share-both.jpg

What should be the appropriate IPTABLES commands to enable squid.

Following is our squid.conf file
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl purge method PURGE
acl CONNECT method CONNECT
cache_mem 1024 MB
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
acl lan src 192.168.0.1 192.168.2.0/24
http_access allow localhost
http_access allow lan
http_access deny all
http_reply_access allow all
icp_access allow all
visible_hostname myclient.hostname.com
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
coredump_dir /var/spool/squid
 
Old 11-03-2009, 09:57 PM   #2
chappel
LQ Newbie
 
Registered: Jul 2009
Posts: 8

Rep: Reputation: 1
I'm not a Squid expert, but I found this tutorial which may be helpful: http://www.aboutdebian.com/proxy.htm

The pertinent section is a clever bit of piping that grabs the IP address dynamically as squid starts:

EXTIP="`/sbin/ifconfig ppp0 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
(you'll probably want to change the 'ppp0' bit to 'eth0', or whatever your external interface is)

There appears to be an assumption that the IP address only changes on a system restart; if there is a chance of your connection getting logged out and the IP address changing while squid is still running, you may require some additional scripting to detect the change and restart the squid service so the new address can take effect.

I hope this helps.

ch
 
Old 11-06-2009, 09:59 AM   #3
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, PCLinuxOS
Posts: 148

Rep: Reputation: 9
You have not mentioned whether you use squid as browser proxy or transperent. For browser you need not to configure any thing. it will just need to configure browser settings.

For transperent proxy:

#iptables -t nat -I PREROUTING -s <Your network> -p tcp --dport 80 -j REDIRECT --to-port <PROXY PORT>
#iptables -t nat -I POSTROUTING -s <your network> -o ppp0 -j MASQUERADE

I hope this will resolve your problem. Best of Luck
 
  


Reply

Tags
iptables, proxy, squid


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
Question about IPTABLES Configuration / Squid Proxy andy.schmid Linux - Networking 4 10-15-2009 12:14 PM
Do you use the e-mail account provided by your ISP? Mega Man X General 18 01-11-2009 03:40 AM
iptables configuration for squid 2.6 BurhanKhan Linux - Networking 2 06-05-2008 01:22 AM
DNS, Dynamic IP address and and ISP Erik_kron Linux - Networking 4 11-17-2002 12:27 AM
Iptables / Squid Configuration aushtosh Linux - Security 2 04-10-2002 12:57 AM


All times are GMT -5. The time now is 03:20 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration