Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:setting_up_wifi [2011/05/05 17:32] – external edit 127.0.0.1wiki:setting_up_wifi [2024/06/20 20:17] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +===== A No-nonsense, foolproof way to wifi =====
 +All you need to connect to a WiFi hotspot is wpa_supplicant, its dependencies, and a DHCP client (udhcpc is included with BusyBox and is therefore already present in the base system).
  
 +Just follow 3 easy steps:
  
-====== Easy Waywicd ======+  * If you have access to a wired connection on your TCL machine: 
 +    * Boot your TCL machine and establish a wired connection 
 +    * Download the wpa_supplicant extension (on x86_64 it's called wpa_supplicant-dbus) and all its dependencies: **tce-load -w wpa_supplicant-dbus** 
 +    * Load the wpa_supplicant extension and its dependencies: **tce-load -i wpa_supplicant-dbus**\\ (to load automatically at every boot, just add wpa_supplicant-dbus.tcz to tce/onboot.lst)
  
-If you want to set up wifi with minimum of fussjust install wicd package (and its dependenciesfrom the package repository. You will then be able to setup your connection in a user-friendly GUI +  * If you do NOT have access to a wired connection on your TCL machine: 
-See http://wicd.sourceforge.netfor detailed information about wicd.+    * Using a different machineestablish an internet connection then manually download the wpa_supplicant extension (on x86_64 it's called wpa_supplicant-dbus) and all its dependencies from the repository that corresponds to your TCL version and architecture (e.g., 11.x, x86_64). See NOTES below. 
 +    * Boot your TCL machine and manually copy the downloaded files to tce/optional/ 
 +    * Load the wpa_supplicant extension and its dependencies: **tce-load -i wpa_supplicant-dbus** \\ (to load automatically at every boot, just add wpa_supplicant-dbus.tcz to tce/onboot.lst)
  
-After installing "wicd.tcz" execute the following command to start the wicd daemon: +Now you are ready to connect to any WiFi hotspotYou can do so manually or use a shell script to help you (e.g., https://github.com/bdantas/autowifi/)
-<code> +
-sudo wicd-start +
-</code> +
-Then activate the GUI interface using the application menu.+
  
-If you have problems getting wicd to see your wifi cardyou may have driver issuesAtheros users can see this [[Network Setup - Atheros Wireless Cards]]but note that tinycore 2.0 and later ships with ath5k and ath9k open source drivers that should handle most Atheros cards.+==== NOTES ==== 
 +  * For each extension, download the .tcz file (which is the actual extension), .tcz.md5.txt file, and (if it exists for that extension) the .tcz.dep file. 
 +  * Tiny Core Linux mirrors are listed here: http://wiki.tinycorelinux.net/wiki:mirrors 
 +  * Take a peek at wpa_supplicant.tcz.tree or wpa_supplicant-dbus.tcz.tree (e.g., ftp://distro.ibiblio.org/tinycorelinux/11.x/x86_64/tcz/wpa_supplicant-dbus.tcz.tree) to help you figure out what files you need to download. On TCL 11.x x86_64it turns out to be 14 .tcz extensions (for a grand total of 37 files including .tcz, .tcz.md5.txt, and .tcz.dep files). 
 +  * Despite its name, wpa_supplicant-dbus.tcz does not actually require dbus to be running in order to use wireless. 
 +  * These instructions assume you have a wireless card whose firmware is included in the linux kernel or modules (e.g., ath9k). If this is not the case, you also need to download the appropriate firmware extension.\\ Another easy way: wpa_gui
  
-**TIP**: For a system that doesn't have wired access, you may find it easier to download the wicd package files and its dependencies first and store them some place convenientYou can then load them into tinycore using the tce-load command+**Note**: As of Tiny Core Linux 4.x you can probably just use the wpa_gui extension from the appbrowser and start the application from wbar. It will automatically start wpa_supplicant and udhcpc for all found wireless devices.
  
-====== Another easy waywpa_gui ======+You should configure your network and choose File -> Save Configuration. If you want to automatically restart the WPA wireless connection after reboot, put "/usr/local/etc/init.d/wpa_gui start" to your /opt/bootlocal.sh and put /etc/wpa_gui.conf to your backup. This way it will start wpa_supplicant and udhcpc for your wireless devices with the configured networks. The wpa_gui service can also be en-/disabled from Panel/Services.
  
 Another way to set up a wireless connection is to use wpa_supplicant with it's associated GUI interface. wpa_supplicant is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver. Another way to set up a wireless connection is to use wpa_supplicant with it's associated GUI interface. wpa_supplicant is the IEEE 802.1X/WPA component that is used in the client stations. It implements key negotiation with a WPA Authenticator and it controls the roaming and IEEE 802.11 authentication/association of the wlan driver.
  
-wpa_supplicant is designed to be a "daemonprogram that runs in the background and acts as the backend component controlling the wireless connection. wpa_supplicant supports a text-based frontend (wpa_cli) and a GUI (wpa_gui). +wpa_supplicant is designed to be a //daemon// program that runs in the background and acts as the backend component controlling the wireless connection. wpa_supplicant supports a text-based frontend (wpa_cli) and a GUI (wpa_gui). See http://hostap.epitest.fi/wpa_supplicant/ for more information.
-See http://hostap.epitest.fi/wpa_supplicant/ for more information.+
  
 Install wpa_supplicant and wpa_gui. Then configure wpa_supplicant for remote control by creating a configuration file (this has to be done only once): Install wpa_supplicant and wpa_gui. Then configure wpa_supplicant for remote control by creating a configuration file (this has to be done only once):
  
-Create a configuration file "/opt/wpa.cfgwith the following content: +Create a configuration file **/opt/wpa.cfg** with the following content: 
-<code> +<code>ctrl_interface=/var/run/wpa_supplicant
-ctrl_interface=/var/run/wpa_supplicant+
 ctrl_interface_group=staff ctrl_interface_group=staff
-update_config=1 +update_config=1</code>
-</code>It's recommended to add this file to your backup, or use a persistent opt.+
  
-After creating the configuration file start the wpa_supplicant daemon using the following command +It's recommended to add this file to your backup, or use a persistent opt.
-and to have wpa_supplicant start every boot, add this to /opt/bootlocal.sh: +
-<code> +
-wpa_supplicant -Dwext -iwlan0 -c/opt/wpa.cfg -B +
-</code>Replace wlan0 with the name of your wireless card.+
  
-Afterwardsall you need to do to connect to various networks is to run wpa_gui from the menu.+After creating the configuration file start the wpa_supplicant daemon using the following command and to have wpa_supplicant start every bootadd this to /opt/bootlocal.sh:
  
-====== More Advanced Setup: using wireless tools ======+<code>wpa_supplicant -Dwext -iwlan0 -c/opt/wpa.cfg -B</code>
  
-Prerequisites: +Replace wlan0 with the name of your wireless card.
-1. You have a working tinycore system with some support for persistence (a tce directory and either a backup/restore point or a persistent /opt directory) <-- link to appropriate howtos +
-2. Your wireless hardware is supported by the open source Atheros wifi drivers +
-3You want to connect to an open access point or WPA-PSK secured AP (you do care about security don't you?)+
  
-===== Initial Preparation =====+Afterwards, all you need to do to connect to various networks is to run wpa_gui from the menu.
  
-1. boot tinycore and install the needed wireless packages if you haven't already +===== More Advanced Setup : Using wireless tools =====
-  * wireless_tools.tcz -- gives you iwconfig and other tools +
-  * wireless-2.6.29.1-tinycore.tcz -- various wifi drivers (atheros and others) +
-  * wpa-supplicant.tcz (which depends on openssl-0.9.8.tcz) -- wpa_supplicant tool for negotiating secured access points +
-If you will be installing to a system that depends on wifi access you may find it easier to pre-download these files and copy them to your tinycore tce directory so that they are installed at boot time (or use tce-load to install them after boot).+
  
-2Check whether you can see your wireless hardwarein the console run:+=== Prerequisites === 
 +  - You have a working tinycore system with some support for persistence (ie: A tce directory and either a backup/restore point or a persistent /opt directory) <- **add link to appropriate howtos.** 
 +  - Your wireless hardware is supported by a driver available in the repo. 
 +  - You want to connect to an open access point, WEP or WPA-PSK secured AP (you do care about security don't you?)
  
-^iwconfig^+=== Initial Preparation ===
  
-you should see a list of interfaces with some status infoyour wireless interface may show up as wlan0 (but maybe ath0 or eth0?). You need to remember the name of this interface as it will be used later+1Boot tinycore and install the needed wireless packages if you haven't already (if you have an Intel wireless card, you need to install firmware-intel.tcz first, and iwlwifi.tcz if it doesn't install it as a dependency). 
 +    | wireless_tools.tcz | gives you iwconfig and other tools | 
 +    | wireless-`uname -r`-tinycore.tcz | in-kernel wifi drivers | 
 +    | wpa-supplicant.tcz | wpa_supplicant tool for negotiating secured access points |
  
-If you don't see connection, you may need to load or install drivers. The wireless-2.6.29.1-tinycore contains many wifi drivers, including the open source drivers for Atheros cards (ath5k/ath9k). You can verify the drivers are present using something like (assuming Atheros card): +If you will be installing to system that depends on wifi access you may find it easier to pre-download these files and copy them to your tinycore tce directory so that they are installed at boot time (or use tce-load to install them after boot).
-|^modprobe -l | grep ath^|+
  
-you should see the ath9k.ko.gz and ath5k.ko.gz device driver files+2. Check whether you can see your wireless hardware. in the console run: **iwconfig**
  
-verify they are loaded using:  +You should see a list of interfaces with some status info. your wireless interface may show up as wlan0 (but maybe ath0 or eth0?). You need to remember the name of this interface as it will be used later
-|^lsmod | grep ath^|+
  
-you can use modprobe to temporarily load and unload drivers as neededFor instructions on setting up alternative Atheros drivers, see [[Network Setup - Atheros Wireless Cards]]+If you don't see a connection, you may need to load or install drivers. The **wireless-`uname -r`-tinycore** contains all in-kernel wifi drivers. You can verify the drivers are present using something like (assuming Atheros card): 
 +**modprobe -l <nowiki>|</nowiki> grep ath** 
 +you should see the ath9k.ko.gz and ath5k.ko.gz device driver files
  
-===== Connecting to an open access point =====+Verify they are loaded using: 
 +**lsmod <nowiki>|</nowiki> grep ath**
  
-1To connect to a particular access pointall you need to do is type in the console +You can use modprobe to temporarily load and unload drivers as neededFor instructions on setting up alternative Atheros driverssee Network Setup Atheros Wireless Cards
-^iwconfig *interface* essid *network-id*^+
  
-to search for access points, use the command  +=== Connecting to an open access point === 
-^iwlist scanning+  - To connect to a particular access point, all you need to do is type in the console: **iwconfig *interface* essid *network-id* ** to search for access points, use the command: **iwlist scanning** to connect to the nearest access point, just use: **iwconfig *interface* essid any** 
- +  To finalize the connection (getting IP address etc), go to control panel, open the netcardconfig tool. switch eth0 to the name of your interface (e.g. wlan0). Change //Use DHCP Broadcast?// to yes, leave //Save Configuration// as yes. Hit apply. This will save and run a script /opt/*interface*.sh. In addition, the /opt/bootlocal.sh (the script run at boot) will now include /opt/*interface*.sh. If your /opt directory is not persistent, make sure you do a backup when you boot or you will need to rerun this tool each time you boot.\\ Alternately, instead of running netcardconfig you could just issue the udhcpc command, e.g., **udhcpc -i *interface* ** 
-to connect to the nearest access point, just use: +  At this point you should have a working network connection. If it doesn't work you might need to play around with the udhcpc commandline (the gui in step 2 makes a udhcpc call, but there are additional options that may be needed) 
-^iwconfig *interface* essid any^ +  If you don't want to have to run step 1 and 2 every time you boot, you can add the command to your /opt/bootlocal.sh file before the line that calls /opt/*interface*.sh script (make sure you backup!)
- +
-2. To finalize the connection (getting IP address etc),  go to control panel, open the netcardconfig tool. switch eth0 to the name of your interface (e.g. wlan0). Change "use DHCP Broadcast?to yes, leave "Save Configurationas yes. Hit apply. This will save and run a script /opt/*interface*.sh. In addition, the /opt/bootlocal.sh (the script run at boot) will now include /opt/*interface*.sh. If your /opt directory is not persistent, make sure you do a backup when you boot or you will need to rerun this tool each time you boot. +
- +
-Alternately, instead of running netcardconfig you could just issue the udhcpc command, e.g., +
-^udhcpc -i *interface*^ +
- +
-3. At this point you should have a working network connection. If it doesn't work you might need to play around with the udhcpc commandline (the gui in step 2 makes a udhcpc call, but there are additional options that may be needed) +
- +
-4. If you don't want to have to run step 1 and 2 every time you boot, you can add the command to your /opt/bootlocal.sh file before the line that calls /opt/*interface*.sh script (make sure you backup!) +
- +
-===== Connecting to a WPA-PSK secured access point =====+
  
 +=== Connecting to a WPA-PSK secured access point ===
 Before you start, you need to look up your access point id (ssid) and passphrase (a string). Before you start, you need to look up your access point id (ssid) and passphrase (a string).
- +  * At the command line, run **<nowiki>wpa_passphrase *essid* *passphrase*</nowiki>**\\ For example: **wpa_passphrase mynetwork mypassphrase network={ssid="mynetwork",psk=f242925f83787084d58101d5eb52485989e2a553983bfe6fc5b8d27fdfa063bd}** 
-1. At the command line, run +  * Now create a file in your favorite editor replacing the ssid and psk values below with result from step 1: **ctrl_interface=/var/run/wpa_supplicant** 
-^wpa_passphrase *essid* *passphrase*+<code>
- +
-For example: +
-+
-~$ wpa_passphrase mynetwork mypassphrase+
 network={ network={
- ssid="mynetwork" +      ssid=mynetwork 
- #psk="mypassphrase" +      proto=WPA 
- psk=f242925f83787084d58101d5eb52485989e2a553983bfe6fc5b8d27fdfa063bd +      key_mgmt=WPA-PSK 
-+      pairwise=TKIP 
-+      group=TKIP 
- +      psk=f242925f83787084d58101d5eb52485989e2a553983bfe6fc5b8d27fdfa063bd 
-2. Now create a file in your favorite editor replacing the ssid and psk values below with result from step 1: +}</code>
- +
-+
-ctrl_interface=/var/run/wpa_supplicant +
- +
-network={ +
-        ssid=mynetwork +
-        proto=WPA +
-        key_mgmt=WPA-PSK +
-        pairwise=TKIP +
-        group=TKIP +
-        psk=f242925f83787084d58101d5eb52485989e2a553983bfe6fc5b8d27fdfa063bd +
-} +
-+
- +
-Note that this assumes a fairly conventional WPA-PSK setup. If you need to use other security (e.g. WEP) or are connecting to a more sophisticated network you may have to tweak this file. See the wpa_supplicant manual for more info. (What if you connect to more than one WPA-PSK network -- can add as many network sections to the conf file as needed) +
- +
-save it as /opt/wpa_configure.conf (then to ensure it is persistent in the system, add the line ''opt/wpa_configure.conf'' to ''/opt/.filetool.lst''+
- +
-3. to connect to the access point, run in the console: +
-^wpa_supplicant -i*interface* -c/opt/wpa_configure.conf &^ +
- +
-(what diagnostics can be run here to verify the connection? iwconfig etc) +
- +
-4. now to finalize the connection (getting IP address etc), go to control panel, open the netcardconfig tool. switch eth0 to the name of your interface (e.g. wlan0). Change "use DHCP Broadcast?" to yes, leave "Save Configuration" as yes. Hit apply. This will save and run a script /opt/*interface*.sh. In addition, the /opt/bootlocal.sh (the script run at boot) will now include /opt/*interface*.sh. If your /opt directory is not persistent, make sure you do a backup when you boot or you will need to rerun this tool each time you boot. +
- +
-Alternately, instead of running netcardconfig you could just issue the udhcpc command, e.g.: +
-^udhcpc -i *interface*^ +
- +
-5. At this point you should have a working network connection. If it doesn't work you might need to tweak the wpa_supplicant configuration or the udhcpc command line. +
- +
-6. If you don't want to have to run step 3 and 4 every time you boot, you can add the wpa_supplicant command in line 3 to your /opt/bootlocal.sh file before the line that calls /opt/*interface*.sh script (make sure you backup!) +
- +
-===== Simple scripts to auto connect to specific networks ===== +
- +
-==== Connect to non-secured access point. ==== +
- +
-Script that displays local Access Points to connect to. Only works with unsecured APs. +
- +
-http://forum.tinycorelinux.net/index.php?topic=2221.msg14821#msg14821+
  
-==== Connect to either non-secure or WEP protected access point ====+Note: This assumes a fairly conventional WPA-PSK setup. If you need to use other security (e.g. WEP) or are connecting to a more sophisticated network you may have to tweak this file. See the wpa_supplicant manual for more info. (What if you connect to more than one WPA-PSK network? You can add as many network sections to the conf file as needed.) 
 +save it as /opt/wpa_configure.conf (then to ensure it is persistent in the system, add the line opt/wpa_configure.conf to /opt/.filetool.lst)
  
-NOTE requires editing of shell script to set ESSID (network name) and wep key (set to blank if network is unsecured).+  * to connect to the access point, run in the console: **wpa_supplicant -i*interface* -c/opt/wpa_configure.conf & **\\ For diagnostic run this command with debugging option **-d**\\ **sudo wpa_supplicant -i*interface* -c/opt/wpa_configure.conf -d** (Close debugging mode with Ctrl+c)\\ You can verify the connection with iwconfig. After successful association you get all connection data in command output: AP BSSID, Bit Rate, Link Quality etc. Another simple method is watching card LINK diode. Diode shines with constant light, when Adapter is connected to AP. 
 +  * now to finalize the connection (getting IP address etc), go to control panel, open the netcardconfig tool. switch eth0 to the name of your interface (e.g. wlan0). Change //Use DHCP Broadcast?// to yes, leave //Save Configuration// as yes. Hit apply. This will save and run a script /opt/*interface*.sh. In addition, the /opt/bootlocal.sh (the script run at bootwill now include /opt/*interface*.sh. If your /opt directory is not persistent, make sure you do a backup when you boot or you will need to rerun this tool each time you boot.
  
-NOTE to set your WEP key using a plain text string (i.e.: not HEX) then put an s: in front of the key+Alternately, instead of running netcardconfig you could just issue the udhcpc command, e.g.: **udhcpc -i *interface* ** 
-^iwconfig wlan0 key s:BlahBlahBlah^+  * At this point you should have a working network connection. If it doesn't work you might need to tweak the wpa_supplicant configuration or the udhcpc command line
 +  * If you don't want to have to run step 3 and 4 every time you boot, you can add the wpa_supplicant command in line 3 to your /opt/bootlocal.sh file before the line that calls /opt/*interface*.sh script (make sure you backup!)
  
-<code>#!/bin/sh+=== Simple scripts to auto connect to specific networks === 
 +Connect to non-secured access point. (Script that displays local Access Points to connect to. Only works with unsecured APs.) 
 +  * [[http://forum.tinycorelinux.net/index.php?topic=2221.msg14821#msg14821|Connect to either non-secure or WEP protected access point]]\\ NOTE: requires editing of shell script to set ESSID (network name) and wep key (set to blank if network is unsecured).\\ NOTE: to set your WEP key using a plain text string (i.e.: not HEX) then put an s: in front of the key **iwconfig wlan0 key s:BlahBlahBlah** 
 +<code bash> 
 +#!/bin/sh
   - Example usage:   - Example usage:
   -    - 
Line 174: Line 129:
 echo SID ${essid} echo SID ${essid}
 if [[ -n "${wep}" ]] if [[ -n "${wep}" ]]
-then              +then
     echo WEPKEY $wepkey     echo WEPKEY $wepkey
 fi fi
Line 195: Line 150:
 pkill udhcpc pkill udhcpc
 udhcpc -H box -b -i ${wlan} udhcpc -H box -b -i ${wlan}
 +</code>
  
- 
-</code> 
  
Print/export
QR Code
QR Code wiki:setting_up_wifi (generated for current page)