~kim0/serverguide/serverguide-review-ch19

« back to all changes in this revision

Viewing changes to build/serverguide/C/tcpip.html

  • Committer: Matthew East
  • Date: 2011-05-03 07:11:18 UTC
  • Revision ID: mdke@ubuntu.com-20110503071118-081aatibsr9k2yqy
Add files from ubuntu-docs natty branch, trim to use only those necessary for serverguide

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
<html xmlns="http://www.w3.org/1999/xhtml">
 
4
  <head xmlns="http://www.w3.org/1999/xhtml">
 
5
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
6
    <title xmlns="">TCP/IP</title>
 
7
    <link rel="stylesheet" href="../../libs/ubuntu-book.css" type="text/css" />
 
8
    <link rel="home" href="index.html" title="Ubuntu Server Guide" />
 
9
    <link rel="up" href="networking.html" title="Chapter 4. Networking" />
 
10
    <link rel="prev" href="network-configuration.html" title="Network Configuration" />
 
11
    <link rel="next" href="dhcp.html" title="Dynamic Host Configuration Protocol (DHCP)" />
 
12
    <link rel="copyright" href="legal.html" title="Credits and License" />
 
13
  </head>
 
14
  <body>
 
15
    <div id="round">
 
16
      <img id="topcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-top.png" />
 
17
      <div id="layout" class="container clear-block">
 
18
        <script xmlns="" src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>
 
19
        <script xmlns="" type="text/javascript">
 
20
_uacct = "UA-1018242-8";
 
21
urchinTracker();
 
22
</script>
 
23
        <div id="header">
 
24
          <div id="logo-floater">
 
25
            <h1>
 
26
              <a href="https://help.ubuntu.com" title="Ubuntu Documentation">
 
27
                <img alt="Ubuntu" id="logo" src="https://help.ubuntu.com/htdocs/ubuntunew/img/logo.png" />
 
28
              </a>
 
29
            </h1>
 
30
          </div>
 
31
          <noscript>
 
32
            <form action="http://www.google.com/cse" id="cse-search-box">
 
33
              <div>
 
34
                <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />
 
35
                <input type="hidden" name="ie" value="UTF-8" />
 
36
                <input type="text" name="q" size="27" />
 
37
                <input type="submit" name="sa" value="Search" />
 
38
              </div>
 
39
            </form>
 
40
          </noscript>
 
41
          <script>
 
42
 document.write('<form action="https://help.ubuntu.com/search.html" id="cse-search-box">');
 
43
 document.write('  <div>');
 
44
 document.write('    <input type="hidden" name="cof" value="FORID:9" />');
 
45
 document.write('    <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />');
 
46
 document.write('    <input type="hidden" name="ie" value="UTF-8" />');
 
47
 document.write('    <input type="text" name="q" size="27" />');
 
48
 document.write('    <input type="submit" name="sa" value="Search" />');
 
49
 document.write('  </div>');
 
50
 document.write('</form>');
 
51
</script>
 
52
          <div id="sitename">
 
53
            <a href="https://help.ubuntu.com/">
 
54
              <img alt="Official Documentation" src="https://help.ubuntu.com/htdocs/ubuntunew/img/help-about.png" />
 
55
              <span>Official Documentation</span>
 
56
            </a>
 
57
          </div>
 
58
        </div>
 
59
        <div id="page">
 
60
          <div id="content">
 
61
            <div class="breadcrumbs"><a href="https://help.ubuntu.com/">Ubuntu Documentation</a> &gt; <a href="https://help.ubuntu.com/11.04">Ubuntu 11.04</a> &gt; <span class="breadcrumb-link"><a href="index.html">Ubuntu Server Guide</a></span> &gt; <span class="breadcrumb-link"><a href="networking.html">Networking</a></span> &gt; <span class="breadcrumb-node">TCP/IP</span></div>
 
62
            <div xmlns="http://www.w3.org/1999/xhtml" class="sect1" title="TCP/IP">
 
