アプリ版:「スタンプのみでお礼する」機能のリリースについて

/etc/hosts  記述

ip アドレス  ホスト名 ですが、

ホスト名  ipアドレス の記述だと、認識しないのでしょうか?

それとも、問題ないでしょうか?

Linux でも結果は同じでしょうか?

A 回答 (4件)

> ホスト名  ipアドレス の記述だと、認識しないのでしょうか?


逆になぜこうしてみたくなったのかそれを聞いてみたいところではあるが、

では、/etc/hostsの役割から検討してみよう。
/etc/hostsの役割は「IPアドレスに対してわかりやすい別名をつける」事だ。/etc/hostsの正確な書き方は以下のようになる。

xxx.xxx.xxx.xxx hostname1 hostname2 hostname3 hostname4 ....

分かるだろうか。1つのIPアドレスに対して複数の別名をつける事ができる。これは、書き方が(IPアドレスとホスト名で)逆だと実現できない機能だ。いや、hostname1 xxx.xxx.xxx.xxx、hostname2 xxx.xxx.xxx.xxxという2行で表現できるかもしれないけど。
なので、上記の正確な書き方をしてあげてほしい。そうしないとSolarisは分かってくれない。

そして、このhostsファイルの役割と書き方はSolarisでもLinuxでもWindowsでも同じだ。LinuxとWindowsでも同じようにしてあげてほしい。
    • good
    • 0
この回答へのお礼

ありがとうございます。

お礼日時:2011/07/27 10:21

# Copyright (c) 1993-2009 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

# localhost name resolution is handled within DNS itself.
#127.0.0.1 localhost
#::1 localhost
    • good
    • 1

この質問の解決がとても必要なのにも拘わらず、


http://oshiete.goo.ne.jp/qa/6884878.html (すぐに回答ほしいです)
自分では確認できない、不思議な状況にとても興味あり。

もし気が向いたら、補足にその状況の説明を書いてね!


ちなみに、Windows XP ではダメだったよ?

| C:\WINDOWS\system32\drivers\etc>echo somepc 192.168.1.10>>hosts
|
| C:\WINDOWS\system32\drivers\etc>more +17 hosts
|
| 127.0.0.1 localhost
| somepc 192.168.1.10
|
| C:\WINDOWS\system32\drivers\etc>ping -a somepc
| Ping request could not find host somepc. Please check the name and try again.
|
| C:\WINDOWS\system32\drivers\etc>
    • good
    • 0

質問するまでもなく実際にやってみるのが一番だと思います。


結果報告よろしくお願いします。
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!