How can I create a local DNS that is seen from other computers on my local network?











up vote
1
down vote

favorite












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?










share|improve this question
























  • have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
    – ptetteh227
    Nov 14 at 10:27












  • @ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
    – Rafael Muynarsk
    Nov 14 at 10:59










  • avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
    – ptetteh227
    Nov 14 at 16:15










  • Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
    – Thomas Ward
    Nov 16 at 15:50















up vote
1
down vote

favorite












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?










share|improve this question
























  • have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
    – ptetteh227
    Nov 14 at 10:27












  • @ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
    – Rafael Muynarsk
    Nov 14 at 10:59










  • avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
    – ptetteh227
    Nov 14 at 16:15










  • Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
    – Thomas Ward
    Nov 16 at 15:50













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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?










share|improve this question















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?







server 18.04 dns ip localhost






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 at 15:55

























asked Nov 14 at 2:44









Rafael Muynarsk

485518




485518












  • have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
    – ptetteh227
    Nov 14 at 10:27












  • @ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
    – Rafael Muynarsk
    Nov 14 at 10:59










  • avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
    – ptetteh227
    Nov 14 at 16:15










  • Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
    – Thomas Ward
    Nov 16 at 15:50


















  • have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
    – ptetteh227
    Nov 14 at 10:27












  • @ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
    – Rafael Muynarsk
    Nov 14 at 10:59










  • avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
    – ptetteh227
    Nov 14 at 16:15










  • Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
    – Thomas Ward
    Nov 16 at 15:50
















have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
– ptetteh227
Nov 14 at 10:27






have you tried adding machine-network-ip myhostname in /etc/hosts in addition to 127.0.0.1 myhostname?
– ptetteh227
Nov 14 at 10:27














@ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
– Rafael Muynarsk
Nov 14 at 10:59




@ptetteh227 I've tried that just now and rebooted the computer... But the DNS is still only available from my computer.
– Rafael Muynarsk
Nov 14 at 10:59












avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
– ptetteh227
Nov 14 at 16:15




avoid using .local and use say .home. how many computers form the network?. If there are few computers you could manually enter into each machine's hosts file the machine-network-ip hostname.home of the other pc on the network. but if there are lots of computers consider dnsmasq.
– ptetteh227
Nov 14 at 16:15












Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
– Thomas Ward
Nov 16 at 15:50




Keep in mind there isn't a DNS 'server' running open to the world on your computer by default. Avahi-Daemon is typically used for local mDNS things not network-wide normal DNS lookups.
– Thomas Ward
Nov 16 at 15:50










1 Answer
1






active

oldest

votes

















up vote
1
down vote













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:



sudo apt install dnsmasq


Then setup dnsmasq:



sudo nano /etc/dnsmasq.conf


create a static file:



sudo rm /etc/resolv.conf
echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf


stop any instances of the services:



sudo killall dnsmasq
sudo service systemd-resolved stop


edit the dnsmasq conf:



sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
sudo nano /etc/dnsmasq.conf


and add the following



#Beginning of configuration
domain-needed
bogus-priv
no-resolv
interface=wlp2s0
#Use below nameservers to reach the internet
server=8.8.8.8
server=8.8.4.4
#use below line to point to the router address.
#dhcp-option=option:router,192.168.0.50
#use two lines below to resolve local domains (eg .home)
local=/home/
domain=home


then restart dnsmasq:



sudo service dnsmasq restart


if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall



then edit the hosts file:



sudo nano /etc/hosts


and paste into it



