Have you ever been in a situation where you couldn’t access certain websites or online services? 

That’s because they blocked your IP address, either intentionally or as part of a broader security measure.

Want to gain the same control and block IP addresses from your network or devices? 

In this article, we’ll guide you through the step-by-step process of how to block IP address across various devices.

But before that, you should take a look at what exactly is an IP address.

What is An IP Address Exactly?

Every device connected to the internet, from your smartphone to the server hosting your favorite websites, has a unique identifier known as an IP address. 

An IP address is a string of numbers separated by decimal points like this 192.168.123.132. It is used to identify websites, apps, and devices.  

IP addresses play a huge role in facilitating online communication. They make sure that data sent across the internet reaches the correct destination. Much like a postal address does for physical mail.

Now, you might wonder, if everything on the Internet has an IP address comprised of a string of numbers, why don’t I see these numbers while browsing? Good question!

Well, these numerical strings are difficult to remember, given that there are over 1.13 billion websites globally. 

That’s where the Domain Name System (DNS) comes into the picture. DNS acts like a phonebook for the internet. 

It translates different types of IP addresses into human-readable names. For example, the domain name of the Netflix website is “www.netflix.com” but its IP address could be “52.0.131.132”.

Wait, did I say “different types of IP addresses”? Let’s understand that next.

Different Types of IP Addresses

There are two main types of IP addresses: IPv4 and IPv6. IPv4 is the original Internet Protocol introduced in the 1980s. An IPv4 address looks like this: 192.158.1.38.

It uses a 32-bit address scheme, which allows for a total of around 4.3 billion unique addresses. But who knew the internet would take over the world? 

So, due to the expansion of the internet, this range of IP addresses proved insufficient.

To address this limitation, IPv6 was developed, which uses a 128-bit address scheme that expands the range of addresses.

This newer version can support a virtually limitless number of devices. An example of an IPv6 address is 2001:0db8:85a3:0000:0000:8a2e:0370:7334. 

The transition from IPv4 to IPv6 is important as it provides not just more addresses but also improved routing and auto-configuration capabilities.

Now that you understand the basics, it’s time to learn how to block IP addresses.

Here are five ways to block unwanted or malicious IP addresses and carry out your online activities without any hassle:

How To Block IP Address On Router

The best way to prevent IPs from entering your network is to block an IP address from the router level. 

Here’s how you can do it:

1. Access the Admin Control Panel of Your Router

First off, you need to access your wireless router’s admin interface. This is where all network administrators manage settings. 

You can access your router by entering the default IP address, such as 192.168.1.1 or 192.168.0.1, into a web browser. 

To log in, you will need your router’s username and password. You can find this information on the back of your router or in its manual.

2. Open Control Settings

After logging into the admin control panel, find options such as Security, Firewall, or Access Control. These are the options for managing who can access your network.

3. Type in the IP Address You Wish to Block

After entering the access control or security settings, you will find options to restrict or block IP addresses. You may also see this option labeled as “Internet Filtering”, depending on your router. 

Once you find the right option, click on it and enter the IP address(es) you want to block. 

4. Save and Test Your Changes

After following all the previous steps, don’t forget to save your changes. You might have to restart your router to make these changes effective.

However, remember that these steps for how to block IP address on a router can vary depending on the brand and model of your router. 

If these steps do not match your router’s configuration, you should read the router’s manual or check the support website for more precise guidance. 

With that said, let’s take a look at how to block an IP address on Windows.

How to Block IP Addresses on Windows?

To block IP addresses on any version of Windows, you need to access Windows Defender Firewall settings. 

Here is a step-by-step process of doing it:

1. Open Windows Firewall and Enter Advanced Settings

From the Windows start menu, search “Windows Firewall” and click on the “Windows Defender Firewall” option. The Windows Defender Firewall option will appear with a “Globe behind a Wall” icon. 

Once you open Windows Firewall, look for the “Advanced Settings” option and click on it.

Geoplugin's screenshot of Windows Firewall Advanced Settings.

2. Create a New Rule

In Advanced Settings, there will be an option for “Inbound Rules”. Click on it and then click on “New Rule”.

Geoplugin's screenshot of Windows Firewall’s inbound rules

3. Select Rule Type and Specific Protocol

In the new inbound rule wizard, click on “Rule Type”, select “Custom”, and click “Next”. On the next window, click “All Programs” under title “Does this Rule Apply to All Programs or a Specific Program?”.

After that, the system will ask you about the protocol and ports. Just select the “Any” option and click on the “Next” button to move forward.

Geoplugin's screenshot of defining rule type

Geoplugin's screenshot of applying rules

Geoplugin's screenshot of selecting a protocol.

4. Enter the IP Address to Block

Now, on the next window, under the title “Which local IP address does this rule apply to?” select the “These IP addresses” option. Then, click on “Add” to add the desired IP address. 

Once the IP address block opens, choose the “This IP address or subnet” option and enter the IP to block. Then click the “OK” button.

Once you click “OK”, the system will redirect you back to the previous screen. There, you will see the IP address you just entered to block. You can add more IP addresses here by clicking the “Add” button and following the same process. 

After entering all the IP addresses to block, click “Next” to proceed.

Geoplugin's screenshot of adding IP addresses to block

Geoplugin's screenshot of adding IP addresses to block

Geoplugin's screenshot of adding IP addresses to block.

5. Block the Connection and Name Your Rule

