Olive reloaded or how to emulate Juniper routers

October 29th, 2009 by Jeremy Grossmann Leave a reply »

« »

This article explain you how to emulate Juniper JunOS on a PC using Qemu. This is an updated and enhanced version of excellent howtos from Juniper Clue and Internetwork Pro as well as Himawan Nugroho’s blog. I mainly focused on Qemu, so if you wish to install JunOS on a real PC or using VMware, please have a look at the Juniper Clue article for more information (and of course Google).

So what’s new you would say? First, I chose to use the latest version of Qemu: the 0.11.0 which supports the Intel e1000 network card emulation since version 0.10.0. and includes several fixes for it. I have modified and adapted the old patch for Qemu 0.11.0, it includes the UDP tunnel (connection to Dynamips/GNS3), PCAP and LCAP support. Also, the patch allows multicast traffic with the e1000, i82557b and i82559er Qemu emulated network cards. Moreover, this article show how to emulate JunOS on multiple operating systems: Mac OS X, Windows XP and Linux Ubuntu 9.04 without using an untrustworthy obscure binary downloaded from a forum you can’t even read the language ;)

Disclaimer

Please note that JunOS is not provided and will not be. So please don’t ask. Also, I do not take any responsibility on what happen on your PC, keep in mind this howto requires some patience and that is not for complete beginners. Moreover, this howto doesn’t necessarily present the best and/or easiest way to emulate JunOS. This is the cleanest and less intrusive for me but please feel free to give me constructive comments and tell what worked or didn’t worked for you.

What is a Olive?

This is very well summarized on the JuniperClue website:

Olive is also the codename name given to JUNOS software running on an PC rather than a Juniper router. A common misconception is that Olive is some sort of “special software”, but it is actually ordinary JUNOS software running on a PC of similar specifications to a Routing Engine, with no forwarding hardware (or PFE) attached. 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.

Juniper originally developed Olive functionality as a software development platform, before its hardware product was fully implemented. It is not intended as a “router simulator”, and has never been a supported product, or intended for use by the general public in any way. At one point it was used by Juniper internally for lab work, but has largely been phased out of this role with the availability of low-end hardware based platforms such as the M5.

The most common use of the Olive platform is for creative and unix-competent hackers to learn the JUNOS CLI on a low-cost platform. It is capable of forwarding a small amount of traffic, but does not support many of the features found on real Juniper routers. Essentially the forwarding on an Olive is the same as routing traffic via your fxp0 or em0 management interface on a real Routing Engine.

Ok so why all the secrecy?

Again, JuniperClue explained all of this:

Juniper’s official position is that Olive does not exist. Considering that Olive is an unsupported and unsupportable platform using “free” (aka illegally licensed) software, this is not an unreasonable official position. Olive is essentially a hackers platform, with absolutely no support of any kind, and it is not suitable for any type of commercial use. If you are in any doubt, or if you are not able to figure it out, you should invest in a low-cost platform such as J-Series instead.

It is also important to remember that Olive exists because Juniper allows it to exist, and is a testament to the mutual respect between the extremely knowledgeable developer and user bases. If the Olive platform became widely abused, Juniper could easily add additional software checks to prevent it from working. Please do not abuse this feature by doing stupid things like contacting JTAC for support on an Olive, or selling illegal copies of the software as “router simulators”. This type of activity is likely to have serious legal consequences and/or provoke a justified response from Juniper, so just don’t do it.

133 comments

  1. shih says:

    The best tutorial on the Internet regarding Olive simulation. I wish I had seen your tutorial before I setup my lab environment which had spent me more than 4 whole days to explore and get it done.

    Could you also do a comparison between different network card drivers? Any way to get VRRP running so far?

  2. Jeremy Grossmann says:

    Thanks for your comment. What is the issue with VRRP?

  3. mike says:

    ip add a junos img (jinstall-8.3R2.8-export-signed.tgz) ; for QEMU section what bin shoul i add ? this is ok : qemu-0.11.0.tar.gz.
    i drag/drop a juniper router in workplace but when i try to start i get this error in dynagen console :
    Error : lost communication with qemuwrapper server localhost
    Where i get wrong ?

  4. MAEB says:

    Hi I was waiting for this!!
    Some questions:

    1) Under Preferences/Quemu/GeneralSettings/PathToQemu/

    I just have put the path to my qemu.tar.gz. Right? Should I untar and gunzip the file?

    2) Under Preferences/Qemu/GeneralSettings/Qemu/Binary

    What is supposed to be here? Maybe the binary image of a linux machine? should I create before?

    Thanks for this software!!

  5. cristi says:

    there are 3fields and ai dont know how / what is for :
    1-path to qemu
    2-in qemu section : binary image
    3-in JunOS section : binary image
    I could ask for a small tutorial,pls?(maybe video with camtasia for windows/linux)

  6. prat says:

    After completing the whole process above.. it can be used in GNS3 0.71RC or we can directly load the “jinstall-9.0R1.10-domestic-signed.tgz” just live we load Cisco IOS..

    Can you be more specific on how to use JunOS on GNS3 0.71RC..

    Sorry a little bit confused!

  7. spacy says:

    Great tutorial indeed, I haven’t tried this one yet, since I do need to find that JunOs image somewhere in the net ;) , the thing that I wanted to ask is, why using Qemu and since JunOs is x86 based image, and better to use another virtualiasation software that have better performance running the FreeBSD OS? I’m think Xen, VMware or VirtualBox, if it’s not an X86 image, then of course we need Qemu,

    thanks in advance :)

  8. spacy says:

    hmm, think I overlooked the intro and got excited about the details ;) , so it’s possible :D

  9. Jeremy Grossmann says:

    Make sense and you are right but why using Qemu? First Because we need to patch the source code for multicast support and also I like Qemu ;) I’ll have a look how it JunOS runs with vmware …

  10. Jeremy Grossmann says:

    Sure.

    First patch Qemu, make the image and install FreeBSD/JunOS like described in this tutorial. Then in GNS3, in the Qemuwrapper settings, set the path to your patched Qemu and the path to Qemuwrapper.py (.exe on Windows), then in JunOS settings, set the path to your Qemu/JunOS image, let’s call it Olive. Drag a JunOS router on the scene, start the router and it should work.

  11. Jeremy Grossmann says:

    1-path to qemu

    This is the path to the patched Qemu program.

    3-in JunOS section : binary image
    2-in qemu section : binary image

    For JunOS, you don’t have to set a binary image. Go to JunOS tab and put the path to your JunOS image.

    I could ask for a small tutorial,pls?(maybe video with camtasia for windows/linux)

    I don’t really have the time but if someone makes a video I will be happy to put a link on the GNS3 website.

  12. Jeremy Grossmann says:

    1) Under Preferences/Quemu/GeneralSettings/PathToQemu/

    I just have put the path to my qemu.tar.gz. Right? Should I untar and gunzip the file?

    Qemu must be unzipped and patched. You put the path to the Qemu program. (qemu.exe on Windows for instance).

    2) Under Preferences/Qemu/GeneralSettings/Qemu/Binary

    What is supposed to be here? Maybe the binary image of a linux machine? should I create before?

    This is if you want to use a Qemu host, you don’t need to set that for a JunOS emulation. Go to JunOS tab and set the path to your JunOS image.

  13. Jeremy Grossmann says:

    for QEMU section what bin shoul i add ? this is ok : qemu-0.11.0.tar.gz.

    Qemu must be unzipped and patched. You put the path to the Qemu program. (qemu.exe on Windows for instance).

  14. cristi says:

    if I understood ..
    in qemu path – just qemu patched
    in JunOS path – BSD/JUNOS img

    correct?

  15. cristi says:

    jeremy,
    is anyone still work to dynamips dev ?

  16. ky says:

    Hi,

    When i try to run code:

    $ patch -pl -i qemu-0.11.0-olive.patch
    patch: **** strip count l is not a number

    It throws error as seen and make and make install exit without compilation. What could be reason ?

  17. ky says:

    I am getting following error:(trying to compile qemu)

    $ make
    CC net.o
    AR libqemu_common.a
    GEN i386-softmmu/qemu-options.h
    CC i386-softmmu/vl.o
    CC i386-softmmu/eepro100.o
    CC i386-softmmu/e1000.o
    LINK i386-softmmu/qemu.exe
    D:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\
    d -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2

    winpcap is installed. It is throwing some error about lwpcap. Can you help ?

  18. spacy says:

    Hey jeremy;

    I’ve got this problem while compiling the Qemu using the make command,

    c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2

    any idea of what may cause this? even though I followed the guidelines to the letter, if not , can I use the Qemu that’s shipped with the latest GNS3 0.7RC1 package? ( supposing that it’s already patched ;) )
    Also I’ve got the same error posted by
    mike ( November 29, 2009 at 5:18 am ), whether I’m trying to load ASA, or JunOS, Using Windows Vista here ( firewall deactivated ), also wanted to report that I managed to install it in a vmware Workstation, and now wondering if it’s possible to load the .vmkd harddisk image, directly to GNS3, because I used to do the same thing using the Qemu Manager, so I’m supposing that the vmware images are also supported using the patched Qemu,
    I know too many questions and not organized, hope you find your way out :D

    thanks

  19. gerry says:

    Same problem for me if I try to compile the qemu following the description I get:

    c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwpcap

    any ideas ?

    Thanks

  20. I am definitely bookmarking this page and sharing it with my friends.

    :)

  21. Brockwell says:

    Hi,

    I’m getting exactly the same error message as Spacy when I run the make command for Qemu

    c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2

    Does anybody know how to resolve this?

  22. Duberney says:

    Jeremy,Thanks for your amazing GNS3!

    I´ve worked with GNS3 integrated with ASA (qemu vm) and JunOS (qemu vm) and it´s OK, but I have some trouble with 0.7RC1. When I follow the steps of emulating JunOS for Windows and this is message it shows:

    “c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2″

    keep up date!

  23. rk says:

    I’ve got exactly the same error message as spacy has mention before ..

    Windows 7 Environment

  24. Jeremy Grossmann says:

    Concerning wpcap:

    I did my installation on Windows XP. I’ll test with Windows 7 and post about this problem, soon I hope.

  25. rafe says:

    hi all,
    I’m getting :

    $ make
    cc -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c
    make: cc: Command not found
    make: *** [example.o] Error 127

    What am I doing wrong?

    Thanks,

    Rafe

  26. spacy says:

    Back again :D with good news for you guys this time, another patch did it for me, after that weird results that we all got, I re-patched again with the command “patch -p1 < qemu-0.11.0-olive.patch" and answering "Y" to confim the repatching, recompiled again with "make" and all went very well, now I'm installing The FreeBSD OS,
    F.Y.I : the make install command copy everything needed to "c:\program file\qemu" from there you continue your little journey ;)

    HTH

  27. Mike says:

    Just out of curiosity, if someone *has* QEMU patched and compiled properly, is there any chance they could upload it to the forum and we could all download it from there? Heck, I’d even be happy to post it on my own servers if I could get the darn thing to compile.

  28. Alan says:

    Running vista, did the following:

    wget http://download.savannah.gnu.org/releases/qemu/qemu-0.11.0.tar.gz

    tar -xvzf qemu-0.11.0.tar.gz

    cd qemu-0.11.0

    wget http://www2.gns3.net/files/qemu-0.11.0-olive.patch

    patch -p1 -i qemu-0.11.0-olive.patch

    ./configure –target-list=i386-softmmu

    make

    then got the error:

    “c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2″

    To fix, then ran:

    patch -p1 -i qemu-0.11.0-olive.patch
    “answering y to all the prompts”

    make

    make install

    Note: if i run
    ./configure –target-list=i386-softmmu

    after do the repatch, the error message occurrs

    and also, need to run msys as administrator in vista, otherwise cannot create qemu directory. Hope this helps.

    This now builds qemu, but i get the following:

    Error: lost communication with qemuwrapper server localhost, though this might be a different issue.

  29. Krum Alexandrov says:

    Regarding the above posts about error messages during QEMU compilation:
    You need to download the developer version of WinPCAP: http://www.winpcap.org/install/bin/WpdPack_4_1_1.zip
    When you extract the zip archive, copy the contents of \lib and \include folders into \lib and \include folders of your MinGW installation location:
    C:\MinGW\lib
    C:\MinGW\include
    After that just run the make script again.

  30. spacy says:

    alright, I find a way cleaner than repatching, I downloaded the Winpcap Developer Pack 4.0.1 from here
    http://www.winpcap.org/devel.htm, extracted the content, then went to the lib directory and copied the two *.a files into the c:\mingw\lib directory because that’s where it’s expected to be, recompiled and everything went very well :)

  31. spacy says:

    something else, for those of you using windows the command of redirecting the serial to vga wont work because it’s designed to work under linux, as an alternative you should use something like this:
    qemu -m 256 -hda olive-base.img -boot c -localtime -serial telnet::3000,server,nowait
    you’ll be able to access the console via your favorite telnet program
    HTH

  32. gt9706b says:

    If you do not use the -daemonize option in Mac OS X you will get the qemu console which allows you to save the VM images for instant startup.

    Before you quit qemu save the image
    IE
    (qemu) savevm R1-save.vm

    When you restart qemu use the -loadvm option
    IE
    qemu -loadvm R1-save.vm

  33. Jeremy Grossmann says:

    $ make
    cc -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c
    make: cc: Command not found
    make: *** [example.o] Error 127

    What am I doing wrong?

    GCC is not installed. Therefore you obviously cannot compile.

  34. Jeremy Grossmann says:

    Scapy, do you confirm you are able run JunOS in GNS3? (after the few corrections you did, thanks for that).

  35. spacy says:

    Hey Jeremy;

    well, as of right now, It only was successful when running outside of GNS3, about it’s integration, I’m not sure, but I tried few things, and tried to figure out how the whole process work, I tried both JunOS and ASA, and get the same error that I’ve posted before, the thing that I’m sure of, is that there’s something need to be done in the qemuwrapper,

    1 – (FLASH file problem): the error I’ve got kinda went away when I manually copied the 256MB flash file to the temp directory for example (C:\Users\\AppData\Local\Temp\ ASA1\) , as if it’s not created automatically, the weird thing is that JunOS emulation also seems to ask for it !!!!

    2 – After putting it manually, it looks like the qemuwrapper doesn’t load the qemu process itself, cause after that there’s no tcp port 3000, listening .. could be that the telnet::3000 option doesn’t work in windows, so better to change it somewhere in the code by telnet tcp:127.0.0.1:3000 plus figuring out why the qemu process itself doesn’t load.

    hope this will point you out to modify few things in the qemuwrapper.py code ;) , I tried the “telnet tcp:127.0.0.1:3000″ thingy and loaded it in windows using python along with py2exe just to see how it behave, It didn’t work since I’m sure I’m missing some other details

    HTH

  36. rk4k says:

    this line :

    md5 -q jinstall-8.5R1.14-domestic-signed.tgz > \
    jinstall-8.5R1.14-domestic-signed.tgz.md5
    openssh sha1 jinstall-8.5R1.14-domestic-signed.tgz > \
    jinstall-8.5R1.14-domestic-signed.tgz.sha1

    Should be :

    md5 -q jinstall-8.5R1.14-domestic-signed.tgz > jinstall-8.5R1.14-domestic-signed.tgz.md5
    openssl sha1 jinstall-8.5R1.14-domestic-signed.tgz >
    jinstall-8.5R1.14-domestic-signed.tgz.sha1

  37. rafe says:

    re GCC is not installed.

    Hi Jeremy,

    I installed GCC through MINGW32 installer and I’m getting still the same error:

    $ make
    cc -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c
    make: cc: Command not found
    make: *** [example.o] Error 127

    Thanks in advance,

    Rafe

  38. Tasnimkido says:

    Hi,

    I just would like to thank Jeremy Grossmann and his team for bringing out GNS3.

    With out GNS3 allot of us would not be able to practice on real Router Images.

    And regarding Junos i can see you guys are doing a great job.

    I just thought to pay my respect!.

    Regards,

  39. Rafe says:

    Hi all,

    I was following all the steps on that article using another PC and stuck on the same step. When trying to execute ‘make’ I got errror 127.I think it’s time to give up.

    Regards,

    Rafe

  40. rk4k says:

    in what directory should I run this command :

    tar zcfv /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz *

    in /var/tmp/jinst-signed
    or
    in /var/tmp/jinst-signed/jinst

    It’s not clear ..

    Thks ..

  41. rk4k says:

    The :

    tar zcfv /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz *

    Should be in
    the steps in this part (my correction)

    cd /var/tmp/jinst-signed/

    md5 -q jinstall-8.5R1.14-domestic-signed.tgz > \
    jinstall-8.5R1.14-domestic-signed.tgz.md5
    openssl sha1 jinstall-8.5R1.14-domestic-signed.tgz > \
    jinstall-8.5R1.14-domestic-signed.tgz.sha1

    cd /var/tmp/jinst-signed/jinst/

    tar zcfv /var/tmp/jinstall-8.5R1.14-domestic-olive.tgz *

    Correct me if I’m wrong but I got the progress pass this page :

    http://blog.gns3.net/2009/10/olive-juniper/4/

    more pages to go :) )

  42. davide says:

    Hi anyone anidea receive the same error as described by gerry and spacy…:

    C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot fin
    d -lwpcap
    collect2: ld returned 1 exit status
    make[1]: *** [qemu.exe] Error 1
    make: *** [subdir-i386-softmmu] Error 2

    thanks for some constructive proposals,
    davide

  43. Linn says:

    Hi Rafe, when you install MinGW, I found the same problem as yours. I reinstalled MinGW with all compilers and everything is OK now.
    Regards,
    Linn

  44. bikash says:

    Up to qemu compiled successfully.. but getting error like this…
    Office@HP-E41BE814E7D6 ~/qemu-0.11.0
    $ qemu -m 256 -hda olive-base.img -cdrom 4.11-RELEASE-i386-miniinst.iso -boot d
    -localtime
    sh: qemu: command not found

  45. spacy says:

    @davide
    I wrote the solution for that compilation problem, couple of comments below ;)

    @bikash
    the “make install” command copies your qemu.exe & qemu-img.exe files along with other files are copied to your “program files” directory, also you’ll need to copy the SDL.dll file manually to the same directory, you should find it in the
    C:\msys\home\YOURNAME\SDL-1.2.14\build\.libs

    HTH :)

  46. Shih says:

    Has anyone experienced problem when -kernel-kqemu feature is enabled? It gives me an unknown error whenever I run qemu.exe with kqemu service on, which then forcing me to close the process.

  47. tom says:

    When i run “./configure –target-list=i386-softmmu”, i get the following errors
    “Error: zlib check failed
    Make sure to have the zlib libs and headers installed.”
    Zlib is installed.Can someone shed a light on this,please.thanks

  48. safronsoup says:

    When I issue the command “qemu -m 256 -hda olive-based.img -boot c -localtime \ -net nic,macaddr=00:aa:00:60:01:01,model=e1000 -net user”, I get the following error “Warning: vlan 0 with no nics”. I continue into the FreeBSD image, issue ifconfig -a but there is no em0 interface created so I can’t issue “dhclient em0″ to get an IP address. Any help would be appreciated.

  49. safronsoup says:

    I got em0 to be added but why is an IP address range out of 10.0.2.0/24 being assigned to it? And why is 10.0.2.2 my default gateway? Where is this IP address? It isn’t assigned to my tap0 or br0 interface on the Ubuntu host running qemu.

  50. george says:

    hi i have my olive junos 9.6 but in a VMware Virtual Machine.
    How can i put this into de GNS?

    If i install qemu inside de VM Ill be able to extract and Junos image?

    thanks

Leave a Reply