HOWTO: Update Linksys PAP2 Firmware Without Windows

pap2t

UPDATE APR 21 2010: There’s an even easier way of doing this.

I finally got my Linksys PAP2T VoIP adapter yesterday. As is par for the course, the firmware was out of date. What wasn’t par for the course is that I had no way to get the firmware to the adapter. The Linksys PAP2T doesn’t offer the standard check-for-update or upload-firmware interface. It uses an upgrade rule that expects to find a TFTP or web server. Linksys also provides a Windows executable that will upload the firmware without you having to fiddle with anything.

The Windows option didn’t go well.

  • On first go, the dialog box that appeared while waiting for the adapter to connect reminded me that the adapter wasn’t going to be able to connect if there was a NAT in the way. Oops. The adapter was on the external WEP network. The computer was on the internal WAP network.
  • After moving the adapter inside the WAP network, I then realized that I was running Windows 2000 inside a VM in Linux, and that the default networking setup in the VM was to provide a NAT to the guest OS.
  • I tried using my Vista laptop. Now the Linksys-provided software couldn’t even find the adapter, even with Windows Firewall turned off. GO VISTA! And my desktop currently had Windows 7 Beta instead of Windows XP. GREAT!
  • I then researched using a TUN/TAP interface for the Linux VM that was hosting Windows 2000. Never mind that the Qemu Launcher GUI application silently failed when I hit Launch and I had to run qemu-launcher from the terminal to see any error messages. After much fiddling, I couldn’t get TUN/TAP to actually work.

I had one option left: actually set up a TFTP or Web server. I already had a web server set up which would have made things so much easier. But I didn’t find out about that option until I went to write this article. For that, I want to punch somebody in the face. Seriously, I could have cut an hour out of this nonsense. But it’s not all-for-nothing. Most people don’t have a web server. It’s more likely that they might have a web site, but still rather unlikely. If you only have the option to set up your own web or tftp server, setting up a tftp server is a lot less intensive on resources, from download to disk space to CPU and memory usage.

Thanks to this page I got the tftp set up on my main desktop. And I assume that the way this ends up being set up, the tftp server isn’t always going to be on since using inetd is disabled. Below is a script based on the directions on that page. You can copy and paste the code to run it, as long as you run this line first:

sudo su

Yes, that opens up a “root terminal” in which you can do all kinds of nasty things to your computer. In this case it’s only used so you don’t have to append sudo to every line, and the code will automatically exit you out of that root terminal and back into your own, safer terminal.

aptitude install atftpd
mv /etc/default/atftpd /etc/default/atftpd.bak
echo USE_INETD=false >> /etc/default/atftpd
echo OPTIONS=”–daemon –port 69 –tftpd-timeout 300 –retry-timeout 5 –mcast-port 1758 –mcast-addr 239.239.239.0-255 –mcast-ttl 1 –maxthread 100 –verbose=5 /tftpboot” >> /etc/default/atftpd
mkdir /tftpboot
chmod -R 777 /tftpboot
chown -R nobody /tftpboot
/etc/init.d/inetd restart
/etc/init.d/atftpd start
exit

Next I had to log into my PAP2 adapter, click on Advanced View, click on Provisioning, and change a couple of things in the Firmware Upgrade section.

Upgrade enable: yes
Upgrade rule: (<5.1.6)? tftp://[host]/pap2t-5-1-6.bin

Change [host] to the IP address of the computer running the tftp server. You can also use a web server and change the protocol from tftp to http. If you have a web site in which you can upload and fetch binary files, you can use a domain name instead of an IP address. Some hosting services may put a cap on the size of files they will host. The firmware binary is 719KB.

The latest firmware for the PAP2 is version 5.1.6 as of the writing of this article. You can change 5.1.6 to whatever the latest firmware version is if Linksys produces later version. The (<5.1.6)? restricts downloading of new firmware only when the current firmware is less that 5.1.6. Do not use a static address for the upgrade rule! Yes, simply using a straight URL works, but the PAP2 is designed for automated updating of it firmware. If you just put a URL pointing to a file, it will continually attempt download and install that firmware. Even when you shut off your TFTP or Web server. If you’re using a web hosting provider, this is a good way to reach your transfer cap. Yeah, it takes 1,458 downloads of this file to reach 1GB. That can almost be achieved in one day if the adapter attempts a download once every minute (1,440 downloads). Yes, web hosting transfer caps are usually huge, but it’s stuff like this that can push you over the edge if you’re actually running a somewhat-popular site. You might also have to deal with transfer caps from your ISP.


UPDATE APR 21 2010: Cisco has long since bought out Linksys (that move was already made before I wrote this article) but it seems Cisco is on the move to phase out the Linksys brand. Finding the firmware was never easy under Linksys, but it was doable. Good luck finding it now without Google.

Official Cisco PAP2T-NA Firmware Download
My Own Dropbox Mirror (bin file only)

You’ll also notice from the comments that there’s a shortcut for upgrading the router without touching the upgrade rules — “http://%5BPAP2T-IP%5D/admin/upgrade?&#8221; is the URL. Append another URL to the bin file (like my mirror above) and you’re all set.