How To - Step By Step Installation of JunOS on GNS3 [Part 2]

Posted by Ahsan Tasneem | 10:24 PM | , , , , , , , , , , , , , , , , | 3 comments »

FreeBSD installation

Now that we have qemu installed, we can create the image for installing FreeBSD. Run this command to create it and allocate 4 GB:
qemu-img create -f qcow2 olive-base.img 4G
Launch Qemu to install FreeBSD on the image:
qemu -m 256 -hda olive-base.img -cdrom 4.11-RELEASE-i386-miniinst.iso \
-boot d -localtime
Qemu window will pop up (remember, by default press CTRL + ALT to release the cursor in Qemu):


Skip Kernel configuration:
Once Qemu has booted the FreeBSD installation image, you can select standard installation:
When you see the FDISK Partition Editor, press A to allocate the entire disk for FreeBSD and then Q to confirm:
Select “install a standard MBR” and when you see the FreeBSD Disklabel editor, press C to create the following partitions:

ad0s1a /               1024M
 ad0s1b swap            1024M
 ad0s1e /config         12M
 ad0s1f /var            rest

Choose “User” distribution type and answer no for the question “Would you like to install the FreeBSD ports collection?”. Exit the menu and install from a FreeBSD CD/DVD:
Wait until all the files are installed in your image:
Once the files are copied, the installer program will ask you many user confirmation questions (Ethernet/SLIP config, gateway, inetd, FTP, NFS, security, console, linux compatibility, set time, etc). Just answer no for each of them. You will also be asked to enter a root password, just do and remember it. Now you should see the starting menu of the FreeBSD installer, exit by choosing X Exit Install. While FreeBSD CD is rebooting, quit Qemu by by pressing Ctrl-Alt-2, then type: quit.

JunOS installation

Now it’s time to install JunOS our FreeBSD image. I used JunOS 8.5R1.14 but your are free to try other versions even if it is usually recommended to have a version less than 8.5. Boot the image and attach a Intel e1000 virtual network card to Qemu:
qemu -m 256 -hda olive-base.img -boot c -localtime \
-net nic,macaddr=00:aa:00:60:01:01,model=e1000 -net user
FreeBSD should start and after login with the root password, you are ready to enter commands:
Ensure you get an IP address and find out what is your default gateway IP address. Ping it just to be sure it’s working:
dhclient em0
netstat -r
You can use FTP or SCP (or any other way you may think about) to download JunOS in FreeBSD. Here I chose to use SCP. On Mac OS X, don’t forget to activate “Remote login” in System Preferences -> Sharing.
scp user@ /var/tmp
The jinstall file after 7.4 version has a binary called checkpic. This binary will fail and the image cannot be installed. Replacing this binary with /usr/bin/true fixes the issue. Also, it is needed to recalculate MD5 and SHA1 checksums before archiving them back. Finally, you can install JunOS with pkg_add.
cd /var/tmp
mkdir jinst-signed
cd jinst-signed
tar zxvf ../jinstall-8.5R1.14-domestic-signed.tgz
mkdir jinst
cd jinst
tar zxvf ../jinstall-8.5R1.14-domestic.tgz
mkdir pkgtools
cd pkgtools
tar zxvf ../pkgtools.tgz
cd bin
cp /usr/bin/true ./checkpic
cd ..
tar zcvf ../pkgtools.tgz *
cd ..
rm -rf pkgtools
md5 -q  jinstall-8.5R1.14-domestic-signed.tgz >
openssh sha1 jinstall-8.5R1.14-domestic-signed.tgz >
tar zcfv /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz *
pkg_add -f /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz

Once the jinstall package installed, you can stop FreeBSD by using the halt command and then Qemu by pressing Ctrl-Alt-2, then type: quit. The jinstall above really just installed a bootstrap environment so you need to boot up FreeBSD one more time to finish the installation (depending on your version). If you just restarted your guest above you will notice that you will get no output on your screen. This is because a real Juniper router has no VGA out and redirects everything to the serial port. No worries for us since QEMU will redirect the serial port to either stdio or a telnet port. To do so, launch Qemu with the stdio parameter:
qemu -m 256 -hda olive-base.img -boot c -localtime -nographic -serial stdio
On Mac OS X -nographic is not understand, so just ignore the Qemu window and look at your terminal.
Wait while the bootstrap process completes. The virtual olive will reboot itself automatically and nothing is needed. At the end of this process we will be sitting at a login prompt. Login as root and issue the halt command (CTRL + L if you do not see the prompt) and kill your Qemu proccess.
On Mac OS X, my terminal was kind of “broken”. To fix this, issue the reset command in your terminal.

Related Articles


  1. Anonymous // February 23, 2012 at 9:36 AM  

    I am trying your guide on mac os lion. when I try to install freebsd from iso all get is black windows that close after 3 seconds. the error i' m getting is : segmentation faillure 11
    can you please help me.

  2. zibou76 // February 23, 2012 at 9:06 PM  

    i'm trying your guide on mac os lion 10.7.3 and when i try to install freebsd i get the blanck window for 3 second then ai have the error : segmentation error : 11

    please help me.

  3. adam // March 8, 2012 at 9:36 PM  

    I'm trying to run:
    pkg_add -f /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz

    and getting:
    pkg_add: find_play_pen: can't find enough temporary space to extract the files, please set your PKG_TMPDIR environment variable to a location with at least 191524360 bytes free.

    I tried removing everything out of the /var/tmp aside from the domestic-olive and the signed files but still not enough space...

    df -h showing only 1.4G available in the /var.

    not sure what to do here aside from start over and make the original qemu image maybe 5G instead of 4? hope there is an easier way it took forever to get this far lol.

Related Posts Plugin for WordPress, Blogger...