title: Block or allow websites with "/etc/hosts" is really deprecated? What to use instead?
body: <p>I'm creating a Java project for my university and one of the features of my project is to block / allow websites that was set by the teacher (it's an open-source laboratory monitoring software). <strong>Actually I need something easier:</strong> block ALL sites but allow only a few (allow about 2 or 3 sites, all the others must be blocked).</p>
  <p>I've found <a href="https://jamalahmed.wordpress.com/2010/03/19/using-etchosts-allow-and-etchosts-deny-to-secure-unix/" rel="nofollow noreferrer">this excellent tutorial</a> that uses <code>/etc/hosts.allow</code> and <code>/etc/hosts.deny</code> to do exactly what I need. However <a href="https://askubuntu.com/a/23225/145168">I discovered that these files and this method of blocking / allowing websites is deprecated</a>.</p>
  <p>I don't think IPTables is a good way to achieve my aim, because to allow the access to a single website I need allow an IP address - but remember that a single hostname can have several IP addresses (like any Google service, Facebook and even Moodle of my university).</p>
  <h3>So, what would be the best way to block all websites and allow only a few?</h3>