Skip to content

Instantly share code, notes, and snippets.

@m1
Last active September 15, 2023 07:33
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save m1/e5f1f190ba309b500f0a to your computer and use it in GitHub Desktop.
Save m1/e5f1f190ba309b500f0a to your computer and use it in GitHub Desktop.
How to throttle the FCC to dial up modem speeds on your website using Apache.
# How to throttle the FCC to dial up modem speeds on your website using Apache.
# Ported from https://gist.github.com/kyledrake/e6046644115f185f7af0
## The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
##
## Current known FCC address ranges:
## https://news.ycombinator.com/item?id=7716915
##
## Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
## For Apache 2.4.* and above
#
# 1) First, make sure you have Apache 2.4 or above. (In terminal: apache2 -v)
#
# 2) Enable the ratelimit module and reload apache2: sudo a2enmod ratelimit && sudo service apache2 reload
#
# 3) Copy and paste the text below into your site root .htaccess or your site .conf file:
<If "-R '192.133.125.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</If>
<ElseIf "-R '165.135.0.0/16'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
<ElseIf "-R '192.104.54.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
<ElseIf "-R '4.21.126.0/24'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
<ElseIf "-R '65.125.25.64/26'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
<ElseIf "-R '208.23.64.0/25'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 28
</ElseIf>
<ElseIf "-R '2620:0:610::/48'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 56
</ElseIf>
<ElseIf "-R '2600:803:230::/48'">
SetOutputFilter RATE_LIMIT
SetEnv rate-limit 56
</ElseIf>
## For Apache 2.2
#
# 1) First, you need mod_bw (On Ubuntu: sudo apt-get install libapache2-mod-bw)
#
# 2) Enable mod_bw and reload apache2: sudo a2enmod bw && sudo service apache2 reload
#
# 3) Copy and paste the text below into your site .conf file in between the <VirtualHost> tags (You can't do this in .htaccess as it's unsupported by the module)
BandWidthModule On
ForceBandWidthModule On
BandWidth 192.133.125.0/24 28
BandWidth 165.135.0.0/16 28
BandWidth 192.104.54.0/24 28
BandWidth 4.21.126.0/24 28
BandWidth 65.125.25.64/26 28
BandWidth 208.23.64.0/25 28
BandWidth 2620:0:610::/48 28
BandWidth 2600:803:230::/48 28
@neelchauhan
Copy link

THANK YOU SO MUCH! I love you for this! (even though I never met you, but thanks anyways)

@rjonesx
Copy link

rjonesx commented May 9, 2014

any chance for an apache 2.2 version - maybe with mod_security?

@bradchesney79
Copy link

I am, sadly, also a 2.2 user. Sooo close!

@m1
Copy link
Author

m1 commented May 10, 2014

Updated for 2.2. ( @bradchesney79 @rjonesx )

@duckydan
Copy link

Done. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment