Results 1 to 2 of 2

Thread: [all variants] HowTo set OpenDNS as DNS in DHCP env

  1. #1
    Join Date
    Oct 2005
    Milano, Italy
    Ubuntu Jaunty Jackalope (testing)

    [all variants] HowTo set OpenDNS as DNS in DHCP env

    Due to the recent vulnerability in the worldwide DNS
    can be useful to change the DNS provided by your provider and use OpenDNS instead.

    Here is described two ways to do it for DHCP users and without touching the router configuration (for users that have a static IP is pretty straightforward).
    The first option change permanently the DNS
    The second option change "when you need" the DNS

    Install a simple editor
    Install Scite to simplify and unify the editing for all *ubuntu distros.
    sudo apt-get install scite
    1) Change DNS permanently
    Edit the dhcp configuration file:
    sudo scite /etc/dhcp3/dhclient.conf
    Add this line at the end and save the file:
    prepend domain-name-servers,;
    Reboot your machine.

    Then try a non-existent url like:
    You should reach an OpenDNS response as search result in the OpenDNS home page... well you are using OpenDNS DNS.

    2 Change DNS when you need
    Create a file in your home:
    scite ~/resolv.conf
    Write the DNS IP of OpenDNS and save it:
    Create a file under /usr/bin
    sudo scite /usr/bin/dnsrenew
    Write the following and save it
    cp ~/resolv.conf /etc/resolv.conf
    /etc/init.d/networking restart
    Then chmod it to create an executable file:
    sudo chmod +x /usr/bin/dnsrenew
    Execute the script:
    sudo dnsrenew
    Then try a non-existent url like:

    Now you can use the DNS provided by OpenDNS till the next reboot.

    The Samba fix with OpenDNS (or external DNS)
    If you are using Samba (as supposed to be) and you are using the DNS of OpenDNS (or any external dns), you must change the configuration of Samba in order to be able to browse your LAN; so, edit your configuration file in this way:
    sudo scite /etc/samba/smb.conf
    and change the line of the name resolver section in this way:
    name resolve order = lmhosts bcast wins host
    Save and close the file
    Then restart Samba:
    sudo /etc/init.d/samba restart
    Wait 10/15 minutes and you are able to browse your LAN with the new DNS.

    I write this little HowTo just to use OpenDNS because I appreciate their service, I'm not involved in OpenDNS team.
    Last edited by dentaku65; August 3rd, 2008 at 04:41 PM.

  2. #2
    Join Date
    Dec 2005
    Ubuntu Development Release

    Re: [all variants] HowTo set OpenDNS as DNS in DHCP env

    Simple and very Concise, thank you.

Tags for this Thread


Posting Permissions

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