I have a Raspberry Pi 4.
As I do not have a screen and keyboard available, I connect it through an Ethernet cable.
I want the Raspberry Pi to be connected to the Wi-Fi and not via Ethernet.
I tried to update /etc/network/interfaces
to:
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
wpa-essid MYESSID12345
wpa-psk MYPASSWORD$1234567
Then I am running:
sudo dhclient wlan0
But it does not seem to work.
ifconfig
returns:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.41 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::dea6:32ff:fe62:c4fc prefixlen 64 scopeid 0x20<link>
ether dc:a6:32:62:c4:fc txqueuelen 1000 (Ethernet)
RX packets 118 bytes 13529 (13.5 KB)
RX errors 0 dropped 52 overruns 0 frame 0
TX packets 63 bytes 9012 (9.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 168 bytes 12300 (12.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 168 bytes 12300 (12.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:62:c4:fd txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I also tried to do it through:
iwconfig wlan0 essid name key password
Or:
iwconfig wlan0 essid name key s:password
But I have an invalid argument error because my password is 8 characters.
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
I also tried iwconfig wlan0 essid name
using wps but it does not work.
I also tried with wpasupplicant
.
Creating /etc/wpa_supplicant.conf
with
network={
ssid="ssid_name"
psk="password"
}
and then running sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D wext
But I have errors too.
Successfully initialized wpa_supplicant
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument