Read LPI Linux Certification in a Nutshell Online
Authors: Adam Haeder; Stephen Addison Schneiter; Bruno Gomes Pessanha; James Stanger
Tags: #Reference:Computers
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 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 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 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 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:
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.
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.
ICMP is used among network components to
instruct a sender to use a different gateway.
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.
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
.
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 | Assigned use | Description |
---|---|---|
20 and 21 | FTP data FTP | When an FTP session is opened, the |
23 | Telnet server | Inbound Telnet requests are sent to |
25 | SMTP server | This port is used by mail transfer |
53 | DNS server | Used by the Domain Name System (DNS) |
67 | BOOTP/DHCP server | Hands out IP addresses to workstations |
68 | BOOTP/DHCP | The client side for |
80 | HTTP server | Web servers, such as Apache |
110 | POP3 | The Post Office Protocol (POP) is used |
119 | NNTP server | This port is used by news servers for |
139 | NetBIOS | Reserved for Microsoft’s LAN |
143 | IMAP | An alternate to POP3, Internet Message |
161 | SNMP | Agents running on monitored systems |
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.
The following popular applications, although not strictly
a part of TCP/IP, are usually provided along with a TCP/IP
implementation.
dig
dighostname
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.
$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
ftp
ftp [options
]host
...interactive commands...
Establish an interactive FTP connection withhost
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.
Turn off interactive prompting during multiple file
transfers (also see the
prompt
command in
the next list).
Set verbose mode; display server responses and transfer
statistics.
Establish the transfer mode for files.
ASCII mode is provided to correctly transfer
text among computer architectures where character encoding
differs.
file
Receive a singlefile
from the server.
files
Receive multiplefiles
from the server.files
can be specified using normal
file glob
patterns
.
files
]Obtain a directory listing from the server,
optionally listingfiles
.
file
Send a singlefile
to
the server.
files
Send multiplefiles
to the server.
Toggle on and off interactive prompting during
mget
and
mput
(also
see the
-i
option in the previous
list).
Print the working remote directory.
Cleanly terminate the FTP session.
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.
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 thatanonymous
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
...>