Network Configuration
◾
493
DNS name servers generally come in two forms,
authorities
and
caches
. An authority
is responsible for its own domain. This means that for each domain, there will be at least
one authoritative DNS server that contains information about that domain. Other DNS
servers can cache information about domains outside of their own. Thus, your local
DNS server may know how to find a domain such as nku.edu. If not, then it will know
of a DNS server to communicate with one that will either
know of the domain or know
of another DNS server to hand the request onto. Typically, a specific resource’s address
will only be stored in an authoritative DNS server’s table. But the domain information
itself should be known elsewhere.
As an example, you want to reach www.nku.edu. The domain is nku.edu. While
your local DNS server may not know nku.edu, it knows of a DNS server that does. Your
request goes to that DNS server that responds with the IP address for the DNS server
for nku.edu. Now, your request for www.nku.edu goes to that DNS server that knows
about the specific machine www. In its DNS table is a mapping of www to the IP address.
This address is sent back to your computer and finally, you have the IP address needed
to communicate with the computer www.nku.edu. While this seems complicated, the
actual amount of time that this operation might take will typically be a few seconds or
less, probably less than a second. Further, this entire interaction happens transparently
for the user.
To
establish proper communication, you will have to set up a table that indicates the
location of your DNS server(s). In Linux, these IP addresses are placed in the file
/etc/
resolv.conf
. We will look at setting up a DNS server in Linux using the bind program
in Chapter 15 (available at http://www.crcpress.com/product/isbn/9781482235890).
If there are machines whose IP addresses are static and which you communicate with
often, you may wish to bypass the entire DNS address-translation process. In Linux, you
can set up your own mapping information in the file
/etc/hosts
. Before any name reso-
lution
is attempted, Linux first examines the hosts file to see if there any entries that match
the request. Entries in this file are denoted as ip address followed by host name(s).
Let us consider a local server with a static IP address called
ourserver.internal-
net.com
. The organization has aliased this machine to the name
internalserver.
com
. As we might contact this server frequently and since it has an IP address, this server
seems a useful target for inclusion in the /etc/hosts file to reduce the amount of traffic for
our DNS servers. If the IP address is 10.11.12.13, we could add this entry to /etc/hosts.
10.11.12.13 ourserver.internalnet.com internalserver.com
What else do you have to do to establish how your computer communicates on a net-
work? First, your computer needs an IP address. This is discussed in Section 12.4. Second,
you need for your computer to respond to incoming messages. The network service needs
to be running, and this is discussed in Section 12.3. You may
also wish to protect your
computer so that incoming messages are scrutinized first. We use a firewall for this. The
Linux firewall is discussed in Section 12.6. Third, you need to establish your interface(s) to
the network. We also discuss this in Section 12.3.
494
◾
Linux with Operating System Concepts
12.3 NETWORK SERVICES AND FILES
The primary network services are all controlled by script files stored under /etc/init.d as
are most of the important services in Linux (refer back to Chapter 11). The services them-
selves are typically found under /usr/sbin. Many of the network services can be thought of
as umbrella services in that other services call upon them to help fulfill their tasks. Other
supporting scripts for network services are found under /etc/sysconfig and /etc/sysconfig/
network-scripts.
12.3.1 The Network Service
The network service is used to start or stop network communication. If this service is not
running, then you are unable to communicate over the network. Even lo (the loopback
device over 127.0.0.1) is unreachable. Unless you wish your computer
to serve as a stand-
alone machine, you will want your network service running in all situations except when
you are working on the network (changing interface devices or altering some network con-
figuration). All other services related to the network rely on network running. Thus, if you
stop network, services such as netconsole, httpd, iptables, autofs, ntpd, and dnsmasq are
useless even if they are running.
When you start the network service through the controlling script (from /etc/
init.d), it first executes the script
/etc/init.d/functions
which contains numer-
ous script functions that support other scripts. It then executes the script
/etc/sys-
config/network
to establish two environment variables:
NETWORKING
=
yes
and
HOSTNAME
=
Do'stlaringiz bilan baham: