hostファイルを編集して新たなhostを作りたい

このQ&Aのポイント
  • hostファイルを編集して新たなhostを作りたいと考えています。しかし管理者権限で編集をした後にコマンドプロンプトのpingを実行して疎通確認をしても、新たに作成したhostと疎通できていないようです。
  • 新たなhostと疎通するためには、どうすれば良いでしょうか?詳しい方がいらっしゃいましたら、ご教示願います。
  • 質問者はWindows 8のPCとVMware Playerで動作しているUbuntu JeOS 10.04の仮想マシンを使用しています。コマンドプロンプトで疎通確認を行っているときは、仮想マシンとOSを立ち上げています。
回答を見る
  • ベストアンサー

hostファイルを編集して新たなhostを作りたい

○質問の主旨 hostファイルを編集して新たなhostを作りたいと 考えています。しかし管理者権限で編集をした後に コマンドプロンプトのpingを実行して疎通確認をしても、 新たに作成したhostと疎通できていないようです。 例えば、http://example.jp/phpinfo.phpと ブラウザソフトに入力しても、 「接続を試みましたが、拒否されました: example.jp (port=80)」 と返されます。 新たなhostと疎通するためには、どうすれば良いでしょうか? 詳しい方がいらっしゃいましたら、ご教示願います。 ○質問の補足 (編集前の一部) # x client host # localhost name resolution is handled within DNS itself. # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localpress (編集後の一部) # localhost name resolution is handled within DNS itself. # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 localpress 192.168.64.128 example.jp trap.example ○環境 PC:windows8 仮想マシン:VMwarePlyaer OS:UbuntuJeOS10.04 ※コマンドプロンプトで疎通確認を行っているときは、 仮想マシンとOSを立ち上げています(添付画像) ○参考文献 体系的に学ぶ 安全なWebアプリケーションの作り方  脆弱性が生まれる原理と対策の実践 P18 (アマゾン短縮コード) http://goo.gl/miO5p8

質問者が選んだベストアンサー

  • ベストアンサー
  • bunjii
  • ベストアンサー率43% (3589/8248)
回答No.1

>しかし管理者権限で編集をした後にコマンドプロンプトのpingを実行して疎通確認をしても、新たに作成したhostと疎通できていないようです。 IPアドレスでのPingに応答がありましたか? IPアドレスを対象にPing応答を確認してから名前でのPing応答を確かめてください。 >192.168.64.128 example.jp trap.example この記述はUbuntuJeOS10.04のホスト定義ファイルに追加されたのでしょうか? Pingを実行する端末のhostsファイルに定義しないと無意味です。 >※コマンドプロンプトで疎通確認を行っているときは、仮想マシンとOSを立ち上げています(添付画像) PingをホストOSのWindows 8のコマンドプロンプトから実行するときはWindows 8側のhostsファイルにも192.168.64.128 example.jp trap.exampleと追記してなければ名前解決ができませんので応答が返らないはずです。 TCP/IPのネットワーク通信について基礎的な知識不足のようです。 DNSサーバーとhostsファイルの関連性についても学習が必要でしょう。

dradra33
質問者

お礼

bunjiiさま コメントありがとうございます! >IPアドレスでのPingに応答がありましたか? 192.168.64.128でpingを送信したところ、 「宛先ホストに到達できません」 と返されました。 >この記述はUbuntuJeOS10.04のホスト定義ファイルに追加されたのでしょうか? ??? すいません。せっかく貴重なお答えを 頂いているのに、意味がよく分かりませんでした。 >TCP/IPのネットワーク通信について 基礎的な知識不足のようです。 >DNSサーバーとhostsファイルの関連性についても 学習が必要でしょう。 ご指摘のとおりだと思います。 ここらへんのところを 学習してから見直してみます。

