LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2010, 01:09 PM   #1
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Rep: Reputation: 28
Debian Lenny WPA using CLI


Hi there

As a challenge, I've setup a Debian box without a GUI. However, I'm having problems with the wifi. I know this question has probably been asked to death, but none of the internet how-tos work.

My card is a USB zd1211rw (3com branded). I can scan for networks, and find my own WPA network, but can't connect to it. I've setup my '/etc/network/interfaces' file like this:

Code:
auto wlan0
iface wlan0 inet dhcp
     wpa-ssid BUFFALO
     wpa-bssid 00:16:01:a1:8a:7b
     wpa-psk (hex key here)
     wpa-psk-mgmt WPA-PSK
However, when it tries to connect to the network on boot I don't get any messages about encryption or having connected, only it trying to get a DHCP lease, which of course fails.

Is there a better way (IE one that works) to do this?

Thanks
Joe
 
Old 05-13-2010, 01:17 PM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Have you looked at the iwconfig man page yet? That tool can be used on CLI level to make a connection and if you want to automate it, you can put it all togeter in a script to launch at logon.

Kind regards,

Eric
 
Old 05-13-2010, 01:43 PM   #3
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,883
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Take a look at WiFi/HowToUse - Debian Wiki - http://wiki.debian.org/WiFi/HowToUse#wpasupplicant
 
Old 05-13-2010, 01:46 PM   #4
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Eric - Thanks, I'll have a play with it and see what happens

Quote:
Originally Posted by craigevil View Post
Take a look at WiFi/HowToUse - Debian Wiki - http://wiki.debian.org/WiFi/HowToUse#wpasupplicant
That's what I started with, but didn't work, so I kept adding bits in the hope that it might...
 
Old 05-13-2010, 01:55 PM   #5
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

You're welcome, please let us know your progress and if you encounter any problems running the commands I'm sure LQ can help out.

Kind regards,

Eric
 
Old 05-13-2010, 02:06 PM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I've yet to use WPA yet. But based on my package manager:

apt-get install wireless-tools
apt-get install wpasupplicant

zcat /usr/share/doc/wpasupplicant/README.wpa_supplicant.conf.gz | less

wpa<tab><tab> shows:
wpa_action
wpa_cli
wpa_passphrase
wpa_supplicant

if you want to read the manpages or try to do it all manually first.
 
Old 05-14-2010, 01:09 AM   #7
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
For what it is worth, I have set up wireless N on a headless eBox with a Tp-Link TL-WN861N Wireless N Mini PCI Card.

This has Debian Lenny with the following setup to enable wpa supplicant:

/etc/network/interfaces
Code:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
  address 192.168.xxx.xxx
  netmask 255.255.255.0
  broadcast 192.168.xxx.255
  network 192.168.xxx.0
  gateway 192.168.xxx.xxx

auto wlan0
iface wlan0 inet static
wireless-essid MYESSID
  wpa-diver wext
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  wpa-psk <HEX_KEY_HERE>
  address 192.168.xxx.111
  netmask 255.255.255.0
  broadcast 192.168.xxx.255
  network 192.168.xxx.0
  gateway 192.168.xxx.xxx
/etc/wpa_supplicant/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
ap_scan=1
network={
        ssid="MYESSID"
        scan_ssid=1
        proto=RSN
        pairwise=CCMP TKIP
        group=CCMP TKIP
        key_mgmt=WPA-PSK
#        psk="ASCII_PASSPHRASE"
        psk=<HEX_KEY_HERE>
}
The following script starts the connection from the command line:
Code:
#!/bin/sh
echo "Loading Chipset Driver"
/sbin/modprobe ath9k
/bin/sleep 2

echo "De-activating eth0 interface - for some reason I cannot get wifi up without this"
/sbin/ifconfig eth0 down
/bin/sleep 2

echo "Activating wlan0 interface"
/sbin/ifconfig wlan0 down
/bin/sleep 1
echo "Setting network parameters"
/sbin/wpa_supplicant -v -B -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf
/bin/sleep 1

echo "Setting IP Address"
# Via DHCP
#/sbin/dhclient wlan0
/bin/sleep 2
# Static IP config
/sbin/ifconfig wlan0 192.168.xxx.111 up
/sbin/route add default gateway 192.168.xxx.xxx
Regards,
Stefan
 
