The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

5.5. Configuring your Name Resolver.

The `Name Resolver' is a part of the linux standard library. Its prime function is to provide a service to convert human-friendly hostnames (like `ftp.funet.fi' ) into machine friendly IP addresses (such as 128.214.248.6).

5.5.1. What's in a name ?

You will probably be familiar with the appearance of Internet host names, but you may not understand how they are constructed or de-constructed. Internet domain names are hierarchical in nature. In other words, they have a tree-like structure. A `domain' is a family, or group, of names. A `domain' may be broken down into a `subdomain'. A `top level domain' is a domain that is not a subdomain. The Top Level Domains are specified in RFC-920. Some examples of the most common top level domains are:

COM

Commercial Organizations

EDU

Educational Organizations

GOV

Government Organizations

MIL

Military Organizations

ORG

Other Organizations

NET

Internet-Related Organizations

Country Designator

These are two- letter codes that represent a particular country.

For historical reasons, most domains belonging to one of the non-country based top level domains were used by organizations within the United States (even though the United States also has its own country code `.us'). This is not true any more for .com and .org domains, which are commonly used by non-us companies.

Each of these top level domains has subdomains. The top level domains based on country name are often next broken down into subdomains based on the com, edu, gov, mil and org domains. So for example you end up with: com.au and gov.au for commercial and government organizations in Australia; note that this is not a general rule, as actual policies depend on the naming authority for each domain.

The next level of division usually represents the name of the organization. Further subdomains vary in nature. Often the next level of subdomain is based on the departmental structure of the organization. It can, however, be based on any criterion considered reasonable and meaningful by the network administrators of the organization.

The very left-most portion of the name is always the unique name assigned to the host machine. It is called the `hostname'. The portion of the name to the right of the hostname is called the `domainname' and the complete name is called the `Fully Qualified Domain Name'.

To use Terrys host as an example, the fully qualified domain name is `perf.no.itg.telstra.com.au'. This means that the host name is `perf' and the domain name is `no.itg.telstra.com.au'. The domain name is based on a top level domain (based on his country Australia). And since his email address belongs to a commercial organization, `.com' is positioned as the next level domain. The name of the company is (was) `Telstra' . Their internal naming structure is based on organizational structure. In this case, the machine belongs to the Information Technology Group (Network Operations section).

Usually, the names are much shorter. For example, my ISP is called ``systemy.it'' . My non-profit organization is called ``linux.it'', without any com and org subdomain. My own host is just called ``morgana.systemy.it'' : rubini@linux.it is a valid email address. Note that the owner of a domain has the rights to register hostnames as well as subdomains. For example, the LUG I belongs to uses the domain pluto.linux.it, because the owners of linux.it agreed to open a subdomain for the LUG.

5.5.2. What information you will need.

You will need to know what domain your hosts name will belong to. The name resolver software provides this name translation service by making requests to a `Domain Name Server'. You will need to know the IP address of a local name server that you can use.

There are three files you need to edit. I'll cover each of these in turn.

5.5.3. /etc/resolv.conf

The /etc/resolv.conf is the main configuration file for the name resolver code. Its format is quite simple. It is a text file that has one keyword per line. There are three keywords typically used by the file. These keywords are:

domain

This keyword specifies the local domain name.

search

This keyword specifies a list of alternate domain names to search for a hostname

name server

This keyword, which may be used many times, specifies an IP address of a domain name server to query when resolving names

An example /etc/resolv.conf might look something like:

	domain maths.wu.edu.au
	search maths.wu.edu.au wu.edu.au
	name server 192.168.10.1
	name server 192.168.12.1

This example specifies that the default domain name to append to unqualified names (ie hostnames supplied without a domain) is maths.wu.edu.au . If the host is not found in that domain, it will also try the wu.edu.au domain directly. Two name server entries are supplied. These entries may be called upon by the name resolver code to resolve the name.

5.5.4. /etc/host.conf

The /etc/host.conf file is where you configure some items that govern the behavior of the name resolver code. The format of this file is described in detail in the `resolv+' man page. In nearly all circumstances, the following example will work for you:

	order hosts,bind
	multi on

This configuration tells the name resolver to check the /etc/hosts file before attempting to query a name server. It also tells the resolver to return all valid addresses for a host found in the /etc/hosts file (instead of just the first address).

5.5.5. /etc/hosts

The /etc/hosts file is where you put the name and IP address of local hosts. If you place a host in this file, then you do not need to query the domain name server to get its IP Address. The disadvantage of doing this is that if the IP address for that host changes, you must keep this file up to date yourself . In a well managed system, the only hostnames that usually appear in this file are an entry for the loopback interface, and also the local hosts name.

	# /etc/hosts
	127.0.0.1      localhost loopback
	192.168.0.1    this.host.name

You may specify more than one host name per line (as demonstrated by the first entry), which is a standard entry for the loopback interface.

5.5.6. Running a name server

If you want to run a local name server, you can do it easily. Please refer to the DNS-HOWTO and to any documents included in your version of BIND (Berkeley Internet Name Domain).




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру