Ubuntu – Trying to block YouTube


I've tried two different commands in IPTables to block YouTube. They briefly work, but then, hours later, or the next day, I test it again, only to find that it comes through when I DON'T want it to. Does anyone know of a good solution to this?

Best Answer

That's because you're up against YouTube which is huge and has servers all over the planet and they use them very efficiently to stream Terabytes of data!!!

If you really want to do this: don't remove any YouTube address from your IPtables; just keep adding them and to start, just go here for a list of YouTube IP addresses and add those all in. Check it weekly as they keep adding servers...

Fair warning: Some day, when you finally nailed down all of the YouTube servers, someone will show up at your desk and tell you: "Look, there's this educational video on how to install my printer/teach me math/... and I really need it!" and then you're going to pull out all of your hair and remove the blocks you've so painstakingly put in. (Your mileage may vary, though)

Edit: Additionally there might be circumstances where you actually block other Google services if you block huge ranges of YouTube IP addresses in IPtables or any other IP based filtering.