Block port (SSH) on centos7 with IPTables

Subscribers:
4,970
Published on ● Video Link: https://www.youtube.com/watch?v=ba644iszIDc



Duration: 10:18
3,744 views
10


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 root@192.168.56.105

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




Other Videos By Ambar Hasbiyatmoko


2017-05-12Laravel 5.4 error - Cannot call constructor
2017-04-30Laravel 5.4 problem - Wrong Route (Not Found) on Ubuntu 16.04
2017-04-30Ubuntu 16.04 problem - Could not get lock in folder var lib when trying to install with apt-get
2017-04-28Fix PHP - Ubuntu 16.04 phpinfo shows blank Page (PHP 7.0)
2017-04-28Install Laravel 5.4 on Ubuntu 16.04 (with PHP 7.0) [part1]
2017-04-25Problem installing laravel(Ubuntu) - phpunit/phpunit 57 requires ext dom the requested PHP extension
2017-04-24Android Studio Error - android.os.NetworkOnMainThreadException
2017-04-24Android Studio Error - Cannot resolve symbol 'DefaultHttpClient'
2017-04-23VirtualBox - Connect guest to guest (Ubuntu and Centos7)
2017-04-22PHP tutorial : run C program from PHP on Ubuntu
2017-04-21Block port (SSH) on centos7 with IPTables
2017-04-20Install + Running Phpmyadmin on nginx (Ubuntu 16.04)
2017-04-19Install Arduino IDE on Ubuntu 16.04 from terminal
2017-04-19Tutorial Arduino Dasar - nyalain lampu LED arduino dengan koding
2017-04-19Arduino error (Ubuntu) - avrdude: ser_open(): can't open device "COM1": No such file or directory
2017-04-18Samba Tutorial (Centos 7) - samba share with password
2017-04-16Can't install Arduino (Ubuntu16.04) - xdg mime: file 'lin/cc.arduino.arduinoide.xml' does not exist
2017-04-16Phpmyadmin Tutorial - Create a user and grant privileges only their own databases
2017-04-15Membuat server web sendiri (laptop + ubuntu 16.04) menggunakan ISP firstmedia
2017-04-14Samba (Centos 7) - install and share folder from centos 7 to windows 7
2017-04-13Setting codeigniter in subfolder on nginx (ubuntu 16.04)



Tags:
port
block
iptables
centos7
ssh
ubuntu
linux
terminal
script
ip
connect
unblock
install