Content-Length: 76196 | pFad | http://web.archive.org/web/20090411054311/http://www.linuxjournal.com/video/fun-hosts

Fun with Hosts | Linux Journal
The Wayback Machine - http://web.archive.org/web/20090409080857/http://www.linuxjournal.com:80/video/fun-hosts

Fun with Hosts

April 6th, 2009 by Shawn Powers in

Your rating: None Average: 3.8 (12 votes)

How to edit your hosts file to redirect urls, which is a fun way to play pranks at work or keep your kids off myspace!

Download in .ogv format
__________________________
Shawn Powers is an Associate Editor for Linux Journal. You might find him chatting on the IRC channel, or Twitter


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anonymous's picture

microsoft doesn't exist!

On April 6th, 2009 Anonymous (not verified) says:

awesome. Now I can block websites on Linux without squid!

Oh, and I can make microsoft.com = youareanidiot.org.

w00t...

Joe Tole's picture

RE: Better ways...

On April 6th, 2009 Joe Tole (not verified) says:

Oh and djbdns keeps logs of all requests if you are really concerned about your kids going to microsoft.com. I know I would be. :O

Joe Tole's picture

Better ways...

On April 6th, 2009 Joe Tole (not verified) says:

When looking up a host name, you can use the command host or dig instead of ping. Ping sends extra data to the host when all you need is an IP address.

host -t a google.com
google.com has address 209.85.171.100
google.com has address 74.125.67.100
google.com has address 74.125.45.100

Also, DNS can be even more effective then a host file since DNS can do wildcards and afaik a host file cannot. djbdns is easy to setup for a cache (using dnscache) and tinydns as a resolver. You can tell dnscache to use a host of your choosing to resolve a domain name by creating a file named /etc/dnscache/root/servers/domain.tld with the IP. In this case you can run dnscache on your external IP and tinydns on your loopback. Create a file named /etc/dnscache/root/servers/microsoft.com which contains the IP address "127.0.0.1" where tinydns is listening and then create these entries in /etc/tinydns/root/data:

.microsoft.com:127.0.0.1:a
+microsoft.com:74.125.67.100
+*.microsoft.com:74.125.67.100

This will redirect all requests to anything.microsoft.com to the google IP address including www.microsoft.com, download.microsoft.com and even abc.def.ghi.jkl.microsoft.com. Wildcards FTW! ;)

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

May 2009, #181

We don't own the desktop yet but we do own the first ever Nobel Prize in Cool. Cool Projects that is, we've got a Linux powered rocket and a Linux powered submarine. Plus we show you how to use the iRobot Create with Linux, how to convert those old 8mm movies to DVD with Linux, and how to control your house with Linux and Mi Casa Verde.

After checking out the cool projects don't miss the rest of this cool issue and read how to run Rails under Apache using Phusion Passenger, how to build a secure Squid Web Proxy, how to use OpenFiler to create an open-source network storage appliance, and if just typed "rm -rf /" find out what to do and what not to do in our continuing series of "When Disaster Strikes" articles. And don't miss our interview with Neuros CEO Joe Born or Doc's monthly words of wisdom.

Read this issue









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://web.archive.org/web/20090411054311/http://www.linuxjournal.com/video/fun-hosts

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy