<<

. 29
( 69 .)



>>

ou can look up an IP address to verify that you can
when systems are on the same network and when they are
reach a system over the Internet. The command you
not. When the network portions of two IP addresses are
use to look up an address is nslookup. To use this
different, the systems are not on the same network. The
command effectively, you need to know about IP addresses
default router is a system on the local network that
and name translation.
forwards communications to remote systems ” systems not
on the local network.
A local area network might, for example, include all of the
IP addresses between 128.2.10.1 and 128.2.10.254. On such
While all of these addresses are essential for network
a network, an address such as 128.2.10.13 functions much
connections, it is more convenient to use fully qualified
like a street address.
domain names such as www.apple.com to communicate on
the Internet instead of IP addresses such as 17.254.0.91. For
A subnet mask is a value of the form 255.255.255.0 that
this to be possible, you need to use a service that translates
numerically marks the dividing line between the portion of
names into IP addresses and vice versa. The service that
an IP address that identifies the network and the portion
translates between domain names and IP addresses is called
that identifies a particular system or host. When a netmask
the Domain Name System and is generally referred to as
contains only values of 255 and 0, this dividing line is easy
DNS. The nslookup command allows you to make use of
to determine ” it is the point at which the values change
DNS services on the command line.
from 255 to 0. If the network portion of an address were
the street, the host portion of the address would be the




LOOK UP AN INTERNET ADDRESS




– The screen displays the – The screen displays the IP
¤ Type a fully qualified host
Note: You must be connected to the
Internet for this task. name and/or address of the name and press Return. address for that URL.
DNS server servicing your
„ In the Terminal window, system.
type nslookup and press
Return.
136
10
WORK WITH INTERNET COMMANDS

You can only use the Internet effectively if your system makes use of DNS.
Servers are able to resolve domain names into IP addresses and IP addresses
back into domain names only because records containing this information
have been established and made available through the distributed lookup
service known as DNS. If DNS records have not been established for a
system, you will only be able to locate that system over the Internet if you
know its IP address. A system that DNS knows about is said to be registered.
No DNS server knows about every system that is registered. Instead, each
knows about locally registered systems for which it is said to be
authoritative. However, DNS servers also know how to communicate with
other DNS servers, so that lookup requests can be answered regardless of
how remote the system and the DNS server might be.
Although few users are aware of the activity of DNS, they use the service
every time they make a connection to a remote system or browse to a Web
site. To examine where your system looks for DNS services, use the cat
command to display the file /etc/resolv.conf where this information is stored.


RESULT:
TYPE THIS:
[ferro:˜] cat /etc/resolv.conf
The content of the resolv.conf file
showing DNS configuration data
is displayed.




– The screen displays the – Your nslookup session
‹ Type the returned IP › Type exit and press
address and press Return. domain name of the IP Return. terminates.
address you entered.



137
UNIX FOR MAC


LOOK UP DOMAIN INFORMATION
server's zone of authority ” what information it can vouch

Y
ou can gather quite a bit of information about a
for ” and usually provides a point of contact. It also
domain by using the nslookup or the whois
contains the serial number and information about when
commands. These commands provide information
zone information expires.
that can be helpful if you want to know how to reach
someone responsible for a domain. Such information can
The DNS mail exchanger (MX) record identifies the mail
also be useful in troubleshooting.
servers for the domain. These records determine which
systems are contacted when another system needs to deliver
The primary function of DNS is to return IP addresses
e-mail to someone with an address at that domain. You can
in exchange for fully qualified domain names such as
also get this information using the nslookup command.
www.apple.com. The secondary function is to return fully
qualified domain names in exchange for IP addresses.
The whois command looks up information in the Network
These, however, are only the most obvious services that
Information Center (NIC) database. This information
DNS provides to the systems that use the service around
includes the registrar and the name servers responsible for
the clock and around the globe. DNS also provides several
the registration. If you are curious about a domain that has
other useful functions. For example, DNS maintains and can
a name similar to your own or you want to determine
provide information about a domain and its registration.
whether you can buy it, the whois command will provide
you with some basic information.
You can retrieve information about a domain by requesting
the statement of authority (SOA) record with the nslookup
command. The SOA record includes a statement about the