63
              <div class="titlepage">
 
64
                <div>
 
65
                  <div>
 
66
                    <h2 class="title" style="clear: both"><a id="tcpip"></a>TCP/IP</h2>
 
67
                  </div>
 
68
                </div>
 
69
              </div>
 
70
              <p>
 
71
            The Transmission Control Protocol and Internet Protocol (TCP/IP) is a standard 
 
72
                        set of protocols developed in the late 1970s by the Defense Advanced Research 
 
73
                        Projects Agency (DARPA) as a means of communication between different types of 
 
74
                        computers and computer networks. TCP/IP is the driving force of the Internet, 
 
75
                        and thus it is the most popular set of network protocols on Earth. 
 
76
          </p>
 
77
              <div class="sect2" title="TCP/IP Introduction">
 
78
                <div class="titlepage">
 
79
                  <div>
 
80
                    <div>
 
81
                      <h3 class="title"><a id="tcpip-introduction"></a>TCP/IP Introduction</h3>
 
82
                    </div>
 
83
                  </div>
 
84
                </div>
 
85
                <p>
 
86
            The two protocol components of TCP/IP deal with different aspects of computer networking.
 
87
            <span class="emphasis"><em>Internet Protocol</em></span>, the "IP" of TCP/IP is a 
 
88
                        connectionless protocol which deals only with network packet routing using the <span class="italics">IP Datagram</span> as the basic unit of networking information.  The 
 
89
                        IP Datagram consists of a header followed by a message.  The <span class="emphasis"><em>
 
90
                        Transmission Control Protocol</em></span> is the "TCP" of TCP/IP and enables network hosts 
 
91
                        to establish connections which may be used to exchange data streams.  TCP also guarantees 
 
92
                        that the data between connections is delivered and that it arrives at one network host in 
 
93
                        the same order as sent from another network host.
 
94
          </p>
 
95
              </div>
 
96
              <div class="sect2" title="TCP/IP Configuration">
 
97
                <div class="titlepage">
 
98
                  <div>
 
99
                    <div>
 
100
                      <h3 class="title"><a id="tcpip-configuration"></a>TCP/IP Configuration</h3>
 
101
                    </div>
 
102
                  </div>
 
103
                </div>
 
104
                <p>
 
105
            The TCP/IP protocol configuration consists of several elements which must be set by 
 
106
                        editing the appropriate configuration files, or deploying solutions such as the Dynamic 
 
107
                        Host Configuration Protocol (DHCP) server which in turn, can be configured to provide the 
 
108
                        proper TCP/IP configuration settings to network clients automatically. These 
 
109
                        configuration values must be set correctly in order to facilitate the proper network 
 
110
                        operation of your Ubuntu system.
 
111
            </p>
 
112
                <p>
 
113
            The common configuration elements of TCP/IP and their purposes are as follows:
 
114
            </p>
 
115
                <div class="itemizedlist">
 
116
                  <ul class="itemizedlist" type="disc">
 
117
                    <li class="listitem">
 
118
                      <p>
 
119
                  <span class="bold"><strong>IP address</strong></span> The IP address is a unique
 
120
                  identifying string expressed as four decimal numbers ranging from zero (0)
 
121
                  to two-hundred and fifty-five (255), separated by periods,
 
122
                  with each of the four numbers representing eight (8) bits of the address for a
 
123
                  total length of thirty-two (32) bits for the whole address. This format is called
 
124
                  <span class="emphasis"><em>dotted quad
 
125
                  notation</em></span>.</p>
 
126
                    </li>
 
127
                    <li class="listitem">
 
128
                      <p>
 
129
                  <span class="bold"><strong>Netmask</strong></span> The Subnet Mask (or simply,
 
130
                  <span class="emphasis"><em>netmask</em></span>) is a local bit mask, or set of flags
 
131
                  which separate the portions of an IP address significant to the network from the
 
