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.

84 comments

  1. ustas says:

    Hi, firs of all I would like to thank you! You made the best description of the procedure how to build the olive ever existed in the internet! Regarding your procedure I would like to confirm that some additional tasks is also required:
    download the developer version of WinPCAP: http://www.winpcap.org/install/bin/WpdPack_4_1_1.zip
    opy the contents of \lib and \include folders into \lib and \include folders of your MinGW installation location:
    C:\MinGW\lib
    C:\MinGW\include

    If it is not difficult for you, could you please make a qemu 12.0-rc1 patch for olive? Or explain the procedure how to make it itself to not disturb you with this. THANK YOU once again!

  2. user says:

    Hi,
    I can login in the routers but each router only has one interface i.e. em0. How do i get more interfaces on each router e,g, i would like to get 4 em0 interface on each router….i this possible….
    Thanks

  3. Olu says:

    I got same problem as Tom above

    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.

    Please can someone help urgently ?

  4. Dan says:

    Hi all
    I manage to build the qemu image and ran 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”
    all look fine.
    I get IP address 10.0.2.15 and can ping to 10.0.2.2 but I cant manage to copy the junos file to qemu.
    I get :
    ssh: connect to host 10.0.2.2 port 22: Operation time out

    please help

  5. Antonio Soares says:

    I see PCAP support=no after executing the configure script:

    amsoares@WINXP ~/qemu-0.11.0
    $ patch -p1 -i qemu-0.11.0-olive.patch
    (Stripping trailing CRs from patch.)
    patching file Makefile.target
    (Stripping trailing CRs from patch.)
    patching file configure
    (Stripping trailing CRs from patch.)
    patching file hw/e1000.c
    (Stripping trailing CRs from patch.)
    patching file hw/eepro100.c
    (Stripping trailing CRs from patch.)
    patching file net.c
    (Stripping trailing CRs from patch.)
    patching file qemu-options.hx

    amsoares@WINXP ~/qemu-0.11.0
    $

    amsoares@PT-AMSOARES ~/qemu-0.11.0
    $ ./configure –target-list=i386-softmmu
    Install prefix c:/Program Files/Qemu
    BIOS directory c:/Program Files/Qemu
    binary directory c:/Program Files/Qemu
    Source path /home/amsoares/qemu-0.11.0
    C compiler gcc
    Host C compiler gcc
    ARCH_CFLAGS -m32
    make make
    install install
    host CPU i386
    host big endian no
    target list i386-softmmu
    tcg debug enabled no
    gprof enabled no
    sparse enabled no
    strip binaries yes
    profiler no
    static build no
    -Werror enabled no
    SDL support yes
    SDL static link yes
    curses support no
    curl support no
    mingw32 support yes
    Audio drivers
    Extra audio cards ac97 es1370 sb16
    Mixer emulation no
    VNC TLS support no
    VNC SASL support no
    kqemu support yes
    xen support no
    brlapi support no
    Documentation no
    NPTL support no
    vde support no
    AIO support no
    IO thread no
    Install blobs yes
    KVM support no
    fdt support no
    preadv support no
    PCAP support no

    amsoares@WINXP ~/qemu-0.11.0

    Of course, i want PCAP support. I saw this section in the patch file:

    + if test “$pcap” = “yes” ; then
    + pcap=no
    + cat > $TMPC << EOF
    + #include
    + int main(void) { return pcap_lib_version(); }
    + EOF
    + if $cc $ARCH_CFLAGS -o $TMPE $PCAPLIBS $TMPC 2> /dev/null; then
    + pcap=yes
    + fi
    + fi
    +

    I’m not a programmer but it seems pcap will always be equal to “no” and thus the output i see after executing the configure script. What is the workaround for this ? I followed the steps in this tutorial and also copied the files from WpdPack_4_1_1.zip to the minGW directories.

    There’s another section in the patch mentioning a file that does not exist:

    if test “$mingw32″ = “yes” ; then
    + PCAPLIBS=”-lwpcap”
    if test -z “$prefix” ; then
    prefix=”c:/Program Files/Qemu”
    fi

    The WpdPack_4_1_1.zip contains a file called libwpcap.a and another one called wpcap.lib. Do we need to rename some files ?

  6. Chad says:

    Having issues getting my Juniper router up and running and I keep seeing that the error:

    “could not communicate with the qemuwrapper server localhost” Below is what I believe to be the output. Any suggestions would be greatly appreciated

    Qemu Emulator Wrapper (version 0.2.5)
    Copyright (c) 2007-2009 Thomas Pani & Jeremy Grossmann

    Unpacking pemu binary.
    Qemu TCP control server started (port 10525).
    Connection from (‘127.0.0.1′, 51621)
    Connection from (‘127.0.0.1′, 51622)
    Shutdown in progress…
    Shutdown completed.
    Qemu path is now .
    !! JUNOS1.console = 3000
    !! JUNOS1.netcard = e1000
    !! JUNOS1.image = C:\Documents and Settings\All Users\Documents\Junos\jinstall-9
    .6R2.11-domestic-signed.tgz
    !! JUNOS1.ram = 96
    !! JUNOS1.kqemu = True
    —————————————-
    Exception happened during processing of request from (‘127.0.0.1′, 51622)
    Traceback (most recent call last):
    File “SocketServer.pyc”, line 558, in process_request_thread
    File “SocketServer.pyc”, line 320, in finish_request
    File “SocketServer.pyc”, line 615, in __init__
    File “qemuwrapper.py”, line 383, in handle
    File “qemuwrapper.py”, line 433, in handle_one_request
    File “qemuwrapper.py”, line 599, in do_qemu_start
    File “qemuwrapper.py”, line 105, in start
    File “qemuwrapper.py”, line 230, in _build_command
    File “qemuwrapper.py”, line 290, in _disk_options
    AttributeError: ‘module’ object has no attribute ’spawnlp’
    —————————————-

    - Chad

  7. anirban says:

    hi getting following error–>
    babai@ANIRBAN-05773C5 ~/qemu-0.11.0
    $ 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
    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

  8. Antonio Soares says:

    I was able to compile with PCAP support after changing the configure script:

    if test “$pcap” = “yes” ; then
    pcap=yes
    cat > $TMPC << EOF

    Now everything seems to be working fine. I used Winpcap release 4.0.1.

  9. mantoba says:

    hi guys,

    Did any of you guys have a problem with isis protocol ?

    I unable to establish isis if protocol run on more than 3 routers.

    I have no problem to run ospf and bgp but have a problem with isis.

    Any advice?
    Thanx

  10. richard says:

    Hi,

    First of all, I am a great olive fan and working a lot for my job (I am already JNCIE for a while).

    I completed the process you described, everything went fine. However, I face stability issues (qemu crashes) with the udp network if i895522er if type is used and my em inteface is seen administratively down if e1000 interface type is used.

    so not a great reward for the hard job of compiling/patching. Note that I applied the kqemu patch to avoid crashes too :-)

  11. malon says:

    You can use this for more than one interface but you would need the physical interfaces to be present. Adjust the model name as you wish

    qemu.exe -L . -m 48 -hda Olive.img -serial telnet::1001,server -localtime
    -net nic,vlan=0,macaddr=00:aa:00:00:01:01,model=i82559er -net tap,vlan=0,ifname=tap1
    -net nic,vlan=0,macaddr=00:aa:00:00:01:02,model=i82559er -net tap,vlan=0,ifname=tap2

  12. Treq says:

    Qemu-from-source have no “make remove” target. Therefore I would suggest that it is tidier to turn it into a .deb package prior to installing it on your Ubuntu system.

    This can be done by first installing the package “checkinstall”, and then simply replacing the step “make install” with “checkinstall”. This will then generate a .deb and install it for you, making it easy to remove if you should get tired of it.

  13. zippy says:

    Hey great Balog,

    I get these errors using qemu 0.12.1 on linux. Any ideas anyone?

    Thanks.

    Hit [Enter] to boot immediately, or space bar for command prompt.
    Booting [/boot/installer]…
    ACPI autoload failed – no such file or directory
    kernel trap 12 with interrupts disabled

    Fatal trap 30: reserved (unknown) fault while in kernel mode
    instruction pointer = 0×20:0xc06b3ef4
    stack pointer = 0×28:0xc1021c98
    frame pointer = 0×28:0xc1021cb8
    code segment = base 0×0, limit 0xfffff, type 0×1b
    = DPL 0, pres 1, def32 1, gran 1
    processor eflags = interrupt enabled, IOPL = 0
    current process = 0 ()
    trap number = 30
    dog: ERROR – reset of uninitialized watchdog
    panic: reserved (unknown) fault
    (null)(c089caa0) at 0
    (null)(c0836fe5,0,fffff,8e4cc89b,c089a8c0) at 0
    (null)(c1021c58,0) at 0
    (null)(8,28,28,0,c089a8c0) at 0
    (null)(8,28,28,f0000,c08ced40) at 0
    (null)(2) at 0
    (null)(0,c1021d3c,c051e8ef,c0835147,0) at 0
    (null)(c1021d84,c06ac030,101ec00,101e000,1026000) at 0
    (null)(101ec00,101e000,1026000,0,c044df8d) at 0
    (null)(1026000) at 0
    (null)() at 0
    dog: ERROR – reset of uninitialized watchdog
    dog: ERROR – reset of uninitialized watchdog
    Uptime: 1s

  14. Sushant says:

    I was able to run Olive under qemu in windows,
    But I am facing problems with qemuwrapper.
    Editing qemuwrapper.py and recompiling will fix it,
    Anybody one good at Python?

    http://sushantwagle.wordpress.com/2010/01/11/gns3-07rc1-supports-juniper-part2/

  15. sid says:

    (correction)

    its:

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

    not

    patch -pl -i qemu-0.11.0-olive.patch

  16. brezular says:

    Hi guys,
    I record video when I was configuring Juniper routers in GNS3. It is only about running and networking routers in GNS3 (not Qemu FreeBSD, JunOS installation).

    No real how to but it can help.

    http://rapidshare.com/files/347400010/configuration-part1.ogv

    http://rapidshare.com/files/347401764/configuration-part2.ogv

  17. trunksy says:

    When I do a ’sudo make install’ on Ubuntu 9.10, here’s what I get. What did I do wrong?

    user@Hostname:/opt/GNS3/qemu-0.11.0$ sudo make install
    install -d -m0755 -p “/usr/local/bin”
    install -m0755 -p -s qemu-nbd qemu-io qemu-img “/usr/local/bin”
    install -d -m0755 -p “/usr/local/share/qemu”
    set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin video.x openbios-sparc32 openbios-sparc64 openbios-ppc pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin bamboo.dtb petalogix-s3adsp1800.dtb multiboot.bin; do \
    install -m0644 -p /opt/GNS3/qemu-0.11.0/pc-bios/$x “/usr/local/share/qemu”; \
    done
    install -d -m0755 -p “/usr/local/share/qemu/keymaps”
    set -e; for x in da en-gb et fr fr-ch is lt modifiers no pt-br sv ar de en-us fi fr-be hr it lv nl pl ru th common de-ch es fo fr-ca hu ja mk nl-be pt sl tr; do \
    install -m0644 -p /opt/GNS3/qemu-0.11.0/pc-bios/keymaps/$x “/usr/local/share/qemu/keymaps”; \
    done
    for d in x86_64-softmmu; do \
    make -C $d install || exit 1 ; \
    done
    make[1]: Entering directory `/opt/GNS3/qemu-0.11.0/x86_64-softmmu’
    install -m 755 -s qemu-system-x86_64 “/usr/local/bin”
    make[1]: Leaving directory `/opt/GNS3/qemu-0.11.0/x86_64-softmmu’
    user@Hostname:/opt/GNS3/qemu-0.11.0$

  18. Linn says:

    Thanks a lot to Jeremy and GNS3 supporters and developers :) Your article helped me alot.
    After spending 1 night without any sleep, I have successfully loaded JUNOS 8.4 on FreeBSD in VMware( in the next day afternoon, LOL). Creating a virtual serial port to get access to CLI took me the whole morning :( . I know I am stupid :P

  19. Jeremy Grossmann says:

    I updated this howto concerning wpcap on Windows and I also provide a link to download a static version of Qemu, no need for you to compile on Windows now ;)

  20. keenshoes says:

    These days I worked out a olive patch for qemu 0.12+ version and found a workaround to fix the ERROR “reset of uninitialized watchdog”.

    if you like you can download the binary file (windows) directly.
    Qemu 0.12.3 for Juniper (windows version)
    http://www.netemu.cn/bbs/thread-13265-1-1.html

  21. JiuG says:

    Hi All:

    Great howto! Great software!

    I finished with all the steps of the how to and wow! it works. I was able to run JunOS along with a Cisco 3725 inside GNS3 0.7 on Windows 7 32 bits, and voila! they can see eachother.

    The only thing I am missing and I am out of ideas is that I cannot start a second instance of JunOS within GNS3 (I can manually from the command prompt).

    I suppose that I should see a second qemu process hanging from the qemuwrapper.exe process, but it is not starting.

    Note: I am using the all-in-one package.

    Any ideas?

  22. JiuG says:

    Correction: I cannot run a second instance from the command line either.

  23. Fabio says:

    Hello everyone,
    I installed Gns3 version 0.7 on a PC running Windows XP, my problem is that in gns3 only one juniper router starts.
    I have created an olive-base.img called Olive.img.
    Under the menu preferences–> qemu –> general settings i have this situation :
    qemuwrapper path : C:\programs\gns3\quemuwrapper.exe
    path to qemu : qemu
    path to quemu-img :qemu-img
    Under the menu preferences –> qemu –> Junos Ihave this situation :
    Binary image : C:\Olive.img
    Memory 96
    Nic e1000.
    When i push test , appears the message : “Failed to start qemu”.
    I did two copies of olive.img and called them olive2.img and olive3.img.
    I used three routers and configured them with olive.img in first router, olive2.img in the second and olive3.img in the third.
    I got the result that the only first two routers have worked fine (in windows task manager there are two istances of qemu).
    I would like to run more routers can someone help me solve the problem?
    Thanks Fabio

  24. MAE says:

    Hello friends! I have been able to add to routers, I turn on the first one and I can telnet into it without any problem, but when I turn on the second one I can’t telnet to the second one.. Any idea?

    Another issue is that when I turn on the routers if I point to one of them with the mouse it says that the router is stopped (just a minor bug :) ).

    Regards

  25. Jeremy Grossmann says:

    I updated the link to the Qemu patch.

Leave a Reply