Results 1 to 9 of 9

Thread: Default dns search terms that are used across all network interfaces?

  1. #1
    Join Date
    Mar 2008
    Beans
    17

    Question Default dns search terms that are used across all network interfaces?

    I'm running a mixed bag of xubuntu 12.04, ubuntu 12.04, and mythbuntu 13.04. What I want is for a set of DNS search terms, (e.g. splunge.company.org,company.org,something.else.com ,etc.org) to be used no matter what interface I bring up, static or DHCP. What config file(s) do I have to touch, and how, to get my systems to do this?

  2. #2
    Join Date
    Oct 2005
    Location
    Milano, Italy
    Beans
    871
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Default dns search terms that are used across all network interfaces?

    If I understood well your question, you're try to configure multiple suffix of your machine. As far as I know you must use resolv.conf file.
    But you must first remove the actual symlink create by network-manager daemon:
    Code:
    sudo rm /etc/resolv.conf
    And create a personalized resolv.conf file:
    Code:
    sudo nano /etc/resolv.conf
    Then configure it properly:
    nameserver x.x.x.x
    nameserver y.y.y.y
    search yourdomain.com
    search yourotherdomain.com
    search anotheryourdomain.com
    Reboot.
    ------------------------------------------------
    yep ”short and long URL„
    http://yep.it/
    ------------------------------------------------

  3. #3
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    13,006
    Distro
    Kubuntu Development Release

    Re: Default dns search terms that are used across all network interfaces?

    That approach won't work on machines running 12.04 or later because of changes to how name resolution is handled.

    For static IPs, you need to add a "dns-search" entry in the appropriate stanza in /etc/network/interfaces. This is also the method to specify DNS server addresses.

    Code:
    auto eth0
    iface eth0 inet static
            address 192.168.1.1
            netmask 255.255.255.0
            network 192.168.0.0
            broadcast 192.168.1.255
            gateway 192.168.1.1
            dns-nameservers 10.10.10.10 10.10.10.11
            dns-search example.com example.net
    For machines that get their information from DHCP you need to add the relevant search list to your router or other DHCP server.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  4. #4
    Join Date
    Oct 2005
    Location
    Milano, Italy
    Beans
    871
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Default dns search terms that are used across all network interfaces?

    Quote Originally Posted by SeijiSensei View Post
    ...

    For machines that get their information from DHCP you need to add the relevant search list to your router or other DHCP server.
    Hi,
    I've discovered that the prepend domain-name-servers option inside /etc/dhcp/dhclient.conf are ignored on my box
    I supposed for some type of configuration of dnsmasq in network-manager daemon; my ADSL provider do not allow me to change DNS on router and the only way to change the dns entries on dhcp connection is the one that I reported above; in fact if I set OpenDNS DNS as prepend domain-name-servers and I make some typo in the browser address bar, the error page cames from my adsl provider and not from OpenDNS service; deleting the symlink /etc/resolv.conf and create a new file with persoalized entries everything works.

    Xubuntu Quantal
    ------------------------------------------------
    yep ”short and long URL„
    http://yep.it/
    ------------------------------------------------

  5. #5
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    13,006
    Distro
    Kubuntu Development Release

    Re: Default dns search terms that are used across all network interfaces?

    Unless you did major surgery on your system like removing resolvconf, or you made /etc/resolv.conf "immutable" (not just read-only), those changes should not survive a reboot. On any Ubuntu distribution starting with 12.04, the default resolv.conf reads:

    Code:
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    (The nameserver address may be 127.0.0.1 in some versions.)

    The business about getting back a page from your ISP if you mistype a name means the ISP is intercepting all port 53 queries and pushing them through its server so it can show you ads when you make mistakes.

    See if you can actually resolve names against a remote DNS server like this:

    Code:
    host ubuntuforums.com 8.8.8.8
    That should return
    Code:
    Using domain server:
    Name: 8.8.8.8
    Address: 8.8.8.8#53
    Aliases: 
    
    ubuntuforums.com has address 91.189.94.12
    Now try a name like "ubuntuforumz.com". What happens? The last line should read:
    Code:
    Host ubuntuforumz.com not found: 3(NXDOMAIN)
    Last edited by SeijiSensei; June 25th, 2013 at 09:50 PM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  6. #6
    Join Date
    Oct 2005
    Location
    Milano, Italy
    Beans
    871
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Default dns search terms that are used across all network interfaces?

    Quote Originally Posted by SeijiSensei View Post
    Unless you did major surgery on your system like removing resolvconf, or you made /etc/resolv.conf "immutable" (not just read-only), those changes should not survive a reboot. On any Ubuntu distribution starting with 12.04, the default resolv.conf reads:

    Code:
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    e
    (The nameserver address may be 127.0.0.1 in some versions.)
    The changes will not survive the reboot if you make modification of the file /etc/resolv.conf (symlink from /run/resolvconf/resolv.conf); but if you delete the /etc/resov.conf and create a new file /etc/resol.conf with desired configuration, will not be modified on the next reboots... at least on my box.

    The business about getting back a page from your ISP if you mistype a name means the ISP is intercepting all port 53 queries and pushing them through its server so it can show you ads when you make mistakes.
    This happens if I maintain the symlink described above even with the personalized prepend domain-name-servers in dhcp.conf; in fact with the symlink if I do "nslookup ubuntuforums.com" I get:
    Code:
    Server:		127.0.1.1
    Address:	127.0.1.1#53
    
    Non-authoritative answer:
    Name:	ubuntuforums.com
    Address: 91.189.94.12
    This response is given (I supposed) by dnsmasq. As I said creating the personalized /etc/resolv.conf with google dns and execute "nslookup ubuntuforums.com" I get:
    Code:
    Server:		8.8.8.8
    Address:	8.8.8.8#53
    
    Non-authoritative answer:
    Name:	ubuntuforums.com
    Address: 91.189.94.12
    This setting will bypass the intercepting all queries on port 53 by my ISP
    ------------------------------------------------
    yep ”short and long URL„
    http://yep.it/
    ------------------------------------------------

  7. #7
    Join Date
    Mar 2005
    Beans
    211

    Re: Default dns search terms that are used across all network interfaces?

    Quote Originally Posted by mrz80 View Post
    What I want is for a set of DNS search terms, (e.g. splunge.company.org, company.org, something.else.com, etc.org) to be used no matter what interface I bring up, static or DHCP. What config file(s) do I have to touch, and how, to get my systems to do this?
    In general you need different DNS search domains for different networks. Likewise, for different networks your machine needs to use different DNS nameserver addresses. That is why, in Ubuntu 12.04 and later, DNS is configured dynamically just as the network interface itself is configured dynamically. So DNS information is now entered into the logical interface definition in /etc/network/interfaces (on Ubuntu Server, where ifup is used for network configuration) or into the connection definition (on Ubuntu Desktop where NetworkManager is used).

    So the official answer to your question is that you need to add "dns-search" options with the desired domain names to /etc/network/interfaces on your Ubuntu Server 12.04+ machines. On your Ubuntu Desktop 12.04+ machines you put the same domain names in the field Edit Connections... | Edit... | IPv4 Settings | Additional search domains.

    Keep in mind that you can have no more than six domain names on the search list. See resolv.conf(5).

    A quick way to set the search list, e.g., "foo bar baz", on an Ubuntu 12.04+ machine is to add a "search foo bar baz" line to /etc/resolvconf/resolv.conf.d/base. The domain names listed there will always be included in the search list, even when all network interfaces are deconfigured. Additional domain names can still be added to the list when interfaces are configured.

    --
    Thomas Hood

  8. #8
    Join Date
    Mar 2005
    Beans
    211

    Re: Default dns search terms that are used across all network interfaces?

    Quote Originally Posted by dentaku65 View Post
    Then configure it properly:
    Code:
    nameserver x.x.x.x
    nameserver y.y.y.y
    search yourdomain.com
    search yourotherdomain.com 
    search anotheryourdomain.com
    On Ubuntu 12.04 or later you do not normally edit /etc/resolv.conf directly. /etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf which is a file dynamically generated by the resolvconf utility.

    Second, your example will not work because it does not have the correct syntax. The resolver only recognizes the last "search" or "domain" option included in the file.

    (Because of this, if you want to override the search path unconditionally on a resolvconf system so that the path is always exactly "foo bar baz" then you include the line "search foo bar baz" in /etc/resolvconf/resolv.conf.d/tail.)
    --
    Thomas Hood

  9. #9
    Join Date
    Oct 2005
    Location
    Milano, Italy
    Beans
    871
    Distro
    Ubuntu Jaunty Jackalope (testing)

    Re: Default dns search terms that are used across all network interfaces?

    Quote Originally Posted by jdthood View Post
    On Ubuntu 12.04 or later you do not normally edit /etc/resolv.conf directly. /etc/resolv.conf is a symbolic link to /run/resolvconf/resolv.conf which is a file dynamically generated by the resolvconf utility.

    Second, your example will not work because it does not have the correct syntax. The resolver only recognizes the last "search" or "domain" option included in the file.

    (Because of this, if you want to override the search path unconditionally on a resolvconf system so that the path is always exactly "foo bar baz" then you include the line "search foo bar baz" in /etc/resolvconf/resolv.conf.d/tail.)
    --
    Thomas Hood
    Hi,
    as I wrote on my post above I do not edit/modify the actual /etc/resolv.conf but I delete it and create new one with my settings; for the search content perhaps will be managed better in this way:
    Code:
    nameserver x.x.x.x
    nameserver y.y.y.y
    search 1dom.com 2dom.com 3dom.com 4dom.com
    Last edited by dentaku65; June 26th, 2013 at 10:03 AM. Reason: wrong info
    ------------------------------------------------
    yep ”short and long URL„
    http://yep.it/
    ------------------------------------------------

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
  •