We help IT Professionals succeed at work.

configuring Squid and NAT server

narayanamoorthy
on
  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.
Comment
Watch Question

Commented:
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.

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


#!/bin/sh
/sbin/ipchains -F
/sbin/ipchains -P forward DENY

/sbin/ipchains -A input -p TCP -d 127.0.0.1/32 www -j ACCEPT
/sbin/ipchains -A input -p TCP -d 192.168.1.1/32 www -j ACCEPT
/sbin/ipchains -A input -p TCP -d 0/0 www -j REDIRECT 8080
/sbin/ipchains -A forward -s 192.168.1.0/24 -j MASQ

note the abobe address of 192.168.1.0/24 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

Author

Commented:
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.

Moorthy

Commented:
you can use the command

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

whenever you like

Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange

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