Old 05-14-2010, 04:22 PM   #8
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by propofol View Post
For what it is worth, I have set up wireless N on a headless eBox with a Tp-Link TL-WN861N Wireless N Mini PCI Card.

This has Debian Lenny with the following setup to enable wpa supplicant:


Regards,
Stefan
Well, one problem was that wpa_supplicant wasn't installed. Stupid me assumed every modern distribution installed it, stupid Debian didn't install it by default >.>

I adapted your scripts for my network and no dice. No error messages, but dhclient doesn't get a response. iwconfig tells me I'm associated with my access point, but not connected. I got this working on another box about 4 years ago, it was just a short script. Wish I could remember what I did...

This is a bit harder than wired eh?

Last edited by Joe of Loath; 05-14-2010 at 04:25 PM.
 
Old 05-14-2010, 05:59 PM   #9
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
I had a difficult time getting this working - I have another usb wifi that required iwpriv commands to get it running.

I would suggest disabling WPA and see if you can connect. Another option is to use:
Code:
iwlist wlan0 scan
I do not know much about the adapter you mentioned, but does seem to require firmware to be loaded.

If the adapter works, you could run wpa_supplicant with a '-dd' option for a more verbose debugging output. Some short and sweet instructions here.

Regards,
Stefan

Last edited by propofol; 05-14-2010 at 06:04 PM.
 
Old 05-15-2010, 08:33 AM   #10
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Quote:
Originally Posted by propofol View Post
I had a difficult time getting this working - I have another usb wifi that required iwpriv commands to get it running.

I would suggest disabling WPA and see if you can connect. Another option is to use:
Code:
iwlist wlan0 scan
I do not know much about the adapter you mentioned, but does seem to require firmware to be loaded.

If the adapter works, you could run wpa_supplicant with a '-dd' option for a more verbose debugging output. Some short and sweet instructions here.

Regards,
Stefan
I'll setup a network without a password on my laptop, I don't trust the neighbours...

iwlist scanning works, my network and next door's shows up. I also have the firmware loaded.

I'll try that site you linked later, thanks!
 
Old 05-15-2010, 08:29 PM   #11
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
wireless.kernel.org

A lot of the drivers and corresponding tools seem to be getting a complete makeover. I wasted most of today trying to revamp my wireless network after a power outage this morning. Turns out I fat fingered the key and it didn't match the existing network. So most of today figuring out why none of my wireless devices could talk to each other, even though they were all basically identical. Because the key on the AP / router didn't match the clients. I'm assuming since using the same script on the clients worked even though it was just a modified version of the existing scripts on those clients.
 
Old 05-20-2010, 12:16 PM   #12
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Got it I initially copied this guide here: http://ubuntuforums.org/showthread.php?t=288753, since it's similar to the one I know worked about 4 years ago. I then realised it didn't work perfectly, and adapted it. Now wpa_supplicant and dhclient simply run at boot.

Thanks for all the help, I'm now even able to run a webserver

Now, lets see how much uptime I can get without the electricity bill going through the roof...
 
Old 05-20-2010, 12:39 PM   #13
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Great to hear you got it solved and thanks for posting the solution (without your adaptations ). I'm sure others can use it as a reference. Please mark your thread as solved using the Thread tools.

Kind regards,

Eric
 
Old 05-20-2010, 01:27 PM   #14
Joe of Loath
Member
 
Registered: Dec 2009
Location: Bristol, UK
Distribution: Ubuntu, Debian, Arch.
Posts: 152

Original Poster
Rep: Reputation: 28
Actually, I'm not completely finished yet, I still need to get it working on boot properly...
 
Old 05-20-2010, 01:30 PM   #15
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by Joe of Loath View Post
Now wpa_supplicant and dhclient simply run at boot.
Hi,

I assumed from this that you got it up and running. What are you 'struggling' with?

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
does Debian Lenny/sid support Debian Sarge Binary Installer..? @nthoon Debian 1 06-14-2009 10:47 AM
LXer: How To Upgrade A Debian Etch System (Server & Desktop) To Debian Lenny LXer Syndicated Linux News 0 02-20-2009 04:30 PM
LXer: The Perfect Server - Debian Lenny (Debian 5.0) [ISPConfig 2] LXer Syndicated Linux News 0 02-19-2009 11:00 AM
Reboot of Debian Lenny now Windows PCs cannot see Debian. sr_25 Debian 3 02-14-2009 02:03 PM
WPA in Debian h2gofast Debian 2 08-19-2005 10:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration