Tuesday, January 25, 2022

Blocking specified ports with ipchains

 # Blocking specified ports with ipchains  
# Written by: Redbox [redbox@vitalsecurity.net]
# June 26, 2001
# http://www.vitalsecurity.net


In short, ipchains is a tool in Linux that allows you to administer IP packet
filters.

# Blocking specified ports

Lets say your running a service, but instead of shutting it down, you just
want to filter out the port and block connections to it.  This is made simple
with ipchains:

/sbin/ipchains -A input -j REJECT -p tcp -s 0.0.0.0/0 -d 0.0.0.0/0 21

This tells ipchains to REJECT tcp connections from any IP on port 21.  You'll
notice that the port number is at the very end of the line.  If you wanted to
block out a different service or port, simply replace the number 21 with the
new port.



Copyright (C) Vital Security.  All Rights Reserved.

> mail: redbox@vitalsecurity.net
> irc: irc.vitalsecurity.net