# Connections with a USB wireless adapter

## NathanZachary

Hello all,

I recently purchased an Alfa AWUS036NHA, which utilises the Atheros AR9271 chipset.  I have the ath9k_htc module available in my kernel, and have modprobed it.  I have also placed the newest version (1.3, as of writing) of the firmware in /lib/firmware.  My machine recognises the adapter, and many APs are shown in both wicd and in the output of iwlist wlan1 scan.  However, when attempting to connect to any AP, it fails to obtain an IP address (even when testing it with my own network).  It seems like dhcpcd is not able to associate with the APs.  Does anyone have suggestions as to troubleshooting tactics?

Thank you preemptively.

Cheers,

Nathan Zachary

----------

## chithanh

What output do you get if you stop wicd and run wpa_supplicant from the shell?

----------

## NathanZachary

Here is some information from the wicd log, under various scenarios:

1.  Trying to connect to an open network:

```

tail -f /var/log/wicd/wicd.log

2011/07/26 08:59:23 :: Running DHCP with hostname netbook

2011/07/26 08:59:23 :: /sbin/dhcpcd wlan1 -h netbook 

2011/07/26 08:59:23 :: dhcpcd[4108]: version 5.2.12 starting

2011/07/26 08:59:23 :: 

2011/07/26 08:59:24 :: dhcpcd[4108]: wlan1: waiting for carrier

2011/07/26 08:59:24 :: 

2011/07/26 08:59:25 :: iwconfig wlan1

2011/07/26 08:59:28 :: iwconfig wlan1

2011/07/26 08:59:30 :: iwconfig wlan1

2011/07/26 08:59:33 :: iwconfig wlan1

2011/07/26 08:59:35 :: iwconfig wlan1

2011/07/26 08:59:37 :: iwconfig wlan1

2011/07/26 08:59:40 :: iwconfig wlan1

2011/07/26 08:59:42 :: iwconfig wlan1

2011/07/26 08:59:45 :: iwconfig wlan1

2011/07/26 08:59:47 :: iwconfig wlan1

2011/07/26 08:59:49 :: iwconfig wlan1

2011/07/26 08:59:52 :: iwconfig wlan1

2011/07/26 08:59:54 :: dhcpcd[4108]: timed out

2011/07/26 08:59:54 :: 

2011/07/26 08:59:54 :: DHCP connection failed

2011/07/26 08:59:54 :: iwconfig wlan1

2011/07/26 08:59:57 :: iwconfig wlan1

2011/07/26 08:59:59 :: iwconfig wlan1

2011/07/26 09:00:01 :: iwconfig wlan1

2011/07/26 09:00:02 :: exiting connection thread

2011/07/26 09:00:02 :: Sending connection attempt result dhcp_failed

2011/07/26 09:00:02 :: ifconfig eth0

2011/07/26 09:00:02 :: ifconfig wlan1

2011/07/26 09:00:02 :: Forced disconnect on

2011/07/26 09:00:02 :: /sbin/dhcpcd -k wlan1

2011/07/26 09:00:02 :: ifconfig wlan1 0.0.0.0 

2011/07/26 09:00:02 :: /sbin/route del dev wlan1

2011/07/26 09:00:02 :: ifconfig wlan1 down

2011/07/26 09:00:02 :: ifconfig wlan1 up

2011/07/26 09:00:02 :: wpa_cli -i wlan1 terminate

2011/07/26 09:00:02 :: /sbin/dhcpcd -k eth0

2011/07/26 09:00:02 :: ifconfig eth0 0.0.0.0 

2011/07/26 09:00:02 :: /sbin/route del dev eth0

2011/07/26 09:00:02 :: ifconfig eth0 down

2011/07/26 09:00:02 :: ifconfig eth0 up

2011/07/26 09:00:04 :: ifconfig eth0

2011/07/26 09:00:04 :: ifconfig wlan1

```

2.  Trying to connect to WPA2 network with passphrase:

