Running JunOS under VMWare (updated – again!)

October 3, 2009

Interested in trying out JunOS? Can’t afford to build a real Juniper lab? Sounds like you need some Olives. No, we’re not talking about the green fruit commonly seen in a martini glasses across the nation. Olive is the codename name given to JunOS software running on something other than a Juniper router. It can either run on a PC of similar specifications to a Routing Engine, with no forwarding hardware (or PFE) attached, or inside a Virtual Machine (VM). If you took a Routing Engine out of a Juniper router and booted it in a blade server chassis, it would effectively be an Olive.

This guide is to help you run Olive inside vmware to create a virtual Juniper router lab. You can also extend your lab to dynamips (Cisco Emulation), or other router VMs that you may have. My screenshots will be from VMWare Fusion on Mac OS X, but should work perfectly well, possibly even better (since you’ll be able to setup multiple interfaces) on VMWare Server. At some point, I would like to test using VMWare ESXi as well.

Update: Since ESXi requires SCSI disks, there is no chance (afaik) of getting this working properly…

Software

The first step is obtaining a copy of JunOS. I recommend using 9.4 (jinstall-9.4R1.8-export-signed.tgz) or higher as earlier versions had issues with multicast working properly under vmware. Do not ask for me for copies of JunOS Since JunOS runs top of FreeBSD, you will also need to download the FreeBSD 4.11 mini .iso from the FreeBSD FTP site.

Setting up your Virtual Machine

Our initial settings should be something along the lines of …

  • Disk – IDE 4gb
  • Memory – 512MB (you can reduce later to 128MB (or less ( untested ) ) )
  • Interface – NAT or Shared ( up to you )
  • CD/Optical – Point to the FreeBSD ISO

Installing FreeBSD 4.11

  • Feel free to skip the custom kernel config
  • Standard Install
  • On fdsik screen select a (use entire disk) then q (finish)
  • You can use the default FreeBSD boot manager
  • In the BSD Disk Label Editor, use the following setup.
     ad0s1a     /               512M
     ad0s1b	swap            1024M
     ad0s1e	/config         12M
     ad0s1f	/var            rest
    
  • Next it will ask you which distribution set you wish to install. Go with User, and do not install the ports collection.
  • On the next screen, choose CD as your media for install. It will then ask if you you’re sure you wish to proceed. Choose yes, unless you’re scared.
Post Install Config

After the install, you’ll be taken through some configuration options…

  • Config Ethernet: Yes
  • Select em0
  • Config IPv6: No
  • Config DHCP: Yes
  • Network Gateway: No
  • Config Inetd: No
  • Config Anonymous FTP: No
  • Config NFS Server: No
  • Config NFS Client: No
  • Select Default Security Profile: No
  • Customize System Console: No
  • Set Time Zone: Yes/NoIts really up to you if you want to do this…
  • Enable Linux Binary Compatibility: No
  • Non USB Mouse: No
  • Browse Package Collection: No
  • Add Accounts: Yes
  • Config Menu: No
  • After the post install config, you will be taken back to the sysinstall Main Menu, go ahead and exit / reboot
  • On the first boot, it may hang here for a moment, be patient..

Preparing and Installing JunOS

Ok, now that we have a working FreeBSD installation, we need to copy our jinstall image over using the account we created. Use ifconfig to figure out your DHCP address and scp the file over.. go ahead and put it in /var/tmp
In order to install JunOS, we have to circumvent some things.. Juniper has installed a binary in JunOS packages since version 7.4 called checkpic. This binary will fail during install and and interrupt the process. Extracting the package and replacing this binary with /usr/bin/true and repackaging fixes this issue.

cd /var/tmp
mkdir jinst-signed
cd jinst-signed
tar zxvf ../jinstall-9.4R1.8-export-signed.tgz

mkdir jinst
cd jinst
tar zxvf ../jinstall-8.4R1.8-export.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

tar zcfv /var/tmp/jinstall-9.4R1.8-export-olive.tgz *

Install your new modified jinstall package.

pkg_add -f /var/tmp/jinstall-9.4R1-8-export-olive.tgz

After it has finished, go ahead and issue a normal reboot command. Upon reboot, you may think the VM is hung, but its just fine. It is no longer outputting kernel messages to the screen, behind the scenes the JunOS install is completing and will reboot when finished. You will be able to login in a few minutes.

 

Update – 11/8/2009

VMware Server Users have had some issues with the secondary install (1st reboot after jinstall) hanging on the following line.

ad0: 32768MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33

The simple fix for this is to edit the appropriate VMware configuration file ( whatever.vmx ) and change the line that reads.

scsi0.present = "TRUE"

to

scsi0.present = "FALSE"

Since JunOS has no support for SCSI devices, this prevents it from hanging when one is present. Many thanks to the commenters that suggested this fix.

 

Post Install

To tell the boot loader to send kernel messages to the video console is simple. Just edit the file /boot/loader.conf and change the line that reads….

console="comconsole"

to

console="vidconsole"

 

Conclusion

While this is far from a perfect solution ( at least under VMWare fusion.. ) It works quite well for getting your feet well in the JunOS environment. Once I have a chance to test it under ESXi I will report back with my findings… If you have any issues with getting this setup, feel free to comment below and I’ll try to point you in the right direction.

Also many thanks to everyone from the ineternetwork pro wiki, without their guide on qemu I would’ve been completely lost.

 

 

Related posts

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

{ 1 trackback }

Make Junos Olive (Part I) « EngBatt
January 11, 2010 at 4:31 pm

{ 21 comments… read them below or add one }

MrPaul October 4, 2009 at 11:54 pm

This is the most informative demonstration for Olive I’ve seen yet. Rock on!

Reply

shef October 6, 2009 at 1:20 pm

As I remember, multicast didn't work properly in vmware -> no ldp/ospf/etc.

Reply

Tony October 6, 2009 at 1:25 pm

I was told it should work on 9.5, I only had 9.4 on hand and it works fine. I have a video demonstrating OSPF functionality here –> http://tony.mattke.net/2009/10/04/junos-olive-dem...

Reply

Gil October 20, 2009 at 10:39 pm

Hi Tony
I follow your guide and after the instalation, the VM "freezes" on "BTX loader 1.00 BTX version is 1.02" screen and don't start.
Have you any ideas about this problem?

Thanks

Reply

Tony October 21, 2009 at 1:44 am

Well, it could be a few things. First off, its not going to output the kernel messages to the console when you reboot/during the install after the first reboot. So, unless you gave it enough time, it could of still been installing… Since that is mentioned in the guide, I'll assume its the second issue – The install will fail if it doesn't have enough memory. Thats why my guide recommends an inital config of 512MB of memory. You'll need to start over, or remove your virtual disks and increase the memory. After installing the jinstall file, but before rebooting follow the post install instructions for adding console="vidconsole" to /boot/loader.conf — this will get overwritten during the install process again (on first boot) but it'll at least show you whats going on. And if it does encounter an issue, you'll be able to give me some idea of what is going wrong.. When I first attempted this I had issues with having too little memory.

Reply

Gil October 22, 2009 at 1:47 am

Hi Tony

In the current VM I used 256 MB of memory, so I deleted the VM and create another VM and this time I configured to 512 MB and before of reboot I insert the console="vidconsole" line on the loader.conf

After reboot, the kernel messages appeared, but freezes in the line below:

"ad0: 4096MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33"

I uplodaed the screenshot of VM, see the link below:
http://img35.imageshack.us/i/olive.jpg/

I searched in google for this issue, but I can't found.

Sorry for my bad english, I'm from Brazil.

Thanks

Reply

Tony October 22, 2009 at 2:09 am

That is strange. Just a couple questions.. What version of jinstall are you using? and how long did you leave it there? I would reccomend checking out http://juniper.cluepon.net/index.php/Olive#Use_vi... — a friend on Freenode #cisco thinks it may be an issue with it not spawning an interactive tty

Reply

Temi October 29, 2009 at 10:26 am

i have the same problem as the gy from Brazil it just freezes in the line
ad0: 32768MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33

Have you found any solution to this ?

Thanks

Reply

Tony October 29, 2009 at 1:03 pm

I haven't heard back from him yet regarding the questions I asked..

Reply

Gil November 6, 2009 at 1:08 am

Hi Tony and everybody.

Sorry for my delay to reply your questions.
I used three versions of jinstall: jinstall-7.4R1.7, jinstall-9.3R2.8 and jinstall-9.4R1.8. They all did not work. I suspected that issue could be the scsi because when you create the VM (in 1.0.9 and 2.0.1 versions I tested), previously you are required to select BUS or LSI scsi and only after you can select the IDE disk type and as your tutorial say, scsi don't work.

