Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
@andrewpurkett

This comment has been minimized.

Show comment Hide comment
@andrewpurkett

andrewpurkett May 9, 2014

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.

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.

@hughescr

This comment has been minimized.

Show comment Hide comment
@hughescr

hughescr May 9, 2014

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)

hughescr commented May 9, 2014

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)

@neelchauhan

This comment has been minimized.

Show comment Hide comment
@neelchauhan

neelchauhan May 9, 2014

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

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

@rjonesx

This comment has been minimized.

Show comment Hide comment
@rjonesx

rjonesx May 9, 2014

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

rjonesx commented May 9, 2014

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

@bradchesney79

This comment has been minimized.

Show comment Hide comment
@bradchesney79

bradchesney79 May 9, 2014

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

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

@m1

This comment has been minimized.

Show comment Hide comment
@m1

m1 May 10, 2014

Updated for 2.2. ( @bradchesney79 @rjonesx )

Owner

m1 commented May 10, 2014

Updated for 2.2. ( @bradchesney79 @rjonesx )

@duckydan

This comment has been minimized.

Show comment Hide comment
@duckydan

duckydan May 15, 2014

Done. Thanks.

Done. Thanks.

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