Alternatively there are many very usefull extensions to firefox, many of which can perform this funtion. E.g. the Adblock extension allows you to block sites and there are even additional extensions that supply regularly updated ad server addresses for blocking.
Personally I think this is the simplest and most efficient method as its integrated into the browser, so for example you can ritgh click on something and opt to block the site, though of couse as mentioned before you can modify the hosts file manually or use thirdparty software/hardware.
Edit: Of course this depends on your purpose, if you wish to restrict access to another person without them being able to re-enable access then router is the best solution if you can't or dont want to restrict their user account, otherwise thirdparty software e.g. an appropriate firewall with a password and restrict the users ability to add remove programs, access the registry etc...