132
                  bits significant to the <span class="emphasis"><em>subnetwork</em></span>.  For example,
 
133
                  in a Class C network, the standard netmask is 255.255.255.0 which masks the first
 
134
                  three bytes of the IP address and allows the last byte of the IP address to
 
135
                  remain available for specifying hosts on the subnetwork.
 
136
                  </p>
 
137
                    </li>
 
138
                    <li class="listitem">
 
139
                      <p>
 
140
                  <span class="bold"><strong>Network Address</strong></span> The Network Address represents the
 
141
                  bytes comprising the network portion of an IP address.  For example, the host 12.128.1.2
 
142
                  in a Class A network would use 12.0.0.0 as the network address, where twelve (12)
 
143
                  represents the first byte of the IP address, (the network part) and zeroes (0) 
 
144
                  in all of the remaining three bytes to represent the potential host values.  A network
 
145
                  host using the private IP address 192.168.1.100
 
146
                  would in turn use a Network Address of 192.168.1.0, which specifies the first three
 
147
                  bytes of the Class C 192.168.1 network and a zero (0) for all the possible hosts on the
 
148
                  network.
 
149
                  </p>
 
150
                    </li>
 
151
                    <li class="listitem">
 
152
                      <p>
 
153
                  <span class="bold"><strong>Broadcast Address</strong></span> The Broadcast Address is an IP address
 
154
                  which allows network data to be sent simultaneously to all hosts on a given subnetwork rather
 
155
                  than specifying a particular host.  The standard general broadcast address for IP networks is
 
156
                  255.255.255.255, but this broadcast address cannot be used to send a broadcast message to
 
157
                  every host on the Internet because routers block it.  A more appropriate broadcast address
 
158
                  is set to match a specific subnetwork.  For example, on the private Class C IP network,
 
159
                  192.168.1.0, the broadcast address is 192.168.1.255. Broadcast messages are
 
160
                  typically produced by network protocols such as the Address Resolution Protocol (ARP) and the 
 
161
                  Routing Information Protocol (RIP).             
 
162
                  </p>
 
163
                    </li>
 
164
                    <li class="listitem">
 
165
                      <p>
 
166
                  <span class="bold"><strong>Gateway Address</strong></span> A Gateway Address is the IP address through which
 
167
                  a particular network, or host on a network, may be reached.  If one network host wishes to communicate
 
168
                  with another network host, and that host is not located on the same network, then a 
 
169
                  <span class="emphasis"><em>gateway</em></span> must be used. In many cases, the Gateway Address will be that
 
170
                  of a router on the same network, which will in turn pass traffic on to other networks or hosts, such as
 
171
                  Internet hosts.  The value of the Gateway Address setting must be correct, or your system will not be able
 
172
                  to reach any hosts beyond those on the same network.                  
 
173
                  </p>
 
174
                    </li>
 
175
                    <li class="listitem">
 
176
                      <p>
 
177
                  <span class="bold"><strong>Nameserver Address</strong></span> Nameserver Addresses represent the IP addresses of
 
178
                  Domain Name Service (DNS) systems, which resolve network hostnames into IP addresses.  There are three levels of
 
179
                  Nameserver Addresses, which may be specified in order of precedence: The 
 
180
                  <span class="emphasis"><em>Primary</em></span>
 
181
                  Nameserver, the <span class="emphasis"><em>Secondary</em></span> Nameserver, and the 
 
182
                  <span class="emphasis"><em>Tertiary</em></span>
 
183
                  Nameserver. In order for your system to be able to resolve network hostnames into their
 
184
                  corresponding IP addresses, you must specify valid Nameserver Addresses which you are authorized to use
 
185
                  in your system's TCP/IP configuration.  In many cases these addresses can and will be provided by your
 
186
                  network service provider, but many free and publicly accessible nameservers are available for use, such as
 
187
                  the Level3 (Verizon) servers with IP addresses from
 
