Press "Enter" to skip to content

Tag: juniper ftp image upload

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 10.1.1.1
Connected to 10.1.1.1.
Name (10.1.1.1:root): test
331 Password required for test
Password:
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
root@alcatron-switch:RE:0%

Now we can see the image has been downloaded as its in the directory when typing ls.
root@alcatron-switch:RE:0% ls
.snap
ex_autod_config
ex_autod_rollback_cfg
gres-tp
if-rtsdb
jinstall-ex-2200-12.3R1.7-domestic-signed.tgz
krt_gencfg_filter.txt
rtsdb
vi.recover

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.

1 Comment