#008: Adding a static IP Address to the wifi on the pi!

More stuff documented elsewhere - harrah!


Prerequisites

  1. Rasbian Installed and Setup as per #007: My default Raspberry Pi!

Choose your address

I set my Raspberry Pi to be 192.168.0.118, because my network has ip addresses like 192.168.0.*; Yours may be different.

  1. On windows, type windows-r to open the run menu
  2. Open : cmd to open the command prompt
  3. Type ipconfig to see all your ip address-y stuff

Edit interfaces

To set up a static IP address so you don't have to use the router (or whatever) to find it again, you need to edit the interfaces file (after backing it up first!)

sudo cp /etc/network/interfaces /etc/network/interfaces.bak
sudo nano /etc/network/interfaces

It took a bit of messing about, but here is the changes to the interfaces file, including wifi:
How to set the interfaces file

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.0.118
netmask 255.255.255.0
gateway 192.168.0.1

<delete>
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.118
netmask 255.255.255.0
gateway 192.168.0.1
wpa-passphrase <the password for the wifi>
wpa-ssid <the SSID for the wifi></delete>

Close nano and

sudo reboot

Set Hosts

On my windows pc, I set the hosts file with an alias - it's just nicer.
To do this on your windows7 pc, open Notepad++ as admin, then open c:\windows\system32\drivers\etc\hosts

Add

192.168.0.118 raspberrypi

It means you can open putty with raspberrypi as the ip address, harrah!

Written on August 14, 2015