Block Ports in IPtables

Blocking Ports in Iptables

In order to block  a single port you can use the following statement :

iptables -A INPUT -p <protocol – udp or tcp>  –dport -j REJECT

In order to block multiple ports , use the following statement :

iptables -A INPUT -p -m multiport –dports port1,port2 -j REJECT