Warning The changes to /etc/network/interfaces
file will prevent dhcpcd
running. Wireless settings should be made by editing /etc/wpa_supplicant/wpa_supplicant.conf
. Also init.d
commands are obsolete in Raspbian Jessie.
WEP is unsecure and very hackeable, not going to judge, but if you need to set it up I'll try to help a little.
Take in mind that these comands should be used with as root permisión, or with sudo.
First check if your wifi doondle is started:
$ sudo iwconfig
> lo no wireless extensions. eth1 no wireless extensions.
> wlan0 IEEE 802.11bg ESSID:"testessid"
> Mode:Managed Frequency:2.462 GHz Access Point: 00:2A:3B:24:1A:ED
> Bit Rate=1 Mb/s Tx-Power=23 dBm
> Retry min limit:7 RTS thr:off Fragment thr=2352 B
> Power Management:off
> Link Quality=67/100 Signal level:-61 dBm
> Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
> Tx excessive retries:0 Invalid misc:0 Missed beacon:
If an info similiar to this appear is that your wifi adaptor is detected, but not configured.
We are going to set up you encripted WIFI. Let’s suppose your ESSID is testessid and your password is safestpasswordever
$ sudo iwconfig wlan0 essid testessid key s:safestpasswordever
In this command, we tell wlan0 the name of our essid, and our password in plain text. If you want to use your WEP password (ASCII string) instead of the true WEP hex key, then you must use the s: prefix.
After a seconds, you may check that your interface has been associated to the Access point:
$ sudo iwconfig
> lo no wireless extensions. eth1 no wireless extensions.
> wlan0 IEEE 802.11bg ESSID:" testessid "
> Mode:Managed Frequency:2.462 GHz Access Point: 00:2A:3B:24:1A:ED
> Bit Rate=1 Mb/s Tx-Power=23 dBm
> Retry min limit:7 RTS thr:off Fragment thr=2352 B
> Power Management:off
> Link Quality=67/100 Signal level:-61 dBm
> Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
> Tx excessive retries:0 Invalid misc:0 Missed beacon:0
We have Access to it, but it is still not configured. We wake up the interface with ifconfig, and after that we ask for an IP from the DHCP client
$ sudo ifconfig wlan0 up
$ sudo dhclient3 wlan0
> There is already a pid file /var/run/dhclient.pid with pid 11426
> killed old client process, removed PID file Internet Systems
> Consortium DHCP Client V3.1.1 Copyright 2004-2008 Internet Systems
> Consortium. All rights reserved. For info, please visit
> http://www.isc.org/sw/dhcp/
>
> Listening on LPF/wlan0/10:90:6a:37:ae:cc Sending on
> LPF/wlan0/10:90:6a:37:ae:cc Sending on Socket/fallback DHCPREQUEST
> of 192.168.4.4 on wlan0 to 255.255.255.255 port 67 DHCPACK of
> 192.168.4.4 from 192.168.4.1 bound to 192.168.4.4 -- renewal in 104602 seconds.
OK from now. Let’s imagine you want to start your wifi from the start. You need to modify your /etc/network/interfaces file.
First, we need to get rid of your ascii password and use it in HEX mode. You can covert any text to hexadecimal from console with:
$printf “yourpassword”|od –t x1
> 0000000 79 6f 75 72 20 70 61 73 73 77 6f 72 64
> 0000015
Your password in HEX should be 79 6f 75 72 20 70 61 73 73 77 6f 72 64
Select the editor more convenient to you (vi, nano, emacs..) and edit the file /etc/network/interfaces
You should focus on the lines where wlan0 appear, you need to add this information with your personal essid and hex password
$ sudo vi /etc/network/interfaces
[...]
auto wlan0
iface wlan0 inet dhcp
wireless-essid testessid
wireless-key 9 6f 75 72 20 70 61 73 73 77 6f 72 64
Now it should be ready if you restart your raspi, or just if you restart the network service
$ sudo /etc/init.d/networking stop
> * Deconfiguring network interfaces...
> [ OK ]
$ sudo /etc/init.d/networking start
> * Configuring network interfaces... Internet Systems Consortium DHCP
> Client V3.1.1 Copyright 2004-2008 Internet Systems Consortium. All
> rights reserved. For info, please visit http://www.isc.org/sw/dhcp/
>
> Listening on LPF/wlan0/10:90:6a:37:ae:cc Sending on
> LPF/wlan0/10:90:6a:37:ae:cc Sending on Socket/fallback DHCPDISCOVER
> on wlan0 to 255.255.255.255 port 67 interval 7 DHCPOFFER of
> 192.168.4.4 from 192.168.4.1 DHCPREQUEST of 192.168.4.4 on wlan0 to 255.255.255.255 port 67 DHCPACK of 192.168.4.4 from 192.168.4.1 bound to 192.168.4.4 -- renewal in 126729 seconds.
And it should be done...