# How can I block an IP address? are there wildcards?

**URL:** https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299
**Category:** Support
**Created:** [Fevereiro 16, 2015, 9:21pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299 "2015-02-16T21:21:19Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![rodrigofarcas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rodrigofarcas/32/69085_2.png) [@rodrigofarcas](https://meta.discourse.org/u/rodrigofarcas)
#### Post date: [Fevereiro 16, 2015, 9:21pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/1 "2015-02-16T21:21:19Z")

</div>

I can’t see an Admin option to block IP or a range of IPs, is there one?

Thanks!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Fevereiro 16, 2015, 9:24pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/2 "2015-02-16T21:24:47Z")

</div>

Yes, go to Admin, Logs, Screened IPs. either star wildcard or the crazy standard subnet nomenclature will work.

---

<div class="post-metadata">

### Author: ![rodrigofarcas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rodrigofarcas/32/69085_2.png) [@rodrigofarcas](https://meta.discourse.org/u/rodrigofarcas)
#### Post date: [Fevereiro 16, 2015, 9:30pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/3 "2015-02-16T21:30:07Z")

</div>

Thanks!  
so 10.20.30.\* will work?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Fevereiro 16, 2015, 9:32pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/4 "2015-02-16T21:32:39Z")

</div>

> [@rodrigofarcas](#):
>
> Thanks! so 10.20.30.\* will work?

Yes, that is the same as  
10.20.30.0/24

But for  
10.20.\*.\*  
you need to do  
10.20.0.0/16

Look for CIDR masking if you dare

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Fevereiro 16, 2015, 10:28pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/5 "2015-02-16T22:28:04Z")

</div>

10.20.\* should also work as expected.

---

<div class="post-metadata">

### Author: ![strager](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@strager](https://meta.discourse.org/u/strager)
#### Post date: [Fevereiro 17, 2015, 5:57am UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/6 "2015-02-17T05:57:15Z")

</div>

Is there any kind of character limit here? We are going to need to block entire countries by company policy.

---

<div class="post-metadata">

### Author: ![purldator](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@purldator](https://meta.discourse.org/u/purldator)
#### Post date: [Fevereiro 17, 2015, 7:37am UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/7 "2015-02-17T07:37:58Z")

</div>

Have access to root? You can ban entire countries at the kernel level with iptables.

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [Maio 28, 2016, 8:10pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/8 "2016-05-28T20:10:08Z")

</div>

I know it’s a little politically sensitive, but could anyone share a good list of IP address ranges to block for a site that runs just for a local community in the UK? A block list that removes countries like Nigeria, China, Russia etc.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Maio 28, 2016, 10:03pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/9 "2016-05-28T22:03:18Z")

</div>

Are you running akismet?

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [Maio 28, 2016, 10:28pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/10 "2016-05-28T22:28:17Z")

</div>

> [@sam](#):
>
> Are you running akismet?

No, I don’t have akismet set up but I certainly will do if I start getting spammed.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Maio 28, 2016, 10:38pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/11 "2016-05-28T22:38:00Z")

</div>

One moment there… You are not getting spammed and still want to block huge portions of the planet?

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [Maio 28, 2016, 10:59pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/12 "2016-05-28T22:59:11Z")

</div>

> [@sam](#):
>
> still want to block huge portions of the planet

Yes. Perhaps we can discuss political correctness in a different thread? I’m running a forum for people within a small region of South East London. The value to me of protecting against the worst offending spammer nations is far greater than the cost of excluding a tiny number of casual visitors from around the world who might stumble upon my forum.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Maio 28, 2016, 11:09pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/13 "2016-05-28T23:09:55Z")

</div>

IMHO a compromise would be the better approach than an all out preemptive Blacklisting.

Kind of a “extremely harsh manual roll-up”

That is, wait for some SPAM to happen.  
Say it’s IP is “123.123.123.123”

What Discourse does automatically is when more SPAM happens from  
“123.123.123.124”, “123.123.123.125” etc. it Blacklists “123.123.123.0/24”  
That is, all IPs beginning with “123.123.123.\_\_”

As long is your forum’s target audience is only very local, you could do the roll-up yourself.

eg. SPAM happens from “123.123.123.123” you check and find that those using that IP should have no legitimate interest in joining your forum.

You could add “123.123.123.0/24” yourself without waiting for Discourse to do a roll-up.

Take care with this approach. bit masking IPs isn’t exactly the easiest thing to understand and doing it wrong might Blacklist innocents

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [Maio 28, 2016, 11:12pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/14 "2016-05-28T23:12:29Z")

</div>

But… You don’t have a problem now? I don’t see why you need to do anything here?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Maio 28, 2016, 11:13pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/15 "2016-05-28T23:13:12Z")

</div>

It is generally a bad idea to build things speculatively based on imagined problems you might have.

That said I strongly recommend using our Akismet plugin for every Discourse site. Human spammers are a huge and growing problem across the entirety of the Internet. (Akismet is built in to all our hosting plans.)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [Janeiro 25, 2019, 12:10pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/16 "2019-01-25T12:10:37Z")

</div>



---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [Janeiro 25, 2019, 3:43pm UTC](https://meta.discourse.org/t/how-can-i-block-an-ip-address-are-there-wildcards/25299/17 "2019-01-25T15:43:41Z")

</div>


