5

I'm trying to setup my new Wifi dongle I've bought from ModMyPi.

Its working for DHCP but when I try to make it a static IP, I get this error when restarting it:

wpa-roam can only be used with the manual inet METHOD

Here is my /etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

Here is my wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="My-Wifi"
    psk="my_password"
}

I don't know what else to do to get it to use 192.168.1.2 as its static IP wirelessly. Help?


If it helps, I have a BTHomeHub3 with a WPA & WPA2 compatible key and my SSID is visible.


UPDATE I would like my configuration to support multiple wifi networks setup so that when I move to and from University and Home, My Raspberry Pi can just work wirelessly.

My files are currently like so:

/etc/network/interfaces: http://pastebin.com/HeP8kgBR /etc/wpa_supplicant/wpa_supplicant.conf: http://pastebin.com/RaFkEAx6


UPDATE When I run sudo ifup wlan0 now I am getting this error:

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
  • Are you sure the ssid is correct? Did you set up the wifi with the wpa_gui on the desktop environment or from the command line? Are you using "madwifi"? – 11chubby11 Nov 24 '13 at 21:01
6

In the end I got it working as I wanted, here is what I did.

I restored the original /etc/network/interfaces file and /etc/wpa_supplicant/wpa_supplicant.conf to make sure those aren't an issue.

I then ran startx to launch into the GUI and used WiFi Config to scan for my network and set it up. When setting it up, I specified the ID at the bottom of the setup window and called it home.

I then edited /etc/network/interfaces to add iface home inet static and defined my static IP information.

After a reboot, it worked perfectly!

Thanks everybody for your help, the GUI was the best way in the end.

  • Glad to see you got it working! If you could mark your self-answer (this one) as answer, that would be great! We are trying to get the site Q:A ratio up and that would help us a lot! – RPiAwesomeness Mar 23 '14 at 17:20
  • No problem! Again, glad to here you got the issue resolved! Also, if you plan on being active around here, pop into the chat from time to time! We always love company and it shows that this site is active and has an involved user base. – RPiAwesomeness Mar 24 '14 at 20:21
3

In /etc/network/interfaces Change iface wlan0 inet static to iface wlan0 inet manual

Now put in a new line:

iface somenamehere inet static

Then cut the wlan0 static IP info(not the wpa-roam part) and paste it underneath. Your interfaces file should now look like:

auto lo

iface lo inet loopback
iface eth0 inet static
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface somenamehere inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254

Note: I leave out network and broadcast from my static IP configuration and it always works fine.

Now in wpa_supplicant.conf add the line

id_str="somenamehere"

In the network setting part. It should now look like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="My-Wifi"
    psk="my_password"
    id_str="somenamehere"
}

Change somenamehere to anything you like.

Look at my answer here for more info on setting up wpa_supplicant.conf with multiple networks

0

If you only have one network in wpa_supplicant.conf, rather than using wpa-roam, use wpa-conf as this will allow you to use static IP addresses.

  • Nope still not working – Jamesking56 Nov 23 '13 at 17:46
  • Still not working as in you get the same error message ? Also, the network and broadcast lines in the config aren't needed. – Lawrence Nov 24 '13 at 7:03
  • See other answer, I would like a multiple network setup so I can move to and from Home / University with ease. – Jamesking56 Nov 24 '13 at 13:35
  • 1
    this solved the error quoted in the question title for me, and it does in fact work if you have multiple networks defined in wpa_supplicant.conf, as each network defined in that file has a priority metric defined. good answer, apart from the incorrect assumption "If you only have on network in wpa_supplicant.conf. – ardnew Apr 28 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.