Today's Posts. Quick Links. Search Forums. Show Threads. Show Posts. See Interaction with netconfig. Uses the Internet Domain Name Service. Typically these entries will be simple, such as "protocols: files" or "networks: files nisplus".
However, when multiple sources are specified, it is sometimes necessary to define precisely the circumstances under which each source will be tried. For each status code, two actions are possible: Action Meaning continue Try the next source in the list.
Lines that are blank, or that start with white space, are ignored. Everything on a line fol- lowing a character is also ignored; the character can begin anywhere in a line, to be used to begin comments. The library functions contain compiled-in default entries that are used if the appropriate entry in nsswitch. The default, or explicitly specified, criteria are meaningless following the last source in an entry; and they are ignored, since the action is always to return to the caller irrespective of the status code the source returns.
This function obtains the system-wide source lookup policy for hosts, ipnodes, and services based on the inet family entries in netconfig 4 and uses the switch entries only if the netconfig entries have a "-" in the last column for nametoaddr libraries. In this case, the clients get much the same results except for getspnam 3C from the "nis" source as from "nisplus"; however, "nisplus" is recommended instead of "nis". When a program needs to access the site by its domain name, the operating system sends a request to the DNS server to find out which IP to forward packets to.
But this is not true always. For example, when we access the localhost domain, the request is always sent to our local computer. The whole reason is file hosts. If you used Windows before, you probably already heard about such a file. There, it was most often used to quickly block access to a resource. But its application is much wider. In this article, we will look at how to configure the hosts file in Linux, as well as what features it provides us. Before we go to the hosts file itself, you need to figure out how to find the IP address for a domain name in Linux.
I said that the operating system immediately sends a request to the DNS server, but this is not quite so. There is a specific search order according to which it is performed. Here we are interested in the line of hosts. It lists the services in order of priority, which are used to find the IP address for the domain name.
This is default configuration. To open it, you can use any text editor both in the command line and in the graphical interface, we only need to open it with superuser privileges.
For example, using vim:. The file syntax is pretty simple. It contains several lines with domain names and IP addresses that you need to use for them. Each of them looks like this:.
0コメント