LPI Linux Certification in a Nutshell (59 page)

Read LPI Linux Certification in a Nutshell Online

Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger

Tags: #Reference:Computers

BOOK: LPI Linux Certification in a Nutshell
2.3Mb size Format: txt, pdf, ePub
Protocols

TCP/IP is a suite of Internet protocols, including the
Transmission Control Protocol (TCP), Internet Protocol (IP), User
Datagram Protocol (UDP), and Internet Control Message Protocol (ICMP),
among others. Some protocols use
handshaking
(the exchange of control
information among communicating systems) to establish and maintain a
connection. Such a protocol is said to be connection-oriented and
reliable, because the protocol itself is responsible for handling
transmission errors, lost packets, and packet arrival order. A protocol
that does not exchange control information is said to be connectionless
and unreliable. In this context, “unreliable” simply means that the
protocol doesn’t handle transmission problems itself; they must be
corrected in the application or system libraries. Connectionless
protocols are simpler and have fewer overheads than connection-oriented
protocols. TCP/IP is a
stack
of protocols because protocols
are built in a hierarchy of
layers
. Low-level protocols are used
by higher-level protocols on adjacent layers of the protocol
stack:

TCP

TCP is a connection-oriented transport agent used by
applications to establish a network connection. TCP transports
information across networks by handshaking and retransmitting
information as needed in response to errors on the network. TCP
guarantees packet arrival and provides for the correct ordering of
received packets. TCP is used by many network services, including
FTP, Telnet, and SMTP. By using TCP, these applications don’t need
to establish their own error-checking mechanisms, thus making
their design simpler and easier to manage.

IP

IP can be thought of as the fundamental building
block of the Internet. IP, which is connectionless, defines
datagrams (the basic unit of transmission), establishes the
addressing scheme (the IP address), and provides for the routing
of datagrams between networks. IP is said to provide a
datagram delivery service
.
Other higher-level protocols use IP as an underlying
carrier.

UDP

UDP is a connectionless transport agent. It provides
application programs direct access to IP, allowing them to
exchange information with a minimum of protocol overhead. On the
other hand, because UDP offers no assurance that packets arrive at
destinations as intended, software must manage transmission errors
and other problems such as missing and incorrectly ordered
packets. UDP is used by applications such as DNS and NFS.

ICMP

ICMP is a connectionless transport agent that is
used to exchange control information among networked systems. It
uses IP datagrams for the following control, error-reporting, and
informational functions:

Flow control

Sometimes inbound traffic becomes too heavy
for a receiving system to process. In such cases, the
receiving system can send a message via ICMP to the source
instructing it to temporarily stop sending datagrams.

Detecting unreachable destinations

Various parts of network infrastructure are
capable of detecting that a network destination is
unreachable. In this case, ICMP messages are sent to the
requesting system.

Redirecting routes

ICMP is used among network components to
instruct a sender to use a different gateway.

Checking remote hosts

Hosts can transmit echo messages via ICMP to
verify that a remote system’s Internet Protocol is
functioning. If so, the original message is returned. This
is implemented in the
ping
command.

PPP

Point-to-Point Protocol (PPP) is used for TCP/IP
dial-up network access via modem.

On the Exam

You will need a general understanding of the control messages
sent via ICMP. In particular, note that ICMP does not transmit data
and that it is used by
ping
.

Services

When an inbound network request is made, such as that from
a web browser or FTP client, it is sent to the IP address of the server.
In addition, the request carries inside it a
port number
(or just
port
), which is a 16-bit value placed near the
beginning of a network packet. The port number defines the type of
server software that should respond to the request. For example, by
default, web browsers send requests en
coded
for port 80. Web servers “listen” to
port 80 and respond to incoming requests. The encoded port can be
considered part of the address of a request. While the IP address
specifies a particular interface (or host), the port specifies a
specific service available on that host. Many port numbers are
predefined, and the list is expanded as needed to accommodate new
technologies. The official list of port number assignments is managed by
the Internet Assigned Numbers Authority (IANA). The ports known by your
system are listed in
/etc/services
.

Port numbers 1 through 1023 are often referred to as
privileged ports
because the services
that use them often run with superuser authority. Many of these, such as
ports used for FTP (21), Telnet (23), and HTTP (80), are often referred
to as
well-known ports
because they are
standards. Port numbers from 1024 through 65535 (the maximum) are
unprivileged ports
and can be used by
applications run by ordinary system users.

During the initial contact, the client includes a local (randomly
selected) unprivileged port on the client machine for the server to use
when responding to the request. Client-to-server communications use the
well-known port, and the server-to-client communications use the
randomly selected port. This Objective requires you to be familiar with
the privileged port numbers detailed in
Table 19-4
.

Table 19-4. Common privileged port numbers

Port
number

Assigned use

Description

20 and 21

FTP data FTP
control

When an FTP session is opened, the
binary or ASCII data flows to the server using port 20, while
control information flows on port 21. During use, both ports are
managed by an FTP daemon, such as
vftpd
.

23

Telnet server

Inbound Telnet requests are sent to
server port 23 and processed by
telnetd
.

25

SMTP server

This port is used by mail transfer
agents (MTAs), such as Sendmail.

53

DNS server

Used by the Domain Name System (DNS)
server,
named
.

67

BOOTP/DHCP server

Hands out IP addresses to workstations
dynamically.

68

BOOTP/DHCP
client

The client side for
BOOTP/DHCP.

80

HTTP server

Web servers, such as Apache
(
httpd
), usually listen in on this
port.

110

POP3

The Post Office Protocol (POP) is used
by mail client programs to transfer mail from a
server.

119

NNTP server

This port is used by news servers for
Usenet news.

139

NetBIOS

Reserved for Microsoft’s LAN
Manager.

143

IMAP

An alternate to POP3, Internet Message
Access Protocol (IMAP) is another type of mail
protocol.

161

SNMP

Agents running on monitored systems
use this port for access to the Simple Network Management
Protocol (SNMP).

This list is a tiny fraction of the many well-known ports, but it
may be necessary for you to know those in the list both by name and by
number.

On the Exam

You should commit the list of ports in
Table 19-4
to memory so you can
recognize a type of network connection solely by its port number. Your
exam is likely to have at least one question on how a specific port is
used.

Utilities

The following popular applications, although not strictly
a part of TCP/IP, are usually provided along with a TCP/IP
implementation.

Name

dig

Syntax
dig
hostname
Description

dig
obtains information from DNS
servers. Note that additional command-line arguments and options are
available for
dig
but are beyond the scope of
Exam 102.

Example
$
dig redhat.com
; <<>> DiG 9.3.2 <<>> redhat.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41163
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;redhat.com. IN A
;; ANSWER SECTION:
redhat.com. 60 IN A 209.132.177.50
;; Query time: 43 msec
;; SERVER: 68.87.68.166#53(68.87.68.166)
;; WHEN: Fri Sep 18 06:28:08 2009
;; MSG SIZE rcvd: 44
Name

ftp

Syntax
ftp [
options
]
host
...interactive commands...
Description

Establish an interactive FTP connection with
host
to transfer binary or text files.
FTP creates an interactive dialog and allows for two-way file
transfer. The dialog includes username/password authentication, user
commands, and server responses.

Frequently used options
-i

Turn off interactive prompting during multiple file
transfers (also see the
prompt
command in
the next list).

-v

Set verbose mode; display server responses and transfer
statistics.

Frequently used commands
ascii
,
binary

Establish the transfer mode for files.
ASCII mode is provided to correctly transfer
text among computer architectures where character encoding
differs.

get
file

Receive a single
file
from the server.

mget
files

Receive multiple
files
from the server.
files
can be specified using normal
file glob
patterns
.

ls
[
files
]

Obtain a directory listing from the server,
optionally listing
files
.

put
file

Send a single
file
to
the server.

mput
files

Send multiple
files
to the server.

prompt

Toggle on and off interactive prompting during
mget
and
mput
(also
see the
-i
option in the previous
list).

pwd

Print the working remote directory.

quit, exit

Cleanly terminate the FTP session.

Example 1

Get a file from machine
smp
:

$
ftp -v smp
Connected to smp.
220 smp FTP server (Version wu-2.4.2-VR17(1)
Mon Apr 19 09:21:53 EDT 1999) ready.
Name (smp:root):
jdean
331 Password required for jdean.
Password:

230 User jdean logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
ls myfile
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
-rw-r--r-- 1 jdean jdean 29 Jan 24 01:28 myfile
226 Transfer complete.
ftp>
binary
200 Type set to I.
ftp>
get myfile
local: myfile remote: myfile
200 PORT command successful.
150 Opening BINARY mode data connection for myfile
(29 bytes).
226 Transfer complete.
29 bytes received in 0.000176 secs (1.6e+02 Kbytes/sec)
ftp>
quit
221-You have transferred 29 bytes in 1 files.
221-Total traffic for this session was 773 bytes in 3 transfers.
221-Thank you for using the FTP service on smp.
221 Goodbye.
Example 2

Many FTP servers are set up to receive requests from
nonauthenticated users. Such public access is said to be anonymous.
Anonymous FTP is established just like any other FTP connection,
except that
anonymous
is used as
the username. An email address is commonly used as a password to let
the system owner know who is transferring files:

#
ftp -v smp
Connected to smp.
220 smp FTP server (Version wu-2.4.2-VR17(1)
Mon Apr 19 09:21:53 EDT 1999) ready.
Name (smp:root):
anonymous
331 Guest login OK, send your complete e-mail address as password.
Password:
[email protected]
230 Guest login OK, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
<
commands follow
...>

Other books

Courthouse by John Nicholas Iannuzzi
Conjure by Lea Nolan
Match Made in HeVan by Lucy Kelly
The Beginning of Everything by Robyn Schneider
When the War Is Over by Stephen Becker
The Gorgon Festival by John Boyd
One Fight at a Time by Jeff Dowson