Raspberry PI: Static WiFi IP

Impressed as I was, the pi worked with the WiFi gizmo out of the box, once I setup the keys and SSID from the desktop. But really DHCP is not ideal especially if you want to use only the ssh server (don’t care much about the mouse and desktop fluffy stuff).

Ran into a roadblock trying to enable static IP, searched high and low but could but configure a static route for the USB Micro WiFi dongle (belkin).

Finally got it working by updating the default interfaces config, changed the default from dhcp to static and added the ip properties:

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 static
address 192.168.2.120
netmask 255.255.255.0
gateway 192.168.2.1

Hope this helps someone in the same boat.

6 thoughts on “Raspberry PI: Static WiFi IP

  1. I tried so many tutorials concerning this problem and none of them worked. But your post worked perfectly. Thanks for that!

  2. Glad to have helped!

  3. Jon

    This is the solution that works. Thank You.

  4. I Could kiss you!!!! ;-S

    I’ve struggled for days now trying other tuts and happened upon yours by chance.
    I used my netgear n300 router to reserve the ip address for the mac code of the RPi then followed your directions. BINGO!! I have fixed ip, can access the internet and print FINALLY!
    with your solution the wlan0 starts automatically rather than having to go to the gui to start the wifi. Too old for using the term ‘Kudos’ but in this case you deserve it!

  5. Anacleto

    Funciona Perfectamente!!, gracias desde España

Leave a comment