Functionality of ipnodes and hosts in /etc/nsswitch.conf ?

Posted on 2009-04-28
Last Modified: 2013-12-27
Given below entry in /etc/nsswitch.conf file, How the resolving of hostname is functioning here ?
Should I consider,

-> if the entry exists in NIS database then lookup always succeeds
-> if the entry exists in /etc/inet/ipnodes then lookup always succeeds
-> if the entry doesn't exists in NIS database then lookup always fails
-> if the entry does not exist in either NIS or /etc/inet/ipnodes, the lookup always fails ?
#cat /etc/nsswitch.conf


ipnodes: files [NOTFOUND=return]

hosts: nis [NOTFOUND=return] files



bash-3.00# ls -l /etc/hosts 

lrwxrwxrwx   1 root     root          12 May  9  2008 /etc/hosts -> ./inet/hosts

bash-3.00# ls -l /etc/inet/ipnodes 

lrwxrwxrwx   1 root     root           7 May  9  2008 /etc/inet/ipnodes -> ./hosts

bash-3.00# ls -l /etc/inet/hosts   

-r--r--r--   1 root     root        3811 Apr 22 11:10 /etc/inet/hosts

Open in new window

Question by:beer9
    LVL 40

    Expert Comment

    why you put [NOTFOUND=return] in both entries ?
    LVL 22

    Expert Comment

    He didn't put it there. It is in the nsswtich.nis example file.

    I am sorry, but I don't understand your question. Could you clarify what you are asking?

    Author Comment

    If we heave both entry like 'ipnodes' and 'hosts' in nsswitch.conf then what is which file is gets consultant first for the name resolution?
    LVL 22

    Accepted Solution

    It depends on which naming service is in use. If you are using a service that requires ipnodes, then the ipnodes
    linr is used. If you are using a service that requires hosts, then the hosts line is used. It does not use both for any
    one lookup.

    However, when the ipnodes file was removed and replaced with a link to the hosts file, all the services that used
    ipnodes were changed to use hosts as well, so it is very unlikely that the ipnodes line will be used at all. It was
    only left in for backwards compatibility.

    Author Closing Comment

    Thank blu! :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
    In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now