Wi-Fi: Difference between revisions
Iguananaut (talk | contribs) (→Broadcom Wi-Fi Chipset Users: this should be aports now, not abuild) |
(Separate manual from automatic configuration and add more detail for less experienced users.) |
||
Line 1: | Line 1: | ||
This document describes how to set up a wireless network connection with WPA encryption. | This document describes how to set up a wireless network connection with WPA encryption. | ||
== Install necessary drivers and software == | |||
First make sure your wireless drivers are loaded properly. (if you are using a '''Broadcom chipset''', see the [[#Broadcom_Wi-Fi_Chipset_Users|section at the bottom of this post]].) | First make sure your wireless drivers are loaded properly. (if you are using a '''Broadcom chipset''', see the [[#Broadcom_Wi-Fi_Chipset_Users|section at the bottom of this post]].) | ||
Line 5: | Line 7: | ||
Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}. | Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}. | ||
{{Cmd|apk add wireless-tools wpa_supplicant}} | {{Cmd|apk add wireless-tools wpa_supplicant}} | ||
== Manual Configuration == | |||
Bring the link up so we can look for wireless networks. (An error here means you probably need extra drivers/firmware.) | Bring the link up so we can look for wireless networks. (An error here means you probably need extra drivers/firmware.) | ||
Line 12: | Line 16: | ||
{{Cmd|iwlist wlan0 scanning}} | {{Cmd|iwlist wlan0 scanning}} | ||
Configure the wlan0 interface to associate with the MyNet ESSID: | |||
{{Cmd|iwconfig wlan0 essid MyNet}} | {{Cmd|iwconfig wlan0 essid MyNet}} | ||
Print its configuration, to check: | |||
{{Cmd| | {{Cmd|iwconfig wlan0}} | ||
Create a wpa_supplicant configuration stanza for wpa_supplicant by executing the following: | |||
{{Cmd|wpa_passphrase MyNet > wpa.conf}} | |||
wpa_passphrase expects the password to be passed via stdin. | |||
So, type the password and press ENTER. | |||
The above commands creates the file {{Path|wpa.conf}} which includes the pre-shared key. | |||
From one terminal/console, start wpa_supplicant with the generated config: | |||
{{Cmd|wpa_supplicant -Dwext -iwlan0 -c ./wpa.conf}} | {{Cmd|wpa_supplicant -Dwext -iwlan0 -c ./wpa.conf}} | ||
From another console, start dhcpcd: | From another terminal/console, start dhcpcd: | ||
{{Cmd|udhcpc -i wlan0}} | {{Cmd|udhcpc -i wlan0}} | ||
The wlan0 interface should be configured with an IP address at this point: | |||
{{Cmd|ifconfig wlan0}} | |||
== Automatic Configuration on System Boot == | |||
Add an interface stanza for wlan0 to the file {{Path|/etc/network/interfaces}} | |||
<pre> | |||
auto wlan0 | |||
iface wlan0 inet dhcp | |||
</pre> | |||
Create {{Path|/etc/wpa_supplicant}} if it doesn't already exist, set sane permissions and append the configuration {{Path|wpa.conf}} to {{Path|wpa_supplicant.conf}}. | |||
<pre> | |||
mkdir -p /etc/wpa_supplicant | |||
chmod 750 /etc/wpa_supplicant | |||
cat wpa.conf >> /etc/wpa_supplicant/wpa_supplicant.conf | |||
</pre> | |||
Test the automatic interface configuration: | |||
Bring the interface down: | |||
{{Cmd|ifconfig wlan0 down}} | |||
Manually start wpa_supplicant | |||
{{Cmd|/etc/init.d/wpa_supplicant start}} | |||
The wlan0 interface should be associated with the MyNet SSID: | |||
{{Cmd|iwconfig wlan0}} | |||
{{ | |||
The wlan0 interface should have been assigned an IP address via DHCP: | |||
{{Cmd|ifconfig wlan0}} | |||
Configure wpa_supplicant to start automatically on boot: | |||
{{Cmd|rc-update add wpa_supplicant boot}} | {{Cmd|rc-update add wpa_supplicant boot}} | ||
Reboot: | |||
{{Cmd|reboot}} | |||
Log in and check that the interface is associated with the access point: | |||
{{Cmd|iwconfig wlan0}} | {{Cmd|iwconfig wlan0}} | ||
Check that the interface was assigned an IP address via DHCP: | |||
{{Cmd|ifconfig wlan0 {{!}} grep addr}} | {{Cmd|ifconfig wlan0 {{!}} grep addr}} | ||
== Broadcom Wi-Fi Chipset Users == | == Broadcom Wi-Fi Chipset Users == | ||
The Broadcom chipset is quite popular among older computers. You will need to compile the firmware manually for this chipset as it is not included. | The Broadcom chipset is quite popular among older computers. You will need to compile the firmware manually for this chipset as it is not included. | ||
Revision as of 10:05, 21 November 2017
This document describes how to set up a wireless network connection with WPA encryption.
Install necessary drivers and software
First make sure your wireless drivers are loaded properly. (if you are using a Broadcom chipset, see the section at the bottom of this post.)
Install wireless-tools and wpa_supplicant.
apk add wireless-tools wpa_supplicant
Manual Configuration
Bring the link up so we can look for wireless networks. (An error here means you probably need extra drivers/firmware.)
ip link set wlan0 up
Find a network to connect to. Look for the ESSID. In this example we will use the ESSID "MyNet".
iwlist wlan0 scanning
Configure the wlan0 interface to associate with the MyNet ESSID:
iwconfig wlan0 essid MyNet
Print its configuration, to check:
iwconfig wlan0
Create a wpa_supplicant configuration stanza for wpa_supplicant by executing the following:
wpa_passphrase MyNet > wpa.conf
wpa_passphrase expects the password to be passed via stdin.
So, type the password and press ENTER.
The above commands creates the file wpa.conf which includes the pre-shared key.
From one terminal/console, start wpa_supplicant with the generated config:
wpa_supplicant -Dwext -iwlan0 -c ./wpa.conf
From another terminal/console, start dhcpcd:
udhcpc -i wlan0
The wlan0 interface should be configured with an IP address at this point:
ifconfig wlan0
Automatic Configuration on System Boot
Add an interface stanza for wlan0 to the file /etc/network/interfaces
auto wlan0 iface wlan0 inet dhcp
Create /etc/wpa_supplicant if it doesn't already exist, set sane permissions and append the configuration wpa.conf to wpa_supplicant.conf.
mkdir -p /etc/wpa_supplicant chmod 750 /etc/wpa_supplicant cat wpa.conf >> /etc/wpa_supplicant/wpa_supplicant.conf
Test the automatic interface configuration:
Bring the interface down:
ifconfig wlan0 down
Manually start wpa_supplicant
/etc/init.d/wpa_supplicant start
The wlan0 interface should be associated with the MyNet SSID:
iwconfig wlan0
The wlan0 interface should have been assigned an IP address via DHCP:
ifconfig wlan0
Configure wpa_supplicant to start automatically on boot:
rc-update add wpa_supplicant boot
Reboot:
reboot
Log in and check that the interface is associated with the access point:
iwconfig wlan0
Check that the interface was assigned an IP address via DHCP:
ifconfig wlan0 | grep addr
Broadcom Wi-Fi Chipset Users
The Broadcom chipset is quite popular among older computers. You will need to compile the firmware manually for this chipset as it is not included.
You can check if you have a Broadcom chipset by using dmesg:
dmesg | grep Broadcom
First install the SDK an Git:
apk add alpine-sdk git
Then git clone aports from git.alpinelinux.org.
git clone git://git.alpinelinux.org/aports
Change your directory to aports/non-free/b43-firmware, then build it.
You can't be root and must be a user of the group abuild (use groupadd)
abuild -r
Install the generated packge file (it will be in ~/packages/) - make sure to pass --allow-untrusted
apk add --allow-untrusted ~/packages/...pkg
Now we need fwcutter, which is executed from the firmware package:
apk add b43-fwcutter b43-firmware
Now you need to use modprobe so the device will show up:
modprobe b43
To automate this on startup add it to /etc/modules:
echo b43 >> /etc/modules
Now continue with the normal instructions.