- Network Interface Access
- Name Service and Name Resolver
- Using Graphical Tools to Configure Network Interfaces
- Configuring SLIP and PPP
Name Service and Name Resolver
TCP/IP uses the /etc/hosts file to resolve symbolic names into IP addresses. For example, when you give the name darkstar for a target machine, TCP/IP examines the /etc/hosts file for a machine of that name, then reads its IP address. If the name isn't in the file, you can't send data to it.
Suppose you connect to several different machines. Adding all those entries to the /etc/hosts file can be tiresome and difficult, and maintaining the files as changes occur in the networks can be even more bothersome. On those rare instances where you need to connect to only about a dozen machines, maintaining the /etc/hosts file is all that you need. To solve the general name resolution problem, BIND was developed. BIND (Berkeley Internet Name Domain service) was developed to help resolve the IP addresses of remote machines. BIND was later developed into DNS (Domain Name System). Most Linux distributions implement the BIND version, although a few DNS-specific versions of software are appearing. Both BIND and DNS are complex subjects and involve many details that simply are not of interest to most Linux users. If you already have a DNS server on your network, or if you intend on using an ISP's DNS server, you do not need to configure your machine to run BIND. However, you should at least configure your machine to use a DNS server, because entering host names of all sites that are of interest to you in the /etc/hosts file is a tedious process. The name resolver is the DNS client, and in the case of Linux, is a set of library routines that are called whenever an application needs to resolve a name using DNS. The name resolver is configured using the /etc/resolv.conf file.
Typical contents of this file include a search directive and name server directive. The search directive takes the following form:
search domain1 domain2 domainN
The domain1, domain2, and domainN are replaced by a list of the domain name suffixes the name resolver will append to a hostname that is not in its Fully Qualified Domain Name (FQDN) form. As an example, consider the following search directive:
search xyz.com us.xyz.com europe.xyz.com
If a name such as http://www.abc.com is used, it is in the FQDN form and has a full domain name abc.com suffixed to the host name, http://www. In this case, the search directive is not used. However, if a TCP/IP service uses the name www, it is not in the FQDN form. In this case, the search directive will try to resolve this as first http://www.xyz.com, then http://www.us.xyz.com, and finally http://www.europe.xyz.com. If any of these names is properly resolved, there is no need to search for other names.
The DNS servers the name resolver uses is specified by the nameserver directive:
The IPaddress is the IP address of the DNS server. For example, if the first DNS server has an IP address of 18.104.22.168, then this directive will appear as the following:
Up to three DNS servers can be specified, each with its own nameserver directive on a line by itself. For example, if the second and third DNS servers are 22.214.171.124 and 126.96.36.199, the full set of name server directives would appear as
nameserver 188.8.131.52 nameserver 184.108.40.206 nameserver 220.127.116.11
Combining the full set of search and nameserver directives, the example /etc/resolv.conf will have the following contents:
search xyz.com us.xyz.com europe.xyz.com nameserver 18.104.22.168 nameserver 22.214.171.124 nameserver 126.96.36.199
You can also configure whether the name resolution process will consult the /etc/hosts file first and then DNS, or first DNS and then the /etc/hosts file. This order can be controlled by configuring the /etc/nsswitch.conf file.
For larger systems, or if you want to run the full Internet services available to your Linux machine, you need to configure BIND properly. Luckily, BIND usually has to be configured only once, then it can be ignored. You need the BIND software, which is usually included in the distribution software. The BIND package includes all the files and executables, as well as a copy of the BIND Operator's Guide (BOG) that you can consult for information on how to configure BIND database files.