LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (http://www.linuxquestions.org/questions/linux-security-4/)
-   -   Debian 6: iptables blocking certain IP ranges on a certain port range (http://www.linuxquestions.org/questions/linux-security-4/debian-6-iptables-blocking-certain-ip-ranges-on-a-certain-port-range-880997/)

templar 05-16-2011 08:40 AM

Debian 6: iptables blocking certain IP ranges on a certain port range
 
Hi, I am currently running Debian 6. I would like to know if there is a way and how i would go about blocking a certain IP range from connecting to my server within a certain port range. Say for example.

i want to block ip range 123.123.123.* from connecting to my server on the ports 33000 - 43000. But, i want to allow them to connect on any other port range, and i want to be able to allow connections from my server to the blocked ip range on those same ports. so, blocking incoming only on the above port range.

using iptables.

troop 05-16-2011 11:23 AM

Code:

-A INPUT -p tcp -m tcp -s 123.123.123.0/24 --dport 33000:43000 -j DROP


All times are GMT -5. The time now is 09:31 PM.