Modificare IP da DHCP a IP statico

<p><span style="font-family: arial;">Pu&ograve; capitare che in una rete installata con dchp ogni qualvolta i client vengono &quot;rinnovati&quot; dal dhcp server, non riusciamo pi&ugrave; a contattare i client stessi.</span><br /> <span style="font-family: arial;">Gli utenti meno smaliziati si sentiranno in difficolt&agrave;. Vediamo quindi come possiamo rendere &quot;statici&quot; gli IP dei nostri client.</span><br /> <span style="font-family: arial;">Di solito il server dhcp d&agrave; ai nostri client quasi sempre gli stessi range di IP.</span><br /> <span style="font-family: arial;">Possiamo provarlo con il comando da terminale e da root seguente:</span><br /> <br /> <span style="font-family: arial;"> <span style="color: rgb(51, 51, 255); font-weight: bold;"> /sbin/ifconfig</span></span><br /> <br /> <span style="font-family: arial;">quale sia l'IP attuale lo vediamo dalla risposta del terminale:</span><br /> <br /> <span style="font-family: arial;">eth1 Link encap:Ethernet HWaddr 00:3B:AC:B8:C6:60</span><br /> <span style="font-family: arial;"> inet addr:<span style="font-weight: bold; color: rgb(255, 0, 0);">192.168.1.233</span> Bcast:192.168.1.255 Mask:255.255.255.0</span><br /> <span style="font-family: arial;"> inet6 addr: rd80::57b:atff:feb0:c6420/64 Scope:Link</span><br /> <span style="font-family: arial;"> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1</span><br /> <span style="font-family: arial;"> RX packets:11350 errors:0 dropped:0 overruns:0 frame:0</span><br /> <span style="font-family: arial;"> TX packets:8924 errors:0 dropped:0 overruns:0 carrier:0</span><br /> <span style="font-family: arial;"> collisions:0 txqueuelen:1000</span><br /> <span style="font-family: arial;"> RX bytes:8717172 (8.3 MiB) TX bytes:782942 (764.5 KiB)</span><br /> <span style="font-family: arial;"> Interrupt:220</span><br /> <br /> <span style="font-family: arial;">lo Link encap:Local Loopback</span><br /> <span style="font-family: arial;"> inet addr:127.0.0.1 Mask:255.0.0.0</span><br /> <span style="font-family: arial;"> inet6 addr: ::1/128 Scope:Host</span><br /> <span style="font-family: arial;"> UP LOOPBACK RUNNING MTU:16436 Metric:1</span><br /> <span style="font-family: arial;"> RX packets:5434 errors:0 dropped:0 overruns:0 frame:0</span><br /> <span style="font-family: arial;"> TX packets:5434 errors:0 dropped:0 overruns:0 carrier:0</span><br /> <span style="font-family: arial;"> collisions:0 txqueuelen:0</span><br /> <span style="font-family: arial;"> RX bytes:3090116 (2.9 MiB) TX bytes:3090116 (2.9 MiB)</span><br /> <br /> <br /> <span style="font-family: arial;">Nel caso di cui sopra si vede benissimo l'IP che risulta quindi essere <span style="font-weight: bold; color: rgb(255, 0, 0);">192.168.1.233</span>, mentre la scheda di rete risulta essere la <span style="font-weight: bold; color: rgb(255, 0, 0);">eth1</span>.</span><br /> <span style="font-family: arial;">Bene, ora possiamo modificare un file di configurazione che far&agrave; s&igrave; che al boot verr&agrave; sempre caricato l'ip <span style="font-weight: bold; color: rgb(255, 0, 0);">192.168.1.233</span> dalla scheda <span style="color: rgb(255, 0, 0); font-weight: bold;">eth1</span>.</span><br /> <br /> <span style="font-family: arial;">Il file che dobbiamo aprire con un editor (vi per esempio) &egrave; il seguente:</span><br /> <br /> <span style="color: rgb(51, 51, 255); font-family: arial;">/etc/sysconfig/networking/profiles/default/ifcfg-eth1</span><br /> <br /> <span style="font-family: arial;">Mettiamo un <span style="color: rgb(51, 51, 255);">&quot;#&quot;</span> davanti a ciascuna riga che troviamo nel file e alla fine copiamoci queste brevi righe:</span><br /> <br /> <span style="font-family: arial;">DEVICE=eth1</span><br /> <span style="font-family: arial;">BOOTPROTO=none</span><br /> <span style="font-family: arial;">BROADCAST=192.168.1.255</span><br /> <span style="font-family: arial;">HWADDR=00:3B:AC:B8:C6:60</span><br /> <span style="font-family: arial;">IPADDR=<span style="font-weight: bold; color: rgb(255, 0, 0);">192.168.1.233</span></span><br /> <span style="font-family: arial;">NETMASK=255.255.255.0</span><br /> <span style="font-family: arial;">NETWORK=192.168.1.0</span><br /> <span style="font-family: arial;">ONBOOT=YES</span><br /> <span style="font-family: arial;">GATEWAY=192.168.1.1</span><br /> <span style="font-family: arial;">TYPE=Ethernet</span><br /> <br /> <br /> <span style="font-family: arial;">(Nota: se il vostro IPADDR &egrave; diverso ovviamente voi ci mettete il vostro!)</span><br /> <br /> <span style="font-family: arial;">Fatto, salviamo e copiamo questo file in <span style="color: rgb(51, 51, 255);">/etc/sysconfig/networking/devices</span> e perci&ograve; da root, in un terminale digitiamo:</span><br /> <br /> <span style="color: rgb(51, 51, 255); font-family: arial;">cat /etc/sysconfig/networking/profiles/default/ifcfg-eth1 &gt; /etc/sysconfig/networking/devices/ifcfg-eth1</span><br /> <br /> <span style="font-family: arial;">E' tutto. Ora possiamo spegnere e riavviare il nostro pc con la certezza che l'IP sar&agrave; impostato in modo statico.</span><br /> <br /> <span style="font-family: arial;">Eugenio</span></p>

SMF 2.0.17 | SMF © 2013, Simple Machines
TinyPortal © 2005-2012

Indietro all'articolo