25.3 Name Resolution in a Pure UNIXLinux World

25.3 Name Resolution in a Pure UNIX/Linux World

The key configuration files covered in this section are:

  • /etc/ hosts

  • /etc/resolv.conf

  • /etc/host.conf

  • /etc/nsswitch.conf

25.3.1 /etc/hosts

This file contains a static list of IP addresses and names . localhost localhost.localdomain bigbox.quenya.org bigbox alias4box 

The purpose of /etc/hosts is to provide a name resolution mechanism so users do not need to remember IP addresses.

Network packets that are sent over the physical network transport layer communicate not via IP addresses but rather using the Media Access Control address, or MAC address. IP addresses are currently 32 bits in length and are typically presented as four (4) decimal numbers that are separated by a dot (or period). For example,

MAC Addresses use 48 bits (or 6 bytes) and are typically represented as two-digit hexadecimal numbers separated by colons: 40:8e:0a:12:34:56.

Every network interface must have a MAC address. Associated with a MAC address may be one or more IP addresses. There is no relationship between an IP address and a MAC address; all such assignments are arbitrary or discretionary in nature. At the most basic level, all network communications take place using MAC addressing. Since MAC addresses must be globally unique and generally remain fixed for any particular interface, the assignment of an IP address makes sense from a network management perspective. More than one IP address can be assigned per MAC address. One address must be the primary IP address ” this is the address that will be returned in the ARP reply.

When a user or a process wants to communicate with another machine, the protocol implementation ensures that the " machine name " or " host name " is resolved to an IP address in a manner that is controlled by the TCP/IP configuration control files. The file /etc/hosts is one such file.

When the IP address of the destination interface has been determined, a protocol called ARP/RARP is used to identify the MAC address of the target interface. ARP stands for Address Resolution Protocol and is a broadcast-oriented method that uses User Datagram Protocol (UDP) to send a request to all interfaces on the local network segment using the all 1s MAC address. Network interfaces are programmed to respond to two MAC addresses only; their own unique address and the address ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will contain the MAC address and the primary IP address for each interface.

The /etc/hosts file is foundational to all UNIX/Linux TCP/IP installations and as a minimum will contain the localhost and local network interface IP addresses and the primary names by which they are known within the local machine. This file helps to prime the pump so a basic level of name resolution can exist before any other method of name resolution becomes available.

25.3.2 /etc/resolv.conf

This file tells the name resolution libraries:

  • The name of the domain to which the machine belongs.

  • The name(s) of any domains that should be automatically searched when trying to resolve unqualified host names to their IP address.

  • The name or IP address of available Domain Name Servers that may be asked to perform name-to-address translation lookups.

25.3.3 /etc/host.conf

/etc/host.conf is the primary means by which the setting in /etc/resolv.conf may be effected. It is a critical configuration file. This file controls the order by which name resolution may proceed. The typical structure is:

 order hosts,bind multi on 

then both addresses should be returned. Please refer to the man page for host.conf for further details.

25.3.4 /etc/nsswitch.conf

This file controls the actual name resolution targets. The file typically has resolver object specifications as follows :

 # /etc/nsswitch.conf # # Name Service Switch configuration file. # passwd: compat # Alternative entries for password authentication are: # passwd: compat files nis ldap winbind shadow: compat group : compat hosts: files nis dns # Alternative entries for host name resolution are: # hosts: files dns nis nis+ hesiod db compat ldap wins networks: nis files dns ethers: nis files protocols: nis files rpc: nis files services: nis files 

Of course, each of these mechanisms requires that the appropriate facilities and/or services are correctly configured.

It should be noted that unless a network request/message must be sent, TCP/IP networks are silent. All TCP/IP communications assume a principal of speaking only when necessary.

Starting with version 2.2.0, Samba has Linux support for extensions to the name service switch infrastructure so Linux clients will be able to obtain resolution of MS Windows NetBIOS names to IP Addresses. To gain this functionality, Samba needs to be compiled with appropriate arguments to the make command (i.e., make nsswitch/libnss_wins.so ). The resulting library should then be installed in the /lib directory and the wins parameter needs to be added to the " hosts: " line in the /etc/nsswitch.conf file. At this point, it will be possible to ping any MS Windows machine by its NetBIOS machine name, as long as that machine is within the workgroup to which both the Samba machine and the MS Windows machine belong.

Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net