Title: Custom Pattern &#8211; Multiple IP Ranges
Last modified: May 11, 2020

---

# Custom Pattern – Multiple IP Ranges

 *  Resolved [focct](https://wordpress.org/support/users/focct/)
 * (@focct)
 * [6 years ago](https://wordpress.org/support/topic/custom-pattern-multiple-ip-ranges/)
 * I have a small non-profit and we are using the free version of WordFence. Given
   the large number of hack attempts from countries like China, Russia and others
   I’d like to block the ranges within these countries with the larges distribution
   of IP addresses. Our customer based it very regional in the U.S. so there is 
   no issue will blocking large ranges.
 * Is it possible to create a custom pattern that includes multiple ranges? For 
   example, could I create a rule for 36.96.0.0-36.223.255.255 and 59.192.0.0-60.31.255.255?
   Would a comma (,) or semi-colon (;) work to string multiple IP ranges together?
   If so, how many ranges can I include in a single rule? From a performance perspective
   would it be more efficient if I created a new custom pattern for each range?
 * Thanks!

Viewing 1 replies (of 1 total)

 *  [wfdave](https://wordpress.org/support/users/wfdave/)
 * (@wfdave)
 * [6 years ago](https://wordpress.org/support/topic/custom-pattern-multiple-ip-ranges/#post-12817152)
 * Hi [@focct](https://wordpress.org/support/users/focct/),
 * You can only add one IP range per custom pattern, so if you have multiple ranges,
   you will need to add them one-by-one into Wordfence.
 * Alternatively, you can explore using `.htaccess` to block IP ranges. For example:
 *     ```
       Order Allow,Deny
       Deny from 1.2.3.4/24
       Allow from all
       ```
   
 * The above code would block 1.2.3.0 -> 1.2.3.255.
 * Dave

Viewing 1 replies (of 1 total)

The topic ‘Custom Pattern – Multiple IP Ranges’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

## Tags

 * [IP Range](https://wordpress.org/support/topic-tag/ip-range/)

 * 1 reply
 * 2 participants
 * Last reply from: [wfdave](https://wordpress.org/support/users/wfdave/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/custom-pattern-multiple-ip-ranges/#post-12817152)
 * Status: resolved