How to restrict access to users not registered or logged in

Hi, just wondering if there is a way to restrict access to all pages but the home page when a user is not registered or logged in? Or even to send them to a page that says they have to register or log in in order to access this site. As it is now, when I log out, I still have access to all of the pages.