Press "Enter" to skip to content

Alternate FTP method to upload JunOS image to Juniper switch

I have had some issues getting the ftp command on a Juniper switch to download a new JunOS image from a FTP server. Basically I would initiate this command:

request system software add ftp://test:[email protected]/jinstall-ex-2200-12.3R1.7-domestic-signed.tgz      

and then I would get this in return

Checking pending install on fpc0
Fetching package…
error: File-fetch failed
error: Couldn’t retrieve package ftp://test:[email protected]/jinstall-ex-2200-12.3R1.7-domestic-signed.tgz

And after that I was basically stuck and had no idea what else to do to resolve it and how to pull down this image. Then I knew the underlying OS running on the switch is freebsd linux and this is shows when the switch first boots up. When the switch boots you get into the command line 0% which allows you to perform linux type commands, and this includes using the ftp package, only when you type “cli” you get into JunOS.

So with that in mind here is my attempt to update the image via FTP in 0% mode. You must make sure to type in “binary” to transfer the images in binary mode. I have used /var/tmp on the switch since that had most amount of space.

root@alcatron-switch:RE:0% cd /var/tmp

root@alcatron-switch:RE:0% ftp
Connected to
Name ( test
331 Password required for test
230 Logged on
Remote system type is UNIX.
ftp> binary
200 Type set to I
ftp> mget jinstall-ex-2200-12.3R1.7-domestic-signed.tgz
mget jinstall-ex-2200-12.3R1.7-domestic-signed.tgz?
200 Port command successful
150 Opening data channel for file transfer.
100% |**************************************************| 96491 KB    00:00 ETA
226 Transfer OK
98807485 bytes received in 130.93 seconds (736.97 KB/s)
ftp> quit
221 Goodbye

Now we can see the image has been downloaded as its in the directory when typing ls.
root@alcatron-switch:RE:0% ls

Then to load the image to the switch simple type:

root@alcatron-switch:RE:0% cli
root@alcatron-switch>request system software add validate /var/tmp/jinstall-ex-2200-12.3R1.7-domestic-signed.tgz
root@alcatron-switch>request system reboot

I hope this has been been useful to someone as it has to me, i have no idea why the ftp method worked when outside the JunOS cli but inside JunOS it failed with an error.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.