Blocking specified ports with ipchains
In short, ipchains is a
tool in Linux that allows you to administer IP packet filters.
# Blocking specified ports
Let’s say you’re 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.