(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

Chapter 13. Setting up Name to Address Resolution (DNS)

Whilst we humans like to give names to things, computers really like numbers. On a TCP/IP network (which is what the Internet is), we call machines by a particular name - and every machine lives in a particular domain. For example, my Linux workstation is called archenland and it resides in the interweft.com.au domain. Its human readable address is thus archenland.interweft.com.au (which is known as the FQDN - fully qualified domain name).

However, for this machine to be found by other computers on the Internet, it is actually known by its IP number when computers are communicating across the Internet.

Translating (resolving) machine (and domain) names into the numbers actually used on the Internet is the business of machines that offer the Domain Name Service.

What happens is this:-

  • your machine needs to know the IP address of a particular computer. The application requiring this information asks the 'resolver' on your Linux PC to provide this information;

  • the resolver queries the local host file (/etc/hosts and/or the domain name servers it knows about (the exact behaviour of the resolver is determined by /etc/host.conf);

  • if the answer is found in the host file, this answer is returned;

  • if a domain name server is specified, your PC queries this machine;

  • if the DNS machine already knows the IP number for the required name, it returns it. If it does not, it queries other name servers across the Internet to find the information. The name server than passes this information back to the requesting resolver - which gives the information to the requesting application.

When you make a PPP connection, you need to tell your Linux machine where it can get host name to IP number (address resolution) information so that you can use the machine names but your computer can translate these to the IP numbers it needs to do its work.

One way is to enter every host that you want to talk to into the /etc/hosts file (which is in reality totally impossible if you are connecting to the Internet); another is to use the machine IP numbers as opposed to the names (an impossible memory task for all but the smallest LANs).

The best way is to set up Linux so that it knows where to go to get this name to number information - automatically. This service is provided by the Domain Name Server (DNS) system. All that is necessary is to enter the IP number(s) for the domain name servers into your /etc/resolv.conf file.

13.1. The /etc/resolv.conf file

Your PPP server sysadmin/user support people should provide you with two DNS IP numbers (only one is necessary - but two gives some redundancy in the event of failure).

As previously mentioned, Linux cannot set its name server IP number in the way that MS Windows 95 does. So you must insist (politely) that your ISP provide you with this information!

Your /etc/resolv.conf should look something like :-

domain your.isp.domain.name
nameserver 10.25.0.1
nameserver 10.25.1.2

Edit this file (creating it if necessary) to represent the information that your ISP has provided. It should have ownership and permissions as follows :-

-rw-r--r--   1 root     root           73 Feb 19 01:46 /etc/resolv.conf

If you have already set up a /etc/resolv.conf because you are on a LAN, simply add the IP numbers of the PPP DNS servers to your existing file.