Saturday, August 9, 2014

Static IP for raspberry Pi

Two essential things to do when you get a raspberry pi is to set up wifi access for it and configure it to a static ip address so that you can ssh into it without guessing the ip. To be honest being connected to a HDMI monitor all the time is not going to be practical for most of the projects.

Since the board does not come with built-in wifi support you need to get a USB Wifi adapter for the board, which you have probably done already.

Refer to this if you are having trouble setting up the USB Wifi adapter.
http://www.maketecheasier.com/setup-wifi-on-raspberry-pi/

Using the GUI makes the Wifi configuration a lot easier. Once you have set that up your
/etc/network/interfaces file is going to look like almost the following

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp


All you need to do is edit the last line to make the ip configuration static and add the lines that follow.

iface default inet static
        address 192.168.0.141
        netmask 255.255.255.0
        network 192.168.0.0
        gateway 129.168.0.1

Depending on what ip you want modify the address.