Nsswitch: Name Resolution Service
App->nsswitch->resolve_lib
Libnss
/ETC/NSSWITCH.CONF Master configuration file
# Example:
#passwd: DB Files Nisplus NIS
#shadow: DB Files Nisplus NIS
#group: DB Files Nisplus NIS
Passwd:files
Shadow:files
Group:files
#hosts: DB Files Nisplus NIS DNS
Hosts:files DNS
# Example-obey only what Nisplus tells us ...
#services: Nisplus [Notfound=return] Files
#networks: Nisplus [Notfound=return] Files
#protocols: Nisplus [Notfound=return] Files
#rpc: Nisplus [Notfound=return] Files
#ethers: Nisplus [Notfound=return] Files
#netmasks: Nisplus [Notfound=return] Files
Nisplus return Value:
SUCCESS Service Ok,found name is healthy and goes to a value
NOTFOUND service Ok,name not found normal, name not converted to value
Unavaail Service not available services not found, when Unacaail will find files
Tryagain temporary service failure temporary failure, try again
Bootparams:nisplus [Notfound=return] Files
Ethers:files
Netmasks:files
Networks:files
Protocols:files
Rpc:files
Services:files
Netgroup:nisplus
Publickey:nisplus
Automount:files Nisplus
Aliases:files Nisplus
[Email protected] lib]# Vim/etc/protocols
[Email protected] ~]# vim/etc/services
Name Resolution Service:
Nsswitch call the corresponding library file in/usr/lib to parse
Getent get all entries for a library in Nsswitch
[Email protected] ~]# getent passwd
[Email protected] ~]# getent passwd Root
Root:x:0:0:root:/root:/bin/bash
[Email protected] ~]# Getent hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[[email protected] ~]# getent hosts www.baidu.com first go to the hosts if no more DNS to find
180.97.33.107 www.a.shifen.com www.baidu.com
180.97.33.108 www.a.shifen.com www.baidu.com
This article from "Operation and maintenance Growth Road" blog, declined reprint!
Nsswitch: Name Resolution Service