Difference between revisions of "Wireless from the Terminal" - Pandora Wiki

(formating)
(redirect to wifi)
 
Line 1: Line 1:
Sometimes, you may wish to bypass network manager and configure the [[WLAN]] directly. Here is described how to do this.
+
#REDIRECT [[WiFi]]
 
 
 
 
===Becoming Root===
 
* You'll need to be root for pretty much everything here.
 
<source lang="bash">sudo -i</source>
 
 
 
===Killing NetworkManager===
 
* A good first step is to just stop NetworkManager, so it doesn't conflict with what we're doing now.
 
<source lang="bash">/etc/init.d/NetworkManager stop</source>
 
 
 
===Optional: Disabling NetworkManager===
 
You may want to completely disable NetworkManager.  Here's how.
 
 
 
* This will remove NetworkManager from startup.
 
<source lang="bash">update-rc.d -f NetworkManager remove</source>
 
* This will add it back.
 
<source lang="bash">update-rc.d NetworkManager defaults</source>
 
 
 
===Configuring wpa_supplicant===
 
wpa_supplicant is generally used for connecting using WPA, but I find it pretty convenient even on it's own.  It'll also be easier to explain for 1 thing rather than explaining this and iwconfig.  It also seems to start by default with the Pandora, but I honestly can't determine what starts it, just that it does.
 
 
 
* Anyway, wpa_supplicant needs to be configured.  It's default config file is found in /etc/wpa_supplicant.conf.  Here's a basic configuration file that should work with most home routers with WPA.  If you have no encryption, set key_mgmt to NONE and remove the psk= line.  If you have WEP, key_mgmt should also be NONE and psk= should be removed and replaced with wep_key0= followed by the HEXADECIMAL wep key.  You'll need some kind of converter to go from an ASCII key to a HEX key.  Here's one, be safe and make sure you don't use the key for anything else important, since you're entering it in to another site: [http://www.speedguide.net/wlan_key.php WEP key converter]
 
<source lang="apache">
 
network={
 
&#09;ssid="Access Point SSID goes here"
 
&#09;scan_ssid=1
 
&#09;key_mgmt=WPA-PSK
 
&#09;psk="password goes here"
 
}
 
</source>
 
 
 
* A good idea now would be to reboot, to make sure everything is clean. You may need to kill NetworkManager again afterwards, then toggle WLAN off then on (Menu -> System -> Toggle WiFi). You can also make wpa_supplicant reload it's configuration without rebooting:
 
<source lang="bash">wpa_cli</source>
 
* Then type at the prompt
 
<source lang="bash">reconfigure</source>
 
 
 
wpa_cli is also good to check the status of wpa_supplicant when you're trying to connect.  It'll spit out messages based on what's going on while you're toggling WLAN on and off to see if it's associated or just times out.
 
If wpa_cli outputs "Could not connect to wpa_supplicant - retrying" you need to enable WLAN via "Main Menu"->"System"->"Toggle WiFi" first.
 
 
 
===Setting Up the Network===
 
Once you have a connection to the access point, you need to set up a few things either manually or through DHCP.
 
 
 
* To check for connection, if you have wpa_cli running, you can see it's output when you're toggling WLAN on.  It'll either say it's Associated, which means it succeeded or that it's timed out, which means it failed, or possibly any other number of errors.  You can also check iwconfig.
 
<source lang="bash">iwconfig</source>
 
* If it says Access Point:Not-Associated after about 30 seconds, that means it has likely failed.  If you see a 12 digit hex string, that means it has found the access point and has an active connection to it.
 
 
 
====Automatic====
 
* If you trust DHCP to work, you can just try this.
 
<source lang="bash">udhcpc -i wlan0</source>
 
 
 
If all goes well, everything will be properly configured and you'll be on the net. Otherwise you should try to do it manually (see below).
 
 
 
====Manual====
 
Here are the commands you need to enter to configure the network manually.
 
 
 
* This is optional, but I put it anyway, just in case it causes some kind of trouble.
 
<source lang="bash">ifconfig usb0 down</source>
 
* This disables power management, which can help a dodgy WLAN connection.
 
<source lang="bash">iwconfig wlan0 power off</source>
 
* This limits the rate to 11Mbit, which also can help an unstable WLAN connection.
 
<source lang="bash">iwconfig wlan0 rate 11M auto</source>
 
* Set the IP, broadcast and netmask all at once.
 
<source lang="bash">ifconfig wlan0 192.168.1.150/24</source>
 
* If your network is weird, here's an alternate, more specific line.
 
<source lang="bash">ifconfig wlan0 192.168.1.150 broadcast 192.168.1.255 netmask 255.255.255.0</source>
 
* Add the route to the gateway.
 
<source lang="bash">route add default gw 192.168.1.1</source>
 
 
 
Replace 192.168.1.1 with your gateway IP (You can get this from one of your other computers on the network.  Linux: ifconfig  Windows: ipconfig /all) and 192.168.1.150 with the IP you'd like your Pandora to be.  There are a few caveats here, though.  Simply put, the subnet needs to be the same as your gateway's subnet.  So if it's 192.168.X.Y, it needs to start with 192.168.X or if it's 10.0.0.1, it needs to start with 10.  Also for 10.0.0.1, the /24 needs to be /8.  There's a bunch of other stuff to do with that, and many odd variations on it, but I'm sure there's a better reference for it elsewhere.
 
 
 
* One last thing you'll need to do is set up DNS name servers. You can get this information from another computer on the network with a working Internet connection.
 
=====Linux=====
 
<source lang="bash">cat /etc/resolv.conf</source>
 
* Copy that file verbatim in to the /etc/resolv.conf on the Pandora.
 
 
 
=====Windows=====
 
<source lang="bash">ipconfig /all</source>
 
* There should be a line for Primary DNS Server and possibly Secondary DNS Server. They should be entered in to /etc/resolv.conf like this.
 
<source lang="bash">
 
nameserver Primary.DNS.Server.IP
 
nameserver Secondary.DNS.Server.IP
 
</source>
 
If there is no secondary DNS server, don't worry, just enter only the first line, then.
 
 
 
References:
 
[http://wiki.archlinux.org/index.php/Wpa_supplicant]
 
[http://wiki.archlinux.org/index.php/Wireless#Manual_setup]
 
[http://wiki.archlinux.org/index.php/AutoWLAN]
 
 
 
 
 
[[Category:Tutorials]]
 
[[Category:Wifi]]
 

Latest revision as of 18:05, 9 November 2013

Redirect to:

Top