How To Setup Static IP Address on a Headless Raspberry Pi

Fortunately, I bought a Raspberry Pi and I plan to use it as a video surveillance server. In this tutorial, I am going to configure the Raspberry Pi without connecting it to a display, keyboard and mouse based on Raspbian “wheezy” image in the SD card (SSH is enabled default).

There are two options to setup the static IP address. First option is to determine the DHCP leased IP address to Raspberry Pi by either looking at your router’s DHCP server lease information or perform a simple network scan.

DHCP IP Address Lease

Network Scan

Once the IP address of Raspberry Pi is determined, you can SSH to it using PuTTY in Windows. In this /etc/network/interfaces file, remove the line below: -

iface eth0 inet dhcp

and replace it with below: -

iface eth0 inet static

Finally, issue the “reboot” command to have the configuration change applied and it should boot up with the configured static IP address.

Second option is by editing the SD card on a Linux machine. I am using Backtrack to mount the SD card and edit the file using command below: -

mount /dev/sdb2 /mnt

vi /mnt/etc/network/interfaces

Finally, you need to run the “sync” command and “umount” command to safely remove the SD card. Place the SD card into Raspberry Pi and it should boot up with the configured static IP address.

With these two options above, you can connect to the configured IP address remotely using SSH and start configuring the Raspberry Pi.