Difference between revisions of "Wireless from the Terminal"

From Pandora Wiki
Jump to: navigation, search
(redirect to wifi)
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Becoming Root==
* You'll need to be root for pretty much everything here.
  sudo bash
==Killing NetworkManager==
* A good first step is to just stop NetworkManager, so it doesn't conflict with what we're doing now.
  /etc/init.d/NetworkManager stop
==Optional: Disabling NetworkManager==
You may want to completely disable NetworkManager.  Here's how.
* This will remove NetworkManager from startup.
  update-rc.d -f NetworkManager remove
* This will add it back.
  update-rc.d NetworkManager defaults
==Configure 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]
  	ssid="Access Point SSID goes here"
  	psk="password goes here"
* A good idea now would be to reboot, to make sure everything is clean.  You may need to kill NetworkManager again afterwards, then toggle wifi off then on (Menu -> System -> Toggle WIFI).  You can also make wpa_supplicant reload it's configuration without rebooting.
* Then type at the prompt
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 wifi on and off to see if it's associated or just times out.
==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 wifi 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.
* 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.
Here are the commands you need to enter to configure the network.
* This is optional, but I put it anyway, just in case it causes some kind of trouble.
  ifconfig usb0 down
* This disables power management, which can help a dodgy wifi connection.
  iwconfig wlan0 power off
* This limits the rate to 11Mbit, which also can help an unstable wifi connection.
  iwconfig wlan0 rate 11M auto
* Set the IP, broadcast and netmask all at once.
  ifconfig wlan0
* If your network is weird, here's an alternate, more specific line.
  ifconfig wlan0 broadcast netmask
* Add the route to the gateway.
  route add default gw
Replace with your gateway IP (You can get this from one of your other computers on the network.  Linux: ifconfig  Windows: ipconfig /all) and 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, it needs to start with 10.  Also for, 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:
  cat /etc/resolv.conf
* Copy that file verbatim in to the /etc/resolv.conf on the Pandora.
* Windows:
  ipconfig /all
* 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.
  nameserver Primary.DNS.Server.IP
  nameserver Secondary.DNS.Server.IP
If there is no secondary DNS server, don't worry, just enter only the first line, then.
* If you trust DHCP to work, you can just try this.
  udhcpc -i wlan0
If all goes well, everything will be properly configured and you'll be on the net.

Latest revision as of 17:05, 9 November 2013

Redirect to: