that will only redirect port 80. what about other port? how to use multi port command with iptables? does that command alone close all ports?
Main Topics
Browse All TopicsHi,
I'm using RHEL3 and wish to convert it into SQUID PROXY box. On top of that, the box will also be a gateway for all clients to access the POP3 (110) and SMTP (25) directly from the net. It will also serves as DHCP server.
I have 2 NIC, eth0 (LAN) and eth1 (Internet) with eth1 having a static internet IP and eth0 having a normal 192.168.0.1.
Now, I don't have any problem with SQUID and the transparent proxy (forwarding 80 to 8080), the problem is i need to forward all internet trafic that can handle by the squid's safe port (default setting) to SQUID. That means, not only port 80, but as well as FTP, https, and others (except for DHCP service, port 110 and port 25).
Nobody from the internet can connect to any services running on the SQUID except Webmin and SSH. Clients will be forced to use SQUID regarding what ports they are connecting to (not only port 80). LO can access anything in and out.
Can you please help me to construct a good IPTABLES based on this requirement?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
> that will only redirect port 80 ..
is there a problem to copy the command and substitute 80 by 110?
> how to use multi port command with iptables?
depends on your version of iptables
I'd use on rule for each port, simple, legacy compatible, easy to understand ...
> does that command alone close all ports?
no
are your asking for a rule set to perfectly close your network?
A simple rule set to "close all ports" is:
iptables -P OUTPUT DROP
iptables -P INPUT DROP
iptables -P FORWARD DROP
but then you probably need some more rule to get your network working again.
Business Accounts
Answer for Membership
by: ahoffmannPosted on 2006-03-10 at 00:42:44ID: 16152833
something like (assuming squid on port 3128):
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128