Here is simple way to ratelimit while IP ranges with Nginx.
In HTTP block, create map with limit zones
geo $is_limited {
default 0;
123.123.0.0/10 1;
}
map $is_limited $limit_key {
0 "";
1 $binary_remote_addr;
}
limit_req_zone $limit_key zone=req_limit_zone:10m rate=3r/s;
limit_req_status 429;
Now add this to your server block to limit requests:
...
location / {
limit_req zone=req_limit_zone burst=10 nodelay;
...