I'm trying to create a local DNS on my computer so I can access it locally with a DNS address instead of an IP. The first thing that I did was to configure my hostname on the files /etc/hosts
and /etc/init.d/hostname.sh
.
$ sudo vi /etc/hosts
127.0.0.1 localhost
127.0.1.1 mynewhostname
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$ sudo vi /etc/hostname
mynewhostname
Then I installed the avahi-daemon as a DNS server:
sudo apt-get install avahi-daemon
After rebooting the system I can access the local DNS mynewhostname.local
only from localhost
(only from my own computer), other computers on the local network can only access my computer with the IP address and not with the DNS. Does anyone know why that happens? Or what would be a different approach to create a local DNS that's seen from all my local network?
the .local domain is used by avahi for its special services and i haven't been able to get other computers to use it over the network except when using mDNS applications.
You could run a proper dns server such as dnsmasq to achieve dns resolving of hostnames to ip addresses over a small network in addition to the /etc/hosts file.
To setup dnsmasq as your domain resolver choose another domain instead of .local. for example say .home or .house or anything other than .local. This domain works only on the network.
install dnsmasq onto the central "server". In this case your computer:
Then setup dnsmasq:
create a static file:
stop any instances of the services:
edit the dnsmasq conf:
and add the following
then restart dnsmasq:
if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall
then edit the hosts file:
and paste into it
where 192.168.0.50 is the servers computer ip on the network and mysite.home are services that are listening on the server computer*