søndag 27. juli 2014

Upgrading JunOS and the CompactFlash card on a Juniper J4350

I recently bought a second-hand Juniper J4350 router to play around with and start learning JunOS. The router arrived with a 256MB CompactFlash card and JunOS version 8.2R1.7. That’s a pretty old JunOS version (from 2007 or so), so I wanted to upgrade it before I did anything else with the router. Turned out to be a little tricker than I had expected.

First of all, Juniper won’t let you download any software for a device unless you have a valid service contract for it. This is in no way an unusual policy, Cisco does it too and HP seems to be moving in the same direction. The companies need their money to keep tinkering with the software, that is understandable, but it’s pretty annoying when you’re just using a device for testing and learning purposes. Those service contracts tend to be somewhat expensive, so unless you have a lot of disposable income you either have to know someone with a valid service contract or get the software from a filesharing site. (I'm not sure about the legality of things if you go with the latter option, so make sure to comply with all applicable laws in your area!)

After a little research I found that Juniper does not officially support upgrading to a software version that is more than three point releases ahead of the current one. That means quite a lot of interim versions if you want to upgrade from 8.2 to 12.1 the officially supported way. Another option would be to put a JunOS software recovery image on a USB drive, boot the router from that and perform a clean install to the CompactFlash. I decided to try that route first, replacing the original 256MB CompactFlash with a generic 2GB SanDisk SDCFX-2048 HDX 3.12 that I got from a friend (you need at least 1GB CompactFlash to install JunOS from the 12.1 branch).

The software recovery images must be written to a USB drive or CompactFlash card using dd or some other block write tool. Macs and Linux computers should be good to go, but Windows users need to grab dd for Windows or some other program that can write to raw devices. You can also use dd from the FreeBSD prompt on a Juniper router.

I used a software image named “install-media-12.1R7.7-domestic” to create the recovery drive, but I could never make it work properly. The router would boot from the USB drive, prompt me whether I’d like to start the install process and then crash immediately after it began repartitioning the CompactFlash. I tried several different USB drives and wrote the image to the drives both from my Windows desktop (with dd for Windows) and directly from the J4350, but the installer just kept crashing. Could be that I wasn’t using the right image for the J4350 platform, or the image could have been corrupt, or maybe it had something to do with the CompactFlash card. I honestly don’t know.

The solution for me turned out to be the JunOS snapshot command, which you can use to create a bootable snapshot of the running JunOS on a secondary drive. I put the original 256MB CompactFlash back in the router, created a factory default snapshot on a 4GB USB drive, swapped in the 2GB CompactFlash, booted from the USB and made a new factory snapshot on the CompactFlash.

Once I had JunOS running from the 2GB card I began slowly upgrading my way to 12.1X44, copying the upgraded software images to the router via SCP. I didn’t have every third point release from 8.2 up, so I occasionally had to use the “no-validate” parameter to make the upgrade go through. It’s possible that I could have gone directly to from 8.2 to 12.1 with “no-validate”, but I found it best not to risk it. After every successful upgrade I made sure to create a new snapshot to the USB drive so I wouldn’t have to start from scratch if anything went wrong. Several reboots later the router was running 12.1X44. Sweet! Now I just need to learn how to actually use this thing...

2 kommentarer:

  1. Hi, I realize this article is not fresh but I am in a similar situation. I have a j2350 and am having problems getting to the latest/last release of Junos for the j series. When you say 'software images' you mean the .tgz file, correct? I am stuck trying to get to/past the 10.R version. Any info, pointers or help would be appreciated..

    SvarSlett
    Svar
    1. Hi! I mean the .tgz file, yes. Could you elaborate a little on how you go about doing the upgrade, and at which step it fails for you? Any error messages?

      Slett