Results 1 to 4 of 4

Thread: How do I change /etc/resolv.conf file ?

Hybrid View

  1. #1
    Join Date
    Mar 2013
    Beans
    1

    How do I change /etc/resolv.conf file ?

    am using ubuntu 12.04. How do I change /etc/resolv.conf file ? Every time I edit it , it automatically gets reset. If I want to retain changes in the file what needs to be done. when I browsed through internet I found some solutions one of them was adding the nameserver to /etc/resolvconf/resolv.conf.d/head adding the nameserver to /etc/resolvconf/resolv.conf.d/base
    But even after adding the nameserver to above mentioned files and restarting the services , the /etc/resolv.conf automatically gets reset.
    I want to permanently retain changes in /etc/resolv.conf file .

  2. #2
    Join Date
    Mar 2011
    Location
    Germany
    Beans
    330
    Distro
    Ubuntu Mate 18.04 Bionic Beaver

    Re: How do I change /etc/resolv.conf file ?

    Hello, purohit.Edit the file /etc/resolvconf/resolv.conf.d/tail instead. If it does not exist, create it. For further details run
    Code:
    man 8 resolvconf
    Kind regards,Karl
    "I killed her in pure self-defense", said the bear after crushing the mouse. "She threatened my life."
    War (What is it good for)

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How do I change /etc/resolv.conf file ?

    Or you can add a dns-nameservers line to your /etc/network/interfaces file...
    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # External interface
    auto eth0
    iface eth0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.254
        dns-nameservers 192.168.1.254
    Cheesemill

  4. #4
    Join Date
    Mar 2005
    Beans
    211

    Re: How do I change /etc/resolv.conf file ?

    If your interface is configured via DHCP you don't have to enter nameserver addresses anywhere.

    If your interface is configured statically by NetworkManager, use the Connection Editor to enter nameserver addresses.

    If your interface is configured statically by ifupdown, enter the nameserver addresses on a "dns-nameservers" line as Cheesemill suggested.

    Do *not* put "nameserver" lines in any of the files in /etc/resolvconf/resolv.conf.d/ except as a temporary measure.

    The OP wrote:
    > But even after adding the nameserver to above mentioned files and restarting the services ,
    > the /etc/resolv.conf automatically gets reset.

    Sounds as if resolvconf isn't in control of resolv.conf, otherwise the contents of the above mentioned files would show up in resolv.conf. Run "sudo dpkg-reconfigure resolvconf" to recreate the symbolic link /etc/resolv.conf -> ../run/resolvconf/resolv.conf. Are you by any chance using a third-party VPN client program or something like that which futzes directly with the /etc/resolv.conf file?
    Last edited by jdthood; March 20th, 2013 at 10:08 PM.

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
  •