---
title: "How to Filter Emails for an IP Range"
description: "If you need to filter or block multiple IP addresses, it can sometimes be much quicker and more efficient to block an IP range. In this article, we will show you how you can block an entire range of..."
url: https://www.inmotionhosting.com/support/email/how-to-filter-emails-for-an-ip-range/
date: 2016-11-10
modified: 2023-06-12
author: "Christopher Maiorana"
categories: ["Email"]
type: post
lang: en
---

# How to Filter Emails for an IP Range

If you need to filter or block multiple IP addresses, it can sometimes be much quicker and more efficient to block an IP range. In this article, we will show you how you can block an entire range of IPs from sending mail to your email addresses using cPanel and regular expressions.

## What is an IP range?

An IP range is exactly that. It is simply a group of IP addresses between one address and another. For example, many consumer routers will assign IP addresses between 192.168.1.101 and 192.168.1.150. The group of IP addresses between, and including these two addresses, would be an IP range.

1. [![cPanel login screen](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_03.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_03.png)Log into cPanel
2. [![Email filters icon](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_67.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_67.png)Under *Email* choose **Email Filters**
3. 04 [![manage filters link](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_68.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_68.png)For the example email account choose **Manage Filters**
4. 06 [![create a new filter option](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_69.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_69.png)Click **Create a New Filter**
5. 07 [![new filter settings](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_71.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_71.png)Fill in the dropdown fields. For the *From* field, choose **Any header**. For the second dropdown, choose **Matches regex**
6. 08 [![add rule](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_72.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_72.png)Here you will add your rule, which will look similar to this: `^192\.168\.1\.[0-9]{1,3}$`
7. 10 [![Actions dropdown](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_74.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_74.png)Choose an action for this filter. (You will most likely want to Discard the message, but you can also filter it to a folder.)
8. 11 [![blue create button](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_73.png)](/support/images/stories/cpanel/lanternUpdatesMay17/cmPape_73.png)Click **Create**

Well done on completion of this tutorial. You now know how to filter an IP range.
