Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Changing DNS in Ubuntu 12.10 and 12.04

  1. #1
    Join Date
    Nov 2009
    Location
    Kentucky
    Beans
    220
    Distro
    Xubuntu

    Smile Changing DNS in Ubuntu 12.10 and 12.04

    Okay so I was in the process of making Firefox perform Google searches from the address bar and realised that I was being redirected to my ISP's page not found screen. This I determined was because of the DNS that was set by default in Ubuntu to 127.0.1.1 or 127.0.0.1. I went to change this to Googles DNS 8.8.8.8 and 8.8.4.4. To do this in previous releases
    Code:
     gksudo gedit /etc/resolv.conf
    Change this:
    Code:
    nameserver 127.0.1.1
    to this:
    Code:
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    This no longer works in Ubuntu 12.10 maybe not 12.04 either the only way that I found around this was to:
    Code:
     gksudo gedit /etc/resolvconf/resolv.conf.d/head
    and to add this:
    Code:
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    at the bottom. Then run this code to update the resolv.conf file
    Code:
     sudo resolvconf -u
    If there is a better way to do this please let me know as I am sure others would appreciate it was well.
    "I am what I am because of who we all are." - Leymah Gbowee

  2. #2
    Join Date
    Mar 2005
    Beans
    211

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    The recommended way of configuring DNS is to add nameserver addresses and search domain names via your interface configurer: ifup or NetworkManager.

    If you are using ifup, edit /etc/network/interfaces. If you have, for example, one interface eth0 over which you can access nameservers with addresses 1.2.3.4 and 5.6.7.8, add a "dns-nameservers" option such that the stanza looks like the following.
    auto eth0
    iface eth0 inet static
    address ...
    netmask ...
    gateway ...
    dns-nameservers 1.2.3.4 5.6.7.8
    If the interface is configured using the dhcp method then you can still add the dns-nameservers option but the addresses received from the DHCP server take precedence. It is possible to change this by editing the /etc/resolvconf/interface-order configuration file.

    If you are using NetworkManager, enter the addresses in the field network-indicator | Edit Connections... | <connection-name> | Edit... | IPv4 Settings | Additional DNS Servers. If you don't want to use the DHCP-supplied nameserver addresses then on the same tab change the Method from "Automatic (DHCP)" to "Automatic (DHCP) addresses only".

  3. #3
    Join Date
    Nov 2009
    Location
    Kentucky
    Beans
    220
    Distro
    Xubuntu

    Talking Re: Changing DNS in Ubuntu 12.10 and 12.04

    Quote Originally Posted by jdthood View Post
    The recommended way of configuring DNS is to add nameserver addresses and search domain names via your interface configurer: ifup or NetworkManager.

    If you are using ifup, edit /etc/network/interfaces. If you have, for example, one interface eth0 over which you can access nameservers with addresses 1.2.3.4 and 5.6.7.8, add a "dns-nameservers" option such that the stanza looks like the following.
    auto eth0
    iface eth0 inet static
    address ...
    netmask ...
    gateway ...
    dns-nameservers 1.2.3.4 5.6.7.8
    If the interface is configured using the dhcp method then you can still add the dns-nameservers option but the addresses received from the DHCP server take precedence. It is possible to change this by editing the /etc/resolvconf/interface-order configuration file.

    If you are using NetworkManager, enter the addresses in the field network-indicator | Edit Connections... | <connection-name> | Edit... | IPv4 Settings | Additional DNS Servers. If you don't want to use the DHCP-supplied nameserver addresses then on the same tab change the Method from "Automatic (DHCP)" to "Automatic (DHCP) addresses only".
    Awesome I will give that a try thanks for the reply hope it helps others. sounds much simpler lol.
    "I am what I am because of who we all are." - Leymah Gbowee

  4. #4
    Join Date
    Nov 2009
    Location
    Kentucky
    Beans
    220
    Distro
    Xubuntu

    Smile Re: Changing DNS in Ubuntu 12.10 and 12.04

    Well today I was at school using my laptop with the provided google DNS and it was set up with the method that I first mentioned. I could not access my schools home page and I was not sure why.

    I though back to what I had changed recently and the only thing was the DNS. I change all the settings back to default and then set up the DNS with the method in the second post and all worked good. So method two is a better choice.

    I believe that method one will work in a home network and with a desktop that is set on the same ISP at all times. Any other computer should probably use the second method.
    "I am what I am because of who we all are." - Leymah Gbowee

  5. #5
    Join Date
    Oct 2009
    Location
    Surabaya, Indonesia
    Beans
    19
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    Last night same problems happened to me. The network manager, connection information showed the DNS addresses but still the browser unable to show the pages. So I add the nameservers in /etc/resolvconf/resolv.cond.d/base. And it works. In my understanding that /etc/resolv.conf is not manually configured again but it is driven by resolvconf.

    I tried the second post way with change the eth0 to wlan0 (I use wireless network) and it make my wireless won't work. It seem the second post way is only for cable network. So may it helps other with wireless network

  6. #6
    Join Date
    Mar 2005
    Beans
    211

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    When using NetworkManager to configure interfaces the correct way to add nameserver addresses is not to put them in /etc/resolvconf/resolv.conf.d/base but to enter them into the field Edit Connections | <connection-name> | Edit... | IPv4 Settings | Additional DNS servers.

  7. #7

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    Quote Originally Posted by w1ll1am View Post
    I though back to what I had changed recently and the only thing was the DNS. I change all the settings back to default and then set up the DNS with the method in the second post and all worked good. So method two is a better choice.

    I believe that method one will work in a home network and with a desktop that is set on the same ISP at all times. Any other computer should probably use the second method.
    Method two doesn't work. What you have done is removing the DNS from your wireless connection and then added them to you wired connection. So even without step two and a clean setup you are able to reach you schools home page because they give you a DNS when you connect to their network.

  8. #8

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    Code:
     gksudo gedit /etc/resolvconf/resolv.conf.d/head
    and to add this:

    What about this line in this file?

    Code:
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

  9. #9

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    This should be the right way to change the DNS servers without loosing the dnsmaq functionality, making it global for all you connections through dhcp and keeping NetworkManager aware of which DNS servers are you using.

    Editing the file
    Code:
    sudo gedit /etc/dhcp/dhclient.conf
    Adding your DNS(s) server(s) here.
    Code:
    prepend domain-name-servers x.x.x.x, y.y.y.y;
    Source:

    http://askubuntu.com/questions/13045...ia-resolv-conf

  10. #10
    Join Date
    Mar 2005
    Beans
    211

    Re: Changing DNS in Ubuntu 12.10 and 12.04

    Adding
    Code:
    prepend domain-name-servers x.x.x.x, y.y.y.y;
    to /etc/dhcp/dhclient.conf is one of several possible ways to add nameserver addresses. This way causes x.x.x.x and y.y.y.y always to be prepended to the list of DHCP-obtained nameserver addresses, no matter what the network. If you only ever connect to one network then that's fine, otherwise it's less than ideal.

    If you connect to different networks then it's better to use the features of either NetworkManager of ifupdown that support different configurations for different networks. In the NetworkManager case you use the Connection Editor to define multiple "connections"; for each connection you can enter nameserver addresses in the "Additional DNS Servers" field as I described earlier. In the ifupdown case you define multiple "logical interfaces" in /etc/network/interfaces; in each iface stanza you can enter nameserver addresses on a "dns-nameservers" line as I described earlier.

    Cheers!

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •