1

I just want to have a local server inside my VirtualBox that offers DNS functionality like www.example.local => 127.0.0.1. My host operating system is Ubuntu 11.10 and guest is Ubuntu 10.10.

On my server I can already ping www.example.local - so I configured my virtual host correctly.

Question is, how can I address www.example.local from outside my VirtualBox? I searched Google and AskUbuntu and found dnsmasq. I installed dnsmasq on my server and followed all steps on help.ubuntu. On my host system I've set 192.168.178.91 to the list of DNS servers (192.168.178.91 is the IP address of my local server which uses a bridged network adapter).

Thing is, I still cannot ping (or connect to) my example.local virtual host. It gives me an unknown host response.

How can I set up my DNS server correctly?

2 Answers 2

1

If hostname.local on your local network is the goal, then you don't need to do anything. You can just connect to it. If your laptop is named mylaptop, for instance, just connect to mylaptop.local. It's done using Avahi out of the box.

2
  • So… my Apache server is on my VirtualBox guest at 192.168.178.91. I want to type localhost or myproject.com in my browser on my host system (and on other devices in my lan) to reach the server. You mean avahi can already handle such requests? Feb 23, 2012 at 20:28
  • If Ubuntu by default makes hostname.local available to all other clients on the local network, I see no reason why ".local" shouldn't be changeable to something else. I've never done it myself. But yes, you can connect to computers on your local network using hostname.local. Feb 24, 2012 at 0:52
0

On the host, you probably have the dns server set in /etc/resolv.conf to a different machine (like your router or your isp DNS). You can change it to your virtual server after running it but since the virtual server will be loaded after the host obviously, if you make the change permanent, you won't have DNS before loading the virtual server and this can be a problem. On other machines, you can make this change permanent.

Anyways, before changing anything, you could just test if the DNS server is working well by issuing on the host machine:

nslookup www.example.local 192.168.178.91 and see if it works.

5
  • Ok, nslookup does not work. So I misconfigured dnsmasq? (My resolv.conf contains the .91-address.) Feb 23, 2012 at 15:40
  • tbh I don't know why you need dnsmasq. Maybe I didn't understood something in your config but I would use only bind on the guest and your usual dhcp server to send the required IP to the guest (or fixed IP). Can you ping the guest from the host by IP? If yes, I think bind is not working (or the firewall is blocking).
    – laurent
    Feb 23, 2012 at 15:46
  • Hum, I haven't installed bind at all. I thought dnsmasq is doing its job. But yes, I can ping my guest. So I will try bind later. Thx so far. :) Feb 23, 2012 at 16:06
  • Not sure on that but I think dnsmasq only forward public DNS and serves the local machines names its DHCP server has registered, not other domain names (even if they are from the local domain names)
    – laurent
    Feb 23, 2012 at 16:19
  • Ok, I am trying bind9 right now but all I got is a servfail by digging. I found this tutorial and followed its steps. Feb 23, 2012 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .