This uses a .htaccess file which can be used to control some aspects of how your website runs.
Create a blank file on your computer and name it .htaccess and put the following lines into it (changing the IPs to suit your needs, each command on one line):
deny from 188.8.131.52
deny from 123.12.3.
allow from all
You can deny access based upon a single IP address or an entire range of IP addresses. The above example blocks access to the site from the IP address184.108.40.206, and from any IP address under the IP range123.12.3. (220.127.116.11, 18.104.22.168, 22.214.171.124, etc.)
You can also use deny from all (instead of allow from all) which will deny everyone. You can also allow or deny by a specific domain name instead of an IP address if you wish.
Just place this .htaccess file into your webroot folder (i.e. the folder you have all your website files located in). If there is a .htaccess file in this folder then just add the lines you need to this file (some php applications create .htaccess files). Please note that you can not and should not modify the .htaccess file directly in the webspace folder.