We help IT Professionals succeed at work.

configuring Squid and NAT server

  I am planned to use a SQUID and NAT in the same machine.  I think we need iptables for Transparent Proxy.
i planned to write two seperate scripts for SQUID and NAT configuration. My idea is to turn squid on whenever i need and also for NAT. can someone give the detail idea of it.
Watch Question

Hmm...no technical objections. However mostly nat and squid serve different purposes.

You can use nat to manage tcp/ip-traffic on udp/icmp/tcp-level (transparent proxying, port forwarding, ip packetfiltering, load balancing).

squid gives you more options on the application level (e.g. who can when access what on the net, caching proxying in order to enhance internet access).

You could use nat in order to make an ip-packet filtering firewall and use squid on the same box in order to regulate internet access and log all traffic.

Please give us some more info on what you want to achieve, so we can give you more detailed info.

you have to put he following in one script and call it at boot ti,e ex. rc.local

/sbin/ipchains -F
/sbin/ipchains -P forward DENY

/sbin/ipchains -A input -p TCP -d www -j ACCEPT
/sbin/ipchains -A input -p TCP -d www -j ACCEPT
/sbin/ipchains -A input -p TCP -d 0/0 www -j REDIRECT 8080
/sbin/ipchains -A forward -s -j MASQ

note the abobe address of can be changed to suit your needs

in squid.conf search and change the following lines

httpd_port 8080
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on


kathotia was right.  But i need the start and stop script for both NAT and SQUID.
   My need to start and stop the SQUID whenever i need without affecting NAT.


you can use the command

'service squid stop'  to stop
'service squid start' to start

whenever you like

Force Accepted

Community Support Moderator @Experts Exchange

Explore More ContentExplore courses, solutions, and other research materials related to this topic.