DIY Wifi Pineapple with TP-link MR3020

DIY Wifi Pineapple with TP-link MR3020

Hardware:

  1. TP-LINK TL-MR3020
  2. USB flash drive of minimum 8GB space

Software:

  1. Ubuntu 15.10 (VirtualBox)
  2. OpenWRT Attitude Adjustment ar71xx-generic-tl-mr3020-v1-squashfs-factory
  3. Wifi Pineapple MK4 2.8.1 / MK5 2.2.0 / MK5 2.4.0

Step 1: Install OpenWRT


  • Download OpenWRT firmware from its website
    1. By the time of making this instruction, the latest openWRT edition is Chaos Calmer 15.05. I tried with Barrier Breaker 14.07 too. But the issue is that those later versions take more disk space. And there is no way to unleash them. TP-LINK MR3020 only has 4MB disk space. The only success i have so far is with Attitude Adjustment 12.09.
    2. Make sure download the correct version
      • fresh installation: ar71xx — generic — tl-mr3020-v1-squashfs-factory.bin
      • upgrade from previous version: ar71xx — generic — tl-mr3020-v1-squashfs- sysupgrade.bin
  • Connect MR3020 to host computer via ethernet cable
    1. Default admin interface is at 192.168.0.254
    2. Username: admin Password: admin
    1. Go to System Tools —> Firmware Upgrade —> Browse and choose the openWRT bin file
  • Click Upgrade button
    1. Upgrade will take about 3 mins.
    2. Device will reboot after upgrade is completed
    3. After device reboots, the IP address for admin interface is at 192.168.1.1
    4. It might be needed to configure host machine’s IP address to be static
      • IP address: 192.168.1.10
      • Subnet Mask: 255.255.255.0
      • Gateway: 192.168.1.1
  • Go to 192.168.1.1
    1. Change password: System —> Administration
    2. Change timezone: System —> System
    3. Enable wireless: Network —> Wifi
    4. Enable DHCP: Network —> Interfaces —> Edit —> DHCP Client —> Switch Protocol
      • The process will take some time and afterwards the device might stop to respond. Just disconnect the device and go to next step

Step 2Configure OpenWRT


  • Connect MR3020 to a router via ethernet cable
    1. After the LEDs on MR3020 stop blinking, it’s almost ready. Use NMAP or other tools to find out the IP address of the device, e.g. 192.168.0.6
  • SSH into MR3020
    1. ssh root@192.168.0.6 or ssh 192.168.0.6 -lroot
  • Install following packages for later usb connection
    1. opkg update
    2. opkg install kmod-usb-storage
    3. opkg install kmod-fs-ext4
    4. opkg install block-mount
    5. opkg list-installed might be helpful to figure out if the system already has those packages
  • Format the USB flash drive
    1. 2GB for swap (sda1)
    2. 6GB for ext4 (sda2)
  • Insert the USB to MR3020 and execute following commands
    1. mkdir -p /mnt/sda2
    2. mount /dev/sda2 /mnt/sda2
    3. mkdir -p /tmp/cproot
    4. mount –bind / /tmp/cproot
    5. tar -C /tmp/cproot -cvf – . | tar -C /mnt/sda2 -xf –
    6. umount /tmp/cproot
    7. umount /mnt/sda2
  • Enable and start stab
    1. /etc/init.d/fstab enable
    2. /etc/init.d/fstab start
    3. Edit /etc/config/fstab (hint: use vi/nano)
    4. Change the content to match content of file ‘fstab’ included within the same folder
  • Reboot after editing the file
    1. reboot
    2. mount (check if the usb is mounted)
    3. df (check if the usb is mounted)
  • Should anything go wrong, there is a failsafe mode for openWRT where you can flash new firmware, reset settings
    1. Google it to find out
    2. Or go to https://wiki.openwrt.org/doc/howto/generic.failsafe if the link is still active

Step 3Back Up USB drive


  • cd ~/Desktop
  • mkdir mr3020
  • sudo cp -R /media/(UUID of the USB)/* ~/Desktop/mr3020
  • sudo cp -R ~/Desktop/mr3020/lib ~/Desktop/mr3020/lib-original
  • To find UUID of the USB
    1. sudo blkid
  • A copy of mr3020 folder is included within the same folder

Step 4Install PineApple Firmware


  • Download Wifi Pineapple firmware from it’s website
    1. By the time of making this instruction, the latest Wifi Pineapple edition is MK5 2.4.0
    2. MK5 2.4.0 / MK5 2.2.0 / MK4 2.8.1 has been proven to work well with MR3020
  • Extract from firmware file
    1. Option One: Unsquashfs
      1. sudo apt-get install squashfs-tools
      2. unsquashfs upgrade-4.0.bin (name of the pineapple bin file)
      3. cd squashfs-root
    2. Option Two: Firmware-mod-kit
      1. To use FMK, there are subversion clients need to be installed
        • standard Linux developments tools(gcc, make, etc); python magic module; zlib and lzma development packages
        • sudo apt-get install git build-essential zlib1g-dev liblzma-dev python-magic
      2. cd ~/Desktop
      3. wget https://firmware-mod-kit.googlecode.com/files/fmk_099.tar.gz
      4. tar -zxvf fmk_099.tar.gz
      5. cd /fmk
      6. chmod +x extract-firmware.sh
      7. sudo ./extract-firmware.sh ~/Desktop/upgrade-4.0.bin (name of the pineapple bin file)
      8. cd fmk/rootfs
    3. Option Three: Binwalk
      1. Install Binwalk (Binwalk comes with FMK but just in case you OS doesn’t have it, google is your friend!)
      2. sudo binwalk -e ~/Desktop/upgrade-2.4.0.bin(name of the pineapple bin file)
  • Copy rootfs/squashfs-root to USB flash drive
    1. sudo cp -R bin/* /media/(UUID of USB)/bin/
    2. sudo cp -R sbin/* /media/(UUID of USB)/sbin/
    3. sudo cp -R usr/* /media/(UUID of USB)/usr/
    4. sudo cp -R etc/* /media/(UUID of USB)/etc/
    5. sudo cp -R www/* /media/(UUID of USB)/www/
    6. sudo cp -R pineapple /media/(UUID of USB)/
    7. sudo cp -R lib/firmware/* /media/(UUID of USB)/lib/firmware/
    8. sudo cp lib/* /media/(UUID of USB)/lib/
    9. sudo cp lib/wifi/* /media/(UUID of USB)/lib/wifi/
    10. sudo cp ~/Desktop/mr3020/etc/config/fstab /media/(UUID of USB)/etc/config/
    11. sudo cp ~/Desktop/mr3020/etc/passwd /media/(UUID of USB)/etc/
    12. sudo cp ~/Desktop/mr3020/etc/shadow /media/(UUID of USB)/etc/
    13. sudo cp -R ~/Desktop/mr3020/lib-original /media/(UUID of USB)/
  • Disconnect USB from host and plug it into MR3020
  • Configure /etc/config/network
    1. Change the gateway IP from 172.16.42.1 to 172.16.42.42
    2. Change the DNS IP to 8.8.8.8

Step 5Fire It UP!


  • Wifi Pineapple is designed to share the internet connection from the existing network to create a new Wifi blackhole. Therefore, it is necessary that the host needs to have at least 2 NICs: one connects to normal network to provide internet access, the other one connects to Wifi Pineapple via ethernet cable to share internet connection
  • For the interface that is connected to Wifi Pineapple, configure it to have static IP address
    1. IP address: 172.16.42.42
    2. Subnet Make: 255.255.255.0
    3. Default Route: 172.16.42.1
  • Download wp4.sh(for MK4)/wp5.sh(for MK5) file from wifipineapple website
  • chmod +x wp5.sh
  • sudo ./wp5.sh
  • Once script finished, go to 172.16.42.1:1471 to access the web interface of wifipineapple.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s