Installation of fail2ban
sudo apt-get install fail2ban
Back up the default configuration file and make changes to new.conf
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/kim.conf
sudo nano /etc/fail2ban/kim.conf
Change setting according to your liking
maxretry
= incorrect login attempts before getting banned
Destemail
= to receive ban email notification
MTA
= email program
Enabled
= true or false (turn on services you want fail2ban to monitor)
Apply changes
sudo service fail2ban restart
Verify new changes and take a look at your IP table
sudo fail2ban-client get ssh bantime
sudo iptables -L