12.7. Configuring IP Address and Domain Name Restrictions

Problem

You want to restrict access to content on your web server by IP address or domain name.

Solution

Using a graphical user interface

To restrict access to all sites on your server, do the following:

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, right-click on the Web Sites node and select Properties.

  3. Select the Directory Security tab and click Edit under IP address and domain name restrictions.

  4. Select either Granted access or Denied access depending on whether you want to define a rule to allow or deny access to your server.

  5. Click Add and specify either a single IP address, an entire subnet of addresses, or a DNS domain name depending on how you want to restrict access to your server. Click OK.

  6. If the Inheritance Overrides dialog box appears, click Select All and click OK (repeat if this box appears again).

To restrict access to a particular web site, do the following:

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, expand the Web Sites node, right-click on your web site, and select Properties.

  3. Select the Directory Security tab and click Edit under IP address and domain name restrictions. Follow the same directions as described previously.

To restrict access to a particular virtual directory, do the following:

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, expand the Web Sites node, right-click on a particular virtual directory within your web site and select Properties ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.