Pages

domenica, maggio 29, 2016

Assegnare Indirizzo IP Statico a Raspberry PI - Jessie / Ubuntu Mate 15.04

Per impostare l'Indirizzo di IP rete sul nostro sistema apriamo il terminale  e digitaimo il seguene comando


sudo nano /etc/network/interfaces

Come potete vedere si è aperto il nostro editor con una configurazione pre-impostata.
Modifichiamo come segue:
presupponendo che vogliamo come indirizzo IP 192.168.1.41 e che il nostro modem/router sia 192.168.1.1

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface home inet static
address 192.168.1.41
netmask 255.255.255.0
gateway 192.168.1.1


allow-hotplug wlan1
iface wlan1 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface pul inet static
address 192.168.1.41
netmask 255.255.255.0
gateway 192.168.1.1

#iface default inet dhcp
dopo aver dato il comando di salvataggio Ctrl + O  possiamo uscire con Ctrl + X

Sempre da terminale, digitiamo


sudo nano /etc/dhcpcd.conf

Si aprirà il nostro editor e mostrà una configurazione, la dobbiamo cambiare in questo modo:

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname

interface eth0
static ip_address=192.168.1.41
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface wlan1
static ip_address=192.168.1.41
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface wlan0
static ip_address=192.168.1.41
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
static domain_search=
dopo aver dato il comando di salvataggio Ctrl + O  possiamo uscire con Ctrl + X

In questo modo, avremo lo stesso indirizzo IP sia che siamo connessi in WiFi che con cavo LAN.

Se vogliamo possiamo impostare la i dati del file  wpa_supplicant.conf, questo file contiene le informazioni delle nostre rete WiFi.
Procediamo in questo modo

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

All'interno del file, dobbiamo avere una configurazione simile, con i vostri dati.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1


network={
 ssid="NomeWifi"           # Nome della rete WiFi
 psk="Password12345678"    # Password della rete Wifi 
 key_mgmt=WPA-PSK          # Chaive di cifratura 
}
dopo aver dato il comando di salvataggio Ctrl + O  possiamo uscire con Ctrl + X

riavviamo e il tutto dovrebbe funzionare correttamente.





Nessun commento: