You must do this in the .htaccess file.
First you specify Deny All, then specify a list of IP addresses that should be allowed.
order deny,allow
deny from all
allow from X.X.X.X
allow from X.X.X.X
allow from X.X.X.X
You can enable the following ranges:
allow from 10.0.0.0-10.255.255.255
allow from 10.0-255.0-255.0-255
allow from 10.*.*.*
1.2.3.254, 1.2.3.255, 1.2.4.1, 1.2.4.2, 1.2.4.3 1.2.4.4,
:
allow from 1.2.3.254-1.2.4.4