Since the network is automatically configured during the initial installation, the /etc/network/interfaces
file already contains a valid configuration. A line starting with auto
gives a list of interfaces to be automatically configured on boot by ifupdown and its /etc/init.d/networking
init script. This will often be eth0
, which refers to the first Ethernet card.
8.2.1. Interfaccia Ethernet
If the computer has an Ethernet card, the IP network that is associated with it must be configured by choosing from one of two methods. The simplest method is dynamic configuration with DHCP, and it requires a DHCP server on the local network. It may indicate a desired hostname, corresponding to the hostname
setting in the example below. The DHCP server then sends configuration settings for the appropriate network.
Esempio 8.1. Configurazione DHCP
auto eth0
iface eth0 inet dhcp
hostname arrakis
Una configurazione «statica» indica delle impostazioni di rete fisse. Ciò include perlomeno un indirizzo IP ed una maschera di rete; a volte vengono indicati anche indirizzi di rete e broadcast. Un router che connette verso l'esterno viene indicato come «gateway».
Esempio 8.2. Configurazione statica
auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
broadcast 192.168.0.255
network 192.168.0.0
gateway 192.168.0.1
8.2.2. Connettersi con PPP attraverso un modem PSTN
Una connessione punto-punto (PPP) stabilisce una connessione intermittente: questa è la soluzione più comune per le connessioni realizzate con un modem telefonico (detto anche modem PSTN poiché la connessione transita nella rete telefonica pubblica).
A connection by telephone modem requires an account with an access provider, including a telephone number, username, password, and, sometimes the authentication protocol to be used. Such a connection is configured using the pppconfig
tool in the Debian package of the same name. By default, it sets up a connection named provider
(as in Internet service provider). When in doubt about the authentication protocol, choose PAP: it is offered by the majority of Internet service providers.
Dopo la configurazione è possibile connettersi usando il comando pon
(fornendo il nome della connessione come parametro, quando il valore predefinito provider
non è appropriato). Si può terminare il collegamento con il comando poff
. Questi due comandi possono essere eseguiti dall'utente root, o da ogni altro utente, purché sia inserito nel gruppo dip
.
8.2.3. Connessione attraverso un modem ADSL
The generic term “ADSL modem” covers a multitude of devices with very different functions. The modems that are simplest to use with Linux are those that have an Ethernet interface (and not only a USB interface). These tend to be popular; most ADSL Internet service providers lend (or lease) a “box” with Ethernet interfaces. Depending on the type of modem, the configuration required can vary widely.
8.2.3.1. Modem che supportano PPPOE
Alcuni modem Ethernet lavorano con il protocollo PPPOE (Point to Point Protocol over Ethernet). Lo strumento pppoeconf
(dall'omonimo pacchetto) configurerà la connessione. Per farlo, modifica il file /etc/ppp/peers/dsl-provider
con le impostazioni fornite e registra le informazioni di accesso nei file /etc/ppp/pap-secrets
e /etc/ppp/chap-secrets
. Si raccomanda di accettare tutte le modifiche proposte.
Quando la configurazione è completata è possibile avviare la connessione ADSL con il comando pon dsl-provider
e terminarla con poff dsl-provider
.
8.2.3.2. Modem che supportano PPTP
The PPTP (Point-to-Point Tunneling Protocol) protocol was created by Microsoft. Deployed at the beginning of ADSL, it was quickly replaced by PPPOE. If this protocol is forced on you, see
Sezione 10.2.4, «PPTP».
8.2.3.3. Modem che supportano DHCP
Quando un modem è connesso al computer tramite un cavo Ethernet (cavo incrociato o «crossover») si configura tipicamente una connessione di rete sul computer attraverso DHCP: il modem agisce automaticamente come gateway in via predefinita e si cura dell'instradamento (significa che gestisce il traffico di rete tra il computer ed Internet).
Most “ADSL routers” on the market can be used like this, as do most of the ADSL modems provided by Internet services providers.
8.2.4. Automatizzare la configurazione della rete per gli utenti in movimento
Many Falcot engineers have a laptop computer that, for professional purposes, they also use at home. The network configuration to use differs according to location. At home, it may be a wifi network (protected by a WPA key), while the workplace uses a wired network for greater security and more bandwidth.
Per evitare di doversi manualmente connettere o disconnettere alle corrispondenti interfacce di rete, gli amministratori hanno installato il pacchetto network-manager su queste macchine in movimento. Questo software abilita l'utente a passare facilmente tra una rete ed un'altra utilizzando la piccola icona visualizzata nell'area notifiche del desktop grafico. Cliccando su questa icona si visualizza una lista di reti disponibili (sia via cavo che wireless) così è possibile scegliere semplicemente la rete che si intende utilizzare. Il programma salva la configurazione per le reti alle quali l'utente si è già connesso ed automaticamente passa alla miglior rete disponibile quando la connessione corrente si interrompe.
In order to do this, the program is structured in two parts: a daemon running as root handles activation and configuration of network interfaces and a user interface controls this daemon. PolicyKit handles the required authorizations to control this program and Debian configured PolicyKit in such a way so that members of the netdev group can add or change Network Manager connections.
Network Manager knows how to handle various types of connections (DHCP, manual configuration, local network), but only if the configuration is set with the program itself. This is why it will systematically ignore all network interfaces in /etc/network/interfaces
for which it is not suited. Since Network Manager doesn't give details when no network connections are shown, the easy way is to delete from /etc/network/interfaces
any configuration for all interfaces that must be managed by Network Manager.
Si noti che questo programma è installato in via predefinita quando viene scelto di installare l'ambiente grafico durante l'installazione iniziale.