Cartoon of Author

@zackeryfretty

Block Public BitTorrent Traffic on your server using hosts.

ūüóď

Plenty of reasons you'd want to do this! While BitTorrent is a wonderfully amazing tool, it can also cause a ton of headaches--especially from public trackers. Public trackers tend to suck because they have a tendency to do two things when you are sharing files to them:

  1. Expose your IP address, which is attached to your name, to giant media providers who are probably trying to pin some sort of silly copyright infringement on you.
  2. Use boatloads of bandwidth, which can lead to crazy bills or a heavily throttled server--depending on your provider.

So as you can see, really, there is no reason why you'd want anyone to be able to host files tracked by public trackers on a server. Be it you are an individual hosting a torrent server (aka seedbox) or a server admin working for a company chances are avoiding legal trouble, having your server shut down and/or throttled heavily are something you share in common--so really this tutorial should help a wide range of visitors!

Thankfully the beauty of public trackers is, well, they are public! So we are easily able to build a list of all the major trackers out there and compile them into a simple hosts file that will make it so when someone attempts to connect to a public tracker, say, thepiratebay.org they'll be redirected to 127.0.0.1. What this means is that even if the users may find a way to run a torrent client on their slice of the server whenever they try to add a file from a public tracker listed in our hosts file they'll be redirected to "localhost", so rather than successfully finding peers to interact with the client will never actually communicate with the server and therefore no data will ever be exchanged!

Please note that this hosts file I'm about to share with you doesn't block private trackers, private trackers are really not that big of a deal and it would be impossible to block all of them. Chances are if you are hosting your own torrent server, you are using it with private trackers, chances are if you are a server admin you won't experience that much bandwidth usage from a private tracker--they are usually much more competitive to share on. Plus legal issues are not big of a deal in private sites like they are with public--so rather than trying to pretend that I know all of the private tracker domains in the world I'll just say don't worry about it.

Alright now to get started, it's pretty simple, first thing you'll want to do is ssh into your server.

ssh [email protected]

Once you are at the command line and successfully logged in you'll want to run the following command:

sudo nano /etc/hosts

When you are inside of your hosts file you will see 5-10 lines of preexisiting rules. If you don't want your day to be ruined don't touch these. Use the arrow keys on your keyboard to go to the very bottom line, make a few spaces for good measure, and then paste in the following list:

