405
405
dei dispositivi di rete. Questo documento è diretto agli amministratori del server ed si focalizza sulla gestione della rete da riga di comando.</para>
406
406
<sect2 id="ethernet" status="complete">
407
407
<title>Ethernet</title>
408
<para>Gran parte della configurazione di ethernet è concentrata il un singolo file, <filename>/etc/network/interfaces</filename>. Se non è presente alcun dispositivo ethernet, in questo file è elencata solo l'interfaccia di loopback ed il contenuto è simile a quanto segue: <screen># Questo file descrive le interfacce di rete disponibili sul sistema e #come attivarle. Per maggiori informazioni, consultare interfaces(5).
408
<para>Gran parte della configurazione di ethernet è concentrata il un singolo file, <filename>/etc/network/interfaces</filename>. Se non è presente alcun dispositivo ethernet, in questo file è elencata solo l'interfaccia di loopback e il contenuto è simile a quanto segue: <screen># Questo file descrive le interfacce di rete disponibili sul sistema e
409
#come attivarle. Per maggiori informazioni, consultare interfaces(5).
410
411
# L'interfaccia di rete di loopback
412
413
iface lo inet loopback
413
414
address 127.0.0.1
414
netmask 255.0.0.0</screen>. Se nel sistema è presente solo un dispositivo ethernet, eth0, e la sua configurazione viene ottenuta da un server DHCP, allora il dispositivo dovrebbe essere attivato automaticamente al boot e nel file sono richieste solo le due righe aggiuntive: <screen>auto eth0
415
netmask 255.0.0.0</screen> Se nel sistema è presente solo un dispositivo ethernet, eth0, e la sua configurazione viene ottenuta da un server DHCP, allora il dispositivo dovrebbe essere attivato automaticamente al boot e nel file sono richieste solo le due righe aggiuntive: <screen>auto eth0
415
416
iface eth0 inet dhcp</screen> La prima riga specifica che il dispositivo eth0 dovrebbe essere attivato automaticamente al boot. La seconda riga indica che l'interfaccia (<quote>iface</quote>) eth0 dovrebbe avere un indirizzo nello spazio di IPv4 (sostituire <quote>inet</quote> con <quote>inet6</quote> per un dispositivo IPv6) e che dovrebbe ottenere la sua configurazione da DHCP in modo automatico. Assumendo che la rete e il server DHCP sono propriamente configurati, la macchina in questione non dovrebbe necessitare di ulteriore configurazione per operare propriamente. Il server DHCP fornisce il gateway predefinito (implementato attraverso il comando <application>route</application>), l'indirizzo IP del dispositivo (implementato attraverso il comando <application>ifconfig</application>) e viene usato un server DNS sulla rete (implementato nel file <filename>/etc/resolv.conf</filename>).</para>
416
<para>To configure your ethernet device with a static IP address and custom configuration,
417
some more information will be required. Suppose you want to assign the IP address
418
192.168.0.2 to the device eth1, with the typical netmask of 255.255.255.0. Your default
419
gateway's IP address is 192.168.0.1. You would enter something like this into
420
<filename>/etc/network/interfaces</filename>:
421
<screen>iface eth1 inet static
423
netmask 255.255.255.0
424
gateway 192.168.0.1</screen>
425
In this case, you will need to specify your DNS servers manually in
426
<filename>/etc/resolv.conf</filename>, which should look something like this:
427
<screen>search mydomain.com
417
<para>Per configurare il dispositivo ethernet con un indirizzo IP statico e una configurazione personalizzata, sono richieste alcune informazioni aggiuntive. Si fa l'ipotesi di voler assegnare l'indirizzo IP 192.168.0.2 al dispositivo eth1, con la tipica maschera di rete 255.255.255.0. L'indirizzo IP del gateway predefinito è 192.168.0.1. In tal caso si dovrebbe inserire in <filename>/etc/network/interfaces</filename> qualcosa tipo: <screen>iface eth1 inet static
419
netmask 255.255.255.0
420
gateway 192.168.0.1</screen> In tal caso è necessario specificare manualmente i server DNS in <filename>/etc/resolv.conf</filename>, che dovrebbe contenere qualcosa tipo: <screen>search miodominio.it
428
421
nameserver 192.168.0.1
429
nameserver 4.2.2.2</screen>
430
The <emphasis role="italics">search</emphasis> directive will append mydomain.com
431
to hostname queries in an attempt to resolve names to your network. For example,
432
if your network's domain is mydomain.com and you try to ping the host
433
<quote>mybox</quote>, the DNS query will be modified to <quote>mybox.mydomain.com</quote>
434
for resolution. The <emphasis role="italics">nameserver</emphasis> directives
435
specifiy DNS servers to be used to resolve hostnames to IP addresses. If you use
436
your own nameserver, enter it here. Otherwise, ask your Internet Service Provider
437
for the primary and secondary DNS servers to use, and enter them into
438
<filename>/etc/resolv.conf</filename> as shown above.</para>
422
nameserver 4.2.2.2</screen> La direttiva <emphasis role="italics">search</emphasis> fa sì che miodominio.it sia accodata alle interrogazioni dei nomi di host nel tentativo di risolvere i nome sulla rete locale. Ad esempio, se il proprio nome di dominio è miodominio.it e si prova a fare un ping all'host <quote>mybox</quote>, l'interrogazione DNS viene modificata in <quote>mybox.miodominio.it</quote> per la risoluzione. La direttiva <emphasis role="italics">nameserver</emphasis> specifica i server DNS da usare per risolvere i nomi di host in indirizzi IP. Se si fa uso di un proprio server di nomi, inserirlo qui. Altrimenti, domandare al proprio ISP (Internet Service Provider) i server DNS primario e secondario da usare e inserirli in <filename>/etc/resolv.conf</filename> come mostrato poco sopra.</para>
439
423
<para>È possibile realizzare molte altre configurazioni, incluse quelle per le interfacce PPP dialup, le reti IPv6, i dispositivi VPN, ecc. Fare riferimento a <application>man 5 interfaces</application> per maggiori informazioni e per le opzioni supportate. Notare che <filename>/etc/network/interfaces</filename> è usato dagli script <application>ifup</application>/<application>ifdown</application> come schema di configurazione ad un livello più alto rispetto magari ad altre distribuzioni di Linux e che le tradizionali utilità di livello inferiore, come <application>ifconfig</application>, <application>route</application> e <application>dhclient</application> sono sempre disponibili per una configurazione ottimale.</para>
441
425
<sect2 id="managing-dns-entries" status="complete">
470
454
<sect1 id="tcpip" status="complete">
471
455
<title>TCP/IP</title>
472
<para>Il protocollo TCP/IP (Transmission Control Protocol and Internet Protocol) è un insieme standard di protocolli sviluppato nella seconda metà degli anni '70 dalla DARPA (Defence Advanced Research Project Agency), allo scopo di permettere la comunicazione tra diversi tipi di computer e di reti di computer. TCP/IP è il motore di Internet, ecco perchè è l'insieme di protocolli di rete del mondo più diffuso al mondo.</para>
456
<para>Il protocollo TCP/IP (Transmission Control Protocol e Internet Protocol) è un insieme standard di protocolli sviluppato nella seconda metà degli anni '70 dalla DARPA (Defence Advanced Research Project Agency), allo scopo di permettere la comunicazione tra diversi tipi di computer e di reti di computer. TCP/IP è il motore di Internet, ecco perchè è l'insieme di protocolli di rete più diffuso al mondo.</para>
473
457
<sect2 id="tcpip-introduction" status="complete">
474
458
<title>Introduzione a TCP/IP</title>
476
The two protocol components of TCP/IP deal with different aspects of computer networking.
477
<emphasis>Internet Protocol</emphasis>, the "IP" of TCP/IP is a
478
connectionless protocol which deals only with network packet routing using the <emphasis role="italics">IP datagram</emphasis> as the basic unit of networking information. The
479
IP datagram consists of a header followed by a message. The <emphasis>
480
Transmission Control Protocol</emphasis> is the "TCP" of TCP/IP and enables network hosts
481
to establish connections which may be used to exchange data streams. TCP also guarantees
482
that the data between connections is delivered and that it arrives at one network host in
483
the same order as sent from another network host.
459
<para>I due protocolli che compongono il TCP/IP si occupano di aspetti diversi delle reti di computer. L'<emphasis>Internet Protocol</emphasis>, la parte IP di TCP/IP, è un protocollo senza connessione che tratta solo l'instradamento dei pacchetti di rete usando il <emphasis role="italics">datagramma IP</emphasis> come l'unità fondamentale dell'informazione di rete. Il datagramma IP è formato da un'intestazione seguita da un messaggio. Il <emphasis>Transmission Control Protocol</emphasis>, la parte TCP di TCP/IP, consente agli host della rete di stabilire delle connessioni usate per scambiare flussi di dati. Inoltre il TCP garantisce che i dati tra le connessioni siano consegnati e che arrivino ad host della rete nello stesso ordine in cui sono stati trasmessi da un altro host della rete.</para>
486
461
<sect2 id="tcpip-configuration" status="complete">
487
462
<title>Configurazione di TCP/IP</title>
489
The TCP/IP protocol configuration consists of several elements which must be set by
490
editing the appropriate configuration files, or deploying solutions such as the Dynamic
491
Host Configuration Protocol (DHCP) server which in turn, can be configured to provide the
492
proper TCP/IP configuration settings to network clients automatically. These
493
configuration values must be set correctly in order to facilitate the proper network
494
operation of your Ubuntu system.
463
<para>La configurazione del protocollo TCP/IP è composta da vari elementi che debbono essere impostati modificando gli appropriati file di configurazione oppure adottando soluzioni quali un server DHCP (Dynamic Host Configuration Protocol); tale server provvede ad assegnare automaticamente le corrette impostazioni di configurazione TCP/IP ai client della rete. Questi valori di configurazione debbono essere impostati correttamente per consentire al sistema Ubuntu di operare adeguatamente in rete.</para>
496
464
<para>I tipici elementi di configurazione del TCP/IP e i loro scopi sono i seguenti: <itemizedlist>
499
<emphasis role="bold">IP address</emphasis> The IP address is a unique
500
identifying string expressed as four decimal numbers ranging from zero (0)
501
to two-hundred and fifty-five (255), separated by periods,
502
with each of the four numbers representing eight (8) bits of the address for a
503
total length of thirty-two (32) bits for the whole address. This format is called
504
<emphasis>dotted quad
505
notation</emphasis>.</para>
509
<emphasis role="bold">Netmask</emphasis> The Subnet Mask (or simply,
510
<emphasis>netmask</emphasis>) is a local bit mask, or set of flags
511
which separate the portions of an IP address significant to the network from the
512
bits significant to the <emphasis>subnetwork</emphasis>. For example,
513
in a Class C network, the standard netmask is 255.255.255.0 which masks the first
514
three bytes of the IP address and allows the last byte of the IP address to
515
remain available for specifying hosts on the subnetwork.
520
<emphasis role="bold">Network Address</emphasis> The Network Address represents the
521
bytes comprising the network portion of an IP address. For example, the host 12.128.1.2
522
in a Class A network would use 12.0.0.0 as the network address, which uses twelve (12)
523
to represent the first byte of the IP address, (the network part) and zeroes (0)
524
in all of the remaining three bytes to represent the potential host values. Network
525
hosts using the very common private and non-routable IP addresses such as 192.168.1.100
526
would in turn use a Network Address of 192.168.1.0, which specifies the first three
527
bytes of the Class C 192.168.1 network and a zero (0) for all the possible hosts on the
533
<emphasis role="bold">Broadcast Address</emphasis> The Broadcast Address is an IP address
534
which allows network data to be sent simultaneously to all hosts on a given subnetwork rather
535
than specifying a particular network host. The standard general broadcast address for IP networks is
536
255.255.255.255, but this broadcast address cannot be used to send a broadcast message to
537
every host on the Internet because routers block it. A more appropriate broadcast address
538
is set to match a specific subnetwork. For example, on the popular private Class C IP network,
539
192.168.1.0, the broadcast address should be configured as 192.168.1.255. Broadcast messages are
540
typically produced by network protocols such as the Address Resolution Protocol (ARP) and the
541
Routing Information Protocol (RIP).
546
<emphasis role="bold">Gateway Address</emphasis> A Gateway Address is the IP address through which
547
a particular network, or host on a network, may be reached. If one network host wishes to communicate
548
with another network host, and that host is not located on the same network, then a
549
<emphasis>gateway</emphasis> must be used. In many cases, the Gateway Address will be that
550
of a router on the same network, which will in turn pass traffic on to other networks or hosts, such as
551
Internet hosts. The value of the Gateway Address setting must be correct, or your system will not be able
552
to reach any hosts beyond those on the same network.
557
<emphasis role="bold">Nameserver Address</emphasis> Nameserver Addresses represent the IP addresses of
558
Domain Name Service (DNS) systems, which resolve network hostnames into IP addresses. There are three levels of
559
Nameserver Addresses, which may be specified in order of precedence: The
560
<emphasis>Primary</emphasis>
561
Nameserver, the <emphasis>Secondary</emphasis> Nameserver, and the
562
<emphasis>Tertiary</emphasis>
563
Nameserver. In order for your system to be able to resolve network hostnames into their
564
corresponding IP addresses, you must specify valid Nameserver Addresses which you are authorized to use
565
in your system's TCP/IP configuration. In many cases these addresses can and will be provided by your
566
network service provider, but many free and publicly accessible Nameservers are available for use, such as
567
the Level3 (Verizon) servers with IP addresses from
568
4.2.2.1 to 4.2.2.6. </para>
466
<para><emphasis role="bold">Indirizzo IP</emphasis> L'indirizzo IP è una stringa d'identificazione unica, espressa da quattro numeri decimali compresi tra zero (0) e duecentocinquantacinque (255), separati da punti; ciascuno dei quattro numeri rappresenta otto (8) bit dell'indirizzo per una lunghezza totale di trentadue (32) bit per l'indirizzo completo. Questo formato è detto <emphasis>notazione decimale a punti</emphasis>.</para>
469
<para><emphasis role="bold">Maschera di rete</emphasis> La maschera di rete (o semplicemente <emphasis>netmask</emphasis>) è una maschera locale di bit, ovvero un insieme di indicatori che separano la porzione di un indirizzo IP che indica la rete dai bit che indicano la <emphasis>sotto-rete</emphasis>. Ad esempio, in una rete di classe C, la maschera di rete standard è 255.255.255.0 che serve a mascherare i primi tre byte dell'indirizzo IP, consentendo all'ultimo byte dell'indirizzo IP di essere disponibile per specificare gli host della sotto-rete.</para>
472
<para><emphasis role="bold">Indirizzo di rete</emphasis> L'indirizzo di rete rappresenta i byte che contengono la porzione di rete di un indirizzo IP. Ad esempio, l'host 12.128.1.2 in una rete di classe A usa 12.0.0.0 come indirizzo di rete; tale indirizzo di rete usa il 12 per rappresentare il primo byte dell'indirizzo IP (la parte della rete) e gli zero (0) in tutti i restanti tre byte per rappresentare i valori dei potenziali host. Gli host di rete che usano indirizzi IP privati e non indirizzabili molto comuni come 192.168.1.100 usano come indirizzo di rete 192.168.1.0, che specifica che i primi tre gruppi di byte 192.168.1 appartengono ad una rete di classe C, mentre uno zero rappresenta tutti gli host presenti nella rete.</para>
475
<para><emphasis role="bold">Indirizzo di broadcast</emphasis> L'indirizzo di broadcast è un indirizzo IP che consente di inviare dati simultaneamente a tutti gli host di una data sotto-rete invece che a uno specifico host di rete. L'indirizzo di broadcast generale standard per le reti IP è 255.255.255.255, ma questo indirizzo di broadcast non può essere usato per inviare un messaggio in broadcast a tutti gli host su Internet poiché viene bloccato dai router. Un indirizzo di broadcast più idoneo è impostato per corrispondere a una specifica sotto-rete. Ad esempio in una comune rete IP privata di classe C, 192.168.1.0, l'indirizzo di broadcast dovrebbe essere configurato come 192.168.1.255. I messaggi di broadcast sono preparati normalmente dai protocolli di rete quali ARP (Address Resolution Protocol) e RIP (Routing Information Protocol).</para>
478
<para><emphasis role="bold">Indirizzo del gateway</emphasis> Un indirizzo del gateway è l'indirizzo IP attraverso il quale una particolare rete, o un host su una rete, può essere raggiunta. Se un host di rete desidera comunicare con un altro host di rete, senza essere localizzati nelle stessa rete, allora deve essere usato un <emphasis>gateway</emphasis>. In molti casi l'indirizzo del gateway coincide con quello di un router della medesima rete, il quale ha il compito di far transitare il traffico ad altre reti o host, come gli host su Internet. L'impostazione del valore dell'indirizzo del gateway deve essere corretta, altrimenti il sistema non è in grado di raggiungere gli host che non si trovano sulla rete cui appartiene.</para>
481
<para><emphasis role="bold">Indirizzo di server dei nomi</emphasis> Gli indirizzi di server dei nomi rappresentano gli indirizzi IP del sistema DNS (Domain Name Service), che risolve i nomi degli host della rete in indirizzi IP. Sono disponibili tre livelli di indirizzi di server dei nomi che possono essere specificati in ordine di precedenza: il server dei nomi <emphasis>primario</emphasis>, il server dei nomi <emphasis>secondario</emphasis>, e il server dei nomi <emphasis>terziario</emphasis>. Per consentire al sisema di risolvere i nomi degli host di rete nei loro corrispondenti indirizzi IP, è necessario specificare nella configurazione del sistema TCP/IP degli indirizzi di server dei nomi validi e che si è autorizzati a usare. In molti casi tali indirizi possono e sono forniti dal provider dell'utente: comunque risultano liberi e pubblicamente accessibili molti server dei nomi, come i server Level3 (Verizon) con indirizzi IP da 4.2.2.1 a 4.2.2.6.</para>
570
483
<para>Gli indirizzi IP, le maschere di rete, gli indirizzi di rete, gli indirizzi di broadcast e gli indirizzi di gateway sono tipicamente determinati attraverso appropriate direttive nel file <filename>/etc/network/interfaces</filename>. Gli indirizzi di server di nomi sono tipicamente specificati attraverso le direttive <emphasis>nameserver</emphasis> nel file <filename>/etc/resolv.conf</filename>. Per maggiori informazioni, consultare rispettivamente le pagine di manuale di sistema per <filename>interfaces</filename> e <filename>resolv.conf</filename>, usando i seguenti comandi da digitare al prompt di un terminale:</para>
585
498
<sect2 id="ip-routing" status="complete">
586
499
<title>Instradamento IP</title>
588
IP routing is a means of specifying and discovering paths in a TCP/IP network along which
589
network data may be sent. Routing uses a set of <emphasis>routing tables</emphasis>
590
to direct the forwarding of network data packets from their source to the destination, often
591
via many intermediary network nodes known as <emphasis>routers</emphasis>.
592
IP Routing is the principal mode of path discovery on the Internet. There are two primary forms of
593
IP Routing: <emphasis>Static Routing</emphasis> and
594
<emphasis>Dynamic Routing.</emphasis>
597
Static routing involves manually adding IP routes to the system's routing table, and this is usually
598
done by manipulating the routing table with the <application>route</application> command. Static routing enjoys
599
many advantages over dynamic routing, such as simplicity of implementation on smaller networks,
600
predictability (the routing table is always computed in advance, and thus the route is precisely the
601
same each time it used), and low overhead on other routers and network links due to the lack of a
602
dynamic routing protocol. However, static routing does present some disadvantages as well. For example,
603
static routing is limited to small networks and does not scale well. Static routing also fails completely
604
to adapt to network outages and failures along the route due to the fixed nature of the route.
607
Dynamic Routing depends on large networks with multiple possible IP routes from a source to a destination
608
and makes use of special routing protocols, such as the Router Information Protocol (RIP), which handle
609
the automatic adjustments in routing tables that make dynamic routing possible. Dynamic routing
610
has several advantages over static routing, such as superior scalability and the ability to adapt
611
to failures and outages along network routes. Additionally, there is less manual configuration of the
612
routing tables, since routers learn from one another about their existence and available routes. This trait
613
also eliminates the possibility of introducing mistakes in the routing tables via human error.
614
Dynamic routing is not perfect, however, and presents disadvantages such as heightened complexity and
615
additional network overhead from router communications, which does not immediately benefit the end users,
616
but still consumes network bandwidth.
500
<para>L'instradamento IP (routing) è un mezzo per specificare e scoprire i percorsi in una rete TCP/IP lungo i quali possono essere inviati dati di rete. L'instradamento fa uso di un insieme di <emphasis>tabelle di instradamento</emphasis> per gestire l'avanzamento dei pacchetti di dati di rete dalla sorgente fino alla destinazione, spesso attraverso molti nodi di rete intermedi di rete noti come <emphasis>router</emphasis>. L'instradamento IP è il mezzo principale per trovare i percorsi su Internet. Due sono le forme principali di instradamento IP: <emphasis>instradamento statico</emphasis> e <emphasis>instradamento dinamico</emphasis>.</para>
501
<para>L'instradamento statico comporta l'aggiunta manuale delle rotte IP alla tabella di instradamento del sistema; ciò viene di solito eseguito mediante la manipolazione della tabella di instradamento con il comando <application>route</application>. L'instradamento statico gode di molti vantaggi sull'instradamento dinamico, come la semplicità d'implementazione sulle reti poco estese, la predicibilità (la tabella di instradamento è sempre calcolata in anticipo, quindi l'instradamento è sempre lo stesso a ogni utilizzo) e una bassa sovrapponibilità (overhaed) sugli altri router e sugli altri collegamenti di rete dovuta alla mancanza di un protocollo di instradamento dinamico. Comunque, l'instradamento statico, presenta anche alcuni svantaggi. Ad esempio, l'instradamento statico è limitato solo alle reti di piccole dimensioni e non è in grado di "scalare" bene. Inoltre l'instradamento statico fallisce completamente nell'adattarsi alle disfunzioni e fallimenti della rete sulla rotta a causa della natura statica della stessa rotta.</para>
502
<para>L'instradamento dinamico su reti di grandi dimensioni è subordinato alla presenza di diverse possibili rotte IP da una sorgente a una destinazione e fa uso di speciali protocolli di instradamento, come il RIP (Router Information Protocol) che gestisce la regolazione automatica delle tabelle di riavviamento così da rendere possibile l'instradamento dinamico. L'instradamento dinamico gode di vantaggi rispetto all'instradamento statico, come maggiore scalabilità e capacità di adattamento a disfunzioni e fallimenti di rete. In aggiunta è richiesta una minore configurazione manuale delle tabelle di instradamento, poichè i router apprendono l'uno dall'altro informazioni sulla loro esistenza e disponibilità. Questa peculiarità elimina di fatto la possibilità di introdurre errori "umani" nelle tabelle di instradamento. Tuttavia l'instradamento dinamico non è perfetto e presenta alcuni svantaggi quali una complessità accentuata ed un carico di lavoro aggiuntivo per le reti, derivato dalle comunicazioni tra router, che non è di beneficio immediato per gli utenti, ma che consuma comunque la larghezza di banda della rete.</para>
619
504
<sect2 id="tcp-and-udp" status="complete">
620
505
<title>TCP e UDP</title>
622
TCP is a connection-based protocol, offering error correction and guaranteed delivery of
623
data via what is known as <emphasis>flow control</emphasis>. Flow control
624
determines when the flow of a data stream needs to be stopped, and previously sent data
625
packets should to be re-sent due to problems such as <emphasis>collisions</emphasis>,
626
for example, thus ensuring complete and accurate delivery of the data. TCP is typically
627
used in the exchange of important information such as database transactions.
630
The User Datagram Protocol (UDP), on the other hand, is a <emphasis>connectionless</emphasis>
631
protocol which seldom deals with the transmission of important data because it lacks flow
632
control or any other method to ensure reliable delivery of the data. UDP is commonly used
633
in such applications as audio and video streaming, where it is considerably faster than
634
TCP due to the lack of error correction and flow control, and where the loss of a few packets
635
is not generally catastrophic.
506
<para>TCP è un protocollo basato sulla connessione, che offre correzione d'errore e che garantisce la consegna dei dati attraverso ciò che è conosciuto come <emphasis>controllo di flusso</emphasis>. Il controllo di flusso determina quando il flusso di uno stream di dati debba essere fermato e i pacchetti di dati inviati in precedenza debbano essere reinviati a causa di problemi come <emphasis>collisioni</emphasis>, assicurando quindi la completa e accurata consegna dei dati. TCP è tipicamente usato nello scambio di informazioni importanti come transazioni di database.</para>
507
<para>UDP (User Datagram Protocol), al contrario, è un protocollo <emphasis>senza connessione</emphasis> che raramente tratta della trasmissione dei dati importanti a causa della mancanza del controllo di flusso o di altro metodo che garantisca la consegna affidabile dei dati. UDP è normalmente usato in applicazioni come lo streaming audio e video, in cui risulta considerevolemnte più veloce del protocollo TCP, a causa della mancanza di correzione d'errore e del controllo di flusso, e in cui la perdita di alcuni pacchetti non è generalmente un evento catastrofico.</para>
638
509
<sect2 id="icmp" status="complete">
639
510
<title>ICPM</title>
647
518
<sect1 id="firewall-configuration" status="help">
648
<title>Firewall Configuration</title>
649
<para>Il kernel Linux include il sottosistema <emphasis>Netfilter</emphasis>, usato per manipolare o decidere la sorte del traffico di rete all'interno o attraverso il server dell'utente. Tutte le soluzioni moderne del firewall per Linux si basano su questo sistema di filtraggio dei pacchetti di rete.</para>
519
<title>Configurazione del firewall</title>
520
<para>Il kernel Linux include il sottosistema <emphasis>Netfilter</emphasis>, usato per manipolare o decidere la sorte del traffico di rete diretto all'interno o attraverso un server. Tutte le moderne soluzioni firewall per Linux si basano su questo sistema di filtraggio dei pacchetti.</para>
650
521
<sect2 id="firewall-introduction" status="help">
651
522
<title>Introduzione al firewall</title>
653
The kernel's packet filtering system would be of little use to administrators without
654
a userspace interface to manage it. This is the purpose of iptables. When a packet
655
reaches your server, it will be handed off to the Netfilter subsystem for acceptance,
656
manipulation, or rejection based on the rules supplied to it from userspace via
657
iptables. Thus, iptables is all you need to manage your firewall if you're familiar
658
with it, but many frontends are available to simplify the task.
523
<para>Il sistema di filtraggio dei pacchetti del kernel non è di grande utilità per gli amministratori senza un'interfaccia nello spazio utente per gestirlo. Questo è il compito di iptables. Quando un pacchetto raggiunge il proprio server, esso è gestito affidato al sottosistema Netfilter per l'accettazione, la manipolazione oppure il rifiuto secondo quanto stabilito da regole fornite al sottosistema dallo spazio utente attraverso iptables. Quindi, iptables è tutto ciò che è necessario per gestire il proprio firewall, a patto che si abbia la dimestichezza necessaria; sono comunque disponibili molte altre applicazioni per semplificare tale attività.</para>
661
525
<sect2 id="ip-masquerading" status="help">
662
<title>IP Masquerading</title>
664
The purpose of IP Masquerading is to allow machines with private, non-routable IP
665
addresses on your network to access the Internet through the machine doing the
666
masquerading. Traffic from your private network destined for the Internet must be
667
manipulated for replies to be routable back to the machine that made the request.
668
To do this, the kernel must modify the <emphasis>source</emphasis>
669
IP address of each packet so that replies will be routed back to it, rather than
670
to the private IP address that made the request, which is impossible over the
671
Internet. Linux uses <emphasis>Connection Tracking</emphasis>
672
(conntrack) to keep track of which connections belong to which machines and reroute
673
each return packet accordingly. Traffic leaving your private network is thus
674
"masqueraded" as having originated from your Ubuntu gateway machine.
675
This process is referred to in Microsoft documentation as Internet
679
This can be accomplished with a single iptables rule, which may differ slightly
680
based on your network configuration:
681
<screen>sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o ppp0 -j MASQUERADE</screen>
682
The above command assumes that your private address space is 192.168.0.0/16 and
683
that your Internet-facing device is ppp0. The syntax is broken down as follows:
685
<listitem><para>-t nat -- la regola è per entrare nella tabella nat.</para></listitem>
686
<listitem><para>-A POSTROUTING -- la regola serve ad accodare (-A) alla catena del POSTROUTING</para></listitem>
687
<listitem><para>-s 192.168.0.0/16 -- la regola si applica al traffico che origina dallo spazio dell'indirizzo specificato</para></listitem>
688
<listitem><para>-o ppp0 -- la regola si applica al traffico previsto e schedulato tramite il dispositivo di rete specificato.</para></listitem>
689
<listitem><para>-j MASQUERADE -- il traffico che soddisfa questa regola viene indirizzato (-j) al bersaglio di mascheratura per essere mascherato come descritto.</para></listitem>
693
Each chain in the filter table (the default table, and where most or all packet
694
filtering occurs) has a default <emphasis>policy</emphasis> of
695
ACCEPT, but if you are creating a firewall in addition to a gateway device, you
696
may have set the policies to DROP or REJECT, in which case your masqueraded
697
traffic needs to be allowed through the FORWARD chain for the above rule to work:
698
<screen>sudo iptables -A FORWARD -s 192.168.0.0/16 -o ppp0 -j ACCEPT
699
sudo iptables -A FORWARD -d 192.168.0.0/16 -m state --state ESTABLISHED,RELATED -i ppp0 -j ACCEPT</screen>
700
The above commands will allow all connections from your local network to the
701
Internet and all traffic related to those connections to return to the machine
526
<title>IP masquerading</title>
527
<para>Il compito dell'IP masquerading è di consentire a quelle macchine della rete fornite di indirizzi IP privati e non instradabili di accedere a Internet tramite la macchina che opera il masquerading. Il traffico che va dalla rete privata verso Internet deve essere manipolato per ottenere risposte che siano re-instradabili alla macchina che ne ha fatto richiesta. Per ottenere questo risultato, il kernel deve modificare l'indirizzo IP <emphasis>sorgente</emphasis> di ciascun pacchetto affinchè tali risposte vengano re-instradate a esso invece che all'indirizzo IP privato che ha fatto la richiesta, procedura impossibile da eseguire su Internet. Linux fa uso del <emphasis>tracciamento della connessione</emphasis> (conntrack) per tenere traccia di quale connessione appartenga a quale macchina e di conseguenza per reinstradare ciascun pacchetto di risposta. Il traffico in uscita dalla rete privata viene quindi "mascherato" per simulare l'uscita dalla macchina gateway Ubuntu. Nella documentazione Microsoft questo processo è indicato come condivisione delle connessioni internet (Internet Connection Sharing).</para>
528
<para>Tutto ciò può essere ottenuto con una singola regola di iptables, che può differire leggermente in funzione della propria configurazione di rete: <screen>sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o ppp0 -j MASQUERADE</screen> Nel comando precedente si è supposto che il proprio spazio di indirizzi privati sia 192.168.0.0/16 e che l'interfaccia affacciata su Internet sia ppp0. La sintassi è: <itemizedlist>
529
<listitem><para>-t nat -- la regola viene inserita nella tabella nat</para></listitem>
530
<listitem><para>-A POSTROUTING -- la regola viene accodata (-A) alla catena POSTROUTING</para></listitem>
531
<listitem><para>-s 192.168.0.0/16 -- la regola si applica al traffico originato dallo spazio di indirizzi specificato</para></listitem>
532
<listitem><para>-o ppp0 -- la regola si applica al traffico instradato attraverso l'interfaccia di rete specificata</para></listitem>
533
<listitem><para>-j MASQUERADE -- il traffico che soddisfa questa regola viene "saltato" (-j sta per jump) alla destinazione MASQUERADE per essere manipolato come descritto in precedenza</para></listitem>
534
</itemizedlist></para>
535
<para>La <emphasis>politica</emphasis> predefinita di ogni catena nella tabella "filter" (la tabella predefinita, dove si verifica la maggior parte o l'intero filtraggio dei pacchetti) è ACCEPT (accetta), ma se si sta creando un firewall in aggiunta a un dispositivo di gateway, è necessario definire delle politiche di DROP (scarta) o REJECT (rifiuta). In questo caso è necessario autorizzare il traffico mascherato attraverso la catena di FORWARD (inoltra) per far funzionare il masquerading: <screen>sudo iptables -A FORWARD -s 192.168.0.0/16 -o ppp0 -j ACCEPT
536
sudo iptables -A FORWARD -d 192.168.0.0/16 -m state --state ESTABLISHED,RELATED -i ppp0 -j ACCEPT</screen> I comandi precedenti servono per autorizzare tutte le connessioni dalla rete locale verso Internet e tutto il traffico relativo a tali connessioni che torna alle macchine che lo hanno inizilizzato.</para>
705
538
<sect2 id="firewall-tools" status="help">
708
There are many tools available to help you construct a complete firewall without
709
intimate knowledge of iptables. For the GUI-inclined,
710
<application>Firestarter</application> is quite popular and easy to use, and
711
<application>fwbuilder</application> is very powerful and will look familiar
712
to an administrator who has used a commercial firewall utility such as Checkpoint
713
FireWall-1. If you prefer a command-line tool with plain-text configuration files,
714
<application>Shorewall</application> is a very powerful solution to help you
715
configure an advanced firewall for any network. If your network is relatively
716
simple, or if you don't have a network, <application>ipkungfu</application> should
717
give you a working firewall "out of the box" with zero configuration,
718
and will allow you to easily set up a more advanced firewall by editing simple,
719
well-documented configuration files. Another interesting tool is
720
<application>fireflier</application>, which is designed to be a desktop firewall
721
application. It is made up of a server (fireflier-server) and your choice of GUI
722
clients (GTK or QT), and behaves like many popular interactive firewall
723
applications for Windows.
539
<title>Strumenti</title>
540
<para>Molti sono gli strumenti disponibili per aiutare nella costruzione di un firewall completo senza ricorrere all'apprendimento di iptables. Per coloro che sono abituati a un'interfaccia grafica, l'applicazione <application>Firestarter</application> è molto comune e semplice da usare e <application>fwbuilder</application> è molto potente e molto familiare agli amministratori di sistema che hanno usato una firewall commerciale quale Checkpoint FireWall-1. Se si preferisce un'applicazione basata sulla riga di comando con file di configurazione in testo semplice, <application>Shorewall</application> è una soluzione molto potente per configurare un firewall avanzato su ogni rete. Se la rete non è complessa, o si ha una singola macchina, <application>ipkungfu</application> è in grado di fornire un firewall funzionante che non necessita di configurazione, offrendo al tempo stesso la possibilità di predisporne uno più avanzato tramite la modifica di semplici e ben documentati file di configurazione. Un altro strumento interessante è <application>fireflier</application>, progettato per essere una applicazione firewall per sistemi desktop. È composto da un server (fireflier-server) e da un'interfaccia grafica (GTK o QT) e si comporta come molte applicazioni firewall interattive per Windows.</para>
726
542
<sect2 id="firewall-logs" status="help">
729
Firewall logs are essential for recognizing attacks, troubleshooting your
730
firewall rules, and noticing unusual activity on your network. You must include
731
logging rules in your firewall for them to be generated, though, and logging
732
rules must come before any applicable terminating rule (a rule with a target
733
that decides the fate of the packet, such as ACCEPT, DROP, or REJECT). For
735
<screen>sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j LOG --log-prefix "NEW_HTTP_CONN: "</screen>
736
A request on port 80 from the local machine, then, would generate a log in dmesg
737
that looks like this:
740
<programlisting>[4304885.870000] NEW_HTTP_CONN: IN=lo OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:08:00 SRC=127.0.0.1 DST=127.0.0.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=58288 DF PROTO=TCP SPT=53981 DPT=80 WINDOW=32767 RES=0x00 SYN URGP=0</programlisting>
743
The above log will also appear in <filename>/var/log/messages</filename>,
744
<filename>/var/log/syslog</filename>, and <filename>/var/log/kern.log</filename>.
745
This behavior can be modified by editing <filename>/etc/syslog.conf</filename>
746
appropriately or by installing and configuring <application>ulogd</application>
747
and using the ULOG target instead of LOG. The <application>ulogd</application>
748
daemon is a userspace server that listens for logging instructions from the kernel
749
specifically for firewalls, and can log to any file you like, or even to a
750
<application>PostgreSQL</application> or <application>MySQL</application>
751
database. Making sense of your firewall logs can be simplified by using a log
752
analyzing tool such as <application>fwanalog</application>, <application>
753
fwlogwatch</application>, or <application>lire</application>.
543
<title>Registri</title>
544
<para>I registri firewall sono essenziali per riconoscere attacci, risolvere problemi relativi alle regole del firewall e notificare attività di rete insolita. Per poter generare tali registri è necessario che vengano incluse delle regole di registrazione nel firewall e che tali regole siano inserite prima di ogni regola di terminazione applicabile (cioè una regola con una destinazione che decide la sorte di un pacchetto, come ACCEPT, DROP o REJECT). Ad esempio: <screen>sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j LOG --log-prefix "NUOV_CONN_HTTP: "</screen> In questo modo, una richiesta alla porta 80 dalla macchina locale genera un registro in dmesg come il seguente:</para>
546
<programlisting>[4304885.870000] NUOV_CONN_HTTP: IN=lo OUT= MAC=00:00:00:00:00:00:00:00:00:00:00:00:08:00 SRC=127.0.0.1 DST=127.0.0.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=58288 DF PROTO=TCP SPT=53981 DPT=80 WINDOW=32767 RES=0x00 SYN URGP=0</programlisting>
548
<para>Il registro precedente appare anche nei file <filename>/var/log/messages</filename>, <filename>/var/log/syslog</filename> e <filename>/var/log/kern.log</filename>. Questo comportamento può essere cambiato, modificando in modo appropriato il file <filename>/etc/syslog.conf</filename> o installando e configurando <application>ulogd</application> facendo uso della destinazione ULOG al posto di LOG. Il demone <application>ulogd</application> è un server nello spazio utente in ascolto per le istruzioni di registro del kernel specifiche dei firewall; è possibile salvare i registri su qualsiasi file o perfino in un database come <application>PostgreSQL</application> o <application>MySQL</application>. Per dare un significato ai registri del firewall è possibile utilizzare delle applicazioni di analisi dei reigistri come <application>fwanalog</application>, <application> fwlogwatch</application> o <application>lire</application>.</para>
757
551
<sect1 id="openssh-server" status="complete">
758
552
<title>Server OpenSSH</title>
759
553
<sect2 id="openssh-introduction">
760
554
<title>Introduzione</title>
761
<para>Questa sezione della guida presenta una potente collezione di strumenti per il controllo remoto di computer in rete, per il trasferimento dei dati tra i medesimi, chiamata <emphasis>OpenSSH</emphasis>. L'utente imparerà come configurare l'applicazione Open Server SSH, e le sue modifiche.</para>
555
<para>Questa sezione della guida presenta una potente collezione di strumenti per il controllo remoto di computer in rete e per il trasferimento di dati tra i medesimi, chiamata <emphasis>OpenSSH</emphasis>. Vengono anche indicate alcune delle possibili impostazioni di configurazione e come cambiarle su sistemi Ubuntu.</para>
763
557
OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of
764
558
tools for remotely controlling a computer or transferring files between computers.