Jump to content

Network Config Lost On Mk4


Recommended Posts

Ok, so my network config is not really "lost" but I don't seem to have a way back into the device. I was an idiot and actually moved the network file instead of copying it, so its now labeled as network.bak. I did not buy my pineapple at Shmoocon, but maybe it was surplus? Either way, I tried the reset pin and that did not seem to help, unless maybe I was doing it wrong.

Can anyone help? Is my only option to do the console connection? I have a console cable and USB adapter, but I dont have anything that can interface with the pineapple itself.

Link to comment
Share on other sites

This is my biggest fear with the MK4, and one of the reasons we've taken away the ability to directly edit /etc/config/network from the web UI. 99% of the time the device isn't bricked but simply not on the network. With the previous models this wasn't as big a deal since the bootloader, redboot, would listen for a few seconds at boot for a network connection. From there you could reflash easily - just an Ethernet cable and a few commands.

With the MK4 we're using the U-Boot bootloader, which is only accessible via serial. Specifically you'll need a 3.3v USB Serial TTL adapter. I'll post a how-to here shortly and sticky it.

There's a cleanup script that runs every 5 minutes on the 1.0 firmware which periodically cleans log files, frees up ram. I was actually considering putting in a line that would replace the /etc/config/network file with a backup if eth0, eth1 or br-lan didn't show up with an IP. Looking at it now it should most definitely be in the 1.0.1 update.

Link to comment
Share on other sites

Here's a quick flashing guide for the MK4 via serial:

Connect a USB TTL Serial console cable to the pin headers next to the USB port. Set your com program (hyperterminal, minicom, screen, gcom) to use these settings:

115200, 8, N, 1, no hardware flow control, no software flow control

minicom -s

Connect ethernet between the PC and the Pineapple's WAN/LAN port. Set a static IP on the PC of 192.168.2.11 / 255.255.255.0

ifconfig eth0 192.168.2.11 netmask 255.255.255.0 up

Configure a TFTP server (Windows: http://tftpd32.jounin.net/ Linux: http://code.google.com/p/tftpgui/)

Download the factory firmware from http://wifipineapple.com/mk4/factory/kernel.bin and http://wifipineapple.com/mk4/factory/rootfs.bin

wget http://wifipineapple.com/mk4/factory/kernel.bin; wget http://wifipineapple.com/mk4/factory/rootfs.bin

Move the two bin files in your tftproot directory

Power on the pineapple. In your com program you will see:


U-Boot 1.1.4 (Sep 29 2011 - 16:39:41)

AP121-8MB (ar9331) U-boot
DRAM:  32 MB
Top of RAM usable for U-Boot at: 82000000
Reserving 248k for U-Boot at: 81fc0000
Reserving 192k for malloc() at: 81f90000
Reserving 44 Bytes for Board Info at: 81f8ffd4
Reserving 36 Bytes for Global Data at: 81f8ffb0
Reserving 128k for boot params() at: 81f6ffb0
Stack Pointer at: 81f6ff98
Now running in RAM - U-Boot at: 81fc0000
id read 0x100000ff
flash size 8388608, sector count = 128
Flash:  8 MB
In:    serial
Out:   serial
Err:   serial
Net:   ag7240_enet_initialize...
Fetching MAC Address from 0x81feb688
Fetching MAC Address from 0x81feb688
: cfg1 0x5 cfg2 0x7114
eth0: 00:c0:ca:5f:6b:5d
eth0 up
: cfg1 0xf cfg2 0x7214
eth1: 00:c0:ca:5f:6b:5e
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1

Please choose the operation: 
   1: Entr boot command line interface. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).

Press 1 to enter the U-Boot CLI

At the ar7240> prompt issue these commands:

setenv bootargs "board=ALFA console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd"
saveenv
tftp 0x80600000 kernel.bin
erase 0x9f650000 +0x190000
cp.b 0x80600000 0x9f650000 d695a
tftp 0x80600000 rootfs.bin
erase 0x9f050000 +0x600000
cp.b 0x80600000 0x9f050000 23d004
bootm 0x9f650000

Once OpenWRT finishes booting press ENTER to active the console. Issue passwd and set a root password. Next start the ssh service /etc/init.d/dropbear start

Move the Ethernet cable from the WAN/LAN port to the PoE LAN port.

From the PC ping 192.168.2.1 to verify a connection. From here you'll need to SCP over the latest MK4 update from http://wifipineapple.com/mk4/firmware

SCP the latest firmware .bin file to the Pineapple's /tmp/ directory (windows: http://winscp.net/eng/index.php linux: you already have scp)

scp firmware.bin root@192.168.2.1:/tmp/

Once the firmware has been copied to the pineapple's /tmp/ directory you're ready to update the factory firmware to the latest version of the Jasager suite. On the pineapple issue:

sysupgrade -n -v /tmp/firmware.bin

The upgrade process takes 2-3 minutes. When complete the Pineapple will reboot and all will be happy again in the land of the pineapple. Continue with normal usage (ie: change your PC's ethernet interface back to DHCP or static it to 172.16.42.42)

Link to comment
Share on other sites

Thanks for all the help Darren. I will give this a shot once my cable comes in.

I bought this one:

http://microcontrollershop.com/product_info.php?products_id=2728&osCsid=v44mj9hdkmm00af3lgt607k9h4

petertfm - looks like you got a good deal! my cable is probably a bit over priced, but oh well, it's ordered and shipped already.

I've already got dozens of USB to DB9 Serial cables from work lying around. So I'm vividly familiar with serial cables. Can anyone confirm the pinouts of the cable needed? A quick google got me this:

1 : Black : Ground

2 : Brown : CTS (Clear to Send)

3 : Red : Vcc +5V typical (output)

4 : Orange : TTL Transmit Tx (output)

5 : Yellow : TTL Receive Rx (input)

6 : Green : RTS (Request to Send)

7 : ----- : Shield / GND

That seem right to you guys? Thanks very much

telot

Link to comment
Share on other sites

I've already got dozens of USB to DB9 Serial cables from work lying around. So I'm vividly familiar with serial cables. Can anyone confirm the pinouts of the cable needed? A quick google got me this:

1 : Black : Ground

2 : Brown : CTS (Clear to Send)

3 : Red : Vcc +5V typical (output)

4 : Orange : TTL Transmit Tx (output)

5 : Yellow : TTL Receive Rx (input)

6 : Green : RTS (Request to Send)

7 : ----- : Shield / GND

That seem right to you guys? Thanks very much

telot

I think the biggest problem is the 5v, you need 3.3v to connect to the pineapple. If not (as Darren put it) you will end up with a very angry pineapple.

Here is the topic about consoling in:

http://forums.hak5.org/index.php?showtopic=12506

Link to comment
Share on other sites

It's not RS232. It is TTL, you would need a USB to TTL

Roger that - worth a shot but oh well. Thanks guys

telot

Link to comment
Share on other sites

I'm evaluating a bunch of USB console cables and once I find one I'm happy with we'll have it cheap in the HakShop. "Wish I had it at launch" is something I'm getting used to saying.

I guess there is a 3.3v TTL and 5v TTL. Not sure if it will make much of a difference but it may.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...