I will try the Blackbird steps and inform about the tests.

Thanks everybody.

Reply

hansito November 2, 2009 at 10:55 pm

You need to make sure the scsi device is disabled. I had the same issue and it disappeared once I followed the following procedure.

http://www.certbible.org/howto-upgrade-your-vmwar...

Reply

Blackbird November 2, 2009 at 10:17 pm

Hi there Tony and all,

Thanks for this excellent tutorial on how to build an Olive. It has certainly helped me.

This post is for the benefit of Gil and Temi. I myself had an identical problem to you (it froze at the line:
ad0: 32768MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33).

After a lot of experimentation I found that when I edited the *.vmx file associated with the Olive, it contained:

scsi0.present = "TRUE"

so, when I closed the VM first and then replaced the line above with:

scsi0.present = "FALSE"

and then ran the VM, to my surprise it all worked !

Note that after the
ad0: 32768MB <VMware Virtual IDE Hard Drive 00000001> at ata0-master UDMA33)
line appears you will have to wait for a few minutes while the hard disk whirrs away and nothing appears to happen, but eventually it will reboot into the command prompt as described in Tony's article. I didn't need to use the post-install "console" config at all.

Instead of using the Free BSD 4.11 mini ISO, I used the latest version of free BSD 6 (namely 6.4). I downloaded the ISO of this from here: ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.4/ using the top file in the list which is approx. 28MB. Then after installing, I used the initial FreeBSD config screen to automatically ftp to the FreeBSD server and install the other parts of the kernel (it's called something like 'installation of binaries and documentation for kernel developers'). This downloaded approx 50MB of additional files, before the extraction begun.

The reason I used a 6.4 kernel is because Junos 9.x is based on the 6.1 kernel, and I couldn't find a 6.1 anywhere.

Also the Juniper pages state that a compact flash of 1024MB should be used, so I used 1024MB for the VM memory setting.

I used Junos 9.0R1.10 for the install and it's all loaded and appears to work, though not tested multicast yet.

Good luck!

Reply

Tony November 3, 2009 at 6:02 pm

I had heard that 9.x was based on a newer FreeBSD version, I may attempt to use the this newer release when I finally get my VM Server finished. ( Had attmepted to use ESXi but you can't run IDE disks, nor can you run VMware Server under a VMware ESXi host… )

Thanks for this info Blackbird, I hope it really helps these guys out !!

Reply

Gil November 8, 2009 at 2:04 pm

Hi Tony and all.

I do the Blackbird steps and work it, it's exactly the scsi parameter that he mentioned.

Tony, I suggest you put on your tutorial this detail because others may have the same problem (my friend had the same problem).

Thank you all for your help and Tony congratulations for the excellent tutorial.

Reply

BR-Juniper November 19, 2009 at 1:43 am

Hi all,

I sucefully installed version jinstall-9.6R1.13-export-signed.tgz !

I only configure the ip interface on a em0. I will be testing for know the multicast is working too.

Thanks from Brazil !!!

Reply

Jhon November 29, 2009 at 3:13 am

Hello friends

Where i can get a JunOs image, can you provide to me a link to download it?

Reply

Tony November 30, 2009 at 3:32 am

No, I do not supply illegal software downloads, please do not ask for them here.

Reply

GungaJim February 25, 2010 at 4:37 pm

I've got the FreeBSD VM up and running. How do i now add the junos image to the cd /var/tmp directory and ftp it from there? Also i haven't been assigned an address to the em0 interface in my FreeBSD machine. Any help?

Gungajim.wordpress.com

Reply

Tony February 28, 2010 at 1:40 pm

I use scp to copy the JunOS image over… Do you have a DHCP server in your network ? ( how is your VM configured? Shared? Bridged? etc.. )

Reply

GungaJim March 3, 2010 at 3:16 pm

Cheers for that! I got my first olive up and running :)
Can you help me in trying to run multiple olives now? I've managed to assign the em0 interface, but how do i bridge the two together on mac without using Qemu? Do i still need a Serial interface or can i connect them via Ethernet?

Please help….

Reply

Tony March 3, 2010 at 3:26 pm

Well, the simplest thing to do would be to use Host Only as your network in Fusion. Obviously you could create multiple interfaces, leave one bridged, one Host Only, or whatever…

Reply

Leave a Comment

Previous post:

Next post: