Cartoon of Author


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, they'll be redirected to 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:

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:


If the next results show that you are pinging the IP address 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.