Using dnsmasq on virtual interfaces.

CraigFrancis

Bit poster
Is it possible for dnsmasq to run on a Parallels virtual network interface (vnic0)?

vnic0: ...
Code:
inet 192.168.2.2 netmask 0xffffff00 broadcast 192.168.2.255

/usr/local/etc/dnsmasq.conf
Code:
address=/host.example.com/192.168.2.2
listen-address=127.0.0.1
listen-address=[B]192.168.2.2[/B]
local-ttl=3600

dig +short host.example.com @127.0.0.1
Code:
192.168.2.2

dig +short host.example.com @192.168.2.2
Code:
;; connection timed out

nmap 192.168.2.2
Code:
PORT      STATE    SERVICE
22/tcp    open     ssh
53/tcp    open     domain
80/tcp    open     http

The intention is to allow the Windows VM's to also use this DNS service... either directly (setting it as the DNS server for the interface in System Preferences), or via a resolver file:

/etc/resolver/host.example.com
Code:
nameserver 127.0.0.1
 
Hi CraigFrancis,
Most probably it won't work on the host side, but should work in guest OS.
Just make sure to turn off DHCP in virtual machine preferences: Parallels Desktop > Preferences > Advanced > Network > Change Settings.
 
Is it possible for dnsmasq to run on a Parallels virtual network interface (vnic0)?

Hi,

There should be no problems if dnsmasq is correctly configured and Mac OS sees it as resolver.

I'd recommend to setup server 127.0.0.1 as DNS-server in System Preferences.

If Parallels is in Detailed logging mode (menu Preferences -> Advanced -> Use detailed logging), then parallels shared network daemon logs all DNS-requests and DNS-servers used in /Library/Logging/parallels.log

Note: Parallels supports only UDP-mode of DNS
 
Sorry for the delay, work has stopped me being able to look at this (need to restart many times, and dedicate quite a bit of time checking).

However I've tried both suggestions, and still don't seem to be getting a response from the correct DNS server (the one running locally, on the host).

At the moment I think that dnsmasq is just not listening on these virtual interfaces... and this also includes restarting it after Parallels has started (and the virtual interfaces are available).

---

I've attached a screenshot of the Parallels network preferences (with DHCP back on for now), and one for OSX System Preferences (host).

Using the output of ifconfig, OSX has these active interfaces:

Code:
ifconfig | grep -o -E '^(\S+\:|.*inet [^ ]+|.*status: [^ ]+)'
lo0:
	inet 127.0.0.1
gif0:
stf0:
en0:
	status: inactive
en1:
	inet 192.168.1.13
	status: active
fw0:
	status: inactive
p2p0:
	status: inactive
vnic0:
	inet 192.168.2.2
	status: active
vnic1:
	inet 10.37.129.2
	status: active

Where en0 is the for the wired network, and has been disconnected for these tests (it normally gets the ip "192.168.1.12", which you will see later, as the DNS server in the office resolves these domains to this IP for other computers on the network).

From Parallels point of view, vnic0 is for the "Shared" networking... and it kind of has 2 IP addresses... the one I can see "192.168.2.2", and the hidden "192.168.2.1".

From the Mac (host) I can only ping "192.168.2.2"... and from the Windows VM, I can ping "192.168.2.2" and "192.168.2.1".

From the Mac I can do a 'dig test.host.example.com @127.0.0.1' for a domain name that 'dnsmasq' should respond to... but this does not work for the virtual interfaces:

Code:
dig +short test.host.example.com @127.0.0.1
	192.168.2.2

dig +short test.host.example.com @192.168.2.1
	;; connection timed out; no servers could be reached

dig +short test.host.example.com @192.168.2.2
	;; connection timed out; no servers could be reached

... which isn't a problem, just an observation.

If I try this from the Windows VM, I get:

Code:
nslookup a.host.example.com

	*** Can't find server name for address 192.168.2.1: Non-existent domain
	*** Default servers are not available
	Server:  UnKnown
	Address:  192.168.2.1

	Non-authoritative answer:
	Name:    a.host.example.com
	Address:  192.168.1.12

Note that it returned the "192.168.1.12" IP address... which came from the DNS server in the office... and for some reason there is the "Can't find server name" error, which is odd.

When this happened, the output from the Parallels log file was:

Code:
	03-10 12:00:17.753 D /prl_naptd:555:507/ dns_req for 1.2.168.192.in-addr.arpa, type 12, class 1 (bytes_left=0)
	03-10 12:00:17.753 D /prl_naptd:555:507/ first request: id=0100
	03-10 12:00:17.753 D /prl_naptd:555:507/ req sent to 192.168.1.1
	03-10 12:00:17.765 D /prl_naptd:555:507/ reply for req 0100
	03-10 12:00:17.768 D /prl_naptd:555:507/ dns_req for a.host.example.com.localdomain, type 1, class 1 (bytes_left=0)
	03-10 12:00:17.768 D /prl_naptd:555:507/ first request: id=0200
	03-10 12:00:17.768 D /prl_naptd:555:507/ dns_searchdomain_port_input: a.host.example.com
	03-10 12:00:17.769 D /prl_naptd:555:507/ dns_req for a.host.example.com, type 1, class 1 (bytes_left=0)
	03-10 12:00:17.769 D /prl_naptd:555:507/ first request: id=0300
	03-10 12:00:17.769 D /prl_naptd:555:507/ req sent to 192.168.1.1
	03-10 12:00:17.771 D /prl_naptd:555:507/ reply for req 0300

