2004年09月12日

Hostsファイルの管理ツールFastNet99とhosts遊びこのエントリーを含むはてなブックマークこのエントリーをはてなブックマークに追加


スポンサード リンク

ringolab.comというドメインはIPアドレスで表すと221.116.212.168である。ブラウザにURLが入力されると、ドメイン名とIPアドレスを変換するデータベース(DNS)へ問い合わせが行われ、この変換が行われる。

このDNSの問い合わせは省略することができる。WindowsXPであればhostsファイルという特殊な設定ファイルがあり、ここに対応関係を記述しておけばDNSは使われないのだ。

環境によって異なるが、WindowsXPであれば

C:\WINDOWS\system32\drivers\etc

などのパスにこのhostsファイルは存在する。中身は以下のようなものである。


# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

■Yahoo.comと打つとGoogle.comを表示する設定

実験してみる。

nslookupコマンドを使ってgoogle.comのIPアドレスを調べてみると、216.239.37.99 である。では上記、ホストファイルに

216.239.37.99 www.yahoo.com

という記述を追加して、ブラウザーを使ってみる。

URLに、www.yahoo.com と打つとGoogleのサイトが表示されるようになった。Hostsファイルに書かれたものはDNSに問い合わせが行われず、優先されるからである。

違う遊び方もできる。

216.239.37.99 www.google.com g

と設定すると、g一文字でも216.239.37.99(Google.com)へアクセスするようになる。だから、a、b、cや短い単語に良く使うサイトのIPアドレスを対応設定しておけばショートカットとして利用することができる。

自分だけのドメイン名をでっちあげることも可能だ。私の名前daiyaで遊ぶとすると、

216.239.37.99 www.google.com www.google.daiya

とすれば「 http://www.google.daiya/ 」でgoogleへアクセスできるのだ。最高に便利である(?)。

この方式を使いスパムで宣伝されるサイトや煩いバナー広告サーバにアクセスしないように設定することも可能である。

例えば、そうしたサイトのIPアドレスを登録した巨大なhostsファイルを配布しているサイトもある。これと自分のhostsファイルを入れ替えれば、特別なフィルタリングソフトなしで、広告がブロックできる。

・how to make the internet not suck (as much)
http://someonewhocares.org/hosts/

ちなみにこれを逆手に利用しているウィルスもある。

・Win32.HLLW.Antinny.6
http://www.viruschaser.jp/vi_index/vi_w/Win32.HLLW.Antinny.6.html
Hostsファイルを書き換えてマイクロソフトなどにアクセスできなくするワーム型ウィルス。

■hostsファイルを管理するツール FastNet99

さて、hostsファイル遊びは楽しいのだが、手書きでの書き換えが面倒だ。それを簡単に管理するのが、FastNet99などのフリーソフト。

FastNet99
http://w3.quipo.it/gcriaco/
fnadd01.gif

同様のhostsツールは他にも幾つかある。

Hosts Editor
http://www.ngweb.biz/resources/hostsedit/
hostseditshot01.png

・Mike Bliv's Page
http://www.users.bigpond.com/m.madronio/

HostsToggle
http://www.accs-net.com/hosts/HostsToggle/
ht-anim01.gif

通常のhostsファイルとカスタマイズしたhostsファイルをクリックでスイッチできる。


スポンサード リンク

Posted by daiya at 2004年09月12日 23:59 | TrackBack このエントリーを含むはてなブックマークこのエントリーをはてなブックマークに追加
Daiya Hashimoto. Get yours at bighugelabs.com/flickr
Comments

昔はPC初期化よくしてたので、hostsを退避させてたけど、あんまりにも初期化が多いので、いつのまにかhostsを書かなくなってしまっている。。。

Posted by: FUZZIO at 2004年09月13日 17:49

I think that you really can judge people by the way they comment different stuff. Some people, even expressing negative thoughts, are still polite and they respect and understand other people. Some people are not even trying to be nice, they just don窶冲 care. I think self-confident person will always act nice, no matter what other people do

Posted by: Bluehairdkid at 2008年04月07日 02:08
Post a comment









Remember personal info?