Can I block an IP address?

An IP address is the numeric label or sequence of numbers that is assigned to a computer or device used on the Internet or a local area network. It is a means of identification and determining the user's address online. When an IP address is blocked, network connections to or from that address are not permitted. An IP address can only be blocked through a firewall that is installed on the computer. Windows users have two options for blocking an IP address: 1) Through the built-in Windows firewall or 2) by using third party software such as Norton Internet Security. If a different firewall is installed on the computer, the steps will be similar to those used for Norton or the built-in firewall to block an IP address.

How to Block an IP Address Using the Windows Firewall

Step 1 – Select “Start” and “Settings” then open the “Control Panel.”

Step 2 – Double click the “Windows Firewall” icon on the subsequently displayed screen.

Step 3 – Choose “Inbound Rules” then click “New Rule.”

Step 4 – Click the “Custom” radio button then click “Next.”

Step 5 – Select “All Programs” then click “Next” twice in a row.

Step 6 – Pick the “These IP Addresses” menu option and click “Add.”

Step 7 – Enter the IP address to be blocked in the subsequently displayed text field, then click “Ok” and “Next” and the IP address will be blocked.

While there are special programs that enable you to block access to specific IP addresses on a computer, the same results are possible by editing the Windows hosts file, present on all Windows computers. The purpose of the hosts file is to map host names to IP addresses. Changing the IP address in the hosts file blocks any outgoing connections to the specified site, enabling you to increase network security or control browsing activity. Connecting to the sites blocked via the hosts file will be impossible, preventing any malicious code or viruses downloading onto your computer or network.

  1. 1.

    Click the Start button and then type "cmd" (without the quotation marks) in the "search programs and files box." Press "Enter" to open the command prompt.

  2. 2.

    Type "nslookup" (without the quotation marks) and then the IP address that you want to block. For example, if the IP address is 99.999.999.99, you would type the following:

    nslookup 99.999.999.99

    Then press "Enter." If you need the IP address of a website, type "ping" (without the quotation marks) followed by the URL of a website. For instance, "ping google.com".

  3. 3.

    Make a note of the website name displayed above the IP address. This is the name of the site associated with the IP address.

  4. 4.

    Open Windows Explorer and navigate to your Windows installation folder, by default on the primary (C:) drive in the "Windows" folder. Open "System32," "drivers" and then the "etc" folder to display the hosts file.

  5. 5.

    Right click the file named "hosts" and select "Copy." Right-click anywhere inside the folder and click "Paste." Click "Continue" to create a file named "hosts - copy" which serves as a backup in case you do anything wrong and need to restore the hosts file.

  6. 6.

    Click Start, then click "All Programs" and select "Accessories" from the list. Right-click "Notepad," select "Run as Administrator" and then click "Yes."

  7. 7.

    Click "File" and then select "Open" from the File menu. Select "All files" from the drop-down menu next to "File name" to display all file types, and then select "hosts." Click "Open" to open the hosts file with administrator privileges, necessary in order to save the file.

  8. 8.

    Scroll to the bottom of the file and, on a new line, type "127.0.0.1" (without the quotation marks.) Leave a space, and then type the name of the website associated with the IP address that you want to block. For example, if the nslookup for the IP address stated that the website is "www.theexamplesite.com," you would enter the following:

    127.0.0.1 www.theexamplesite.com

  9. 9.

    Save and close the hosts file and restart your computer for the changes to take effect. The IP address associated with the blocked site will no longer be accessible.

    Windows Firewall needs to be running on the server. To ensure the Windows Firewall is running, perform the following steps:

    1. Click Start, type control panel, and click Enter.
    2. Click Windows Defender Firewall > Turn Windows Defender Firewall on or off.

    Note: You must have administrative privileges for the server to modify the Windows Firewall.

    Create a Windows Firewall Rule to Block the IP

    1. Log in to the server on which you need to block the IP address.

    2. Click Start, type Windows Firewall with advanced security, and press Enter.

    3. In the left-hand pane, click Inbound Rules to show the currently configured rules in the middle pane.

    4. In the right-hand pane, click Actions >New Rule….

      • For Rule Type, select Custom and click Next.
      • For Program, select All programs and click Next.
      • For Protocol and Ports, select Any from the Protocol Type dropdown and click Next.
      • For Scope:
        • under Which remote IP addresses does this rule apply to?, select the radial option: These IP addresses:.
        • Click Add….
        • Enter the IP address that you want to block from the server and click OK. You can also choose to block a range of IP addresses by selecting the This IP address range: radial option.
    5. After you finish adding the IP addresses, click Next.

    6. For Action, select Block the connection and click Next.

    7. For Profile, leave all options checked and click Next.

    8. For Name, give the rule a descriptive name, such as Blacklisted IPs. You can also enter an optional description of the rule.

    9. Click Finish.

    The newly created rule with the given name now displays in the middle Inbound Rules pane. To order the rules alphabetically by name, you can click on the Name column header.

    If you need to disable the rule, right-click on the rule in the list and click Disable Rule.

    If you need to modify the scope of IP addresses for the rule, right-click the rule in the list and click Properties. Then click the Scope tab, make necessary changes, and click Apply.

    ©2020 Rackspace US, Inc.

    Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

    Can you block someone by IP address?

    IP address blocking can be used to restrict access to or from a particular geographic area, for example, the syndication of content to a specific region through the use of Internet geolocation and blocking.

    How do I block an IP address on a device?

    Change your router's network settings.
    Network Destination: Enter the IP address you wish to block..
    Subnet Mask: Enter 255.255. 255.255..
    Default Gateway: Enter 192.168. 0.1. ... .
    Interface: Select LAN..
    Description: Enter a description for the IP address you are blocking (e.g., Google 1)..

    How do I block an IP address from a website?

    Set Up: Blocking an IP address or a domain name in cPanel.
    Click IP Blocker under Security in cPanel..
    Under Add an IP or Range enter the IP address or range, or domain name. ... .
    When ready, click Add to block that IP address, range or domain name to access your website..