Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Does DNS resolving for subdomains go through the main domain?

    In other words, if I put in my 'hosts', would or would not be still accessible?


  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Yes, but for different reasons than you probably think.

    /etc/hosts can only resolve hosts, as the name indicates. Not domains.

    But /etc/host.conf (by default) has
    order hosts,bind
    which tells the resolver library to first look into /etc/hosts, then query nameserver(s).

    So, the request doesnt "go through" in a sense that /etc/hosts would be responsible for the domain. It just gets asked first.

    That said, it is usually the better approach to keep all data in one place.
    In this case the dns server config.
    You must always face the curtain with a bow.

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    The Keystone State
    Simple answer is yes as the entries in the HOSTS file must match exactly. Using your example, would match while everything else would not and the query would be sent to the DNS server.


    The adventure of a life time.

    Linux User #296285
    Get Counted

  4. $spacer_open
  5. #4
    Thank you for the responses. So the optimization I was hoping to achieve here* actually won't work? Oh well, Android phones will have to handle the whole list then. I appreciate your help.

    * It won't even let me post a link to another thread on this forum. The thread can be found at www linuxforums org/forum/newbie/182630-filtering-out-lines-based-substrings.html#post860635 do note the missing dots in the site address.

Posting Permissions

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