LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to redirect http port 80 from slackware gateway to redhat proxy (https://www.linuxquestions.org/questions/linux-networking-3/how-to-redirect-http-port-80-from-slackware-gateway-to-redhat-proxy-455057/)

cmarasescu 06-15-2006 10:29 AM

How to redirect http port 80 from slackware gateway to redhat proxy
 
I have a small network (around 25 computers), that is connected to Internet through a gateway that is implemented on a Linux Slackware 10.
I wannt to use a proxy for limiting Internet access. So I bought a new computer on wich I wannt to install a Linux RedHat 9.0, and to use on it squid.
Is this possible? And how?

win32sux 06-16-2006 09:26 PM

yes, you can do it... here's one way:
Code:

iptables -t nat -A PREROUTING -i $LAN_IFACE -p TCP --dport 3128 \
-j DNAT --to-destination $REDHAT_BOX_IP

wait, i just re-read the thread's title...

are you asking about a transparent setup??

if so, then it would probably look *somewhat* like this:
Code:

iptables -P FORWARD DROP

iptables -t nat -A PREROUTING -i $LAN_IFACE -s ! $REDHAT_BOX_IP \
-p TCP --dport 80 -j DNAT --to-destination $REDHAT_BOX_IP:3128

iptables -t nat -A POSTROUTING -o $LAN_IFACE -d $REDHAT_BOX_IP \
-j SNAT --to-source $SLACKWARE_BOX_IP

iptables -A FORWARD -p TCP -i $LAN_IFACE -o $LAN_IFACE -s $LAN_NET \
--dport 3128 -d $REDHAT_BOX_IP -j ACCEPT

echo "1" > /proc/sys/net/ipv4/ip_forward

with lines like this in your squid.conf:
Code:

httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on



All times are GMT -5. The time now is 02:59 AM.