Step By Step Guide To Install JUNOS on GNS3 [Part 2][Updated]

Posted by Ahsan Tasneem | 11:48 AM | , , , , | 0 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:
Step By Step Guide To Install JUNOS on GNS3 [Part 1][Updated]
Step By Step Guide To Install JUNOS on GNS3 [Part 3][Updated]
[Video] Step By Step Guide To Install JunOS on GNS3


Related Posts Plugin for WordPress, Blogger...