![도메인 없이 Windows 호스트에 DNS 서비스를 제공하도록 DNSMasq를 얻으려면 어떻게 해야 합니까?](https://linux55.com/image/143791/%EB%8F%84%EB%A9%94%EC%9D%B8%20%EC%97%86%EC%9D%B4%20Windows%20%ED%98%B8%EC%8A%A4%ED%8A%B8%EC%97%90%20DNS%20%EC%84%9C%EB%B9%84%EC%8A%A4%EB%A5%BC%20%EC%A0%9C%EA%B3%B5%ED%95%98%EB%8F%84%EB%A1%9D%20DNSMasq%EB%A5%BC%20%EC%96%BB%EC%9C%BC%EB%A0%A4%EB%A9%B4%20%EC%96%B4%EB%96%BB%EA%B2%8C%20%ED%95%B4%EC%95%BC%20%ED%95%A9%EB%8B%88%EA%B9%8C%3F.png)
DNSMasq가 설치된 Ubuntu 16.04 호스트(10.0.10.2)가 있는데오직동일한 서브넷에 있는 여러 Windows 호스트와 동일한 서브넷에 있는 다른 여러 Linux 호스트에 DNS 서비스를 제공합니다. 내 기본 게이트웨이는 DHCP와 DNS 서버용 10.0.10.2를 배포하고 있습니다.
Windows 시스템에는 정의된 DNS 검색 접미사 또는 도메인이 없지만 도메인이나 검색 접미사를 지정하지 않고도 DNSMasq 서버의 /etc/hosts에 정의한 호스트를 확인할 수 있기를 원했지만 이는 어려운 것으로 판명되었습니다. Wireshark에 따르면 Windows 호스트는 Linux 호스트에서 웹 서비스를 핑하거나 탐색하려고 할 때 항상 .local이 추가될 것으로 예상합니다.
내 /etc/hosts 파일은 다음과 같습니다.
127.0.0.1 localhost
10.0.10.2 box-linux-0 box-linux-0.local
10.0.10.3 box-linux-1 box-linux-1.local
10.0.10.3 box-linux-2 box-linux-2.local
10.0.10.7 box-windows-0 box-windows-0.local
10.0.10.5 box-windows-1 box-windows-1.local
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
내 DNSMasq 구성은 다음과 같습니다.
strict-order
port=53
resolv-file=/etc/resolv.conf
log-queries
log-facility=/var/log/dnsmasq.log
내 resolv.conf는 다음과 같습니다.
nameserver 127.0.0.1
nameserver 8.8.8.8
Windows 호스트가 box-linux-0, box-linux-1, box-linux-2를 확인할 수 있도록 하는 것이 누락되었습니까?
답변1
dnsmasq가 모든 DNS 요청을 해결할 수 있도록 resolv.conf에는 외부 DNS 서버가 없어야 합니다. 로 변경:
nameserver 127.0.0.1
외부 DNS 이름 확인을 허용하려면 dnsmasq에 외부 DNS 서버를 사용하도록 지시하여 dnsmasq를 전역 DNS 서버로 사용하세요. DNSmasq 구성 파일에 추가:
--server는 업스트림 서버의 IP 주소를 직접 지정합니다.
server=8.8.8.8
dnsmasq가 실제로 전역 DNS 이름일 수 있는 이름만 확인하도록 하려면 DNSmasq 구성 파일에 다음을 추가하세요.
# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv
/etc/hosts로 로컬 이름을 확인하려면 DNSmasq 파일에 다음을 추가하세요.
# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/local./
다음 옵션을 시도해 볼 수 있습니다(작동할 수도 있고 작동하지 않을 수도 있음).
# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
expand-hosts
# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
# as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
# domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
domain=local