AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1029485
Accepted
Kingindanord
Kingindanord
Asked: 2020-08-11 00:17:14 +0800 CST2020-08-11 00:17:14 +0800 CST 2020-08-11 00:17:14 +0800 CST

dnsmasq - 防止解析不存在的主机

  • 772

我已经在 ubuntu 实例上安装了 dnsmasq DNS 服务器,并在配置中添加了域名。它工作正常,只是它以与域名相同的方式解析未知主机。

这是我的配置:

/etc/dnsmasq.conf

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

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

/etc/hosts

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

我已经在“示例”实例上安装了 nginx 服务器,所以当我向端口 80 发送 GET 请求时,我希望看到默认页面,这是按计划工作的:

curl example.com

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

在“testhost”实例上,我安装了返回“hello world”的简单服务器,这也可以正常工作。

curl testhost.example.com

hello world

但是,当我请求一个不存在的主机时,它会被重定向到“示例”主机: curl random-string-asfasfasfasf.example.com

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

我怎样才能防止这种行为?

internal-dns dnsmasq
  • 1 1 个回答
  • 155 Views

1 个回答

  • Voted
  1. Best Answer
    tater
    2020-08-11T03:45:09+08:002020-08-11T03:45:09+08:00

    删除该address=行并将example.com您要解析的主机放入/etc/hosts.

    • 1

相关问题

  • Windows DNS 不断重新注册已删除的 IP 地址

  • 事件 ID 1030/1058 导致 DNS 和组策略错误

  • Solaris DNS

  • DNS 整合,如何同时服务于内部网络和互联网

  • 将主机名解析为内部 BIND 域中的域名

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve