+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
+
+<html lang="it">
+<head>
+ <meta name="generator" content=
+ "HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org">
+ <meta http-equiv="Content-Type" content=
+ "text/html; charset=iso-8859-1">
+ <meta name="generator" content=
+ "Docutils 0.5: http://docutils.sourceforge.net/">
+
+ <title>Ricettario</title>
+ <style type="text/css">
+
+ /*
+ Author: Peter Parente
+ Date: 2008/01/22
+ Version: 1.0
+ Copyright: This stylesheet has been placed in the public domain - free to edit and use for all uses.
+ */
+
+ body {
+ font: 100% sans-serif;
+ background: #ffffff;
+ color: black;
+ margin: 2em;
+ padding: 0em 2em;
+ }
+ pre.literal-block {
+ overflow: auto;
+ padding: 5px;
+ background-color: #eeffcc;
+ color: #333333;
+ line-height: 120%;
+ border: 1px solid #ac9;
+ border-left: none;
+ border-right: none;
+ }
+
+ p.topic-title {
+ font-weight: bold;
+ }
+
+ table.docinfo {
+ text-align: left;
+ margin: 2em 0em;
+ }
+
+ a[href] {
+ color: #436976;
+ background-color: transparent;
+ }
+
+ a.toc-backref {
+ text-decoration: none;
+ }
+
+ h1 a[href] {
+ color: #003a6b;
+ text-decoration: none;
+ background-color: transparent;
+ }
+
+ a.strong {
+ font-weight: bold;
+ }
+
+ img {
+ margin: 0;
+ border: 0;
+ }
+
+ p {
+ margin: 0.5em 0 1em 0;
+ text-align: justify;
+ line-height: 1.5em;
+ }
+
+
+ p a:visited {
+ color: purple;
+ background-color: transparent;
+ }
+
+ p a:active {
+ color: red;
+ background-color: transparent;
+ }
+
+ a:hover {
+ text-decoration: none;
+ }
+
+ p img {
+ border: 0;
+ margin: 0;
+ }
+
+ p.rubric {
+ font-weight: bold;
+ font-style: italic;
+ }
+
+ h1.title {
+ color: #003a6b;
+ font-size: 250%;
+ margin-bottom: 0em;
+ }
+
+ h2.subtitle {
+ color: #003a6b;
+ border-bottom: 0px;
+ }
+
+ h1, h2, h3, h4, h5, h6 {
+ color: #555;
+ background-color: transparent;
+ margin: 0em;
+ padding-top: 0.5em;
+ }
+
+ h1 {
+ font-size: 160%;
+ margin-bottom: 0.5em;
+ border-bottom: 2px solid #aaa;
+ }
+
+ h2 {
+ font-size: 140%;
+ margin-bottom: 0.5em;
+ border-bottom: 1px solid #aaa;
+ }
+
+ h3 {
+ font-size: 130%;
+ margin-bottom: 0.5em;
+ }
+
+ h4 {
+ font-size: 110%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ h5 {
+ font-size: 105%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ h6 {
+ font-size: 100%;
+ font-weight: bold;
+ margin-bottom: 0.5em;
+ }
+
+ dt {
+ font-style: italic;
+ }
+
+ dd {
+ margin-bottom: 1.5em;
+ }
+
+ div.admonition, div.note, div.tip, div.caution, div.important {
+ margin: 2em 2em;
+ padding: 0em 1em;
+ border-top: 1px solid #aaa;
+ border-left: 1px solid #aaa;
+ border-bottom: 2px solid #555;
+ border-right: 2px solid #555;
+ }
+
+ div.important {
+ background: transparent url('../images/important.png') 10px 2px no-repeat;
+ }
+
+ div.caution {
+ background: transparent url('../images/caution.png') 10px 2px no-repeat;
+ }
+
+ div.note {
+ background: transparent url('../images/note.png') 10px 2px no-repeat;
+ }
+
+ div.tip {
+ background: transparent url('../images/tip.png') 10px 2px no-repeat;
+ }
+
+ div.admonition-example {
+ background: transparent url('../images/tip.png') 10px 2px no-repeat;
+ }
+
+ div.admonition-critical-example {
+ background: transparent url('../images/important.png') 10px 2px no-repeat;
+ }
+
+ p.admonition-title {
+ font-weight: bold;
+ border-bottom: 1px solid #aaa;
+ padding-left: 30px;
+ }
+
+ table.docutils {
+ text-align: left;
+ border: 1px solid gray;
+ border-collapse: collapse;
+ width: 100%;
+ margin: 1.5em 0em;
+ }
+
+ table.docutils caption {
+ font-style: italic;
+ }
+
+ table.docutils td, table.docutils th {
+ padding: 0.25em 0.5em;
+ }
+
+ table.docutils th {
+ background-color: #dddddd;
+ }
+
+ div.sidebar {
+ width: 33%;
+ float: right;
+ margin: 0em 2em;
+ padding: 0em 1em;
+ border-top: 1px solid #aaa;
+ border-left: 1px solid #aaa;
+ border-bottom: 2px solid #555;
+ border-right: 2px solid #555;
+ }
+
+ p.sidebar-title {
+ margin-bottom: 0em;
+ color: #003a6b;
+ border-bottom: 1px solid #aaa;
+ font-weight: bold;
+ }
+
+ p.sidebar-subtitle {
+ margin-top: 0em;
+ font-style: italic;
+ color: #003a6b;
+ }
+
+ </style>
+</head>
+
+<body>
+ <div class="document" id="ricettario">
+ <h1 class="title">Ricettario</h1>
+
+ <h2 class="subtitle" id=
+ "appunti-e-note-sparse-per-corsi-di-reti-su-linux">Appunti e
+ note sparse per corsi di reti su Linux</h2>
+
+ <blockquote>
+ <table class="docutils field-list" frame="void" rules="none">
+ <col class="field-name">
+ <col class="field-body">
+
+ <tbody valign="top">
+ <tr class="field">
+ <th class="field-name">Author:</th>
+
+ <td class="field-body">Andrea Manni</td>
+ </tr>
+
+ <tr class="field">
+ <th class="field-name">Copyright:</th>
+
+ <td class="field-body">GFDL</td>
+ </tr>
+
+ <tr class="field">
+ <th class="field-name">Version:</th>
+
+ <td class="field-body">1.0</td>
+ </tr>
+ </tbody>
+ </table>
+ </blockquote>
+
+ <div class="contents topic" id="indice">
+ <p class="topic-title first">Indice</p>
+
+ <ul class="auto-toc simple">
+ <li>
+ <a class="reference internal" href="#comandi" id="id1"
+ name="id1">1 Comandi</a>
+
+ <ul class="auto-toc">
+ <li>
+ <a class="reference internal" href=
+ "#propieta-dei-files" id="id2" name=
+ "id2">1.1 Propieta' dei files</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#primo-carattere" id="id3" name=
+ "id3">1.1.1 Primo
+ carattere</a></li>
+
+ <li><a class="reference internal" href=
+ "#manipolare-i-permessi-dei-file" id="id4" name=
+ "id4">1.1.2 Manipolare i permessi
+ dei file</a></li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+
+ <li>
+ <a class="reference internal" href="#tar-archiviazione"
+ id="id5" name="id5">2 TAR:
+ archiviazione</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#esempi-creare-un-archivio" id="id6" name=
+ "id6">2.1 Esempi: creare un
+ archivio</a></li>
+
+ <li><a class="reference internal" href=
+ "#esempi-visualizzare-il-contenuto-di-un-archivio" id=
+ "id7" name="id7">2.2 Esempi:
+ visualizzare il contenuto di un archivio</a></li>
+
+ <li><a class="reference internal" href=
+ "#esempi-esplodere-un-archivio" id="id8" name=
+ "id8">2.3 Esempi: esplodere un
+ archivio</a></li>
+ </ul>
+ </li>
+
+ <li><a class="reference internal" href=
+ "#navigazione-nei-filesystems-virtuali-proc-e-sys" id="id9"
+ name="id9">3 Navigazione nei filesystems
+ virtuali: proc e sys</a></li>
+
+ <li>
+ <a class="reference internal" href="#reti-tcp-ip" id=
+ "id10" name="id10">4 Reti: TCP/IP</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#il-livello-network" id="id11" name=
+ "id11">4.1 Il livello
+ Network:</a></li>
+
+ <li><a class="reference internal" href=
+ "#il-livello-internet" id="id12" name=
+ "id12">4.2 Il livello
+ Internet</a></li>
+
+ <li><a class="reference internal" href=
+ "#documentazione-su-ip" id="id13" name=
+ "id13">4.3 Documentazione su
+ IP</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <a class="reference internal" href="#maschere-di-rete"
+ id="id14" name="id14">5 Maschere di
+ rete</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href="#messa-in-and"
+ id="id15" name="id15">5.1 Messa in
+ AND</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <a class="reference internal" href="#cavi-di-rete" id=
+ "id16" name="id16">6 Cavi di Rete</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href=
+ "#riferimenti-per-cavi-ethernet-ecc" id="id17" name=
+ "id17">6.1 Riferimenti per cavi /
+ ethernet ecc.:</a></li>
+
+ <li><a class="reference internal" href="#tipi-di-wifi"
+ id="id18" name="id18">6.2 Tipi di
+ WiFi:</a></li>
+
+ <li><a class="reference internal" href="#wimax" id=
+ "id19" name="id19">6.3 WiMax:</a></li>
+
+ <li><a class="reference internal" href="#hiperlan" id=
+ "id20" name=
+ "id20">6.4 Hiperlan:</a></li>
+ </ul>
+ </li>
+
+ <li>
+ <a class="reference internal" href=
+ "#breve-sommario-dei-comandi-relativi-al-networking" id=
+ "id21" name="id21">7 Breve sommario dei
+ comandi relativi al networking</a>
+
+ <ul class="auto-toc">
+ <li><a class="reference internal" href="#ifconfig" id=
+ "id22" name=
+ "id22">7.1 ifconfig</a></li>
+
+ <li><a class="reference internal" href="#ping" id=
+ "id23" name="id23">7.2 ping</a></li>
+
+ <li><a class="reference internal" href="#route" id=
+ "id24" name="id24">7.3 route</a></li>
+
+ <li><a class="reference internal" href="#traceroute"
+ id="id25" name=
+ "id25">7.4 traceroute</a></li>
+
+ <li><a class="reference internal" href="#host" id=
+ "id26" name="id26">7.5 host</a></li>
+
+ <li><a class="reference internal" href="#instradamento"
+ id="id27" name=
+ "id27">7.6 Instradamento:</a></li>
+
+ <li><a class="reference internal" href="#tcpdump" id=
+ "id28" name=
+ "id28">7.7 tcpdump</a></li>
+ </ul>
+ </li>
+
+ <li><a class="reference internal" href="#sessione-ftp" id=
+ "id29" name="id29">8 Sessione FTP</a></li>
+
+ <li><a class="reference internal" href="#todo" id="id30"
+ name="id30">9 ToDo</a></li>
+ </ul>
+ </div>
+
+ <p>Generato con: <a class="reference external" href=
+ "http://docutils.sourceforge.net/rst.html">http://docutils.sourceforge.net/rst.html</a></p>
+
+ <div class="section" id="comandi">
+ <h1><a class="toc-backref" href=
+ "#id1">1 Comandi</a></h1>
+
+ <p>Appunti ed esempi sull'utilizzo di alcuni comandi
+ comuni.</p>
+
+ <div class="section" id="propieta-dei-files">
+ <h2><a class="toc-backref" href=
+ "#id2">1.1 Propieta' dei files</a></h2>
+
+ <p>Vediamo come leggere l'output del comando
+ <em>ls</em>:</p>
+ <pre class="literal-block">
+ls -l
+
+drwxr-xr-x 2 andrea staff 4096 2008-09-16 22:05 cartella
+ | | | | | | | Nome file
+ | | | | | | Data di creazione e ora
+ | | | | | inodes (non e' la dimensione del file)
+ | | | | gruppo
+ | | | utente
+ | | ooo = others
+ | ggg = group
+ uuu = user
+</pre>
+
+ <dl class="docutils">
+ <dt>UGO</dt>
+
+ <dd>Acronimo per: User - Groups Others</dd>
+ </dl>
+
+ <table border="1" class="docutils">
+ <colgroup>
+ <col width="6%">
+ <col width="20%">
+ <col width="74%">
+ </colgroup>
+
+ <thead valign="bottom">
+ <tr>
+ <th class="head" colspan="3">Propieta'</th>
+ </tr>
+ </thead>
+
+ <tbody valign="top">
+ <tr>
+ <td colspan="3">rwx</td>
+ </tr>
+
+ <tr>
+ <td>r</td>
+
+ <td>readable</td>
+
+ <td>Il file e' leggibile</td>
+ </tr>
+
+ <tr>
+ <td>w</td>
+
+ <td>writable</td>
+
+ <td>Il file e' scrivibile e modificabile</td>
+ </tr>
+
+ <tr>
+ <td>x</td>
+
+ <td>excecute</td>
+
+ <td>Il file e' eseguibile</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class="section" id="primo-carattere">
+ <h3><a class="toc-backref" href=
+ "#id3">1.1.1 Primo carattere</a></h3>
+
+ <p>Il primo carattere indica la natura o il tipo del
+ <em>file</em>:</p>
+ <pre class="literal-block">
+-rw-r--r-- 1 andrea andrea 26 2008-09-16 22:03 dns.conf
+lrw-r--r-- 1 andrea andrea 0 2008-09-16 22:07 link_dns
+drwxr-xr-x 1 andrea andrea 77352 2008-09-16 21:47 cartella
+</pre>
+
+ <table border="1" class="docutils">
+ <colgroup>
+ <col width="14%">
+ <col width="86%">
+ </colgroup>
+
+ <thead valign="bottom">
+ <tr>
+ <th class="head" colspan="2">Tipi comuni</th>
+ </tr>
+ </thead>
+
+ <tbody valign="top">
+ <tr>
+ <td>d</td>
+
+ <td>directory</td>
+ </tr>
+
+ <tr>
+ <td>-</td>
+
+ <td>file</td>
+ </tr>
+
+ <tr>
+ <td>l</td>
+
+ <td>link</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="section" id="manipolare-i-permessi-dei-file">
+ <h3><a class="toc-backref" href=
+ "#id4">1.1.2 Manipolare i permessi dei
+ file</a></h3>
+
+ <dl class="docutils">
+ <dt>chmod</dt>
+
+ <dd>Cambia i parametri <em>rwx</em> dell'oggetto</dd>
+
+ <dt>chown</dt>
+
+ <dd>Cambia il proprietario</dd>
+
+ <dt>chgrp</dt>
+
+ <dd>Cambia il gruppo</dd>
+ </dl>
+
+ <p>Per la sintassi e le opzioni vedere le pagine
+ <tt class="docutils literal"><span class=
+ "pre">man</span></tt> dei singoli comandi.</p>
+ </div>
+ </div>
+ </div>
+
+ <div class="section" id="tar-archiviazione">
+ <h1><a class="toc-backref" href=
+ "#id5">2 TAR: archiviazione</a></h1>
+
+ <p>Breve lista delle opzioni del comando <tt class=
+ "docutils literal"><span class="pre">tar</span></tt>
+ (archiviazione dei files)</p>
+
+ <table class="docutils option-list" frame="void" rules=
+ "none">
+ <col class="option">
+ <col class="description">
+
+ <tbody valign="top">
+ <tr>
+ <td class="option-group"><kbd><span class="option">-c
+ <var>nome_arch</var></span></kbd></td>
+
+ <td>creare un archivio con nome <tt class=
+ "docutils literal"><span class=
+ "pre">nome_arch</span></tt></td>
+ </tr>
+
+ <tr>
+ <td class="option-group"><kbd><span class=
+ "option">-t</span></kbd></td>
+
+ <td>visualizzare il contenuto di un archivio</td>
+ </tr>
+
+ <tr>
+ <td class="option-group"><kbd><span class=
+ "option">-x</span></kbd></td>
+
+ <td>estrarre da un archivio</td>
+ </tr>
+
+ <tr>
+ <td class="option-group"><kbd><span class=
+ "option">-f</span></kbd></td>
+
+ <td>nome dell'archivio</td>
+ </tr>
+
+ <tr>
+ <td class="option-group"><kbd><span class=
+ "option">-z</span></kbd></td>
+
+ <td>compresso con gunzip</td>
+ </tr>
+
+ <tr>
+ <td class="option-group"><kbd><span class=
+ "option">-j</span></kbd></td>
+
+ <td>compresso con bzip2</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div class="section" id="esempi-creare-un-archivio">
+ <h2><a class="toc-backref" href=
+ "#id6">2.1 Esempi: creare un
+ archivio</a></h2>
+
+ <dl class="docutils">
+ <dt>tar -cf nome_archivio.tar cartella_da_archiviare</dt>
+
+ <dd>crea un archivio nome_archivio.tar dalla cartella
+ cartella_da_archiviare</dd>
+
+ <dt>tar -zcf nome_rchivio.tar.gz
+ cartella_da_archiviare</dt>
+
+ <dd>crea un archivio compresso con gunzip
+ nome_rchivio.tar.gz dalla cartella
+ cartella_da_archiviare</dd>
+
+ <dt>tar -jcf nome_archivio.tb2
+ cartella_da_archiviare</dt>
+
+ <dd>crea un archivio compresso con bzip2
+ nome_rchivio.tar.gz dalla cartella
+ cartella_da_archiviare</dd>
+ </dl>
+ </div>
+
+ <div class="section" id=
+ "esempi-visualizzare-il-contenuto-di-un-archivio">
+ <h2><a class="toc-backref" href=
+ "#id7">2.2 Esempi: visualizzare il
+ contenuto di un archivio</a></h2>
+
+ <dl class="docutils">
+ <dt>tar -tf nome_archivio.tar</dt>
+
+ <dd>Per visualizzare e basta il contenuto di un
+ archivio</dd>
+ </dl>
+ </div>
+
+ <div class="section" id="esempi-esplodere-un-archivio">
+ <h2><a class="toc-backref" href=
+ "#id8">2.3 Esempi: esplodere un
+ archivio</a></h2>
+
+ <dl class="docutils">
+ <dt>tar -xf nome_archivio.tb2</dt>
+
+ <dd>Esplode l'archivio</dd>
+
+ <dt>tar -zxf nome_archivio.tb2</dt>
+
+ <dd>Esplode un archivio compresso con gunzip</dd>
+
+ <dt>tar -jxf nome_archivio.tb2</dt>
+
+ <dd>Esplode un archivio compresso con bzip2</dd>
+ </dl>
+ </div>
+ </div>
+
+ <div class="section" id=
+ "navigazione-nei-filesystems-virtuali-proc-e-sys">
+ <h1><a class="toc-backref" href=
+ "#id9">3 Navigazione nei filesystems
+ virtuali: proc e sys</a></h1>
+
+ <p>Per meglio comprendere la natura dei filesystems virtuali
+ <strong>proc</strong> e <strong>sys</strong> possiamo provare
+ a muoverci al loro interno, vedere alcuni degli esempi piu'
+ interessanti e provare anche a intervenire su di essi.</p>
+
+ <div class="danger">
+ <p class="first admonition-title">!PERICOLO!</p>
+
+ <p class="last">Non sparate dei valori a <em>caso</em> su
+ oggetti come ventole di raffreddamento: potreste cuocere le
+ CPU e provocare danni irreparabili (quindi niente echo >
+ ...)</p>
+ </div>
+
+ <p>Storia:</p>
+ <pre class="literal-block">
+51 cat /proc/
+52 cat /proc/cpuinfo
+53 htop
+54 cat /proc/meminfo
+55 free
+56 cat /sys/devices/system/cpu/cpu0/cpuidle/state0
+57 cat /sys/devices/system/cpu/cpu0/cpuidle/state0/usage
+58 cat /sys/devices/system/cpu/cpu0/cpuidle/state0/power
+59 cat /sys/devices/system/cpu/cpu0/crash_notes
+60 cat /sys/devices/system/cpu/cpu0/topology/core_id
+61 cat /sys/devices/system/clocksource/clocksource0/available_clocksource
+62 cat /sys/devices/system/clocksource/clocksource0/current_clocksource
+63 cat /proc/meminfo
+64 cat /sys/class/thermal/cooling_device
+65 cat /sys/class/thermal/cooling_device0/cur_state
+66 cat /sys/class/thermal/cooling_device0/cur_state
+67 echo "1" > /sys/class/thermal/cooling_device0/cur_state
+68 cat /sys/class/thermal/cooling_device0/cur_state
+69 echo "0" > /sys/class/thermal/cooling_device0/cur_state
+70 echo "0" > /sys/class/thermal/cooling_device1/cur_state
+71 echo "1" > /sys/class/thermal/cooling_device1/cur_state
+72 cat /sys/class/thermal/cooling_device1/cur_state
+73 echo "0" > /sys/class/thermal/cooling_device1/cur_state
+74 echo "0" > /sys/class/thermal/cooling_device1/max_state
+75 cat /sys/class/thermal/cooling_device1/max_state
+76 echo "7" > /sys/class/thermal/cooling_device1/max_state
+77 echo "7" > /sys/class/thermal/cooling_device1/cur_state
+78 echo "7" > /sys/class/thermal/cooling_device0/
+79 echo "7" > /sys/class/thermal/cooling_device0/max_state
+80 cat /sys/class/thermal/cooling_device0/max_state
+81 echo "7" > /sys/class/thermal/cooling_device0/cur_state
+82 cat /sys/class/thermal/cooling_device0/cur_state
+83 echo "0" > /sys/class/thermal/cooling_device0/cur_state
+84 echo "0" > /sys/class/thermal/cooling_device1/cur_state
+85* cat /sys/class/thermal/cooling_device1/
+86 cat /sys/class/thermal/cooling_device1/cur_state
+87 cat /sys/class/thermal/cooling_device0/cur_state
+88 cat /sys/class/hwmon/hwmon0/fan1_pwm
+89 cat /sys/class/net/eth0/address
+90 cat /sys/class/net/eth0/broadcast
+91 cat /sys/class/net/eth0/features
+92 cat /sys/class/net/eth0/flags
+93 cat /sys/class/net/eth0/mtu
+94 cat /sys/class/net/eth0/statistics/rx_errors
+95 cat /sys/class/net/eth0/statistics/rx_bytes
+96 cd /tmp/
+97 history > proc_nav
+</pre>
+ </div>
+
+ <div class="section" id="reti-tcp-ip">
+ <h1><a class="toc-backref" href=
+ "#id10">4 Reti: TCP/IP</a></h1>
+
+ <p>Il modello OSI: 7 livelli. Il modello TCP/IP: 4
+ livelli.</p>
+
+ <p>Link ai livelli dell'OSI: - <a class="reference external"
+ href=
+ "http://it.wikipedia.org/wiki/Open_Systems_Interconnection">http://it.wikipedia.org/wiki/Open_Systems_Interconnection</a>
+ - <a class="reference external" href=
+ "http://upload.wikimedia.org/wikipedia/commons/5/56/Rm-osi_parallel.png">
+ http://upload.wikimedia.org/wikipedia/commons/5/56/Rm-osi_parallel.png</a></p>
+
+ <p>Comparazione livelli OSI / TCP/IP:</p>
+ <pre class="literal-block">
+ OSI TCP/IP
+------------- ------------
+Applicazione Applicazione
+Presentazione
+Sessione
+------------- ------------
+Trasporto Trasporto
+------------- ------------
+Network Internet
+------------- ------------
+Collegamento Network
+Fisico
+------------- ------------
+</pre>
+
+ <p>Il modello TCP/IP e' quindi una semplificazione del
+ modello OSI.</p>
+
+ <p>Per una descrizione dei vari livelli del TCP/IP vedere: -
+ <a class="reference external" href=
+ "http://www.tutorialpc.it/tcp1.asp">http://www.tutorialpc.it/tcp1.asp</a>
+ - <a class="reference external" href=
+ "http://www.docmirror.net/it/linux/howto/misc/NET-3-HOWTO/">http://www.docmirror.net/it/linux/howto/misc/NET-3-HOWTO/</a>
+ - <a class="reference external" href=
+ "http://it.wikipedia.org/wiki/TCP/IP">http://it.wikipedia.org/wiki/TCP/IP</a></p>
+
+ <div class="section" id="il-livello-network">
+ <h2><a class="toc-backref" href=
+ "#id11">4.1 Il livello Network:</a></h2>
+
+ <p>Il livello "Network" e' quello che si occupa di far
+ funzionare l'hardware di rete. E' quindi dipendente dalla
+ macchina su cui viene implementato lo stack TCP/IP.</p>
+ </div>
+
+ <div class="section" id="il-livello-internet">
+ <h2><a class="toc-backref" href=
+ "#id12">4.2 Il livello Internet</a></h2>
+
+ <p>Alias: secondo livello...</p>
+
+ <p>il livello internet si occupa di indirizzamenti, di
+ suddivisione in frammenti, e instradamenti in TCP/IP. I
+ protocolli che lavorano a questo livello,che รจ internet,
+ interagiscono con i livelli immediatamente superiore ed
+ inferiore.</p>
+
+ <dl class="docutils">
+ <dt>I protocolli che lavorano a questo livello sono:</dt>
+
+ <dd>
+ <ul class="first last simple">
+ <li>ARP</li>
+
+ <li>ICMP</li>
+
+ <li>IP</li>
+
+ <li>IGMP</li>
+ </ul>
+ </dd>
+ </dl>
+
+ <p>Links:</p>
+
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://www.tutorialpc.it/tcp1.asp">http://www.tutorialpc.it/tcp1.asp</a></li>
+
+ <li><a class="reference external" href=
+ "http://www.docmirror.net/it/linux/howto/misc/NET-3-HOWTO/">
+ http://www.docmirror.net/it/linux/howto/misc/NET-3-HOWTO/</a></li>
+
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/TCP/IP">http://it.wikipedia.org/wiki/TCP/IP</a></li>
+ </ul>
+ </div>
+
+ <div class="section" id="documentazione-su-ip">
+ <h2><a class="toc-backref" href=
+ "#id13">4.3 Documentazione su IP</a></h2>
+
+ <p>Documentazione su IP:</p>
+
+ <ul>
+ <li>
+ <p class="first"><a class="reference external" href=
+ "http://www.freesoft.org/CIE/Course/Section3/7.htm">http://www.freesoft.org/CIE/Course/Section3/7.htm</a>
+ Tutorial in inglese</p>
+ </li>
+
+ <li>
+ <p class="first">Consigliato: Manuale del TCP/IP
+ dell'Apogeo.</p>
+ </li>
+
+ <li>
+ <dl class="first docutils">
+ <dt><a class="reference external" href=
+ "http://www.disi.unige.it/person/BelleG/Reti99/Appunti/Appunti1/Cap6c/Cap6c.html">
+ http://www.disi.unige.it/person/BelleG/Reti99/Appunti/Appunti1/Cap6c/Cap6c.html</a></dt>
+
+ <dd>
+ <p class="first last">Tutorial in italiano
+ relativamente semplice</p>
+ </dd>
+ </dl>
+ </li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="section" id="maschere-di-rete">
+ <h1><a class="toc-backref" href=
+ "#id14">5 Maschere di rete</a></h1>
+
+ <p>Analizziamo gli indirizzi IP e le sotto reti</p>
+
+ <p>Consideriamo gli indirizzi IP della classe C:</p>
+ <pre class="literal-block">
+ 212.22.136.0 (0 mi permette di identificare la rete)
+
+andrea 212.22.136.177 11010100.00010110.10001000. 10110001
+giulio 212.22.136.178 11010100.00010110.10001000. 10110010
+papo 212.22.136.166 11010100.00010110.10001000. 10100110
+</pre>
+
+ <p>Cosa notiamo?</p>
+
+ <p>Be'... Che la parte relativa alla rete ovviamente non
+ cambia:</p>
+ <pre class="literal-block">
+11010100.00010110.10001000. che corrisponde a 212.22.136.
+</pre>
+
+ <p>Questa e' la sotto rete</p>
+ <pre class="literal-block">
+255.255.255.0
+</pre>
+
+ <div class="section" id="messa-in-and">
+ <h2><a class="toc-backref" href=
+ "#id15">5.1 Messa in AND</a></h2>
+
+ <p>Come calcola il computer le sotto reti per il routing
+ dei pacchetti?</p>
+
+ <p>Facendo la MESSA in AND dell'host0/rete host1/rete</p>
+
+ <p>Proviamo con andrea e papo:</p>
+ <pre class="literal-block">
+andrea IP 11010100.00010110.10001000. 10110001
+andrea rete 11111111.11111111.11111111. 00000000
+risultato andrea: 11010100.00010110.10001000
+
+papo IP 11010100.00010110.10001000. 10100110
+papo rete 11111111.11111111.11111111. 00000000
+risultato papo 11010100.00010110.10001000
+
+Confrontiamoli: 11010100.00010110.10001000
+ 11010100.00010110.10001000
+
+Sono uguali -> stessa rete
+</pre>
+ </div>
+ </div>
+
+ <div class="section" id="cavi-di-rete">
+ <h1><a class="toc-backref" href=
+ "#id16">6 Cavi di Rete</a></h1>
+
+ <p>link a cavi coassiali / thin :</p>
+
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://www.dia.uniroma3.it/~necci/coax_s.htm">http://www.dia.uniroma3.it/~necci/coax_s.htm</a></li>
+
+ <li>Link ai vari tipi di cavi ethernet UTP twisted pairs
+ <a class="reference external" href=
+ "http://www.lineaedp.it/01NET/HP/0,1254,1_ART_78376,00.html?lw=10001">
+ http://www.lineaedp.it/01NET/HP/0,1254,1_ART_78376,00.html?lw=10001</a></li>
+ </ul>
+
+ <div class="section" id="riferimenti-per-cavi-ethernet-ecc">
+ <h2><a class="toc-backref" href=
+ "#id17">6.1 Riferimenti per cavi /
+ ethernet ecc.:</a></h2>
+
+ <blockquote>
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/IEEE_802.3">http://it.wikipedia.org/wiki/IEEE_802.3</a></li>
+
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/Fast_Ethernet">http://it.wikipedia.org/wiki/Fast_Ethernet</a></li>
+
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/Fast_Ethernet">http://it.wikipedia.org/wiki/Fast_Ethernet</a></li>
+
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/10Base5">http://it.wikipedia.org/wiki/10Base5</a></li>
+ </ul>
+ </blockquote>
+ </div>
+
+ <div class="section" id="tipi-di-wifi">
+ <h2><a class="toc-backref" href=
+ "#id18">6.2 Tipi di WiFi:</a></h2>
+
+ <dl class="docutils">
+ <dt>Wifi:</dt>
+
+ <dd>
+ <blockquote class="first">
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/Wifi">http://it.wikipedia.org/wiki/Wifi</a></li>
+
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/IEEE_802.11">http://it.wikipedia.org/wiki/IEEE_802.11</a>
+ Standard WiFi</li>
+ </ul>
+ </blockquote>
+
+ <p class="last"><a class="reference external" href=
+ "http://en.wikipedia.org/wiki/IEEE_802.11#802.11b">http://en.wikipedia.org/wiki/IEEE_802.11#802.11b</a></p>
+ </dd>
+ </dl>
+ </div>
+
+ <div class="section" id="wimax">
+ <h2><a class="toc-backref" href=
+ "#id19">6.3 WiMax:</a></h2>
+
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/WiMAX">http://it.wikipedia.org/wiki/WiMAX</a></li>
+ </ul>
+ </div>
+
+ <div class="section" id="hiperlan">
+ <h2><a class="toc-backref" href=
+ "#id20">6.4 Hiperlan:</a></h2>
+
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://it.wikipedia.org/wiki/Hyperlan">http://it.wikipedia.org/wiki/Hyperlan</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <div class="section" id=
+ "breve-sommario-dei-comandi-relativi-al-networking">
+ <h1><a class="toc-backref" href=
+ "#id21">7 Breve sommario dei comandi
+ relativi al networking</a></h1>
+
+ <div class="section" id="ifconfig">
+ <h2><a class="toc-backref" href=
+ "#id22">7.1 ifconfig</a></h2>
+
+ <p>Configurare un device di rete:</p>
+
+ <blockquote>
+ # ifconfig eth0 192.168.0.1 # ifconfig eth0 down #
+ abbatte una scheda di rete # ifconfig eth0:1 192.168.0.1
+ # abilita una scheda di rete virtuale # ifconfig eth0:1
+ 192.168.1.1 # abilita una scheda di rete VIRTUALE
+ </blockquote>
+ </div>
+
+ <div class="section" id="ping">
+ <h2><a class="toc-backref" href=
+ "#id23">7.2 ping</a></h2>
+
+ <p>Test della connessione tra due hosts (ICMP):</p>
+ <pre class="literal-block">
+ping 192.168.0.254 # ping all'infinito un indirizzo IP, per fermarlo: CTR + c
+ping -c 2 192.168.0.254 # manda solo due pacchetti poi si interrompe
+</pre>
+ </div>
+
+ <div class="section" id="route">
+ <h2><a class="toc-backref" href=
+ "#id24">7.3 route</a></h2>
+
+ <p>Modifica delle tabelle di instradamento / routing:</p>
+ <pre class="literal-block">
+# route -n #visualizza la tabella di routing attuale
+# route add default gw 192.168.0.254 #aggiunge un gateway di default
+# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.254
+ # aggiunge la rotta per una rete
+# route add -host 192.168.1.2 gw 192.168.0.254
+ # aggiunge la rotta per un singolo host
+# route del ... # elimina una rotta precedentemente attivata
+es: # route del -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.0.254
+</pre>
+ </div>
+
+ <div class="section" id="traceroute">
+ <h2><a class="toc-backref" href=
+ "#id25">7.4 traceroute</a></h2>
+
+ <p>Ricerca dei passaggi (hops) attraverso i quali
+ comunicano due hosts:</p>
+ <pre class="literal-block">
+traceroute 192.168.0.254 # visualizza gli hops frapposti tra noi e un IP
+</pre>
+ </div>
+
+ <div class="section" id="host">
+ <h2><a class="toc-backref" href=
+ "#id26">7.5 host</a></h2>
+
+ <p>Risoluzione di nomi di dominio / IP:</p>
+ <pre class="literal-block">
+$ host bender.piffa.net # risolve l'indirizzo IP di bender.piffa.net
+$ host 212.22.136.248 # risoluzione inversa di un indirizzo IP
+</pre>
+ </div>
+
+ <div class="section" id="instradamento">
+ <h2><a class="toc-backref" href=
+ "#id27">7.6 Instradamento:</a></h2>
+
+ <p>Per poter utilizzare le funzionalita' di routing del
+ kernel di Linux e' necessario abilitare l'ip-forwarding
+ dello stesso kernel</p>
+
+ <p>Si puo' verificare se l'instradamento (IP forwarding) e'
+ abilitato leggendo in /proc il valore di:</p>
+ <pre class="literal-block">
+$ cat /proc/sys/net/ipv4/ip_forward
+</pre>
+
+ <p>Si puo' scrivere un valore diverso con echo e il
+ re-indirizzamento dell'output:</p>
+ <pre class="literal-block">
+# echo "1" > /proc/sys/net/ipv4/ip_forward
+</pre>
+
+ <div class="note">
+ <p class="first admonition-title">Nota</p>
+
+ <p class="last">Vedi pag: 295 del manuale cartaceo</p>
+ </div>
+ </div>
+
+ <div class="section" id="tcpdump">
+ <h2><a class="toc-backref" href=
+ "#id28">7.7 tcpdump</a></h2>
+
+ <ul class="simple">
+ <li><a class="reference external" href=
+ "http://openmaniak.com/tcpdump.php">http://openmaniak.com/tcpdump.php</a></li>
+ </ul>
+
+ <p>Analizzatore di traffico a riga di comando:</p>
+ <pre class="literal-block">
+$ tcpdump -q # Output semplificato, usare -v -vv per maggior dettaglio
+$ tcpdump udp # Per catturare il traffico UDP
+$ tcpdump port http # Per catturare il traffico sulla porta 80 (http)
+$ tcpdump src 192.168.1.100 and dst 192.168.1.2 and port ftp
+ # Per catturare il traffico FTP tra src (sorgente) e dst (destinazione)
+ # sulla porta di FTP
+$ tcpdump -A # Per visualizzare il contenuto dei pacchetti intercettati
+</pre>
+ </div>
+ </div>
+
+ <div class="section" id="sessione-ftp">
+ <h1><a class="toc-backref" href=
+ "#id29">8 Sessione FTP</a></h1>
+
+ <p>Breve lista dei comandi per una sessione FTP (non usate
+ FTP, usate SFTP...):</p>
+ <pre class="literal-block">
+ftp nome_host # stabilire la connessione
+ # poi chiedera' la password dell'utente
+ # se avete sbagliato utente: user
+
+help # Lista dei comandi disponibili
+help [nome_comando] # cosa fa quel comando
+put # per caricare un file
+get # per scaricare un file
+ls # lo sapete cosa fa...
+cd # fa il cambio directory
+lcd # cambio directory in LOCALE
+mput/mget # per lavorare su file multipli
+prompt # per uscire dalla modalita' interattiva
+ # (non vi chiede conferma di ogni singola operazione
+ # sul singolo file...)
+binary # entra in modalita' trasferimento binario
+ascii # entra in modalita' trasferimento ascii
+bye # per chiudere la sessione
+</pre><!-- NOTE
+sftp funziona _circa_ con gli stessi comandi. -->
+ </div>
+
+ <div class="section" id="todo">
+ <h1><a class="toc-backref" href=
+ "#id30">9 ToDo</a></h1>
+
+ <p>Mancano (non inseriti in questo file ma presenti come
+ frammenti di testo semplice):</p>
+
+ <ul class="simple">
+ <li>Raid</li>
+
+ <li>firewall</li>
+
+ <li>bsd gestione pacchetti</li>
+
+ <li>backup</li>
+
+ <li>apache</li>
+
+ <li>storie varie</li>
+ </ul>
+ </div>
+ </div>
+</body>
+</html>