IP blocklisting is a common operation in public services. This feature should only be used as the 'last resort' when you have not more resources to deal with the undesired site access. Blocking by IP address may unintentionally block many users.

Modules for Drupal 7

Restrict Login or Role Access by IP Address
This module provides features that allow an IP address (or range of IP addresses) to be allowlisted, which restrict the functionality of users. Currently there are two features implemented: When a user is restricted, that user will not be able to log in outside the defined IP address ranges. When a role is restricted, that role will not be available to users outside the defined IP address ranges.
GoAway
simple light-weight "Ban By IP" module. Designed especially for high-traffic sites which can't (or don't want to) bear the combined load of the Statistics and Tracker modules. The entire purpose of GoAway is to make IP banning as easy as editing a comment.
IP Ranges
Blocklist or allowlist.
Domain IP
Blocklist and allowlist. Works with “Domain access”.
http:BL
This is an implementation of http:BL for Drupal. http:BL can prevent email address harvesters and comment spammers from visiting your site by using a centralized DNS blocklist. It requires a free Project Honey Pot membership. This module provides efficient blocklist lookups and blocks malicious visitors effectively. Support for allowlists and greylists is also included. It is strongly recommended not to use it if you expect visitors from Asia, since the IPv4 numbers are exhausted at the Asia-Pacific Network Information Centre (APNIC) level, so that many public IPs are shared by hundred of computers, and only one of them can compromise the public IP number.

Legacy module

Troll
Troll is not that 'light' as GoAway, and includes also import operations for external blocklists. This is a more rich in features module, allowing permanent or temporarily banning restrictions, and providing the functionality not just by IP, but also using the user as the "ban" start point.

To blocklist domains for email based registrations in Drupal 7 you can use User restrictions module.