dnsmasq - 存在しないホストの解決を防ぐ

dnsmasq - 存在しないホストの解決を防ぐ

Ubuntu インスタンスに dnsmasq DNS サーバーをインストールし、構成にドメイン名を追加しました。ドメイン名の場合と同じ方法で不明なホストを解決していることを除けば、正常に動作しています。

私の設定は次のとおりです:

dnsmasq.conf は、

# domain name
domain=example.com
local=/example.com/

address=/example.com/127.0.0.1 
listen-address=127.0.0.1

/etc/ホスト

127.0.0.1 localhost
172.217.16.195 www.google.com
10.10.1.x testhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

「example」インスタンスに nginx サーバーをインストールしたので、ポート 80 に GET リクエストを送信するとデフォルトのページが表示されるはずですが、これは計画どおりに動作しています。

curl example.com

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...

「testhost」インスタンスに「hello world」を返すシンプルなサーバーをインストールしましたが、これも正常に動作しています。

curl testhost.example.com

hello world

ただし、存在しないホストを要求すると、「example」ホストにリダイレクトされます。 curl random-string-asfasfasfasf.example.com

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...

この動作を防ぐにはどうすればよいですか?

関連情報