how to block a port on centos 7 with IPTABLES.
-----------------
in this video i will block SSH port (22) with IPTABLES.
steps :
1) install iptables with :
sudo yum install iptables-services
2) block port :
sudo iptables -I INPUT -p tcp --dport 22 -j REJECT
3) save iptables :
sudo service iptables save
4) try to connect to centos7 with ssh.
sudo ssh [email protected]
and you will see a message :
ssh: connect to host 192.168.56.105 port 22: Connection Refused.
yeah, port 22 is blocked! bingo!
--------------
** to unblock port, type :
sudo iptables -D INPUT 1
sudo service iptables save