Would you like to learn how to deny access to the IIS server for an IP address? In this tutorial, we will configure the IIS server to block access from a list of IP addresses.

• Windows 2012 R2
• Windows 2016
• Windows 2019

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial IIS - Blocking an IP address

On the server manager, enable the IIS security feature named IP and domain restrictions.

IIS - IP Restriction feature

Start the application named: IIS Manager.

Start IIS Windows

On the IIS Manager application, select your website.

On the right part of the screen, access the option named: IP address and domain restrictions.

IIS - IP address and domain restrictions

On the top right part of the screen, click on the Add deny entry option.

IIS - Deny IP address

To deny access to a single IP address, perform the following configuration:

• SPECIFY THE IP ADDRESS - Yes
• VALUE - Enter the desired IP address.

Click on the OK button.

IIS IP address - Deny access

To deny access to a range of IP addresses, perform the following configuration:

• IP ADDRESS RANGE - Yes
• VALUE - Enter the desired IP  network.
• MASK OR PREFIX - Enter the desired network mask.

Click on the OK button.

IIS IP address network - Deny access

Optionally, use the command-line to restrict access from an IP address.

Copy to Clipboard

In our example, we denied access to a website based on the source IP address.

To test the installation, open the Chrome browser on a remote computer and try to access any page.

In our example, the following URL was entered in the Browser:

• http://192.168.0.10

The system will deny access based on the source IP address of the request.

IIS - Forbiden access

Optionally, you may use the CURL command of a Linux computer to test the header configuration.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Congratulations! You denied access to an IIS website based on the source IP address.