関連するQ&A

  • #「ハッシュタグ」について

    Windows¥System32\drivers\etc\hostのファイルで #「ハッシュタグ」は以降の記入内容にどのように関係しているのでしょうか ご存じの方教えてください。 -------------------- Windows¥System32\drivers\etc\host ---------------- # 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 127.0.0.1 localhost -------------------------------------------------------------------------

    • ベストアンサー
    • Ruby
  • bind zoneファイルの正しい記述を教えてください

    bindのzoneの設定で迷っています。 OCNのJPドメインの取得代行を利用しています。 OCNから自前のDNSサーバー名をns01.mydomin.jpに指定されています。 なので、SOAレコードでDNSサーバー名の宣言がns01.mydomin.jpにせざる得ません。(多分) しかしこの自ホスト名はns01ではありません(当然ですよね) 自分の設定ではAレコードで矛盾が生じてしまうのではないかと 不安があり、悩み悩み設定しました。 DNSのバイブルであるdns&bindを読んでもこのパターン例が無く 迷っています。 以下私なりに知恵を絞った設定なのですが、不備があるかと思います。 いろいろと指摘いただければ幸いです。 賢人のアドバイスをいただきたく、よろしくお願いします。 動作面は勿論ですが可読性を悪くしていることがあれば、これもまた指摘ください。 以下内部向け正引きのゾーンファイルです ;------------------------ ;exmple.jp.internal.zone ;------------------------ @ IN SOA ns01.example.jp. root.example.jp.(省略) IN NS ns01.example.jp. IN NS ns.ocn.ad.jp. ; 自ホスト名をAで宣言したいのでns01はコメントアウト ;ns01 IN A 192.168.11.22 my-host-name IN A 192.168.11.22 localhost IN A 127.0.0.1 IN MX 10 ns01.example.jp. ; Aでns01が宣言するとアドレス重複するので、CNAMEで宣言してみた ns01 IN CNAME my-host-name www IN CNAME my-host-name mail IN CNAME my-host-name

  • TELNETが使えません

    Linuxマシンにtelnetでログインしようとすると、つながりはするみたいなのですが、ログインのプロンプトが出る前に切断されてしまうようなのです。 とりあえずローカルでためすと次のようになります。 >telnet localhost Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Connection closed by foreign host.

  • Apache(2.0.63)(name basedなvirtual host)で、<想定していないサブドメ>.example.com に対してそれ専用の設定を。

    Apache(2.0.63)で、name basedなvirtual hostをおこなっているのですが、example.com www.example.com develop.example.com の場合は、 それぞれのvirtual hostごとの設定(DocumentRoot など)がよまれ、【<想定していないサブドメ>.example.com】 の場合は、その場合特有の設定(DocumentRoot など)が読まれるようにしたいのですが、どうすればいいのでしょうか? <VirtualHost _default_:*>ほげほげ</VirtualHost>はIPベースのときにしか意味ないようですし・・・ なお。以下のように、ServerName をかかなければいい、というのをどこかでみかけ、実践したのですが、挙動変わらずです。 <VirtualHost *:80> # ServerName wildcard.example.com DocumentRoot /var/www/wildcard.example.com/htdocs </VirtualHost> DNSのほうは、 www 111.111.11.111 @ (None) 111.111.11.111 * (All Others) 111.111.11.111 develope 111.111.11.111 また、httpd.conf のほうは、 NameVirtualHost *:80 をちゃんと書いています。

  • unixへのSMTPコマンドでメールが送れません

    windows2000のPC1台と、SolarisOSを積んだunix機が1台(Postfixが素人によりインストールされている状態)あります。 windows2000から、フリーソフトTeraTermを使い、telnetでunix機の25番ポートにSMTPコマンドで 下記のようにメールを送りましたが、エラーが出てしまいます。関係あるかわかりませんが、 resolv.confには社内DNSアドレスが正しく記入されていました。 エラーから、ホストかドメインが見つからなくて、DNSに関連しているだろうことはわかりました。 解決へのヒントをください。よろしくお願いします。 【送ったコマンド】------------------------------------------------------ telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 tokyo_unix.localdomain ESMTP Postfix mail from:tekito@ezweb.ne.jp 250 2.1.0 Ok rcpt to:root@tokyo_unix.localhost 250 2.1.5 Ok data 354 End data with <CR><LF>.<CR><LF> from:tekito@ezweb.ne.jp to:root@tokyo_unix.localhost subject:test date:2008/1/24 10:20:30 送信テスト . 250 2.0.0 Ok: queued as 1A34567DA quit 221 2.0.0 Bye Connection to localhost closed by foreign host. 【エラー】------------------------------------------------------------ 3E84667C0 351 Wed Jan 23 09:17:40 tekito@ezweb.ne.jp (Host or domain name not found. Name service error for name=localdomain type=A: Host not found) root@tokyo_unix.localhost F2A2C678B 336 Mon Jan 21 09:51:14 tekito@ezweb.ne.jp (delivery temporarily suspended: Host or domain name not found. Name service error for name=localdomain type=A: Host not found) root@tokyo_unix.localhost --------------------------------------------------------------------

  • Vine Linux3.2 DNSサーバの構築についえ教えてください

    Vine Linux3.2でDNSサーバを構築しようと苦闘しています。 まずは、LAN内で構築を目指しました。 ルータ 192.168.11.1 Linux マシン 192.168.11.8 WindowsXPマシン 192.168.11.3 Linux マシンの名前をshuttle ドメイン名を rqgdomain.co.jp としました。 http://www.jitaku-server.net/bind_hostname.html を、参考にさせていただきました。ありがとうございます。 6つのファイル (1)named.cd、(2)named.conf、(3)localhost.zone、(4)named.local、(5)rqgdomain.co.jp、(6)11.168.192.in-addr.arpa を用意しました。 いろいろ調べてもわからない不具合がいくつか出てきてしまいました。 #/etc/rc.d/init.d/named restart namedを停止中:rndc:connect failed:connection refused [失敗] namedを起動中:[ OK ] と、なってしまいます。 Q1.何故失敗してしまうのでしょうか。 次に #nameserver 127.0.0.1 -bash: nameserver: command not found と、いうことでこの操作もできません。 Q2.何故できないのでしょうか。 最後に #host localhost localhost has address 127.0.0.1 # host 127.0.0.1 1.0.0.127.in-addr.arpa domain name pointer localhost. となり、正常のようです。 しかし、 #host shuttle.rqgdomain.co.jp Host shuttle.rqgdomain.co.jp not found: 3(NXDOMAIN) # host 192.168.11.8 Host 8.11.168.192.in-addr.arpa not found: 3(NXDOMAIN) となってしまいます。 Q3.何故エラーが出てしまうのでしょうか。 定義ファイルが間違っているのではないかと入念に見直したつもりですが、わかりません。 定義ファイルを以下に記載させていただこうと思いましたが文字数制限にかかりました。ご回答いただけたら補足で記載させていただきます。 おわかりの方見えましたらなにとぞよろしくお願いいたします。

  • ApacheでのVirtual Hostの設定

    RedHatLinux9.0/Apache2.0 動的IPのADSLでhn.orgのDDNSを使い、サーバを立てました。 ドメインを持っているため、それを割り当てようと/etc/httpd/conf/httpd.confでVirtual Hostの設定をしたのですが、外部からドメインで接続しても指定したディレクトリを読みに行ってくれず、ディフォルトの/var/www/htmlのディレクトリが表示されていまいます。 DNS(bind?)をこちらで動かしてないのですが、それが原因なのでしょうか? httpd.confはこのようにしています。 # # Use name-based virtual hosting. # NameVirtualHost 127.0.0.1 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # <VirtualHost 127.0.0.1> ServerAdmin admin@自分のドメイン.biz DocumentRoot /home/ff/www/ ServerName www.自分のドメイン.biz ServerAlias 自分のドメイン.biz ErrorLog logs/ff/error_log CustomLog logs/ff/access_log common </VirtualHost> また、NameVirtualHost 127.0.0.1と<VirtualHost 127.0.0.1>を、NameVirtualHost *と<VirtualHost *>に変えるとすべてのアクセスがForbiddenになってしまいます。 ログをみたところ、どういうわけかIE6.0なのにHTTP/1.0で繋がっているみたいなのですが、やはりそれなのでしょうか・・・? すみません。アドバイスよろしくお願いいたします。m(_ _)m

  • hostsファイルが書き換えられている?

    hostsファイルがいつの間にか購入時とは違う状態になっていました。 Spybotを入れたのでそれが原因なのかな?と思ったのですが… # 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 # Start of entries inserted by Spybot - Search & Destroy 127.0.0.1 www.007guard.com 127.0.0.1 007guard.com 127.0.0.1 008i.com 127.0.0.1 www.008k.com というように続き、 # This list is Copyright 2000-2008 Safer Networking Limited # End of entries inserted by Spybot - Search & Destroy と締めくくられています。 このままでも大丈夫なのでしょうか?

  • PHPの教本の説明などで質問があります。

    http://www.amazon.co.jp/dp/4774144371  以上教本の、P28~P29の質問です。  以下中身です。 ■ドキュメントの設定 ドキュメントルールをC:\xampp\htdocs\study.localhostに設定します。まずはディレクトリを作成します。  次にApacheのバーチャルホストを設定します。C:\xampp\apache\conf\conf\extra\http-vhost.conf を開き次の設定を追加してください。<VirtualHost>で囲まれた部分がバーチャルホストの設定です。ServerNameにWeb ブラウザからアクセスする際のドメイン名(study.localhost)、DocumentRootおよび<Directory>にドキュメントルートへの パスを指定します。 (パソコン側のファイルを以下のプログラムに修正しろと言うことでしょう!?)  NameVirtualHost *:80 <Virtualhost *80> ServerName study.localhost DocumentRoot C:\xampp\htdocs\study.localhost DirectoryIndex index.php index.html <Directory “C:\xampp\htdocs\study.localhost”> AllowOverride All Allow from All </Directory> </VirtualHost> ---------------------------------------------------------- 以上が教本の中身です。 そこで質問があります! 第一の質問  教本では C:\xampp\apache\conf\conf\extra\http-vhost.confですが! パソコン側に存在するファイルは httpd-vhosts.confです。 教本のhttp-vhost.confではなくて、httpの部分がパソコン側では httpdと成っていて、dが多いです! ファイル名が違うことで、設定後何か支障はありますか!? 第二の質問  以下が、httpd-vhosts.conf  ファイルのプログラム全文を以下表示しましたが、 ##NameVirtualHost *:80が二個存在していて、どちらのプログラムを 修正すればいいのでしょうか!?  以上二件よろしくお願いします。 # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # ##NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ##ServerName or ##ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost> ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost>

    • 締切済み
    • PHP
  • Fedora7 へのtelnet接続ができません

    お世話になっております。いつも皆様に助けられているものです。 Fedora7への telnet接続を試みていますが、うまくいきません。 ローカルのFedora7上で、root以外のユーザーで接続すると成功しますが、root等で接続しようとすると、 getname info:localhost:Success temporary failure in name resolution:Illegal seek Connection closed by foreign host と表示されてしまいます。 申し訳ありません。Linux初心者なもので。 どなたか、お助けいただけないでしょうか。