https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&user=Yabobay&feedformat=atomAlpine Linux - User contributions [en]2024-03-28T22:25:52ZUser contributionsMediaWiki 1.40.0https://wiki.alpinelinux.org/w/index.php?title=Wi-Fi&diff=17375Wi-Fi2020-05-07T14:31:28Z<p>Yabobay: /* Install necessary drivers and software */ Clear up some minor confusion</p>
<hr />
<div>This document describes how to set up a wireless network connection with WPA encryption.<br />
<br />
== Install necessary drivers and software ==<br />
<br />
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]].)<br />
<br />
Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}, which are probably available to be installed in the base setup.<br />
{{Cmd|apk add wireless-tools wpa_supplicant}}<br />
<br />
== Manual Configuration ==<br />
<br />
List your available network interfaces. If you don't see any wireless interfaces (e.g. {{Path|wlan0}}), you probably need to load and/or install extra drivers/firmware.<br />
{{Cmd|ip link}}<br />
<br />
Bring the desired interface up.<br />
{{Cmd|ip link set wlan0 up}}<br />
<br />
{{Note|If this errors with <code>ioctl 0x8914 failed: No error information</code>, that's <code>busybox ip</code>'s way of saying your wireless radio is rfkill'd. See [https://wiki.archlinux.org/index.php/Wireless_network_configuration#Rfkill_caveat here] for information on how to unblock your wireless radio; the base installation should have <code>busybox rfkill</code> available.}}<br />
<br />
<br />
Use the interface to scan for wireless access points. Make sure the ESSID you want to connect to appears here.<br />
{{Cmd|iwlist wlan0 scanning}}<br />
<br />
Associate the interface with desired ESSID.<br />
{{Cmd|iwconfig wlan0 essid ExampleWifi}}<br />
<br />
Sanity check: the interface should be configured with {{Path|ESSID:"ExampleWifi"}}.<br />
{{Cmd|iwconfig wlan0}}<br />
<br />
Create a wpa_supplicant configuration stanza for the wireless access point.<br />
{{Cmd|wpa_passphrase 'ExampleWifi' 'ExampleWifiPassword' > /etc/wpa_supplicant/wpa_supplicant.conf}}<br />
''(Access point not broadcasting its SSID requires additional line <code>scan_ssid=1</code> in the file <code>wpa_supplicant.conf</code>)''<br />
<br />
<br />
Start wpa_supplicant in the foreground to make sure the connection succeeds.<br />
{{Cmd|wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}<br />
<br />
If all is well, run it as a daemon in the background by setting the {{Path|-B}} option.<br />
{{Cmd|wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf}}<br />
<br />
Configure the interface with an IP address.<br />
{{Cmd|udhcpc -i wlan0}}<br />
<br />
Sanity check: the interface should have an {{Path|inet}} address.<br />
{{Cmd|ip addr show wlan0}}<br />
<br />
== Automatic Configuration on System Boot ==<br />
<br />
Add a stanza for the desired interface (e.g. {{Path|wlan0}}) to {{Path|/etc/network/interfaces}}:<br />
<br />
<pre><br />
auto wlan0<br />
iface wlan0 inet dhcp<br />
</pre><br />
<br />
Make sure {{Path|/etc/wpa_supplicant/wpa_supplicant.conf}} is the correct configuration for the wireless access point you want to connect to.<br />
<br />
Bring the interface down.<br />
<br />
{{Cmd|ifconfig wlan0 down}}<br />
<br />
Manually start wpa_supplicant.<br />
<br />
{{Cmd|/etc/init.d/wpa_supplicant start}}<br />
<br />
If all is well (confirm with the sanity checks in [[#Manual_Configuration|Manual Configuration]]), configure wpa_supplicant to start automatically on boot.<br />
<br />
{{Cmd|rc-update add wpa_supplicant boot}}<br />
<br />
<br />
=== Launching udhcpc through wpa_cli actions ===<br />
<br />
With the above configuration, udhcpc will only run once at boot.<br />
If the Wifi isn't available then, or the network changes in between, it needs to be notified.<br />
This is done through the wpa_cli action script in /etc/wpa_supplicant/wpa_cli.sh<br />
<br />
{{Cmd|rc-update add wpa_cli boot}}<br />
<br />
== Broadcom Wi-Fi Chipset Users ==<br />
<br />
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. <br />
<br />
You can check if you have a Broadcom chipset by using dmesg:<br />
<br />
{{Cmd|dmesg {{!}} grep Broadcom}}<br />
<br />
First install the SDK an Git:<br />
{{Cmd|apk add alpine-sdk git}}<br />
<br />
Then git clone aports from git.alpinelinux.org.<br />
<br />
<br />
{{Cmd|git clone git://git.alpinelinux.org/aports}}<br />
<br />
Change your directory to '''aports/non-free/b43-firmware''', then build it.<br />
<br />
{{Tip|You can't be root and must be a user of the group abuild (use groupadd f.e. '''addgroup $(whoami) abuild''')}}<br />
{{Tip|If this is your first time building a package you will need to generate a key for use in signing packages (use '''abuild-keygen -a -i''')}}<br />
<br />
{{Cmd|abuild -r}}<br />
<br />
Install the generated packge file (it will be in ~/packages/) - make sure to pass '''--allow-untrusted'''<br />
<br />
{{Cmd|apk add --allow-untrusted ~/packages/...pkg}}<br />
<br />
Now we need fwcutter, which is executed from the firmware package:<br />
<br />
{{Cmd|apk add b43-fwcutter b43-firmware}}<br />
<br />
Now you need to use modprobe so the device will show up:<br />
<br />
{{Cmd|modprobe b43}}<br />
<br />
To automate this on startup add it to /etc/modules:<br />
<br />
{{Cmd|echo b43 >> /etc/modules}}<br />
<br />
Now continue with the normal instructions. <br />
<br />
[[Category:Networking]]</div>Yabobay