Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 11-03-2009, 07:53 AM   #1
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

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
acl manager proto cache_object
acl localhost src
acl to_localhost dst
acl purge method PURGE
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
http_access allow localhost
http_access allow lan
http_access deny all
http_reply_access allow all
icp_access allow all
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, 08:57 PM   #2
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:

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.

Old 11-06-2009, 08:59 AM   #3
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, PCLinuxOS
Posts: 153

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


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

All times are GMT -5. The time now is 02:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration