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
Jamesking56
  • 273
  • 2
  • 6
  • 15

3 Answers3

7

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.

Jamesking56
  • 273
  • 2
  • 6
  • 15
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

11chubby11
  • 4,872
  • 5
  • 26
  • 32
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.

Lawrence
  • 2,692
  • 15
  • 14