iptables question.


 
Thread Tools Search this Thread
Special Forums Cybersecurity iptables question.
# 1  
Old 12-03-2012
iptables question.

I am setting up a new squid daemon to run on my server. I want to make sure that everyone inside my network can access squid but I want to make sure everyone on the internet is blocked.

Code:
eth0 is connected to my internal LAN via: 192.168.0.5/255.255.255.0
eth1 is connected to the internet via: 1.1.1.1/255.255.255.248

Squid listens on port 3124

So far I have the following script for my iptables.

Code:
iptables -F
iptables -t nat -F
iptables -X
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -p tcp --dport 3124 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Is this correct? Will this allow all my LAN users access to squid while blocking outward attempts from the net to my server?

Thanks in advance!

-Ash

Last edited by Scott; 01-28-2013 at 05:51 PM.. Reason: Code tags
# 2  
Old 01-28-2013
You should insert another rule to block incoming traffic from the internet to port 3124 above
Code:
iptables -A INPUT -p tcp --dport 3124 -j ACCEPT

eg:

Code:
iptables -A INPUT -i eth0 -p tcp --dport 3124 -j DROP
iptables -A INPUT -p tcp --dport 3124 -j ACCEPT


Last edited by Scott; 01-28-2013 at 05:51 PM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Multi-table iptables Question

I have a question regarding IPTables packet flow, that I am hoping I can get an answer to. We have a fairly advanced implementation of IPTables that I am trying to convert into a third party product and I am not quite certain on the packet flow in the current IPTables implementation. We are... (2 Replies)
Discussion started by: knightfirefx
2 Replies

2. IP Networking

iptables question

I have two programs, a datagram socket based sender and a datagram socket based receiver. The sender emits a short UDP message to 192.168.0.100:33333 every second. The receiver creates a datagram socket with a default port number (let's say it is 44444), clears the iptables adds the following rule:... (4 Replies)
Discussion started by: michaelrusse
4 Replies

3. UNIX for Dummies Questions & Answers

help with iptables

Hi, On the IPTABLES, I did iptables --flush. I want to start fresh. Now I only want two things. Allow one ip address to this server. Allow port 443 as incoming from every where. Please advice how to do this. This is what I did so for. iptables -I INPUT -i eth0 -s 1.2.3.4 -j ACCEPT... (5 Replies)
Discussion started by: samnyc
5 Replies

4. IP Networking

IPTables question

Hope someone can help cus m really stuck. Im pretty good at making basic IPTables rules to get what i need done, but this one has me beat. I have only 1 Nic in my linux box , and its setup as a trunk to my switch. I have 5 vlans setup on it: eth0.1000 eth0.1001 eth0.1002 eth0.1003... (0 Replies)
Discussion started by: UKShark
0 Replies

5. IP Networking

Iptables

What should be the iptables rule so that only the subnet 64.61.11.224/255.255.255.248 may access the mysql port 3306 (1 Reply)
Discussion started by: proactiveaditya
1 Replies

6. IP Networking

Need help with iptables

Trying to create a whitelist to limit bandwidth. My sync speed is 1536/256 kbps. Simple rules in order: 1. Do not limit (or set to 1536/256) MAC 00:00:00:00:00 (computer is in 192.168.1.0/24). 2. Do not limit (or set to 1536/256) MAC 00:00:00:00:01 (computer is in 192.168.1.0/24). 3. Do not... (1 Reply)
Discussion started by: kripz
1 Replies

7. Linux

iptables question need help

Description i used iptables firewall is a month,running is favorable.it is failed when i connecting to my server on time.the servers' web service and all ports did not connect.i remote login the other server and through intranet address login this server then i restart iptables .but through... (0 Replies)
Discussion started by: proceed
0 Replies

8. IP Networking

IPtables

Hey guys, I have just started using IP tables and was wondering if anyone could direct me to any good online resources as I am totally new to this. Thanks. (1 Reply)
Discussion started by: 182x
1 Replies
Login or Register to Ask a Question