Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
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? –  Boris Karl Schlein Feb 23 '12 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. –  Jo-Erlend Schinstad Feb 24 '12 at 0:52
add comment

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.

share|improve this answer
    
Ok, nslookup does not work. So I misconfigured dnsmasq? (My resolv.conf contains the .91-address.) –  Boris Karl Schlein Feb 23 '12 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 '12 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. :) –  Boris Karl Schlein Feb 23 '12 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 '12 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. –  Boris Karl Schlein Feb 23 '12 at 20:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.