Sonntag, 21. Oktober 2012

static IP address on a Raspberry Pi and Debian GNU/Linux

Connect to your Raspberry Pi with SSH

If you don't know your IP address, you can either use the hostname. The ipscanner from my former post should help you finding out the IP address from your Raspberry Pi.

# ssh pi@yourIPaddress
pi@raspberrypi.lan's password: 

pi@raspberrypi ~ $ cd /etc/network
pi@raspberrypi /etc/network $ sudo vi interfaces




The output should look similar like this.

auto lo

iface lo inet loopback
iface eth0 inet dhcp


auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
        wpa-ssid "my-network-ssid"
        wpa-psk "my-wifi-password"




now change the line"iface lo inet loopback" to your demands:

iface eth0 inet static
# your IP Address 
        address 10.0.0.220
your netmask
        netmask 255.255.255.0
 # your router/modem used as your gateway
        gateway 10.0.0.138


Lines starting with `#' are ignored. Note that end-of-line comments are NOT supported, comments must be on a line of their own.

Then make a reboot:

pi@raspberrypi ~ $ sudo reboot

Your Pi should reboot now with the new ip address.


There is a good manual available for the interface.

pi@raspberrypi ~ $ man interfaces


The static Method
       This method may be used to define Ethernet interfaces with statically allocated IPv4 addresses.
 

Options  
  • address address Address (dotted quad/netmask) required
  • netmask mask Netmask (dotted quad or CIDR)  
  • broadcast broadcast_address Broadcast address (dotted quad, + or -). Default value: "+"
  • gateway address - Default gateway (dotted quad)






Keine Kommentare:

Kommentar veröffentlichen