On the next window, choose the “Block the Connection” option and click on “Next”. Then, the system will prompt you to choose “When does this rule apply?”. Select all three options: Domain, Private, Public, and click “Next”.

Finally, set a suitable name for this rule and hit “Finish.” 

Geoplugin's screenshot of blocking the connection

Geoplugin's screenshot of selecting types of IP addresses to block.

Geoplugin's screenshot of naming the rule and finishing the IP blocking

Voila! You have successfully blocked an IP address on your Windows. But how to block an IP address on Mac? We are about to find that out.

How to Block an IP Address on Mac?

Just like we created a rule to block IP addresses on Windows, we will do the same on Mac. The only difference is we will create a rule on Mac using the terminal(command prompt) and some lines of code. 

1. Open the Terminal and Enter the First Command

Go ahead and press cmd + shift on your keyboard to open the search box on your Mac. Then type “Terminal” and click on it.

After launching the terminal, type the command: sudo vim /etc/pf.conf. This will ​​open the PacketFilter Configuration file.

Geoplugin's screenshot of Mac’s terminal.

Using the keyword “sudo” means you’re asking for extra security privileges as a superuser. This means the system might ask for your Mac’s password.

2. Enter the IP Address You Want to Block

Now, type in this command, “block drop from any to <IP ADDRESS>”. Instead of “IP ADDRESS”, enter the IP address you want to block. Like this:

block drop from any to 18.159.238.13

If you want to block a range of IP addresses, you should replace “any” with an IP address. Like this:

block drop from 18.159.200.0 to 18.159.238.13

3. Block the IP Address

To run the packet filter, load your new rule, and block the IP address, type this command in the terminal:

pfctl -e -f /etc/pf.conf

This will successfully block your desired IP address. If you want to disable this rule or unblock the IP address, you can do it by running this command:

pfctl -d

How To Block IP Address On iPhone?

If you’re wondering how to block an IP address on your iPhone, sorry to disappoint you but it’s not possible.

Blocking an IP address directly on an iPhone is not supported by iOS. Unlike more complex network environments such as those managed via a router or server where you have control over inbound and outbound traffic, iOS does not provide the ability to block specific IP addresses natively within its settings.

If your goal is to prevent your iPhone from communicating with specific IP addresses, you would need to implement blocks at a different network level, such as through your home router, or by using network management software that allows for such configurations.

However, while you cannot block an IP address directly on an iPhone, you can hide your own IP address. Here’s how to do it:

1. Open “Settings” on your iPhone and scroll down until you see “Safari”.

Geoplugin's screenshot of iPhone’s Safari browser setting to hide IP address.

2. Tap on “Safari” and scroll down to find the “Hide IP Address” option.

Geoplugin's screenshot of iPhone’s Safari browser setting to hide IP address.

3. Select “From Trackers” option.

Geoplugin's screenshot of iPhone’s Safari browser setting to hide IP address.

How To Block IP Address In Google Analytics?

If you filter traffic from certain websites, you can simply block their IP addresses in your Google Analytics account.

Follow these steps:

  1. Log in to your Google Analytics account and go to the “Admin” section
  2. From there, find the “View” column, and click on “Filters”
  3. “Add Filter” > Name your filter
  4. Under “Filter Type”, select “Predefined”, “Exclude” and “Traffic from the IP Addresses”
  5. Then choose “That are equal to” and write the IP address you want to block
  6. Lastly, click on “Save”

Note that these steps won’t work if you are using Google Analytics 4. If you want to learn how to block an IP address in Google Analytics 4, visit this Google Analytics guide.

Until now, we have discussed the ways to block IP addresses of other devices and websites. Now you might be wondering “How can I block my IP address for free?”. This is exactly what the next section is going to be about.

How to Block My IP Address For Free?

Here are three practical ways to block or hide your IP address:

  1. Using a VPN: A Virtual Private Network acts as a secret tunnel for your internet activity. When you use a VPN, it sends your internet traffic through a special route that others can’t see. This makes it look like you’re using the internet from a different place, not your actual location. Using a VPN is one of the easiest ways to hide your IP address. There are several free and paid VPN options that you can try out.
  1. Using Tor Browser: Tor is a dedicated browser that hides your IP address. When you use it, your internet activity goes through several random paths before reaching its destination. This makes it really hard for anyone to trace your steps back to you. 
  1. Using a Proxy Server: Using a proxy server is like sending someone else to do your errands. When you connect to the internet through a proxy server, it’s as if the proxy is browsing, not you. Websites see the proxy’s IP address instead of yours, keeping your real IP address hidden.

Level Up Your User Experience with GeoPlugin!

Knowing how to block IP address of other devices and how to block your IP address is important for improving your network’s security and ensuring your online interactions remain private. 

Whether it’s through adjusting settings on your router, managing configurations on your devices, or using advanced network management tools, the power to control IP access should be in your hands. (Not the other way around.)

Want to take your site’s functionality to the next level? GeoPlugin offers robust, real-time geolocation services that can improve your user experience. 

By integrating our easy-to-use API, you open up a world of possibilities for customized user interactions. Explore what GeoPlugin can do for your website—sign up now and see the difference real precision makes!

author avatar
Mehal Rashid
Mehal is a Computer Science graduate who specializes in writing SEO articles about Tech, AI, and cybersecurity. In his free time, you will find Mehal in a boxing ring or playing snooker.