We have published many articles like How to redirect or block websites using HOSTS file which explain how you can block websites in your computer using the HOSTS file in detail. In the same article we have also mentioned about various ready made MVPS HOSTS files which are designed to block malicious websites in your computer. But now some of the malware use an IP address directly to circumvent getting blocked by such HOSTS files. So if you find that an some program is connecting to an offending IP address on the Internet, how would you block it? Fortunately, Windows Firewall in Windows 7, 8 and 8.1 has made this task very easy.
You can block an IP address or a range of IP addresses in Windows 7, 8 and 8.1 using the following steps:
- Press Win+R hotkey to open the Run dialog. Type wf.msc in the Run dialog and press Enter. This will open Windows Firewall with Advanced Security interface.
- In the Windows Firewall with Advanced Security window, you would find a list of rules in the left side. Outbound rules are used when a program or the operating system itself connect with a remote computer or the internet, for example, when your web browser opens a website. Click on the Outbound Rules in the this list on the left side to select the outbound rules section.
- Click on the New Rule… on the right side of the Windows Firewall window. Alternatively, you can also select Action → New Rule from the menubar. This would open the New Outbound Rule Wizard window.
- In this wizard, the first thing you have to select is the rule type. Select Custom rule from the options and click Next.
- Next you have to choose whether the rule you are creating applies to all programs or to some specific programs. If you are creating a rule for your web browser or email client etc., then select This program path: and type in the full program file path. But in most cases, you would want to block the IP address for all programs and you can choose All programs and click Next.
- In this step, you have select a port or protocol type. If you want to block a malicious IP address, then you would want to block it for all protocols. This is why in this step, you do not have to change any default options – leave the default options untouched, just click Next to continue.
- Here you have to specify the IP address or IP address range that you want to block. Under the remote IP address section, select These IP addresses and click on the Add button. Enter an IP address or IP address range and click OK. You can enter multiple IP addresses or their ranges. Finally click Next to continue.
- You have to select an action which specifies what you want to do with the IP address you specified. Choose Block the connection so that Windows blocks these IP addresses. Click Next to continue.
- Windows Firewall uses different profiles for different types of connections. In this step, select all options (Domain, Private and Public) to make sure the IP address is blocked in all the profiles. Click Next to continue.
- You have to give a name to the new rule. You can type any name you like. For this example, we would use Block DNSChanger Malware for the new rule. You can also type a description of the new rule but it is not necessary. Then click the Finish button to finalize the rule.
- That’s it. You have successfully created a new outbound rule to block some addresses on your computer. You can use the same instructions to block any IP address or IP address range on your computer.