Isc Posted August 1, 2012 Share Posted August 1, 2012 (edited) The latest firmware the Pineapple now has a fantastic amazing new feature - built in the drivers for various USB wifi chipsets. Primarily the Ath9k driver from what I can tell so far. In order to use this guide you'll need a supported USB wifi dongle and a MKIV Pineapple. I used a TP-Link WN722N (Also works well with reaver). Before you buy a wifi adaptor please google the model number to determine its chipset. Supported USB Wifi Devices: A small list of devices running Ath9K - http://linuxwireless...oducts/external TP-Link WN722N - $22 - http://www.tp-link.c...model=TL-WN722N ALFA AWUS036NHA Assumptions: You'll be connecting to an existing access point that's running WPA2 encryption & you know the password for the network. Your pineapple is running v2.4 or greater. To begin, connect your wifi adaptor to the pineapple and issue the command iwconfig[/CODE]To confirm you adaptor is compatible there should be an entry for wlan1 in the list. wlan0 is the pineapple's internal wifi adaptor.Next you'll need to create your wpa supplicant configuration file. WPA supplicant is the program used to negotiate WPA2 encryption and the configuration file holds your network password.[CODE]vi /etc/wpa_supplicant.conf[/CODE]Press the i key then paste this text in the file, then save the file by typing these characters :wq[CODE]network={ ssid="Your network name here" psk="Your password here"}[/CODE]To save myself from entering the ip forwarding commands each time I put them in a shell script.Create the script file in your home directory and insert the following code. Follow the step above for inserting text into the vi editor.The script makes some assumptions, such as you haven't changed the ip range for the pineapple wireless lan and that the usb wifi adaptor you plugged in is wlan1.The script will also clear any existing iptables, if you have iptables entries you don't want lost remove the -F and -X lines.[CODE]vi ~/wireless_connect.sh[/CODE][CODE]#!/bin/sh#Change the Mac address of the usb wifi to something random.ifconfig wlan1 downmacchanger -A wlan1ifconfig wlan1 up#WPA2 - Let's assume we're going to connect to a WPA2 networkwpa_supplicant -B -D nl80211 -i wlan1 -c /etc/wpa_supplicant.conf#WEP - Uncomment if you want to conect to a WEP network#iwconfig wlan1 mode managed key your_key_here#iwconfig wlan1 essid "your access point name here"#OPEN - Uncomment if you want to conect to a WEP network#iwconfig wlan1 essid "your access point name here"#Setup ipforwarding via iptables.echo 1 > /proc/sys/net/ipv4/ip_forward#Reset iptablesiptables -Fiptables -Xiptables -A FORWARD -o wlan1 -i br-lan -s 172.16.0.0/24 -m conntrack --ctstate NEW -jACCEPTiptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPTiptables -A POSTROUTING -t nat -j MASQUERADE#Wait for 6 seconds to give enough time for association.sleep 6#Grab an ip via DHCPudhcpc -i wlan1[/CODE]Change the permissions of your script so you can execute it.[CODE]chmod +x ~/wireless_connect.sh[/CODE]Execute the script and then if all goes well you'll have internet on the pineapple which can be shared out to clients that connect to the Karma/Pineapple SSID. No more needing a USB 3G dongle.[CODE]cd ~./wireless_connect.sh[/CODE][u][b]Troubleshooting[/b][/u][b]It does not associated with the access point [/b][indent=1]Bummer. Try running the WPA supplicant connection without the -B flag. The -B mode makes it run as a daemon task in the background.[/indent][indent=1]wpa_supplicant -Dnl80211 -iwlan1 -c/etc/wpa_supplicant.conf[/indent][indent=1]Check the errors that are output for a hint as to what's going wrong. If it complains about the wireless driver change the text 'nl80211' (This is the driver that worked for my TP-Link USB stick) to wext.[/indent][b]It does not get an ip via DHCP[/b][indent=1]Did you check that wpa_supplicant could associate with the access point? If it does associate correctly then perhaps there is no DHCP server running on that network. Try setting an ip address manually for the wlan1 adaptor.[/indent][indent=1]ifconfig wlan1 192.168.0.10 255.255.255.0[/indent][b]Karma wont start after running the above steps[/b][indent=1]I had this issue running version 2.4.1. Upgrading to 2.5.0 corrected this issue. Unsure what the cause was, perhaps it was some other development of my own interfering.[/indent][b]How do I test to see if it's working?[/b][indent=1]ping google.comDid it reply with a ping? It's working, if not damn something has gone wrong.[/indent] Edited August 1, 2012 by Isc Quote Link to comment Share on other sites More sharing options...
telot Posted August 1, 2012 Share Posted August 1, 2012 Nice write up Isc! I particularly appreciate how you voice your assumptions to head off the otherwise inevitable clarification questions and even did up a little troubleshooting guide - saves everyone time! Thanks man telot Quote Link to comment Share on other sites More sharing options...
Neworld Posted August 1, 2012 Share Posted August 1, 2012 Does this work with WEP and unsecured connections?? Quote Link to comment Share on other sites More sharing options...
Isc Posted August 1, 2012 Author Share Posted August 1, 2012 (edited) Yep, it'll work with WEP and unsecured connections. To connect to a WEP network you have to use iwconfig and enter the password using that command. In the script you'd replace the line wpa_supplicant -B -Dnl80211 -iwlan1 -c/etc/wpa_supplicant.conf[/CODE][color=#000000]with whatever method you use to connect to your wireless lan.[/color][color=#000000][b]For WEP[/b], r[/color][color=#000000]eplace the wpa_supplicant line with ... and change the '[/color]your_key_here' to your wep key[CODE]iwconfig wlan1 mode managed key your_key_hereiwconfig wlan1 essid "your access point name here"[/CODE][b]For open networks[/b], replace the wep_supplicant line with[CODE]iwconfig wlan1 essid "your access point name here"[/CODE] Edited August 1, 2012 by Isc Quote Link to comment Share on other sites More sharing options...
PineDominator Posted August 1, 2012 Share Posted August 1, 2012 (edited) Thank you so much for shareing:-D I made a mod to the bash script so it works better/quicker #!/bin/shifconfig wlan1 downmacchanger -A wlan1ifconfig wlan1 up#WPA2wpa_supplicant -B -D nl80211 -i wlan1 -c /usb/wpa_supplicant.conf#WEP#iwconfig wlan1 mode managed key your_key_here#iwconfig wlan1 essid "your access point name here"#OPEN#iwconfig wlan1 essid "your access point name here"#Setup ipforwarding via iptables.echo 1 > /proc/sys/net/ipv4/ip_forward#Reset iptablesiptables -Fiptables -Xiptables -A FORWARD -o wlan1 -i br-lan -s 172.16.0.0/24 -m conntrack --ctstate NEW -jACCEPTiptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPTiptables -A POSTROUTING -t nat -j MASQUERADE#Wait for 6 seconds to give enough time for association.sleep 6#Grab an ip via DHCPudhcpc -i wlan1[/CODE]what I changed was I keep my wpa_supplicant.conf in /usb/added ifconfig wlan1 upand sleep 6 before the dhcp processEDIT:added both WEP and OPEN commands, just uncomment and comment out the other:-)added random mac via macchanger -A wlan1Great work Hackling:-D Edited August 1, 2012 by petertfm Quote Link to comment Share on other sites More sharing options...
Isc Posted August 1, 2012 Author Share Posted August 1, 2012 @peterfm - Nice changes! Quote Link to comment Share on other sites More sharing options...
Neworld Posted August 1, 2012 Share Posted August 1, 2012 This is great!! next thing to do is create a module.... Quote Link to comment Share on other sites More sharing options...
PineDominator Posted August 1, 2012 Share Posted August 1, 2012 @peterfm - Nice changes! thanks but all the work is def yours:-) btw you can also access the UI if connected to the same network wlan1 is by say 192.168.1.100/pineapple Quote Link to comment Share on other sites More sharing options...
itsm0ld Posted August 1, 2012 Share Posted August 1, 2012 (edited) I can confirm that this worked out of the box on my MK4 with a TP-LINK TL-WN722N. This thread is an example of an epic win for the new player nice job! EDIT: MK4 running 2.4.1 Karma functions normally. Edited August 1, 2012 by itsm0ld Quote Link to comment Share on other sites More sharing options...
Molotof Posted August 1, 2012 Share Posted August 1, 2012 Isc Thank you for a great method and thanks to petertfm for a nice addition :) Quote Link to comment Share on other sites More sharing options...
Isc Posted August 1, 2012 Author Share Posted August 1, 2012 I plan to make this into a pineapple module within the next few days, maybe over the weekend. Quote Link to comment Share on other sites More sharing options...
Sebkinne Posted August 1, 2012 Share Posted August 1, 2012 I plan to make this into a pineapple module within the next few days, maybe over the weekend. Whistlemaster is already working on one, maybe talk to him about it. We are actually going to include it directly into the firmware under a "Connections UI". That is also nearing completition. Best, Sebkinne Quote Link to comment Share on other sites More sharing options...
PineDominator Posted August 1, 2012 Share Posted August 1, 2012 Whistlemaster is already working on one, maybe talk to him about it. We are actually going to include it directly into the firmware under a "Connections UI". That is also nearing completition. Best, Sebkinne Great:-) Seb is it WM's code that you are planning on including into the firmware? currious Quote Link to comment Share on other sites More sharing options...
durk182 Posted August 1, 2012 Share Posted August 1, 2012 Thank you for the well written instructions. Quote Link to comment Share on other sites More sharing options...
Whistle Master Posted August 2, 2012 Share Posted August 2, 2012 (edited) Whistlemaster is already working on one, maybe talk to him about it. Indeed ;) The module will support different modes (AP, client) and protocols (WPA / WPA2 Personal & Enterprise, WEP), Interface Connection Sharing. It is almost ready. Edited August 2, 2012 by Whistle Master Quote Link to comment Share on other sites More sharing options...
7ncubane Posted August 2, 2012 Share Posted August 2, 2012 I have Mk IV with 2.5.1 firmware. I have Atheros based AWUS036NHA USB wifi adapter which came with Mk IV as a package. I followed your wpa_supplicant script. The card seems to be brought up ok as wlan1, macchanges OK, but the script quits with error "ifconfig: SIOCGIFFLAGS: No such device". After this happens, the adapter is no longer recognized; plugging, unplugging, etc., doesn't help. Only thing that will fix it is reboot. After reboot, the adapter is recognized again, but the same thing happens. I tried AWUS036H adapter I had which works fine with your wpa_supplicant script, but for some reason, randomly drops out after about an hour or so. Then I have to reboot again. Any ideas? Is this a driver issue? Hardware? Quote Link to comment Share on other sites More sharing options...
PineDominator Posted August 2, 2012 Share Posted August 2, 2012 (edited) I have Mk IV with 2.5.1 firmware. I have Atheros based AWUS036NHA USB wifi adapter which came with Mk IV as a package. I followed your wpa_supplicant script. The card seems to be brought up ok as wlan1, macchanges OK, but the script quits with error "ifconfig: SIOCGIFFLAGS: No such device". After this happens, the adapter is no longer recognized; plugging, unplugging, etc., doesn't help. Only thing that will fix it is reboot. After reboot, the adapter is recognized again, but the same thing happens. I tried AWUS036H adapter I had which works fine with your wpa_supplicant script, but for some reason, randomly drops out after about an hour or so. Then I have to reboot again. Any ideas? Is this a driver issue? Hardware? mk4 firmware 2.5.1? I would say a power issue, I have to use a usb powered hub in order to get the NHA to function, there is not enough power in the mk4 usb port for the NHA unless you take the txpower down iwconfig wlan1 txpower 8 Edited August 2, 2012 by petertfm Quote Link to comment Share on other sites More sharing options...
7ncubane Posted August 3, 2012 Share Posted August 3, 2012 oops. 2.4.1. Anyways, I'm trying it with an old low power Hawking adapter with Ralink set. It seems to be working well given lower power consumption. I just ordered a powered usb hub from Amazon so I can try it out with the NHA. Thanks for the info. Quote Link to comment Share on other sites More sharing options...
7ncubane Posted August 4, 2012 Share Posted August 4, 2012 Using powered usb hub with NHA and Sandisk, works great as a relay AND I get to have modules on usb stick. THANKS! Quote Link to comment Share on other sites More sharing options...
TunezNZ Posted August 4, 2012 Share Posted August 4, 2012 (edited) Im having a problem with getting the TP-Link WN722N going. I have mk4 with 2.5, First run with standard script it attempts to get an IP address and then stopped so I removed the -B from the wpa_supplicant line it then returns "wlan1: Failed to initiate AP scan" three times then and stops. Commenting out everything but the wpa_supplicant line gives the same results. This is the output with the normal commenting. root@Pineapple:~# iwconfig wlan1wlan1 IEEE 802.11bgn ESSID:off/anyMode:Managed Access Point: Not-Associated Tx-Power=20 dBmRTS thr:off Fragment thr:offEncryption key:offPower Management:offroot@Pineapple:~# cat ./wireless_connect2.sh#!/bin/sh#Change the Mac address of the usb wifi to something random.ifconfig wlan1 downmacchanger -A wlan1ifconfig wlan1 up#WPA2 - Let's assume we're going to connect to a WPA2 networkwpa_supplicant -D nl80211 -i wlan1 -c /etc/wpa_supplicant.conf#WEP - Uncomment if you want to conect to a WEP network#iwconfig wlan1 mode managed key your_key_here#iwconfig wlan1 essid "your access point name here"#OPEN - Uncomment if you want to conect to a WEP network#iwconfig wlan1 essid "your access point name here"#Setup ipforwarding via iptables.echo 1 > /proc/sys/net/ipv4/ip_forward#Reset iptablesiptables -Fiptables -Xiptables -A FORWARD -o wlan1 -i br-lan -s 172.16.0.0/24 -m conntrack --ctstate NEW -jACCEPTiptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPTiptables -A POSTROUTING -t nat -j MASQUERADE#Wait for 6 seconds to give enough time for association.sleep 6#Grab an ip via DHCPudhcpc -i wlan1root@Pineapple:~# cat /etc/wpa_supplicant.confnetwork={ssid="ssid"psk="password"}[/CODE]Putting in the correct SSID has helped, but now its telling me this.[CODE]root@Pineapple:~# ./wireless_connect2.shCurrent MAC: 00:60:04:b0:90:58 (Computadores Modulares Sa)Faked MAC: 00:c0:c3:40:34:66 (Acuson Computed Sonography)wlan1: Failed to initiate AP scanwlan1: SME: Trying to authenticate with 90:f6:52:48:43:30 (SSID='Mack_2.0' freq=2412 MHz)wlan1: Trying to associate with 90:f6:52:48:43:30 (SSID='Mack_2.0' freq=2412 MHz)wlan1: Associated with 90:f6:52:48:43:30wlan1: WPA: 4-Way Handshake failed - pre-shared key may be incorrectwlan1: CTRL-EVENT-DISCONNECTED bssid=90:f6:52:48:43:30 reason=3wlan1: CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=3wlan1: SME: Trying to authenticate with f8:d1:11:93:c2:3f (SSID='Mack_2.0' freq=2412 MHz)wlan1: Trying to associate with f8:d1:11:93:c2:3f (SSID='Mack_2.0' freq=2412 MHz)wlan1: Associated with f8:d1:11:93:c2:3fwlan1: CTRL-EVENT-DISCONNECTED bssid=f8:d1:11:93:c2:3f reason=3wlan1: CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=3wlan1: SME: Trying to authenticate with 90:f6:52:48:43:30 (SSID='Mack_2.0' freq=2412 MHz)wlan1: Trying to associate with 90:f6:52:48:43:30 (SSID='Mack_2.0' freq=2412 MHz)wlan1: Associated with 90:f6:52:48:43:30wlan1: WPA: 4-Way Handshake failed - pre-shared key may be incorrect[/CODE] Edited August 4, 2012 by TunezNZ Quote Link to comment Share on other sites More sharing options...
TunezNZ Posted August 4, 2012 Share Posted August 4, 2012 (edited) I have got it working now on a different network. I think it has something to-do with having the pineapple connected on the lan connection and trying to join the same network, I find funny things happen when I connect the pineapple up to my lan (With the exit gateway/router 172.16.42.42) such as it stealing all the DHCP clients and setting the pineapple as the default gateway. Edited August 4, 2012 by TunezNZ Quote Link to comment Share on other sites More sharing options...
7ncubane Posted August 9, 2012 Share Posted August 9, 2012 (edited) To TunezNZ - have you tried other wifi cards, dongles, etc.? It could be either driver or hardware issue. In my case, an old Hawking dongle actually works most reliably. Also ... I thought I had all this figured out till ... firmware 2.5. Since I upgraded, the connection seems much less reliable. It takes much longer to get an IP assigned by DHCP from the AP. Also when I ping various IP's to test the connection (signed in as root from the pineapple and as a client going through the pineapple), I get approximately 30-40% packet loss pinging google, yahoo, AND my own gateway. I'm in S. California, but 100-200msec response times from google and yahoo seems way too long. response time for my router @ 192.168.1.254 is about 30-40msec which is WAAAY too long. When I'm signed in directly to the router/AP, the response time is about 1-2msec. (My entire relay set-up is about 5 feet from the AP and I'm about 5 feet from AP and the pineapple. It almost feels like my packets are getting lost and wondering around the inside of the pineapple. Some make it; some don't. Any thoughts or suggestions? PS Any other driver than nl80211 I can try? Edited August 11, 2012 by 7ncubane Quote Link to comment Share on other sites More sharing options...
Geogian Posted September 16, 2012 Share Posted September 16, 2012 This. Is. Fantastic. And it just so happens that I happen to have that exact model of USB dongle already. ;) I got caught up on one thing, though. It's pretty silly, but worth mentioning methinks: make sure you put in the quotes around the SSID and PW fields in the wpa_supplicant.conf. Quote Link to comment Share on other sites More sharing options...
SFisher Posted November 13, 2012 Share Posted November 13, 2012 Hey guys, Is anyone having issues with their card turning off after a period of time? I'm running mark IV 2.7 firmware, a NHA card that came with the pineapple. I have been getting the card to boot up and scan but after a little while the card just turns itself off. This happens with my old alfa card too. Any ideas? Quote Link to comment Share on other sites More sharing options...
PineDominator Posted November 15, 2012 Share Posted November 15, 2012 Hey guys, Is anyone having issues with their card turning off after a period of time? I'm running mark IV 2.7 firmware, a NHA card that came with the pineapple. I have been getting the card to boot up and scan but after a little while the card just turns itself off. This happens with my old alfa card too. Any ideas? Sounds like a power issue, the mk4 can't supply enough amperage to most USB devices. Try a powered hub. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.