LOOK UP DOMAIN INFORMATION




– The screen displays the
¤ Type the name of a
Note: You must be connected to the
Internet for this task. domain and press Return. NIC information for the
specified domain.
„ Type whois followed by a
space.




138
10
WORK WITH INTERNET COMMANDS



DNS records include those defined in the table below.

RECORD TYPE FUNCTION
Maps a domain name to an IP address
A
Provides an alternate name or alias for a system
CNAME
Maps an IP address to a domain name
PTR
Identifies a mail exchanger for a domain
MX
Provides information about the domain as a whole
SOA

There is not necessarily a one-to-one correspondence between fully
qualified domain names and IP addresses. A single fully qualified
domain name can resolve into multiple IP addresses. This indicates that
connections to these systems are being distributed in such a way that
each system in the set is responding to a share of the overall traffic.
A single system may have virtually any number of fully qualified domain
names, and this is, in fact, often the case with ISPs that provide Web site
support for hundreds or thousands of customers. For this to work, each
of these domain names must resolve to the same IP address.




– The screen displays the
‹ Type nslookup and press ˇ Type a domain name and Á Type set querytype=MX
Return. press Return. and press Return. MX records for the specified
domain.
– The screen displays the
› Type set querytype=SOA ‡ Type a domain name and
and press Return. SOA record for the specified press Return.
domain.



139
UNIX FOR MAC


EXAMINE YOUR NETWORK CONNECTION
Both network connections serve an important function and

V
iewing network connection information is especially
you can examine both with the ifconfig command. The
helpful when you are troubleshooting connection
ifconfig ” interface configuration ” command provides
problems. For example, you can check if your network
information on the network interfaces established on a
connection is running or determine your netmask with the
system. This information includes what addresses are
ifconfig command. You can examine your network
assigned to each interface and whether the network interface
connections, view the state of your network interfaces,
is operational. The ifconfig command also displays the
determine what connections are established, and form an
subnet mask associated with your network connection. This
idea of how well your network connections are performing.
information is critical to proper functioning on a network,
both for proper functioning on the local network and the
All networked Unix systems have at least two network
ability to communicate over the Internet.
connections. One is the normal connection associated
with the network adaptor and used to communicate with
Another informative command for examining your network
other systems. The other is called a loopback and provides
connections is netstat. This command provides a listing
the means for a system to use network protocols while
of your routing table ” a table used in directing network
communicating with itself. The loopback address is
traffic ” and details about current network connections as
associated with the same IP address on every Unix system.
well as network statistics that provide insight about how
That address is 127.0.0.1. The normal or network IP address
well your network connection is working. This includes how
is different on every system and, if dynamically assigned,
busy your network interface is and what types of traffic
might also be different each time a system connects to
your system is handling.
the network.

EXAMINE YOUR NETWORK CONNECTION




– The loopback interface, ¤ Type -rn and press Return.
USING IFCONFIG USING NETSTAT
dial-up IP address, and
„ Type netstat followed by a – The screen displays a
Note: You must be connected to the
network interface addresses
Internet for this task. space. listing of your routing table
appear. Both interfaces are
with IP addresses.
„ Type ifconfig and press operational.
Return.


140
10
WORK WITH INTERNET COMMANDS


Network connections are based on TCP. TCP is one of the primary
Unix systems, especially those
protocols making up TCP/IP and the one that almost all network tools
that are servers, generally
use. Network connections run through a series of states starting from
have many established
the initial connection request and ending with its closure. Ports on
connections at any point in
servers listen for requests. When a client request arrives, the client and
time. At each end of a

<<

. 29
( 69 .)



>>