How to set DNS server?

19,323

Solution 1

If you are uncomfortable using the terminal (although I would never discourage anyone from using it and familiarizing him/her self with the terminal), you can also achieve the task using the GUI method below:

  1. Open Network-Manager from the icon in the System Tray.
  2. Select Edit Connections from the menu.
  3. Select Wired/Wireless depending on your type of connection.
  4. Double click on your particular connection.
  5. Select IPv4 (you are in all probability not using IPv6).
  6. Change the method to Automatic (DHCP) Addresses Only.
  7. In the field provided for DNS servers, enter two DNS addresses separated by a comma. I would recommend trying Google's DNS servers at first.
  8. Click Save.
  9. Disconnect from your network and then reconnect to it.
  10. Restart your browser to test your connection speed.

Thats it.

Solution 2

Edit the /etc/networking/interface file with some text editor.

Since you are not familiar with terminal, nano should be easiest ways.

Or you can use some graphical tool, like gedit, leafpad, mousepad and issue in terminal:

nano /etc/networking/interface

and paste the following:

auto lo
iface lo inet loopback
  address 127.0.0.1
  netmask 255.0.0.0

auto eth0
iface eth0 inet dhcp
    dns-nameservers 8.8.8.8
    dns-nameservers 8.8.4.4

Don't edit /etc/resolv.conf manualy. It will be reset when you restart the network.

Share:
19,323

Related videos on Youtube

Leif Sabellek
Author by

Leif Sabellek

Updated on September 18, 2022

Comments

  • Leif Sabellek
    Leif Sabellek over 1 year

    Since I changed my internet provider, opening websites is very slow, it says that it is resolving the host for a long time. So I think I have to change the DNS server. I tried to follow this documentation, but I cannot get it to work. The content of the /etc/network/interfaces is just this for me:

    # interfaces(5) file used by ifup(8) and ifdown(8)
    auto lo
    iface lo inet loopback
    

    So I added the lines according to the documentation, but I don't know what to enter for adress, netmask, gateway. How do I find out what to enter there?

    I'm sorry, I'm really no expert in those network things.

    EDIT:

    This is the output when i run netstat -rn

    Kernel-IP-Routentabelle
    Ziel            Router          Genmask         Flags   MSS Fenster irtt Iface
    0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
    192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
    

    This is the output when I run ifconfig:

    eth0      Link encap:Ethernet  Hardware Adresse 14:da:e9:c6:81:b6  
              inet Adresse:192.168.0.5  Bcast:192.168.0.255  Maske:255.255.255.0
              inet6-Adresse: 2a02:8109:440:f083:16da:e9ff:fec6:81b6/64 Gültigkeitsbereich:Global
              inet6-Adresse: fe80::16da:e9ff:fec6:81b6/64 Gültigkeitsbereich:Verbindung
              inet6-Adresse: 2a02:8109:440:f083:38ac:bfba:f01f:6cfe/64 Gültigkeitsbereich:Global
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
              RX-Pakete:9748 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
              TX-Pakete:11366 Fehler:0 Verloren:0 Überläufe:0 Träger:0
              Kollisionen:0 Sendewarteschlangenlänge:1000 
              RX-Bytes:9608013 (9.6 MB)  TX-Bytes:1554941 (1.5 MB)
    
    lo        Link encap:Lokale Schleife  
              inet Adresse:127.0.0.1  Maske:255.0.0.0
              inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
              UP LOOPBACK RUNNING  MTU:65536  Metrik:1
              RX-Pakete:2423 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
              TX-Pakete:2423 Fehler:0 Verloren:0 Überläufe:0 Träger:0
              Kollisionen:0 Sendewarteschlangenlänge:0 
              RX-Bytes:194090 (194.0 KB)  TX-Bytes:194090 (194.0 KB)
    
    • George Udosen
      George Udosen about 7 years
      run this and post the result: netstat -rn
    • Leif Sabellek
      Leif Sabellek about 7 years
      I updated the post with the result of this command.
    • George Udosen
      George Udosen about 7 years
      run ifconfig and post the result
    • George Udosen
      George Udosen about 7 years
      Mean while try the GUI method posted first, that's easiest way.
    • Leif Sabellek
      Leif Sabellek about 7 years
      The GUI method seemed to work at first, but now it is slow again. I put the result of ifconfig in the post.
    • George Udosen
      George Udosen about 7 years
      Now using the configuration on that link you provided try these add to /etc/network/interfaces: address 192.168.0.5, netmask 255.255.255.0, gateway 192.168.0.1, and dns-nameservers 8.8.8.8 8.8.4.4. Please format it like seen in the link you gave. Use nano to edit it: sudo nano/etc/network/interfaces
    • George Udosen
      George Udosen about 7 years
      Please post after you add to that file, so I see its ok.
  • Leif Sabellek
    Leif Sabellek about 7 years
    This seemed to work at first, but after I restarted the computer, it is slow again.
  • Leif Sabellek
    Leif Sabellek about 7 years
    I tried this, but then the network didn't work anymore (ifconfig didn't show eth0 anymore).
  • 50calrevolver
    50calrevolver about 7 years
    What exactly do you mean by slow again? Has the DNS reset to its original value, or it's just an observation you made, that your internet is still slow?
  • fugitive
    fugitive about 7 years
    @LeifSabellek ifup eth0