127.0.0.1 10.rarbg.com 127.0.0.1 11.rarbg.com 127.0.0.1 2006.sxsw.com 127.0.0.1 2007.sxsw.com 127.0.0.1 209.50.48.13 127.0.0.1 80.190.151.40 127.0.0.1 9.rarbg.com 127.0.0.1 94.75.205.147 127.0.0.1 a.scarywater.net 127.0.0.1 alanb.yi.org 127.0.0.1 all4nothin.net 127.0.0.1 anifans.ath.cx 127.0.0.1 animex.com 127.0.0.1 anstracker.no-ip.org 127.0.0.1 anstracker2.no-ip.org 127.0.0.1 anvilofsound.com 127.0.0.1 baka-updates.com 127.0.0.1 bakabt.com 127.0.0.1 bangladeshrocks.com 127.0.0.1 beta.legaltorrents.com 127.0.0.1 bittorrent.frozen-layer.net 127.0.0.1 borft.student.utwente.nl 127.0.0.1 bt-flux.com 127.0.0.1 bt.base0.net 127.0.0.1 bt.cartoonpalace.net 127.0.0.1 bt.eastgame.net 127.0.0.1 bt.edwardk.info 127.0.0.1 bt.emuparadise.org 127.0.0.1 bt.etree.org 127.0.0.1 bt.fansub-irc.org 127.0.0.1 bt.ktxp.com 127.0.0.1 bt.peerseed.com 127.0.0.1 bt.shinsen-subs.org 127.0.0.1 bt.speedsubs.org 127.0.0.1 bt.the9.com 127.0.0.1 bt.tjgame.enorth.com.cn 127.0.0.1 bt.ydy.com 127.0.0.1 btcomic.net 127.0.0.1 btjunkie.org 127.0.0.1 bttracker.acc.umu.se 127.0.0.1 colombo-bt.org 127.0.0.1 core-tracker.depthstrike.com 127.0.0.1 cotapers.org 127.0.0.1 coursetorrent.stanford.edu 127.0.0.1 crimsondays.com 127.0.0.1 csclub.uwaterloo.ca 127.0.0.1 dak180.dynalias.com 127.0.0.1 dattebayobrasil.com 127.0.0.1 deadacated.com 127.0.0.1 denis.stalker.h3q.com 127.0.0.1 dimeadozen.org 127.0.0.1 dnbtracker.org 127.0.0.1 doctortorrent.com 127.0.0.1 egelteek.no-ip.org 127.0.0.1 elsewhere.org 127.0.0.1 en.opensuse.org 127.0.0.1 euph.eu 127.0.0.1 ewheel.democracynow.org 127.0.0.1 exe64.com 127.0.0.1 exodus.1337x.org 127.0.0.1 extratorrent.com 127.0.0.1 extremebits.se 127.0.0.1 extremenova.org 127.0.0.1 eztv.tracker.prq.to 127.0.0.1 f.scarywater.net 127.0.0.1 fenopy.com 127.0.0.1 foobar2000.org 127.0.0.1 footage.stealthisfilm.com 127.0.0.1 gdbt.3322.org 127.0.0.1 h33t.com 127.0.0.1 handfilms.com 127.0.0.1 harryy.us 127.0.0.1 hd-dream.net 127.0.0.1 hewgill.com 127.0.0.1 hexagon.cc 127.0.0.1 hits4.us 127.0.0.1 hypaculture.com 127.0.0.1 indytorrents.org 127.0.0.1 inferno.demonoid.com 127.0.0.1 insanity.in 127.0.0.1 irrenhaus.dyndns.dk 127.0.0.1 islamictorrents.net 127.0.0.1 isohunt.com 127.0.0.1 itpb.tracker.prq.to 127.0.0.1 jem.d-addicts.com 127.0.0.1 jem.d-addicts.net 127.0.0.1 kaa.animeconnection.net 127.0.0.1 kaoz-subs.de 127.0.0.1 linuxtracker.org 127.0.0.1 livetorrents.com 127.0.0.1 mass-torrent.com 127.0.0.1 mightynova.com 127.0.0.1 monova.org 127.0.0.1 mozilla.isohunt.com 127.0.0.1 mrtwig.net 127.0.0.1 music-video-torrents.afz.biz 127.0.0.1 mw.igg.com 127.0.0.1 nanikano.no-ip.org 127.0.0.1 nemesis.1337x.org 127.0.0.1 newvoyages.us 127.0.0.1 nova9.org 127.0.0.1 nrkbeta.no 127.0.0.1 nxtgn.org 127.0.0.1 nyaatorrent.info 127.0.0.1 nyaatorrent.org 127.0.0.1 nyaatorrents.info 127.0.0.1 nyaatorrents.org 127.0.0.1 onebigtorrent.org 127.0.0.1 os.us.to 127.0.0.1 ostorr.org 127.0.0.1 p2p.lineage2.com.cn 127.0.0.1 petrochemical-services.com 127.0.0.1 photodiode.mine.nu 127.0.0.1 pj.sidewalkcrusaders.com 127.0.0.1 pleasuredome.org.uk 127.0.0.1 podtropolis.com 127.0.0.1 publicbt.com 127.0.0.1 publiclibrary.metamute.org 127.0.0.1 quetooter-torrents.kicks-ass.net 127.0.0.1 radioarchive.cc 127.0.0.1 randomnothings.com 127.0.0.1 rbgi.net 127.0.0.1 rebootedc.no-ip.org 127.0.0.1 redsphereglobal.com 127.0.0.1 revision3.com 127.0.0.1 rockbox.psychocydd.co.uk 127.0.0.1 rocketredrockers.net 127.0.0.1 saiei.edwardk.info 127.0.0.1 seedler.org 127.0.0.1 seedpeer.com 127.0.0.1 server2.deadacated.com 127.0.0.1 shadowshq.yi.org 127.0.0.1 share.dmhy.org 127.0.0.1 sharereactor.com 127.0.0.1 sharetv.org 127.0.0.1 snowy.arsc.alaska.edu 127.0.0.1 sombarato.org 127.0.0.1 suprnova.org 127.0.0.1 team-mkv.homedns.org 127.0.0.1 thepiratebay.org 127.0.0.1 thewirdsdomain.com 127.0.0.1 tk.btcomic.net 127.0.0.1 tk.comican.com 127.0.0.1 tlm-project.org 127.0.0.1 tntvillage.org 127.0.0.1 tog.net 127.0.0.1 tokyotosho.com 127.0.0.1 top.igg.com 127.0.0.1 torrent-download.to 127.0.0.1 torrent-downloads.to 127.0.0.1 torrent.fedoraproject.org 127.0.0.1 torrent.ibiblio.org 127.0.0.1 torrent.ipnm.ru 127.0.0.1 torrent.mandriva.com 127.0.0.1 torrent.ubuntu.com 127.0.0.1 torrent.unix-ag.uni-kl.de 127.0.0.1 torrentat.org 127.0.0.1 torrentbytes.net 127.0.0.1 torrentchannel.com 127.0.0.1 torrentday.com 127.0.0.1 torrentleech.org 127.0.0.1 torrentraider.com 127.0.0.1 torrentreactor.net 127.0.0.1 torrentriot.net 127.0.0.1 torrents.freebsd.org 127.0.0.1 torrents.gentoo.org 127.0.0.1 torrents.jamendo.com 127.0.0.1 torrents.red.com 127.0.0.1 torrents.vugames.com 127.0.0.1 torrentsforall.net 127.0.0.1 torrentspy.com 127.0.0.1 torrentzilla.org 127.0.0.1 torrentzone.net 127.0.0.1 tracker.anime-4ever.org 127.0.0.1 tracker.anime-kraze.org 127.0.0.1 tracker.anirena.com 127.0.0.1 tracker.bitreactor.to 127.0.0.1 tracker.bootytorrents.com 127.0.0.1 tracker.denness.net 127.0.0.1 tracker.exdesi.com 127.0.0.1 tracker.frozen-layer.net 127.0.0.1 tracker.gits-fans.com 127.0.0.1 tracker.gotwoot.net 127.0.0.1 tracker.ilibr.org 127.0.0.1 tracker.ilovetorrents.com 127.0.0.1 tracker.istole.it 127.0.0.1 tracker.mariposahd.tv 127.0.0.1 tracker.minglong.org 127.0.0.1 tracker.openbittorrent.com 127.0.0.1 tracker.real-3d-games.com 127.0.0.1 tracker.seeding.it 127.0.0.1 tracker.tahise.info 127.0.0.1 tracker.tlm-project.org 127.0.0.1 tracker.to 127.0.0.1 tracker.token.ro 127.0.0.1 tracker.torrent.to 127.0.0.1 tracker.torrent411.com 127.0.0.1 tracker.torrentbay.to 127.0.0.1 tracker.torrentbox.com 127.0.0.1 tracker.torrentleech.org 127.0.0.1 tracker.torrenty.org 127.0.0.1 tracker.zaerc.com 127.0.0.1 tracker1.comicpirates.info 127.0.0.1 tracker1.finalgear.com 127.0.0.1 tracker1.torrentum.pl 127.0.0.1 tracker1.transamrit.net 127.0.0.1 tracker2.comicpirates.info 127.0.0.1 tracker2.finalgear.com 127.0.0.1 tracker2.torrentum.pl 127.0.0.1 tracker3.comicpirates.info 127.0.0.1 tracker3.finalgear.com 127.0.0.1 tracker4.finalgear.com 127.0.0.1 tracker5.zcultfm.com 127.0.0.1 trackerb.zcultfm.com 127.0.0.1 trackers.transamrit.net 127.0.0.1 transamrit.net 127.0.0.1 tvrss.net 127.0.0.1 ushiai.no-ip.org 127.0.0.1 usotsuki.info 127.0.0.1 weebl00.nl 127.0.0.1 weedy.1.vg 127.0.0.1 wiesneronline.net 127.0.0.1 wrentype.hoshinet.org 127.0.0.1 www.2torrent.com 127.0.0.1 www.ahashare.com 127.0.0.1 www.allotracker.com 127.0.0.1 www.animeindex.net 127.0.0.1 www.animesuki.com 127.0.0.1 www.bitenova.nl 127.0.0.1 www.bitsoup.org 127.0.0.1 www.bittorrent.am 127.0.0.1 www.bittorrent.com 127.0.0.1 www.bittorrentshare.com 127.0.0.1 www.bt-chat.com 127.0.0.1 www.btmon.com 127.0.0.1 www.btscene.com 127.0.0.1 www.btswarm.org 127.0.0.1 www.chinadocumentaries.com 127.0.0.1 www.chomskytorrents.org 127.0.0.1 www.d-addicts.com 127.0.0.1 www.datorrents.com 127.0.0.1 www.dattebayo.com 127.0.0.1 www.deadfrog.us 127.0.0.1 www.demonoid.com 127.0.0.1 www.downloadanime.org 127.0.0.1 www.elephantsdream.org 127.0.0.1 www.eztv.it 127.0.0.1 www.freelegaltorrents.com 127.0.0.1 www.fulldls.com 127.0.0.1 www.gameupdates.org 127.0.0.1 www.gotwoot.net 127.0.0.1 www.greylodge.org 127.0.0.1 www.harveydanger.com 127.0.0.1 www.hightorrent.to 127.0.0.1 www.idealtorrent.com 127.0.0.1 www.ipodnova.tv 127.0.0.1 www.jamendo.com 127.0.0.1 www.legittorrents.info 127.0.0.1 www.livingtorrents.com 127.0.0.1 www.mabula.net 127.0.0.1 www.mac-torrents.com 127.0.0.1 www.matrix8.com 127.0.0.1 www.mininova.org 127.0.0.1 www.mvgroup.org 127.0.0.1 www.mvtorrents.com 127.0.0.1 www.mybittorrent.com 127.0.0.1 www.mytorrent.pl 127.0.0.1 www.new2me.net 127.0.0.1 www.newtorrents.info 127.0.0.1 www.nitcom.com.au 127.0.0.1 www.okbt.com 127.0.0.1 www.opensource-cms.org 127.0.0.1 www.opera.com 127.0.0.1 www.p2pbg.com 127.0.0.1 www.peteteo.com 127.0.0.1 www.pimptorrent.com 127.0.0.1 www.point-blank.cc 127.0.0.1 www.psppirates.com 127.0.0.1 www.publicdomaintorrents.com 127.0.0.1 www.raphustle.com 127.0.0.1 www.seedleech.com 127.0.0.1 www.sitasingstheblues.com 127.0.0.1 www.slackware.com 127.0.0.1 www.slotorrent.net 127.0.0.1 www.smaragdtorrent.to 127.0.0.1 www.solidz.com 127.0.0.1 www.speedtorrent.to 127.0.0.1 www.starwreck.com 127.0.0.1 www.sumotorrent.com 127.0.0.1 www.superfundo.org 127.0.0.1 www.thehawks.org 127.0.0.1 www.thetorrentsite.com 127.0.0.1 www.todotorrents.com 127.0.0.1 www.torrent.to 127.0.0.1 www.torrentbar.com 127.0.0.1 www.torrentbox.com 127.0.0.1 www.torrentdownloads.net 127.0.0.1 www.torrentlocomotive.com 127.0.0.1 www.torrentportal.com 127.0.0.1 www.torrentreactor.to 127.0.0.1 www.torrentum.pl 127.0.0.1 www.tracker.big-torrent.to 127.0.0.1 www.tribalmixes.com 127.0.0.1 www.tuxdistro.com 127.0.0.1 www.tvnihon.com 127.0.0.1 www.vuze.com 127.0.0.1 www.web-torrent.com 127.0.0.1 www.worldnova.org 127.0.0.1 www.zeoez.com 127.0.0.1 www.zoektorrents.com 127.0.0.1 xabin.mine.nu 127.0.0.1 xbox.udp.at 127.0.0.1 yhbt.mine.nu 127.0.0.1 zerowing.idsoftware.com 127.0.0.1 zorgtorrent.com

Now close out of nano by hitting Control + X, then Y, then enter.

At this point you should be right back at the main bash area. Now we just need to test everything out to make sure the block is working. To do this type the following command:

ping thepiratebay.org

If the next results show that you are pinging the IP address 127.0.0.1 then you've successfully done it! As of now most, but to be honest probably not all, Public Trackers have been banned from your server.

Happy Not Torrenting! (Well, Public Torrenting at least!)

Special Credit to Lewis Miller for helping me put together this awesome list.

———