```

tail -f /var/log/wicd/wicd.log

2011/07/26 09:02:06 :: iwconfig wlan1

2011/07/26 09:02:06 :: enctype is wpa

2011/07/26 09:02:06 :: Generating psk...

2011/07/26 09:02:06 :: ['/usr/bin/wpa_passphrase', '$REMOVED', '$REMOVED']

2011/07/26 09:02:07 :: Attempting to authenticate...

2011/07/26 09:02:07 :: ['wpa_supplicant', '-B', '-i', 'wlan1', '-c', '/var/lib/wicd/configurations/0019e332fd68', '-D', 'wext']

2011/07/26 09:02:07 :: ['iwconfig', 'wlan1', 'essid', '--', '$REMOVED']

2011/07/26 09:02:07 :: iwconfig wlan1 channel 11

2011/07/26 09:02:07 :: iwconfig wlan1 ap $REMOVED

2011/07/26 09:02:07 :: WPA_CLI RESULT IS DISCONNECTED

2011/07/26 09:02:08 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:08 :: iwconfig wlan1

2011/07/26 09:02:09 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:10 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:11 :: iwconfig wlan1

2011/07/26 09:02:11 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:12 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:13 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:13 :: iwconfig wlan1

2011/07/26 09:02:14 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:15 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:15 :: iwconfig wlan1

2011/07/26 09:02:16 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:17 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:17 :: iwconfig wlan1

2011/07/26 09:02:18 :: WPA_CLI RESULT IS SCANNING

2011/07/26 09:02:19 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:19 :: iwconfig wlan1

2011/07/26 09:02:20 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:21 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:22 :: iwconfig wlan1

2011/07/26 09:02:22 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:23 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:24 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:24 :: iwconfig wlan1

2011/07/26 09:02:25 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:26 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:26 :: iwconfig wlan1

2011/07/26 09:02:27 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:28 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:29 :: iwconfig wlan1

2011/07/26 09:02:29 :: WPA_CLI RESULT IS SCANNING

2011/07/26 09:02:30 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:31 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:31 :: iwconfig wlan1

2011/07/26 09:02:32 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:33 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:33 :: iwconfig wlan1

2011/07/26 09:02:34 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:35 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:35 :: iwconfig wlan1

2011/07/26 09:02:36 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:37 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:38 :: iwconfig wlan1

2011/07/26 09:02:38 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:39 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:40 :: WPA_CLI RESULT IS SCANNING

2011/07/26 09:02:40 :: iwconfig wlan1

2011/07/26 09:02:41 :: WPA_CLI RESULT IS ASSOCIATING

2011/07/26 09:02:42 :: wpa_supplicant authentication may have failed.

2011/07/26 09:02:42 :: connect result is Failed

2011/07/26 09:02:42 :: exiting connection thread

2011/07/26 09:02:42 :: Sending connection attempt result bad_pass

2011/07/26 09:02:42 :: ifconfig eth0

2011/07/26 09:02:42 :: ifconfig wlan1

2011/07/26 09:02:42 :: Forced disconnect on

2011/07/26 09:02:42 :: iwconfig wlan1

2011/07/26 09:02:42 :: /sbin/dhcpcd -k wlan1

2011/07/26 09:02:42 :: ifconfig wlan1 0.0.0.0 

2011/07/26 09:02:42 :: /sbin/route del dev wlan1

2011/07/26 09:02:42 :: ifconfig wlan1 down

2011/07/26 09:02:42 :: ifconfig wlan1 up

2011/07/26 09:02:43 :: wpa_cli -i wlan1 terminate

2011/07/26 09:02:43 :: /sbin/dhcpcd -k eth0

2011/07/26 09:02:43 :: ifconfig eth0 0.0.0.0 

2011/07/26 09:02:43 :: /sbin/route del dev eth0

2011/07/26 09:02:43 :: ifconfig eth0 down

2011/07/26 09:02:43 :: ifconfig eth0 up

2011/07/26 09:02:45 :: ifconfig eth0

2011/07/26 09:02:45 :: ifconfig wlan1

```

However, that same password works when using my internal wireless NIC.  When I try to run wpa_supplicant manually, it doesn't associate, and I can't seem to find a log for it, even though I manually added the log directive to the dbus service:

```

cat /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service 

[D-BUS Service]

Name=fi.epitest.hostap.WPASupplicant

Exec=/usr/sbin/wpa_supplicant -u -f /var/log/wpa_supplicant.log

User=root

```

Thanks again,

Nathan Zachary

----------

## krinn

 *NathanZachary wrote:*   

> 
> 
> However, that same password works when using my internal wireless NIC.

 

Are you sure you're not shooting the wrong person ?

If it work with another interface, blame the drivers, not dhcpcd no ?

----------

## NathanZachary

You may be entirely correct.  I have not had any luck with long-range USB wireless adapters in Linux.  I purchased this particular model because it has an Atheros chipset.  A friend of mine fought with getting another Alfa USB wireless adapter to work, but it was an RTL chipset.  Any suggestions as to how I might get this adapter to work, or even better, a long-range adapter that WILL work?

Cheers,

Nathan Zachary

----------

## krinn

sadly not, as i don't have any wireless, i'm not aware of anything related to them, if i was i would have suggest a correct one to try. But i was thinking my comment might put you at least to the right direction for a solve.

But i'm sure some others users could tell you an adapter that would works flawlessly.

hihi, i will then answer : the one from your friend (i'm captain obivious)

----------

## NathanZachary

Actually, the one my friend purchased doesn't work either.  He finally gave up after months of toying with it.  It goes into monitor mode just fine, and will even inject packets without problem, but it refuses to connect to a network.

----------

## krinn

if in doubt for case like that (new material and new driver, need new handling from you), easiest is still fire up a livecd with plenty (for your case wireless) devices support and see if the device can work as-is.

This will gave you a real clue of what is going on: it's your fault and you need to tickle the drivers/gentoo/anything a bit more, or the device simply doesn't work as expect so problem is more coming from device/drivers... anything but not something that would be easy to track & easy to fix.

If i understood your real problem is that you need a wireless, but not the "standard" one, but one with a more strengh signal to get farer right ?

I'm not aware such device exist, if it's a bit specific (professional usage) this might explain why no user has come yet to gave you a name.

Or maybe the device doesn't exist, i've read some tests times ago about a common french router from a provider here, from version 4 to version 5 (or something like that), the router itself doesn't change or add new speed to its wireless, but its new version have a weaker signal than the previous one.

I think you should be looking for a more well know wireless builder that aim at quality or google for tests case about wireless strengh to get a more accurate clue about what device would fit your specific need.

Sometimes simpler solve exist we don't also think about at first, if the device doesn't have enough strengh to drive the signal at Xm maybe you can just plug it to a cpl to let the device goes closer to its target (lmao except if you're trying to cross a river)

----------

## Gusar

All I can give you is something not very helpful - a success story. I have a TP-LINK usb wireless adapter with the same Atheros chip, so same driver - ath9k_htc. And well, it works.

----------

