====== dCore Wireless====== A network connection is necessary for down-loading extensions from within dCore. If the computer only has wireless connection then one must set that up from the command line as first thing. Once one has a functional graphical desktop the tools are more comfortable to use. =====Command-line===== ====Assumptions==== We assume a basic dCore installation, notably with already set-up tce-directory 'tce/' (cf. sample [[dcore:installations|installations]]). ====Import extensions==== ===Side-loading=== Setting up dCore on a computer without Ethernet connection, wireless extensions must be "side-loaded" into the tce-directory, that is the down-load must be performed from another installation. Down-load all the 'wireless*' files from the 'sce/'-folder at the [[http://tinycorelinux.net/dCore/x86/release/dCore-trusty/sce/|download repository]] into 'tce/sce'. If you need [[http://en.wikipedia.org/wiki/NDISwrapper|NDISwrapper]] for using Windows-drivers then also down-load those files. //wireless--tinycore.sce// consists of drivers for wireless radios whereas //wireless// consists of the necessary utilities like 'iwconfig' etc. ==From within dCore== If you have a functional network connection then launch ''sce-import'' for //wireless//, //wireless--tinycore// and, if applicable, //ndis-wrapper-modules--tinycore//. ====Load extensions==== From within dCore, issue ''sce-load'' for the extensions. ====Configure wireless network==== Let denote the wireless interface name (e.g. "wlan0"); it can be determined by issueing ''iwconfig''. The recommended way to go about establishing a wireless network connection is by using 'wifi.sh'; only more complex situations should necessitate the manual calling of 'wpa_supplicant'. === Using 'wifi.sh' === The installed extensions provide the command 'wifi.sh' which allows for quickly establishing a connection in a WEP/WPA-protected wireless network. It maintains a database of credentials in '~/wifi.db'. == Automatic configuration via DHCP == For quickly establishing a connection in a standard wireless network, issue 'sudo wifi.sh', select the network and enter the credentials. Assuming that there is a DHCP-server available, the configuration will automatically be determined. The ''-w'' option makes the program wait indefinitely until a lease is obtained. == Manual configuration == Using the ''-p'' option, the network configuration can be determined manually by entering IP-address, net mask, gateway and DNS-server address. ===Using 'wpa_supplicant'=== 'wpa_supplicant' is called, together with 'wpa_passphrase' in 'wifi.sh'. Only the basic usage is outlined here; for different set-ups, please confer, e.g. to the [[https://wiki.archlinux.org/index.php/WPA_supplicant|Archlinux Wiki]] or also a thorough explanation of the [[http://w1.fi/cgit/hostap/plain/wpa_supplicant/README|WPA-supplicant]] and its [[http://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf|configuration file]]. The following steps will give you access to one specific wireless network. == Set-up key file manually == *Optional step for determining the available wireless networks: issue ''sudo iwlist scanning | less'' and search for "ESSID" *Create a file '/etc/wpa_supplicant.conf' to contain the following and ''chmod'' it to 600-permissions. network={ ssid="YOUR_ESSID" psk="YOUR_PASSWORD" } Alternatively, one may use 'wifi.sh' which will create the file with the password hashed. The clear-text password is commented out and may be deleted. == Set-up key file by use of WPA-cli== Alternatively, the key file may be generated by use of the configuration tool WPA-cli. Following the excellent presentation in the [[https://wiki.archlinux.org/index.php/WPA_supplicant|Archlinux wiki]], this procedure will automate the writing of the configuration file by use of the semi-interactive tool 'wpa_cli'. It has quite an impressive list of features and probably can be helpful in many kinds of situations; ''wpa_cli --help'' gives a complete list of available commands. In order to use WPA-cli, a control interface must be specified for WPA-supplicant, and it must be given the rights to update the configuration. Do this by creating a minimal configuration file '/etc/wpa_supplicant.conf' with 600-permissions. ctrl_interface=/var/run/wpa_supplicant update_config=1 Launch WPA-supplicant in the background and afterwards WPA-cli. sudo wpa_supplicant -B -i -c /etc/wpa_supplicant.conf sudo wpa_cli In the interactive interface, scan for available networks. scan scan_results From the list, one can create network connections, labeled by numbers. add_network set_network 0 ssid "" set_network 0 psk "" NB: the hyphens around the strings are mandatory! Connect to the network and save the configuration enable_network 0 save_config This will up-date 'wpa_supplicant.conf' with the settings for this network. This step may be repeated for different networks. ==Additional features== The control interface of WPA-supplicant can be configured to allow non-root user access (ctrl_interface GROUP= [[http://linux.die.net/man/8/wpa_cli|parameter]] in the [[http://linux.die.net/man/5/wpa_supplicant.conf|configuration file]]). This would make it possible to run WPA-cli with a normal user account. We do not delve into this realm. For most flexibility, the use of WPA-gui from the graphical desktop is recommended. ==Connect to the network== sudo wpa_supplicant -i -c /etc/wpa_supplicant.conf & connects to the network. ''iwconfig'' should then show the connection. sudo udhcpc -b -i -x hostname -p /var/run/udhcpc..pid' acquires a DHCP-lease. 'ifconfig' should then show the IP-address as "inet addr". Pinging any IP-address should work now. ==Persistence== The configuration file can be made persistent by adding "/etc/wpa_supplicant.conf" to '/opt/.filetool.lst' and issueing ''backup''. Note that the folder '/etc/wpa_supplicant' will be mounted from the wireless extension as an overlay-filesystem, though that does not interfere with the configuration file. The above set-up procedure can be made persistent by the following steps. As said, one may want to handle wireless through the graphical desktop which offers more flexibility. In that case, one will then want to revert these steps. Add "wireless" and "wireless--tinycore" (and "ndiswrapper-modules--tinycore" if applicable) to '/etc/sysconfig/tcedir/sceboot.lst' Add the following lines to '/opt/bootlocal.sh'. /sbin/wpa_supplicant -B -i -c /etc/wpa_supplicant.conf /bb/udhcpc -b -i -x hostname $(hostname) -p /var/run/udhcpc..pid If Syslog is running, one may want to add the option ''-s'' for WPA-supplicant and ''-S > /dev/null 2>&1'' for UDHCP-client. =====Graphical desktop===== Once a graphical desktop is available, the installed extensions (//wireless//, //wireless--tinycore// and, if applicable, //ndis-wrapper-modules--tinycore//) provide a menu item (for instance in Wbar and the entry "Wifi" in the applications section of the Flwm-menu). It will launch 'wifi.sh' in a terminal window, while accessing the same database of credentials in '~/wifi.db'. ===== Trouble-shooting ===== If ''wifi.sh'' takes a long time trying to connect to the network, it will eventually hit a time-out and then continue with ''udhcpc'' which won't succeed either, naturally. A useful first step for localizing the cause of trouble is the manual configuration as outlined above. ''wpa_supplicant'' prints out debug-messages with the ''-d'' option (or even ''-dd''). ==== Driver of wpa_supplicant ==== For older wireless hardware (e.g. Intel PRO/Wireless 2100), the modern driver nl80211 (user space, i.e. the one of wpa_supplicant, not the kernel driver) may need to be replaced. Try ''-D wext'' if the command should fail with an error message about the standard driver nl80211 (cf. ''wpa_supplicant –h'' or also the [[https://wiki.archlinux.org/index.php/WPA_supplicant#nl80211_driver_not_supported_on_some_hardware|respective section]] of the Archlinux-Wiki). === Persistence === Unfortunately, there is no way to specify the driver in 'wpa_supplicant.conf'. Thus one has to either manually call 'wpa_supplicant' with the ''-D wext'' option; or one may patch the file 'wifi.sh'. For the latter, follow these steps: - Load the ''wireless'' extension - Copy the file '/tmp/tcloop/wireless/usr/local/bin/wifi.sh' aside - Re-boot - Do //not// load the ''wireless'' extension yet! - Move 'wifi.sh' to '/usr/local/bin/'. - Add the option ''-D wext'' to line 113 containing the call to 'wpa_supplicant' - Add "usr/local/bin/wifi.sh" to '/opt/.filetool.lst' - Issue ''backup'' From then on, 'wifi.sh' will call 'wpa_supplicant' with the desired driver. **[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]**