1

I've got my Pi connected to my router using a regular Ethernet cable and I can SSH into the Pi. That works pretty well, but I now want to connect my Pi to the Wi-Fi so I don't need an Ethernet cable anymore.

So following these instructions I created a file /etc/wpa_supplicant.conf and pasted in the following:

network={
    ssid="ssid_name"
    psk="password"
}

I then did the following:

pi@raspberrypi:~$ sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Successfully initialized wpa_supplicant
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
pi@raspberrypi:~$
pi@raspberrypi:~$ sudo dhclient wlan0
Restarting ntp (via systemctl): ntp.service.
pi@raspberrypi:~$

I don't really know what this output means so I just disconnected the cable to see what would happen. Unfortunately my SSH session got cut off, and in the UI of my router I don't see the Pi appearing as a Wi-Fi connected device.

So from here I'm kinda lost. Seeing that I don't even know if it is possible to connect to a router using both Wi-Fi and an Ethernet cable, I'm not sure if it is possible at all to connect it to the Wi-Fi from an SSH session.

If that is not possible, I guess the only option is to get a screen and a keyboard for my Pi, right?

All tips are welcome!

kramer65
  • 299
  • 1
  • 3
  • 10

1 Answers1

2

What about the file /etc/network/interfaces ?

Is the interface wlan0 even listed in it and with what kinds of options ?

Something like this should do the trick:

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf
iface default inet dhcp

In this example wlan0 is set to DHCP, therefore the IP address will be assigned by the router and could change over time. If you want you can use a static address, that you know is outside the DHCP range (check your router for this).

Check the output of ifconfig to see if wlan0 is up and already has an IP address assigned perhaps.

Kate
  • 304
  • 2
  • 5