1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DHCP (Dynamic Host Configuration Protocol)</title>
<link rel="stylesheet" type="text/css" href="it.css">
<script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="jquery.syntax.js"></script><script type="text/javascript" src="yelp.js"></script><link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" type="text/css" href="custom.css">
<script type="text/javascript" src="http://ubuntu-it.org/sites/all/themes/light-drupal-theme/js/cookies.js"></script><script type="text/javascript" src="http://ubuntu-it.org/sites/all/themes/light-drupal-theme/js/accessibility.js"></script>
</head>
<body>
<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-8147493-2");
pageTracker._trackPageview();
} catch(err) {}
</script><div id="fixed-header">
<div id="header" class="shadowed curved-bottom"><div class="container">
<ul class="links">
<li><a href="http://help.ubuntu-it.org">Documentazione ufficiale</a></li>
<li><a href="http://wiki.ubuntu-it.org/Documentazione/Indice">Guide della comunità</a></li>
<li class="active"><a href="http://help.ubuntu-it.org/12.04/server/serverguide/it/index.html">12.04 LTS</a></li>
</ul>
<div id="logo">
<div id="ubuntu-it-sites">
<a href="http://www.ubuntu-it.org">web </a><a href="http://wiki.ubuntu-it.org">wiki </a><a href="http://forum.ubuntu-it.org">forum </a><a href="http://planet.ubuntu-it.org">planet </a>
</div>
<a href="http://help.ubuntu-it.org" title="Ubuntu - Documentazione ufficiale"><span>help.</span>ubuntu-it
</a><span>comunità italiana</span>
</div>
<div class="buttons"><div id="accessibility" title="Maggiore focus ai contenuti" onclick="accessibility_toggle();"></div></div>
</div></div>
<div id="subheader"><div class="container"><div class="container-inside"><ul class="links secondary-links">
<li><a href="http://help.ubuntu-it.org/12.04/desktop/index.html" title="Guida utente di Ubuntu 12.04 LTS">Desktop</a></li>
<li class="active"><a href="http://help.ubuntu-it.org/12.04/server/serverguide/it/index.html" title="Guida utente di Ubuntu server 12.04 LTS">Server</a></li>
<li><a href="http://help.ubuntu-it.org/12.04/search.php" title="Ricerna della documentazione di Ubuntu 12.04 LTS">Ricerca</a></li>
</ul></div></div></div>
</div>
<div id="content">
<div id="content-top"></div>
<div class="container">
<div id="tmp-note">Questa guida non è stata ancora completamente tradotta. Se vuoi contribuire alla sua traduzione contatta il <a href="http://wiki.ubuntu-it.org/GruppoTraduzione/" title="Gruppo Traduzione">Gruppo Traduzione</a> di Ubuntu-it.</div>
<div id="search-box"><form action="http://help.ubuntu-it.org/12.04/search.php" id="cse-search-box"><div><input type="text" name="s" value="Cerca ..." onfocus="if(this.value == 'Cerca ...') { this.value = ''; }" onblur="if (this.value == '') {this.value = 'Cerca ...';}"></div></form></div>
<div class="trails"><div class="trail">
<a class="trail" href="index.html" title="Guida a Ubuntu Server">Guida a Ubuntu Server</a> » <a class="trail" href="networking.html" title="Rete">Rete</a> » </div></div>
<div id="cwt-content"><div id="page">
<div id="content">
<div class="links nextlinks">
<a class="nextlinks-prev" href="tcpip.html" title="TCP/IP">Indietro</a> | <a class="nextlinks-next" href="NTP.html" title="Sincronizzazione del tempo con NTP">Avanti</a>
</div>
<div class="hgroup"><h1 class="title">DHCP (Dynamic Host Configuration Protocol)</h1></div>
<div class="region">
<div class="contents">
<p class="para">Il DHCP (Dynamic Host Configuration Protocol) è un servizio di rete che consente di assegnare automaticamente le impostazioni per agli host da un server, senza la necessità di dover configurare manualmente ogni singolo host nella rete. I computer configurati per essere client DHCP non hanno alcun controllo sulle impostazioni che ricevono dal server DHCP e la configurazione è trasparente all'utente del computer.</p>
<p class="para">Le impostazioni comuni fornite da un server DHCP a un client includono:</p>
<div class="list itemizedlist"><ul class="list itemizedlist compact">
<li class="list itemizedlist">
<p class="para">IP address and netmask</p>
</li>
<li class="list itemizedlist">
<p class="para">IP address of the default-gateway to use</p>
</li>
<li class="list itemizedlist">
<p class="para">IP adresses of the DNS servers to use</p>
</li>
</ul></div>
<p class="para">Un server DHCP può fornire anche altre proprietà di configurazione come:</p>
<div class="list itemizedlist"><ul class="list itemizedlist compact">
<li class="list itemizedlist">
<p class="para">Nome dell'host</p>
</li>
<li class="list itemizedlist">
<p class="para">Nome del dominio</p>
</li>
<li class="list itemizedlist">
<p class="para">Server NTP (Network Time Protocol)</p>
</li>
<li class="list itemizedlist">
<p class="para">Server di stampa</p>
</li>
</ul></div>
<p class="para">Il vantaggio di utilizzare DHCP è che i cambiamenti apportati alla rete, per esempio una modifica dell'indirizzo del server DNS, devono essere apportati solamente al server DHCP, mentre tutti gli host della rete vengono riconfigurati quando i client DHCP interrogano il server DHCP. Come ulteriore vantaggio, risulta anche molto semplice integrare nuovi computer nella rete, senza la necessità di controllare la disponibilità di un indirizzo IP. I conflitti nell'allocazione degli indirizzi IP sono quindi notevolmente ridotti.</p>
<p class="para">
A DHCP server can provide configuration settings using the following methods:
</p>
<div class="terms variablelist"><dl class="terms variablelist">
<dt class="terms">Manual allocation (MAC address)</dt>
<dd class="terms">
<p class="para">
This method entails using DHCP to identify the unique hardware address
of each network card connected to the network and then continually
supplying a constant configuration each time the DHCP client makes a
request to the DHCP server using that network device. This ensures that
a particular address is assigned automatically to that network card,
based on it's MAC address.
</p>
</dd>
<dt class="terms">Dynamic allocation (address pool)</dt>
<dd class="terms">
<p class="para">
In this method, the DHCP server will assign an IP address from a pool of addresses
(sometimes also called a range or scope) for a period of time or lease, that is
configured on the server or until the client informs the server that it doesn't
need the address anymore. This way, the clients will be receiving their configuration properties dynamically and on a "first come, first served" basis. When a DHCP client
is no longer on the network for a specified period, the configuration is expired and
released back to the address pool for use by other DHCP Clients. This way, an address
cand be leased or used for a period of time. After this period, the client has to
renegociate the lease with the server to maintain use of the address.
</p>
</dd>
<dt class="terms">Automatic allocation</dt>
<dd class="terms">
<p class="para">
Using this method, the DHCP automatically assigns an IP address permanently to a device, selecting it from a pool of available addresses. Usually DHCP is used to assign a
temporary address to a client, but a DHCP server can allow an infinite lease time.
</p>
</dd>
</dl></div>
<p class="para">
The last two methods can be considered “automatic” because in each case the DHCP server
assigns an address with no extra intervention needed. The only difference between them
is in how long the IP address is leased, in other words whether a client's address varies
over time.
Ubuntu is shipped with both DHCP server and client. The server is
<span class="app application">dhcpd</span> (dynamic host configuration protocol daemon).
The client provided with Ubuntu is <span class="app application">dhclient</span> and should
be installed on all computers required to be automatically configured. Both
programs are easy to install and configure and will be automatically started at
system boot.
</p>
</div>
<div class="links sectionlinks"><ul>
<li class="links"><a class="xref" href="dhcp.html#dhcp-installation" title="Installazione">Installazione</a></li>
<li class="links"><a class="xref" href="dhcp.html#dhcp-configuration" title="Configurazione">Configurazione</a></li>
<li class="links"><a class="xref" href="dhcp.html#dhcp-references" title="Riferimenti">Riferimenti</a></li>
</ul></div>
<div class="sect2 sect" id="dhcp-installation"><div class="inner">
<div class="hgroup"><h2 class="title">Installazione</h2></div>
<div class="region"><div class="contents">
<p class="para">A un prompt di terminale, inserire il seguente comando per installare <span class="app application">dhcpd</span>:</p>
<div class="screen"><pre class="contents "><span class="cmd command">sudo apt-get install isc-dhcp-server</span>
</pre></div>
<p class="para">
You will probably need to change the default configuration
by editing /etc/dhcp/dhcpd.conf to suit your needs and particular configuration.
</p>
<p class="para">
You also may need to edit /etc/default/isc-dhcp-server to specify the interfaces dhcpd
should listen to.
</p>
<p class="para">I messaggi di dhcpd vengono inviati nel syslog, consultare quindi i relativi messaggi per quelli di diagnostica.</p>
</div></div>
</div></div>
<div class="sect2 sect" id="dhcp-configuration"><div class="inner">
<div class="hgroup"><h2 class="title">Configurazione</h2></div>
<div class="region"><div class="contents">
<p class="para">Il messaggio di errore con cui si conclude l'installazione potrebbe essere fuorviante, ma i passi seguenti consentono di configurare il servizio.</p>
<p class="para">Nella maggior parte dei casi si vuole assegnare un indirizzo IP in modo casuale. Questo può essere ottenuto con impostazioni come le seguenti:</p>
<div class="code"><pre class="contents "># minimal sample /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.200;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "mydomain.example";
}
</pre></div>
<p class="para">
This will result in the DHCP server giving clients an IP address from the range
192.168.1.150-192.168.1.200. It will lease an IP
address for 600 seconds if the client doesn't ask for a specific time frame.
Otherwise the maximum (allowed) lease will be 7200 seconds. The server will also
"advise" the client to use 192.168.1.254 as the default-gateway and
192.168.1.1 and 192.168.1.2 as its DNS servers.
</p>
<p class="para">
After changing the config file you have to restart the
<span class="app application">dhcpd</span>:
</p>
<div class="screen"><pre class="contents "><span class="cmd command">sudo /etc/init.d/isc-dhcp-server restart</span>
</pre></div>
</div></div>
</div></div>
<div class="sect2 sect" id="dhcp-references"><div class="inner">
<div class="hgroup"><h2 class="title">Riferimenti</h2></div>
<div class="region"><div class="contents"><div class="list itemizedlist"><ul class="list itemizedlist">
<li class="list itemizedlist">
<p class="para">
The <a class="ulink" href="https://help.ubuntu.com/community/dhcp3-server" title="https://help.ubuntu.com/community/dhcp3-server">dhcp3-server Ubuntu Wiki</a> page has more information.
</p>
</li>
<li class="list itemizedlist">
<p class="para">
For more <span class="file filename">/etc/dhcp/dhcpd.conf</span> options see the
<a class="ulink" href="http://manpages.ubuntu.com/manpages/precise/en/man5/dhcpd.conf.5.html" title="http://manpages.ubuntu.com/manpages/precise/en/man5/dhcpd.conf.5.html">dhcpd.conf man page</a>.
</p>
</li>
<li class="list itemizedlist">
<p class="para">
<a class="ulink" href="http://www.isc.org/software/dhcp" title="http://www.isc.org/software/dhcp">ISC dhcp-server</a>
</p>
</li>
</ul></div></div></div>
</div></div>
</div>
<div class="links nextlinks">
<a class="nextlinks-prev" href="tcpip.html" title="TCP/IP">Indietro</a> | <a class="nextlinks-next" href="NTP.html" title="Sincronizzazione del tempo con NTP">Avanti</a>
</div>
<div class="clear"></div>
</div>
<div id="pagebottom"></div>
</div></div>
</div>
<div id="content-bottom"></div>
</div>
<div id="footer"><div class="container">
<div id="ubuntulinks">Ubuntu e Canonical sono marchi registrati da Canonical Ltd. <br>
Questa opera è pubblicata sotto una <span style="text-decoration: underline;"><a href="http://help.ubuntu-it.org/legal.html">licenza</a></span> Creative Commons.
</div>
<div id="pagebottom"></div>
</div></div>
</body>
</html>