Advertisement
raspberry pi Wi-Pi USB module

Wireless and eth0 Static IP on Raspberry PI with Wi-Pi

I just received my Raspberry PI and had a few problems configuring the static IP on the wireless connection. I use the Wi-Pi official WLAN USB module and I really need to use the Raspbery PI without any cables attached (except for the power suppy). It is quite easy after you know how to do it, so here are the steps that will help you understand how to configure your Raspberry PI to use manual (static) IP and so get rid of the problem of having a new IP every time you reboot it.

First time you’ll have to connect to ssh, login and then use the following commands:

1 – ifconfig – it will show you the network interfaces

raspberry pi ifconfig

2 – sudo nano /etc/wpa_supplicant/wpa_supplicant.conf – this second command will allow you to edit the wpa_supplicant.conf file

raspberry pi wpa_supplicant.conf

You must change the text “home” in the ssid line with the one that you have configured on your wireless router, then change the password too. The most important thing is to add the last line:

id_str="acasa"

This will be your WLAN id from now on (you may change its name to a different one, I used acasa in my case).

After you finished editing the file press CTRL + O and then Enter to write your code to the file then press CTRL + X to exit.

3 – sudo nano /etc/network/interfaces – this is the third command and will show you the content of the interfaces file where you need to add the following text (edit the IP, gateway and netmask as you desire)

auto lo
auto eth0

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

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface acasa inet static
address 192.168.0.104
netmask 255.255.255.0
gateway 192.168.0.1

iface default inet dhcp

raspberry pi interfaces

After you finished editing the file press CTRL + O and then Enter to write your code to the file then press CTRL + X to exit.

4 – sudo /etc/init.d/networking restart – this is the last command and will restart your network. If by bad luck your wi-fi connection doesn’t start up then use this command sudo ifup wlan0

raspberry pi Wi-Pi USB module

As you can see in the picture above the USB module is ON and if you succeeded too then you can enjoy the freedom of the wireless connection on your Raspberry Pi.

5 Comments

Join the conversation!

Error! Please fill all fields.
  • Omer Cohen

    It Work! simple and easy!

    The most important thing:
    id_str=”acasa” (or other name..)Is the “magic key” 🙂

    Thanks P. Marian!

  • Ron

    I found that if I ran the GUI startx and configured the wireless, it would create a working wpa_supplicant.conf as well as the correct entry into the /etc/network/interfaces after which I would copy both files as filename.works as a backup copy before playing with it.

    So that left me with a dhcp address to play with, but worked upon reboot. Right, how to get the static ip working?

    iface textstring inet static AFTER the wpa-roam entry.

    It works! Thank you!

  • harald

    I added cooling elements, drilled a hole in the cover – added a CPU-cooling fan above that hole – widen the plastic edges beneith it (bended the edges downward) so the cooling of the RPi will be improved. I did this for the OC to 1Ghz i want to choose for better performance- all this is yet to be tested – the fan works and draws air from the inside.

    I prefer Debian Wheezy Barn – because of the wide package service

    but i have yet to test wireless – i got one usb/Wlan but i fear it be useless sinced its a strange chipset (atheros/3com/siemens) – take a pick.. under win98 it seems a combo of atheros and 3com drivers. Linux will be a nice challenge..
    but i will try

  • adam

    You can also just bind the IP with the MAC address in your router’s configuration.

Looking for the latest from TI?