. . .
127.0.0.1 localhost localhost.home
. . .
127.0.0.1 www.mysite1.home
127.0.0.1 mysite1.home
192.168.0.50 mysite1.home
192.168.0.50 mysite2.home


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*






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1092727%2fhow-can-i-create-a-local-dns-that-is-seen-from-other-computers-on-my-local-netwo%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    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:



    sudo apt install dnsmasq


    Then setup dnsmasq:



    sudo nano /etc/dnsmasq.conf


    create a static file:



    sudo rm /etc/resolv.conf
    echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf


    stop any instances of the services:



    sudo killall dnsmasq
    sudo service systemd-resolved stop


    edit the dnsmasq conf:



    sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
    sudo nano /etc/dnsmasq.conf


    and add the following



    #Beginning of configuration
    domain-needed
    bogus-priv
    no-resolv
    interface=wlp2s0
    #Use below nameservers to reach the internet
    server=8.8.8.8
    server=8.8.4.4
    #use below line to point to the router address.
    #dhcp-option=option:router,192.168.0.50
    #use two lines below to resolve local domains (eg .home)
    local=/home/
    domain=home


    then restart dnsmasq:



    sudo service dnsmasq restart


    if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall



    then edit the hosts file:



    sudo nano /etc/hosts


    and paste into it



    . . .
    127.0.0.1 localhost localhost.home
    . . .
    127.0.0.1 www.mysite1.home
    127.0.0.1 mysite1.home
    192.168.0.50 mysite1.home
    192.168.0.50 mysite2.home


    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*






    share|improve this answer



























      up vote
      1
      down vote













      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:



      sudo apt install dnsmasq


      Then setup dnsmasq:



      sudo nano /etc/dnsmasq.conf


      create a static file:



      sudo rm /etc/resolv.conf
      echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf


      stop any instances of the services:



      sudo killall dnsmasq
      sudo service systemd-resolved stop


      edit the dnsmasq conf:



      sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
      sudo nano /etc/dnsmasq.conf


      and add the following



      #Beginning of configuration
      domain-needed
      bogus-priv
      no-resolv
      interface=wlp2s0
      #Use below nameservers to reach the internet
      server=8.8.8.8
      server=8.8.4.4
      #use below line to point to the router address.
      #dhcp-option=option:router,192.168.0.50
      #use two lines below to resolve local domains (eg .home)
      local=/home/
      domain=home


      then restart dnsmasq:



      sudo service dnsmasq restart


      if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall



      then edit the hosts file:



      sudo nano /etc/hosts


      and paste into it



      . . .
      127.0.0.1 localhost localhost.home
      . . .
      127.0.0.1 www.mysite1.home
      127.0.0.1 mysite1.home
      192.168.0.50 mysite1.home
      192.168.0.50 mysite2.home


      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*






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        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:



        sudo apt install dnsmasq


        Then setup dnsmasq:



        sudo nano /etc/dnsmasq.conf


        create a static file:



        sudo rm /etc/resolv.conf
        echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf


        stop any instances of the services:



        sudo killall dnsmasq
        sudo service systemd-resolved stop


        edit the dnsmasq conf:



        sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
        sudo nano /etc/dnsmasq.conf


        and add the following



        #Beginning of configuration
        domain-needed
        bogus-priv
        no-resolv
        interface=wlp2s0
        #Use below nameservers to reach the internet
        server=8.8.8.8
        server=8.8.4.4
        #use below line to point to the router address.
        #dhcp-option=option:router,192.168.0.50
        #use two lines below to resolve local domains (eg .home)
        local=/home/
        domain=home


        then restart dnsmasq:



        sudo service dnsmasq restart


        if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall



        then edit the hosts file:



        sudo nano /etc/hosts


        and paste into it



        . . .
        127.0.0.1 localhost localhost.home
        . . .
        127.0.0.1 www.mysite1.home
        127.0.0.1 mysite1.home
        192.168.0.50 mysite1.home
        192.168.0.50 mysite2.home


        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*






        share|improve this answer














        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:



        sudo apt install dnsmasq


        Then setup dnsmasq:



        sudo nano /etc/dnsmasq.conf


        create a static file:



        sudo rm /etc/resolv.conf
        echo 'nameserver 127.0.0.1' | sudo tee /etc/resolv.conf


        stop any instances of the services:



        sudo killall dnsmasq
        sudo service systemd-resolved stop


        edit the dnsmasq conf:



        sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
        sudo nano /etc/dnsmasq.conf


        and add the following



        #Beginning of configuration
        domain-needed
        bogus-priv
        no-resolv
        interface=wlp2s0
        #Use below nameservers to reach the internet
        server=8.8.8.8
        server=8.8.4.4
        #use below line to point to the router address.
        #dhcp-option=option:router,192.168.0.50
        #use two lines below to resolve local domains (eg .home)
        local=/home/
        domain=home


        then restart dnsmasq:



        sudo service dnsmasq restart


        if you have a firewall remember to open ports 53, 67/udp, 68/udp, in the firewall



        then edit the hosts file:



        sudo nano /etc/hosts


        and paste into it



        . . .
        127.0.0.1 localhost localhost.home
        . . .
        127.0.0.1 www.mysite1.home
        127.0.0.1 mysite1.home
        192.168.0.50 mysite1.home
        192.168.0.50 mysite2.home


        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*







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 21 hours ago









        Rafael Muynarsk

        485518




        485518










        answered yesterday









        ptetteh227

        890118




        890118






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1092727%2fhow-can-i-create-a-local-dns-that-is-seen-from-other-computers-on-my-local-netwo%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Quarter-circle Tiles

            build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

            Mont Emei