how to block any ip address

How to Block Russian (or Any Other IP Addresses) From Accessing Your Website Using IIS?

Hacking of your website by another country has become more frequent in recent times. Wars do not only mean soldiers killing each other, wars are also being fought online where countries try to hack into the resources of another country. In fact, it is the easiest way to bring a country down. All of our systems are online and on the cloud, from our electricity to our cars, even our identities can get stolen in a matter of seconds.

Just going through this article will provide you with a glimpse of how old and dangerous this method is.

Our objective today is to provide you with the first line of defense. Before jumping into the discussion on how you can do this on your own (or your head of infrastructure/DevOps person could assist in the same), let us understand some additional steps you can add to safeguard your online business website.


Securing Your Website Using Best Practices and Strategies

Nowadays, blocking by IP address alone may no longer suffice as an effective defense strategy, as today’s hackers can employ methods like VPNs to break through these restrictions. But, since enhancing your website’s security is paramount in safeguarding against potential threats, it is still one of the best ways to protect your websites from unwanted IP addresses.

Down the line, we will show a step-by-step instruction for how you can do it for your website. Here are some other ways that provide an additional line of defense to ensure your website is protected from online fraud.


1. Keeping your software updated

You must regularly update your content management system (CMS) and plugins. These updates often include the latest patches to address security vulnerabilities. Our team at Dignitas Digital can help you stay up-to-date with the current software versions so that you can minimize the risk of exploitation by cybercriminals.


2. Utilizing strong passwords and multi-factor authentication (MFA)

Implementing robust password policies and MFA mechanisms adds an extra layer of protection to your website. We encourage you to create complex passwords that combine uppercase and lowercase letters, numbers, and special characters. Additionally, we help you to set up an MFA whenever possible. It provides additional verification beyond just a password. For example, a code is sent to the mobile device, before gaining access.


3. Regularly patching vulnerabilities

To maintain a secured website, you must proactively address the vulnerabilities. For this, you need to stay informed about security advisories and patches released by your CMS or plugin providers. Our team of experts enables you to promptly apply these patches and reduce the risks.

That is what a team of professionals like ours can do for you while trying to protect your site from threats. Now, let us move on to a step-by-step explanation of how you can block IP addresses.


Blocking IP Addresses from Russia on IIS Server: A Step-by-Step Guide

Here we are going to talk about the IIS server and blocking IP addresses from Russia. You can block a range of IP addresses at the hosting level, or/and at the server level. Keep in mind that your page speeds will go down a bit using this as the IP addresses are compared with the existing list.


Step 1

Download this file. This consists of the IP addresses from Russia and the Sub Mask Details.


Step 2

Login to your server, open IIS Manager and check if you have the “Restrict IP Address and Domains” option available in the IIS section of your site.

block ip address 1


Step 3

If the above is not available go to Control Panel -> Turn Windows features on or off -> Select your server-> Server Roles-> Web Server-> Web Server-> Security Enable all options in this.

You will have to restart your server post this.

block ip address 2


Step 4

Open the file that you downloaded in step 1. Copy the first IP address and subnet mask. Go to IIS Manager, open the IP Address and Domain Restrictions. In Actions, click on Add Deny Entry. Add the IP address and the Subnet Mask here, click OK.


Step 5

Step 4 helps in placing the IP address to be denied at the right place in the configuration file and becomes a placeholder for us to add the rest of the IP addresses.

Keeping that in mind, open the configuration file:



Find the section where you added the IP address. On finding that, add all remaining IP addresses to this configuration file. Keep checking your website that it does not go down (if it does, the usual issue is that the IP address is repeated, as config files use keys, there can be only 1 unique key, or there could be an issue with your syntax).

block ip address 3


Step 6

Use any of the available tools online to replicate the traffic from the country you trying to block. You should get a 403 from the server. This response can also be customized if required. We used BrowserStack to test our approach.


Final Words

Following these steps can be your first line of defense against a large-scale attack. Keep in mind that there are various ways in which your website can be hacked and you should follow the best practices while programming, setting up the infrastructure, user settings, database connections, and security ports, and keeping your server up to date to help prevent any unfortunate incident. There are advanced firewalls available in the market, they can be explored if you are an advanced user and have the budget for the same.

Ready to secure your online presence? Reach out to our team today to fortify your website and protect it from potential vulnerabilities!


For more interesting blogs, check out our latest articles here.