iptables rule to deny all ports except the ones allowed
sudo iptables -A INPUT -p tcp -m tcp -m multiport ! --dports 80,443,22 -j DROP
sudo iptables -A INPUT -p tcp -m tcp -m multiport ! --dports 80,443,22 -j DROP
Please leave a Comment