Last active
September 24, 2024 14:45
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Per comments on the nginx version, you also want these v6's:
2620:0:610:: - 2620:0:610:FFFF:FFFF:FFFF:FFFF:FFFF (aka 2620:0:610::/48)
2600:803:230:: - 2600:803:230:FFFF:FFFF:FFFF:FFFF:FFFF (aka 2600:803:230::/48)
THANK YOU SO MUCH! I love you for this! (even though I never met you, but thanks anyways)
any chance for an apache 2.2 version - maybe with mod_security?
I am, sadly, also a 2.2 user. Sooo close!
Updated for 2.2. ( @bradchesney79 @rjonesx )
Done. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why 56 instead of 28? Feeling generous? What's the third Ferengi rule of acquisition?
Never spend more for an acquisition than you have to.