Wi-Fi: Difference between revisions

From Alpine Linux
(Cleanup, formatting)
Line 3: Line 3:
First make sure your wireless drivers are loded properly. (if you are using a Broadcom chipset, see note at the end of this post.)
First make sure your wireless drivers are loded properly. (if you are using a Broadcom chipset, see note at the end of this post.)


Install wireless-tools and wpa_supplicant.
Install {{Pkg|wireless-tools}} and {{Pkg|wpa_supplicant}}.
{{Cmd|apk add wireless-tools wpa_supplicant}}
{{Cmd|apk add wireless-tools wpa_supplicant}}


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.)
{{Cmd|ip link set wlan0 up}}
{{Cmd|ip link set wlan0 up}}


Find a network to connect to. Look for the ESSID. In this example we will use the ESSID "MyNet"
Find a network to connect to. Look for the ESSID. In this example we will use the ESSID "MyNet".
{{Cmd|iwlist wlan0 scanning}}
{{Cmd|iwlist wlan0 scanning}}


Lets set the ESSID.
Lets set the ESSID:
{{Cmd|iwconfig wlan0 essid MyNet}}
{{Cmd|iwconfig wlan0 essid MyNet}}


We need to create a shared key for wpa_supplicant.
We need to create a shared key for wpa_supplicant.
{{Cmd|wpa_passphrase MyNet > wpa.conf}}
{{Cmd|wpa_passphrase MyNet > wpa.conf}}
It will wait for the password from stdin. Enter the password and enter. Now you will have a wpa.conf file with the preshared key.
It will wait for the password from stdin. Enter the password and enter. Now you will have a {{Path|wpa.conf}} file with the preshared key.


start wpa_supplicant with the generated config
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 console, start dhcpcd:
{{Cmd|udhcpc -i wlan0}}
{{Cmd|udhcpc -i wlan0}}


You should get an IP address.
You should get an IP address.


You then want to make the connection process automatic on boot-up.  Open /etc/network/interfaces and add the following stanza:
You then want to make the connection process automatic on boot-up.  Open {{Path|/etc/network/interfaces}} and add the following stanza:
  auto wlan0
  auto wlan0
  iface wlan0 inet dhcp
  iface wlan0 inet dhcp


You will also need to set wpa_supplicant to start automatically on boot.
You will also need to set wpa_supplicant to start automatically on boot:
rc-update add wpa_supplicant default
{{Cmd|rc-update add wpa_supplicant default}}


Next, create /etc/wpa_supplicant (permissions of 755 w/ root:root are fine), and move wpa.conf into that folder.  Then rename wpa.conf to wpa_supplicant.conf.
Next, create {{Path|/etc/wpa_supplicant/}} (permissions of 755 with root:root are fine), and move {{Path|wpa.conf}} into that folder, renaming it to {{Path|wpa_supplicant.conf}}.


Reboot and check that you are associated with the access point:
Reboot and check that you are associated with the access point:
iwconfig wlan0
{{Cmd|iwconfig wlan0}}
and check that you got a DHCP lease:
and check that you got a DHCP lease:
ifconfig wlan0 | grep addr
{{Cmd|ifconfig wlan0 {{!}} grep addr}}


<b>NOTE FOR BROADCOM WIFI CHIPSET USERS:<br />
{{Note|BROADCOM WIFI CHIPSET USERS will need to compile the firmware manually for their chipset.  First, apk add alpine-sdk, then git clone aports from git.alpinelinux.org, switch to the aports/non-free/b43-firmware folder, then run abuild -r.  Install the generated apk file.  Run fwcutter, and you should be good to go.}}
You will need to compile the firmware manually for your chipset.  First, apk add alpine-sdk, then git clone aports from git.alpinelinux.org, switch to the aports/non-free/b43-firmware folder, then run abuild -r.  Install the generated apk file.  Run fwcutter, and you should be good to go.


[[Category:Networking]]
[[Category:Networking]]

Revision as of 20:38, 28 October 2012

This document describes how to set up a wireless network connection with WPA encryption.

First make sure your wireless drivers are loded properly. (if you are using a Broadcom chipset, see note at the end of this post.)

Install wireless-tools and wpa_supplicant.

apk add wireless-tools wpa_supplicant

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

Lets set the ESSID:

iwconfig wlan0 essid MyNet

We need to create a shared key for wpa_supplicant.

wpa_passphrase MyNet > wpa.conf

It will wait for the password from stdin. Enter the password and enter. Now you will have a wpa.conf file with the preshared key.

Start wpa_supplicant with the generated config:

wpa_supplicant -Dwext -iwlan0 -c ./wpa.conf

From another console, start dhcpcd:

udhcpc -i wlan0

You should get an IP address.

You then want to make the connection process automatic on boot-up. Open /etc/network/interfaces and add the following stanza:

auto wlan0
iface wlan0 inet dhcp

You will also need to set wpa_supplicant to start automatically on boot:

rc-update add wpa_supplicant default

Next, create /etc/wpa_supplicant/ (permissions of 755 with root:root are fine), and move wpa.conf into that folder, renaming it to wpa_supplicant.conf.

Reboot and check that you are associated with the access point:

iwconfig wlan0

and check that you got a DHCP lease:

ifconfig wlan0 | grep addr

Note: BROADCOM WIFI CHIPSET USERS will need to compile the firmware manually for their chipset. First, apk add alpine-sdk, then git clone aports from git.alpinelinux.org, switch to the aports/non-free/b43-firmware folder, then run abuild -r. Install the generated apk file. Run fwcutter, and you should be good to go.