188
                  4.2.2.1 to 4.2.2.6. </p>
 
189
                      <div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;">
 
190
                        <table border="0" summary="Tip">
 
191
                          <tr>
 
192
                            <td rowspan="2" align="center" valign="top" width="25">
 
193
                              <img alt="[Tip]" src="../../libs/admon/tip.png" />
 
194
                            </td>
 
195
                            <th align="left"></th>
 
196
                          </tr>
 
197
                          <tr>
 
198
                            <td align="left" valign="top">
 
199
                              <p>
 
200
                        The IP address, Netmask, Network Address, Broadcast Address, and Gateway Address
 
201
                        are typically specified via the appropriate directives in the file  <code class="filename">/etc/network/interfaces</code>. The Nameserver Addresses are typically specified via  <span class="emphasis"><em>nameserver</em></span> 
 
202
                        directives in the file <code class="filename">/etc/resolv.conf</code>. For more information, 
 
203
                        view the system manual page for <code class="filename">interfaces</code> or <code class="filename">resolv.conf</code> respectively, with the following commands typed at a terminal prompt:
 
204
                        </p>
 
205
                            </td>
 
206
                          </tr>
 
207
                        </table>
 
208
                      </div>
 
209
                      <p>
 
210
                    Access the system manual page for <code class="filename">interfaces</code> with the following command:
 
211
                    </p>
 
212
                      <p>
 
213
</p>
 
214
                      <pre class="screen">
 
215
<span class="command"><strong>man interfaces</strong></span>
 
216
</pre>
 
217
                      <p>
 
218
                    </p>
 
219
                      <p>
 
220
                    Access the system manual page for <code class="filename">resolv.conf</code> with the following command:
 
221
                    </p>
 
222
                      <p>
 
223
</p>
 
224
                      <pre class="screen">
 
225
<span class="command"><strong>man resolv.conf</strong></span>
 
226
</pre>
 
227
                      <p>
 
228
                    </p>
 
229
                    </li>
 
230
                  </ul>
 
231
                </div>
 
232
                <p>
 
233
            </p>
 
234
              </div>
 
235
              <div class="sect2" title="IP Routing">
 
236
                <div class="titlepage">
 
237
                  <div>
 
238
                    <div>
 
239
                      <h3 class="title"><a id="ip-routing"></a>IP Routing</h3>
 
240
                    </div>
 
241
                  </div>
 
242
                </div>
 
243
                <p>
 
244
              IP routing is a means of specifying and discovering paths in a TCP/IP network along which
 
245
              network data may be sent.  Routing uses a set of <span class="emphasis"><em>routing tables</em></span>
 
246
              to direct the forwarding of network data packets from their source to the destination, often
 
247
              via many intermediary network nodes known as <span class="emphasis"><em>routers</em></span>.
 
248
              There are two primary forms of
 
249
              IP routing: <span class="emphasis"><em>Static Routing</em></span> and 
 
250
              <span class="emphasis"><em>Dynamic Routing.</em></span>
 
251
            </p>
 
252
                <p>
 
253
            Static routing involves manually adding IP routes to the system's routing table, and this is usually
 
254
            done by manipulating the routing table with the <span class="application"><strong>route</strong></span> command. Static routing enjoys
 
255
            many advantages over dynamic routing, such as simplicity of implementation on smaller networks, 
 
256
            predictability (the routing table is always computed in advance, and thus the route is precisely the 
 
257
            same each time it is used), and low overhead on other routers and network links due to the lack of a
 
258
            dynamic routing protocol.  However, static routing does present some disadvantages as well.  For example,
 
259
            static routing is limited to small networks and does not scale well.  Static routing also fails completely
 
260
            to adapt to network outages and failures along the route due to the fixed nature of the route. 
 
261
            </p>
 
262
                <p>
 
263
            Dynamic routing depends on large networks with multiple possible IP routes from a source to a destination
 
264
            and makes use of special routing protocols, such as the Router Information Protocol (RIP), which handle
 
265
            the automatic adjustments in routing tables that make dynamic routing possible.  Dynamic routing
 
266
            has several advantages over static routing, such as superior scalability and the ability to adapt
 
267
            to failures and outages along network routes. Additionally, there is less manual configuration of the
 
268
            routing tables, since routers learn from one another about their existence and available routes. This trait
 
269
            also eliminates the possibility of introducing mistakes in the routing tables via human error.
 
270
            Dynamic routing is not perfect, however, and presents disadvantages such as heightened complexity and
 
271
            additional network overhead from router communications, which does not immediately benefit the end users,
 
272
            but still consumes network bandwidth.
 
273
            </p>
 
274
              </div>
 
275
              <div class="sect2" title="TCP and UDP">
 
276
                <div class="titlepage">
 
277
                  <div>
 
278
                    <div>
 
279
                      <h3 class="title"><a id="tcp-and-udp"></a>TCP and UDP</h3>
 
280
                    </div>
 
281
                  </div>
 
282
                </div>
 
283
                <p>
 
284
              TCP is a connection-based protocol, offering error correction and guaranteed delivery of
 
285
              data via what is known as <span class="emphasis"><em>flow control</em></span>. Flow control
 
286
              determines when the flow of a data stream needs to be stopped, and previously sent data
 
287
              packets should to be re-sent due to problems such as <span class="emphasis"><em>collisions</em></span>,
 
288
              for example, thus ensuring complete and accurate delivery of the data.  TCP is typically
 
289
              used in the exchange of important information such as database transactions. 
 
290
            </p>
 
291
                <p>
 
292
              The User Datagram Protocol (UDP), on the other hand, is a <span class="emphasis"><em>connectionless</em></span>
 
293
              protocol which seldom deals with the transmission of important data because it lacks flow
 
294
              control or any other method to ensure reliable delivery of the data.  UDP is commonly used
 
295
              in such applications as audio and video streaming, where it is considerably faster than
 
296
              TCP due to the lack of error correction and flow control, and where the loss of a few packets
 
297
                          is not generally catastrophic.
 
298
            </p>
 
299
              </div>
 
300
              <div class="sect2" title="ICMP">
 
301
                <div class="titlepage">
 
302
                  <div>
 
303
                    <div>
 
304
                      <h3 class="title"><a id="icmp"></a>ICMP</h3>
 
305
                    </div>
 
306
                  </div>
 
307
                </div>
 
308
                <p>
 
309
              The Internet Control Messaging Protocol (ICMP) is an extension to the Internet Protocol (IP) as defined
 
310
              in the Request For Comments (RFC) #792 and supports network packets containing control, error, and
 
311
              informational messages.  ICMP is used by such network applications as the <span class="application"><strong>ping</strong></span>
 
312
              utility, which can determine the availability of a network host or device.  Examples of some error messages
 
313
              returned by ICMP which are useful to both network hosts and devices such as routers, include 
 
314
              <span class="emphasis"><em>Destination Unreachable</em></span> and <span class="emphasis"><em>Time Exceeded</em></span>.
 
315
            </p>
 
316
              </div>
 
317
              <div class="sect2" title="Daemons">
 
318
                <div class="titlepage">
 
319
                  <div>
 
320
                    <div>
 
321
                      <h3 class="title"><a id="daemons"></a>Daemons</h3>
 
322
                    </div>
 
323
                  </div>
 
324
                </div>
 
325
                <p>
 
326
              Daemons are special system applications which typically execute continuously in the background and
 
327
              await requests for the functions they provide from other applications.  Many daemons are network-centric; that is,
 
328
              a large number of daemons executing in the background on an Ubuntu system may provide network-related functionality.
 
329
              Some examples of such network daemons include the <span class="emphasis"><em>Hyper Text Transport Protocol Daemon</em></span> 
 