And when specifying the primary IP address manually:

Code:
nslookup b.host.example.com 192.168.2.1
	*** Can't find server name for address 192.168.2.1: Non-existent domain
	Server:  UnKnown
	Address:  192.168.2.1

	Non-authoritative answer:
	Name:    b.host.example.com
	Address:  192.168.1.12

Code:
	03-10 12:01:56.549 D /prl_naptd:555:507/ dns_req for 1.2.168.192.in-addr.arpa, type 12, class 1 (bytes_left=0)
	03-10 12:01:56.549 D /prl_naptd:555:507/ first request: id=0100
	03-10 12:01:56.549 D /prl_naptd:555:507/ req sent to 192.168.1.1
	03-10 12:01:56.561 D /prl_naptd:555:507/ reply for req 0100
	03-10 12:01:56.563 D /prl_naptd:555:507/ dns_req for b.host.example.com.localdomain, type 1, class 1 (bytes_left=0)
	03-10 12:01:56.563 D /prl_naptd:555:507/ first request: id=0200
	03-10 12:01:56.563 D /prl_naptd:555:507/ dns_searchdomain_port_input: b.host.example.com
	03-10 12:01:56.564 D /prl_naptd:555:507/ dns_req for b.host.example.com, type 1, class 1 (bytes_left=0)
	03-10 12:01:56.564 D /prl_naptd:555:507/ first request: id=0300
	03-10 12:01:56.564 D /prl_naptd:555:507/ req sent to 192.168.1.1
	03-10 12:01:56.588 D /prl_naptd:555:507/ reply for req 0300

So basically the same... and when specifying the secondary IP address manually:

Code:
nslookup b.host.example.com 192.168.2.2
	DNS request timed out.
	    timeout was 2 seconds.
	*** Can't find server name for address 192.168.2.2: Timed out
	Server:  UnKnown
	Address:  192.168.2.2

	DNS request timed out.
	    timeout was 2 seconds.
	DNS request timed out.
	    timeout was 2 seconds.
	*** Request to UnKnown timed-out

With no output in the Parallels log... so I assume that even though the ping works, dnsmasq is not available on this IP either.

For comparison, the Apache web-server is available on:

http://192.168.2.2/

But not:

http://192.168.2.1/

---

And as to the dnsmasq.conf file, I've tried a few different things for this, but at the moment its:

Code:
	address=/host.example.com/192.168.2.2
	listen-address=127.0.0.1
	listen-address=192.168.2.2
	local-ttl=3600
	#interface=lo0
	#interface=vnic0
	#interface=vnic1
	no-hosts

---

I should also point out that while the Mac is still using:

Code:
	/etc/resolver/host.example.com

I have also tried setting it to use "127.0.0.1" for all DNS lookups (in OSX System Preferences), which kind of works... but the windows VM still does a "192.168.2.1: Timed out" for some reason (which adds a 2 second delay, and raises the confusing question as to where it gets the response from):

Code:
nslookup c.host.example.com
	DNS request timed out.
	    timeout was 2 seconds.
	*** Can't find server name for address 192.168.2.1: Timed out
	*** Default servers are not available
	Server:  UnKnown
	Address:  192.168.2.1

	Name:    c.host.example.com
	Address:  192.168.2.2

Code:
	03-10 13:02:21.815 D /prl_naptd:555:507/ dns_req for 1.2.168.192.in-addr.arpa, type 12, class 1 (bytes_left=0)
	03-10 13:02:21.815 D /prl_naptd:555:507/ first request: id=0100
	03-10 13:02:21.815 D /prl_naptd:555:507/ req sent to 127.0.0.1
	03-10 13:02:21.816 D /prl_naptd:555:507/ reply for req 0100
	03-10 13:02:23.808 D /prl_naptd:555:507/ dns_req for c.host.example.com.localdomain, type 1, class 1 (bytes_left=0)
	03-10 13:02:23.808 D /prl_naptd:555:507/ first request: id=0200
	03-10 13:02:23.808 D /prl_naptd:555:507/ dns_searchdomain_port_input: c.host.example.com
	03-10 13:02:23.809 D /prl_naptd:555:507/ dns_req for c.host.example.com, type 1, class 1 (bytes_left=0)
	03-10 13:02:23.809 D /prl_naptd:555:507/ first request: id=0300
	03-10 13:02:23.809 D /prl_naptd:555:507/ req sent to 127.0.0.1
	03-10 13:02:23.810 D /prl_naptd:555:507/ reply for req 0300

This setup also means that dnsmasq fails to search for upstream DNS servers (i.e. /etc/resolv.conf points to 127.0.0.1, and because I use many different networks, I don't really want to change the configuration for each one).
 

Attachments

  • Screen Shot 2014-03-10 at 11.58.57.png
    Screen Shot 2014-03-10 at 11.58.57.png
    261.8 KB · Views: 7
  • Screen Shot 2014-03-10 at 11.43.25.png
    Screen Shot 2014-03-10 at 11.43.25.png
    118.5 KB · Views: 7
  • Screen Shot 2014-03-10 at 11.41.26.png
    Screen Shot 2014-03-10 at 11.41.26.png
    161.2 KB · Views: 7
Back
Top