Is it possible to deny range like 43.249.64.0-43.249.85.255? Or only by mask like 43.249.64.0/19 which includes up to 43.249.95.255 which makes it not good decision.
Is it possible to deny range of IPs on Nginx
Asked Answered
or you could use multiple ranges? –
Lesotho
I'm really bad with networking so I can't calculate which ranges I need to add to cover one mentioned above. If you could calculate them for me, I would be more than grateful –
Joshi
write out the octets in binary format ,e.g. 43 -> 00101011. that'll make visualizing the masks much easier. –
Lesotho
Would that be 43.249.64.0/20, 43.249.80.0/22 and 43.249.84.0/23? –
Joshi
You can block IP ranges using the CIDR notation. Have a look at the article 'Nginx Block And Deny IP Address OR Network Subnets'
You can use IP range calculators like this one that do the math for you. For example your range '43.249.64.0-43.249.85.255' can be expressed as:
43.249.64.0/20
43.249.80.0/22
43.249.84.0/23
@Flyer yeah I noticed. And the numbers add up - isn't that comforting : ) –
Mastermind
haha, I guess. thanks again. Have no clue why I haven't though of combining ranges myself. –
Joshi
do you put a separate "deny" at the beginning of every line and a ";" at the end, or can you use one "deny", ";" pair for the whole block? –
Iatric
@CraigHicks That's correct. Here's the access module documentation –
Mastermind
© 2022 - 2024 — McMap. All rights reserved.