VirtualBox Ubuntu Server with DNS using dnsmasq
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.
Related videos on Youtube
Boris Karl Schlein
Updated on September 18, 2022Comments
-
Boris Karl Schlein over 1 year
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 set192.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?
-
Boris Karl Schlein about 12 yearsOk, nslookup does not work. So I misconfigured dnsmasq? (My resolv.conf contains the .91-address.)
-
laurent about 12 yearstbh 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 about 12 yearsNot 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)
-
Boris Karl Schlein about 12 yearsSo… 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 about 12 yearsOk, I am trying bind9 right now but all I got is a servfail by digging. I found this tutorial and followed its steps.
-
Jo-Erlend Schinstad about 12 yearsIf 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.