Igor Yavych
Igor Yavych

Reputation: 4228

Is it possible to deny range of IPs on Nginx

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.

Upvotes: 12

Views: 26858

Answers (1)

djf
djf

Reputation: 6757

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

Upvotes: 34

Related Questions