DNSMASQ를 사용하여 잘못된 IP로 도메인 해결


1

두 개의 VM을 가지고 있는데 하나는 별표 (및 centos)를 실행하는 다른 VM과 대화하는 내 응용 프로그램입니다. 응용 프로그램 서버의 구성은 별표 상자를 가리켜 야합니다. 사무실과 집 또는 커피 숍을 이동할 때마다 내 설정을 변경하지 않으려면 dnsmasq을 사용하고 싶습니다.

내 맥에서 dnsmasq을 실행하고 있어요 (per http://ramonnogueira.wordpress.com/2013/02/09/resolving-vm-hostnames-with-dnsmasq/comment-page-1/#comment-9 ).

버추얼 박스에서는 vboxnet1을 10.203.175.1로 설정했습니다. 그리고 내 VM은 확실히 dnsmasq에서 자사의 IP를 받고있다; 그것의 IP는 내가 지정한 범위 내에있다.

그러나 만약 내가 asterisk.vm에 ping을하면 vm의 IP 대신에 10.203.175.1로 해결됩니다. 내가 뭘 잘못했는지 알기나 해?

내 dnsmasq.conf는 다음과 같습니다.

# Set this to the name of your VirtualBox host-only interface.
# dnsmasq will listen for DHCP and DNS requests on this interface as
# well as the loopback:
interface=vboxnet1

# This option will be forced anyway on OS X so set here to avoid a warning:
bind-interfaces

# Enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
# Select a range from the address and netmask shown in VirtualBox's
# host-only network configuration dialog:
dhcp-range=10.203.175.10,10.203.175.20,12h

# The default directory does not exist on OSX and this cause an 
# error when enabling DHCP, set an alternative location here:
dhcp-leasefile=/var/lib/dnsmasq.leases

# Assume anything in the .vm domain is local
#local=/vm/

# 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=vm

# This must be the address of you host on the vboxnet0 network
# find this in the VirtualBox host-only network preferences
address=/asterisk.vm/10.203.175.1

답변:


2
address=/asterisk.vm/10.203.175.1

dnsmasq은 당신이 말한대로 정확하게하고 있습니다. asterisk.vm IP와 10.203.175.1. 이 행은 대신 VM의 IP를 참조해야합니다.


좋아, 나는 이것이 어떻게 작동해야하는지 혼란스러워했다. 따라서 1 Vm이 필요한 경우 dhcp-range = 10.203.175.10,10.203.175.10으로 설정하면됩니다. 그리고 대부분의 경우, vms가 대개 동일한 IP를 갖기 때문에 범위를 지정하면 (여러 vms를 지원하기 위해) 잘되어야합니다.
— Brad Rhoads

VM이 동일한 IP를 가져 오도록하려면 VM 자체에 정적으로 할당하거나 dnsmasq 구성에서 고정 DHCP리스를 할당합니다 dhcp-host 지시문을 통해 또는 ethers 파일. 다음은 시작하기위한 예입니다. wiki.archlinux.org/index.php/dnsmasq#DHCP_server_setup
— Kromey

실제로 VM 자체에 IP를 정적으로 할당 한 다음 hosts 파일을 호스트 자체에 저장하고 그림에서 dnsmasq을 완전히 제거하십시오.
— Kromey
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.