Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
wiki:setting_up_wifi [2011/12/08 06:06] – [Another easy way: wpa_gui] gutmensch | wiki:setting_up_wifi [2022/10/08 21:27] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== A No-nonsense, | ||
+ | All you need to connect to a WiFi hotspot is wpa_supplicant, | ||
+ | |||
+ | Just follow 3 easy steps: | ||
+ | |||
+ | * 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: | ||
+ | * Load the wpa_supplicant extension and its dependencies: | ||
+ | |||
+ | * If you do NOT have access to a wired connection on your TCL machine: | ||
+ | * Using a different machine, establish 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/ | ||
+ | * Load the wpa_supplicant extension and its dependencies: | ||
+ | |||
+ | Now you are ready to connect to any WiFi hotspot. You can do so manually or use a shell script to help you (e.g., https:// | ||
+ | |||
+ | ==== 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:// | ||
+ | * Take a peek at wpa_supplicant.tcz.tree or wpa_supplicant-dbus.tcz.tree (e.g., ftp:// | ||
+ | * 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 | ||
+ | |||
+ | **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. | ||
+ | |||
+ | You should configure your network and choose File -> Save Configuration. If you want to automatically restart the WPA wireless connection after reboot, put "/ | ||
+ | |||
+ | 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/ | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | 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 **/ | ||
+ | < | ||
+ | ctrl_interface_group=staff | ||
+ | update_config=1</ | ||
+ | |||
+ | 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 and to have wpa_supplicant start every boot, add this to / | ||
+ | |||
+ | < | ||
+ | |||
+ | Replace wlan0 with the name of your wireless card. | ||
+ | |||
+ | Afterwards, all you need to do to connect to various networks is to run wpa_gui from the menu. | ||
+ | |||
+ | ===== More Advanced Setup : Using wireless tools ===== | ||
+ | |||
+ | === Prerequisites === | ||
+ | - You have a working tinycore system with some support for persistence (ie: A tce directory and either a backup/ | ||
+ | - 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?) | ||
+ | |||
+ | === Initial Preparation === | ||
+ | |||
+ | 1. Boot tinycore and install the needed wireless packages if you haven' | ||
+ | | 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 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). | ||
+ | |||
+ | 2. Check whether you can see your wireless hardware. in the console run: **iwconfig** | ||
+ | |||
+ | 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 | ||
+ | |||
+ | 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 < | ||
+ | you should see the ath9k.ko.gz and ath5k.ko.gz device driver files | ||
+ | |||
+ | Verify they are loaded using: | ||
+ | **lsmod < | ||
+ | |||
+ | You can use modprobe to temporarily load and unload drivers as needed. For instructions on setting up alternative Atheros drivers, see Network Setup - Atheros Wireless Cards | ||
+ | |||
+ | === Connecting to an open access point === | ||
+ | - 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?// | ||
+ | - At this point you should have a working network connection. If it doesn' | ||
+ | - If you don't want to have to run step 1 and 2 every time you boot, you can add the command to your / | ||
+ | |||
+ | === 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). | ||
+ | * 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=/ | ||
+ | < | ||
+ | network={ | ||
+ | ssid=mynetwork | ||
+ | proto=WPA | ||
+ | key_mgmt=WPA-PSK | ||
+ | pairwise=TKIP | ||
+ | group=TKIP | ||
+ | psk=f242925f83787084d58101d5eb52485989e2a553983bfe6fc5b8d27fdfa063bd | ||
+ | }</ | ||
+ | |||
+ | 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 / | ||
+ | |||
+ | * to connect to the access point, run in the console: **wpa_supplicant -i*interface* -c/ | ||
+ | * 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?// | ||
+ | |||
+ | Alternately, | ||
+ | * At this point you should have a working network connection. If it doesn' | ||
+ | * 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 / | ||
+ | |||
+ | === 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:// | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | - Example usage: | ||
+ | - | ||
+ | - sudo sh mywifi.sh | ||
+ | - | ||
+ | - Can automate this stuff by putting into / | ||
+ | - using cpanel, network autocreates /opt/my* | ||
+ | |||
+ | - Determine device name (assume one wifi device; use head, etc. to restrict to first, last...) | ||
+ | |wlan=`iwconfig 2>/ | ||
+ | echo $wlan | ||
+ | |||
+ | essid=myessid | ||
+ | - set wepkey to hex digits, leave blank if no wep-security is used | ||
+ | wepkey=deadbeafdeadbeaf | ||
+ | |||
+ | echo SID ${essid} | ||
+ | if [[ -n " | ||
+ | then | ||
+ | echo WEPKEY $wepkey | ||
+ | fi | ||
+ | |||
+ | iwconfig ${wlan} | ||
+ | |||
+ | iwconfig ${wlan} essid ${essid} | ||
+ | if [[ -n " | ||
+ | then | ||
+ | iwconfig ${wlan} enc ${wepkey} | ||
+ | iwconfig ${wlan} key ${wepkey} | ||
+ | fi | ||
+ | iwconfig ${wlan} commit | ||
+ | |||
+ | - now setup IP address, route, gateway, etc. | ||
+ | - Use DHCP | ||
+ | - after netcardconfig and save settings | ||
+ | - TC@BOX:~$ cat / | ||
+ | - !/bin/sh | ||
+ | pkill udhcpc | ||
+ | udhcpc -H box -b -i ${wlan} | ||
+ | </ | ||
+ | |||