330
              (httpd), which provides web server functionality; the <span class="emphasis"><em>Secure SHell Daemon</em></span> (sshd), which
 
331
              provides secure remote login shell and file transfer capabilities; and the <span class="emphasis"><em>Internet Message Access 
 
332
              Protocol Daemon</em></span> (imapd), which provides E-Mail services.
 
333
            </p>
 
334
              </div>
 
335
              <div class="sect2" title="Resources">
 
336
                <div class="titlepage">
 
337
                  <div>
 
338
                    <div>
 
339
                      <h3 class="title"><a id="tcpip-resources"></a>Resources</h3>
 
340
                    </div>
 
341
                  </div>
 
342
                </div>
 
343
                <div class="itemizedlist">
 
344
                  <ul class="itemizedlist" type="disc">
 
345
                    <li class="listitem">
 
346
                      <p>
 
347
              There are man pages for <a class="ulink" href="http://manpages.ubuntu.com/manpages/natty/en/man7/tcp.7.html" target="_top">TCP</a> and
 
348
              <a class="ulink" href="http://manpages.ubuntu.com/manpages/natty/man7/ip.7.html" target="_top">IP</a> that contain more useful information.
 
349
              </p>
 
350
                    </li>
 
351
                    <li class="listitem">
 
352
                      <p>
 
353
              Also, see the <a class="ulink" href="http://www.redbooks.ibm.com/abstracts/gg243376.html" target="_top">TCP/IP Tutorial and Technical Overview</a>
 
354
              IBM Redbook.
 
355
              </p>
 
356
                    </li>
 
357
                    <li class="listitem">
 
358
                      <p>
 
359
              Another resource is O'Reilly's <a class="ulink" href="http://oreilly.com/catalog/9780596002978/" target="_top">TCP/IP Network Administration</a>.
 
360
              </p>
 
361
                    </li>
 
362
                  </ul>
 
363
                </div>
 
364
              </div>
 
365
            </div>
 
366
          </div>
 
367
          <div xmlns="http://www.w3.org/1999/xhtml" class="navfooter">
 
368
            <hr />
 
369
            <table width="100%" summary="Navigation footer">
 
370
              <tr>
 
371
                <td width="40%" align="left"><a accesskey="p" href="network-configuration.html"><img src="../../libs/navig/prev.png" alt="Prev" /></a> </td>
 
372
                <td width="20%" align="center">
 
373
                  <a accesskey="u" href="networking.html">
 
374
                    <img src="../../libs/navig/up.png" alt="Up" />
 
375
                  </a>
 
376
                </td>
 
377
                <td width="40%" align="right"> <a accesskey="n" href="dhcp.html"><img src="../../libs/navig/next.png" alt="Next" /></a></td>
 
378
              </tr>
 
379
              <tr>
 
380
                <td width="40%" align="left" valign="top">Network Configuration </td>
 
381
                <td width="20%" align="center">
 
382
                  <a accesskey="h" href="index.html">
 
383
                    <img src="../../libs/navig/home.png" alt="Home" />
 
384
                  </a>
 
385
                </td>
 
386
                <td width="40%" align="right" valign="top"> Dynamic Host Configuration Protocol (DHCP)</td>
 
387
              </tr>
 
388
            </table>
 
389
          </div>
 
390
          <hr />
 
391
          <div id="footer">
 
392
            <div id="ubuntulinks">
 
393
              <p>The material in this document is available under a free license, see <a href="/legal.html">Legal</a> for details<br />
 
394
        For information on contributing see the <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu Documentation Team wiki page</a>. To report a problem, visit the <a href="https://bugs.launchpad.net/ubuntu/+source/ubuntu-docs">bug page for Ubuntu Documentation</a></p>
 
395
            </div>
 
396
          </div>
 
397
          <div id="bottomcap">
 
398
            <img src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png" alt="" />
 
399
          </div>
 
400
        </div>
 
401
      </div>
 
402
    </div>
 
403
  </body>
 
404
</html>