-5

So if I edit my /etc/hosts file, I can access localhost as a domain name such as myapp.dev or whatever. Is there any way I can broadcast this domain so that others who are on the same wifi network want to see the app can simply go to myapp.dev or wherever?

3
  • 2
    Might depend on O/S but I think you are referring to multicast DNS. I am not knowledgeable in the subtleties of configuration of it but en.wikipedia.org/wiki/Multicast_DNS offers some more basic info. Apr 21, 2013 at 21:17
  • Can someone tell me why this was downvoted? I apologize if I asked a stupid question, but I can't do anything about it if no one tells me whats wrong Apr 21, 2013 at 23:05
  • 2
    Hover over the downvote arrow: "...does not show any research effort...". This sort of thing could have been easily discoverable with a couple cursory web searches.
    – EEAA
    Apr 21, 2013 at 23:13

3 Answers 3

4

Use a DNS server. Make it authorative for myapp.dev, set it to forward all other requests and then make it the primary DNS server for your network.

2

I never set this up but you can use Avahi or set up a lightweight DNS server like dnsmasq.

0

For such light use, a full DNS server might be excessive and hard to set up.

I like to use dnsmasq on a linux machine on my network for this task, it's a caching DNS server. All machines on your network will essentially be getting DNS responses derived from the dnsmasq server's /etc/hosts file. there's 2 ways you might configure it:

A

Set your dnsmasq box to have a static IP and use the router's DNS server or an external DNS server.

Set your router to tell clients that your dnsmasq box is the DNS server.

B

Set your dnsmasq box to have a static IP and use the router's DNS server or an external DNS server.

Disable your router's DHCP server.

Enable the DHCP server in dnsmasq and configure it to tell clients that it is the DNS server.

I use option B.

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