Difference between revisions of "Wireless from the Terminal"

From Pandora Wiki
Jump to: navigation, search
m
(redirect to wifi)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Sometimes, you may wish to bypass network manager and configure the WiFi directly. Here is described how to do this.
+
#REDIRECT [[WiFi]]
 
 
 
 
===Becoming Root===
 
* You'll need to be root for pretty much everything here.
 
sudo -i
 
 
 
===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
 
 
 
===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]
 
network={
 
	ssid="Access Point SSID goes here"
 
	scan_ssid=1
 
	key_mgmt=WPA-PSK
 
	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:
 
  wpa_cli
 
* Then type at the prompt
 
reconfigure
 
 
 
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.
 
If wpa_cli outputs "Could not connect to wpa_supplicant - retrying" you need to enable Wifi 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 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.
 
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.
 
 
 
====Automatic====
 
* 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. 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.
 
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 192.168.1.150/24
 
* If your network is weird, here's an alternate, more specific line.
 
ifconfig wlan0 192.168.1.150 broadcast 192.168.1.255 netmask 255.255.255.0
 
* Add the route to the gateway.
 
route add default gw 192.168.1.1
 
 
 
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=====
 
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.
 
 
 
References:
 
[http://wiki.archlinux.org/index.php/Wpa_supplicant]
 
[http://wiki.archlinux.org/index.php/Wireless#Manual_setup]
 
[http://wiki.archlinux.org/index.php/Autowifi]
 
 
 
 
 
[[Category:Tutorials]]
 

Latest revision as of 17:05, 9 November 2013

Redirect to: