0

Trying configure DNS service for old Linux machine. Network runs fine and ping by ip reaches internet. But if I ping by name ping www.google.com command just hangs for long time and brings answer: ping: unknown host www.google.com

/etc/network/interfaces:


# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface uses static address
auto eth0
iface eth0 inet static
        address 192.168.1.99
        netmask 255.255.255.0
        broadcast 192.168.1.255
        network 192.168.1.0
        gateway 192.168.1.1
        dns-nameservers 192.168.1.1

How to fix DNS service?

0

Can you change the line

dns-nameservers 192.168.1.1

to

dns-nameservers 8.8.8.8

and execute in terminal

sudo service networking restart

Does the ping www.google.com work after that?

  • 1
    I'd recommend dns-nameservers 192.168.1.1 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4. Then, you get 192.168.1.1 in case there's a WiFi login page or domains on the local network (which 8.8.8.8 won't know about) that you need to access, you get Cloudflare's fast DNS servers, and you get Google's less-fast DNS servers as a backup. – Chai T. Rex Sep 26 '18 at 13:26
  • dns-nameservers 8.8.8.8 and dns-nameservers 192.168.1.1 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 not allows ping google by name – vico Sep 26 '18 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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