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.
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?
Thanks for your comment. What is the issue with VRRP?
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 ?
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!!
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)
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!
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
hmm, think I overlooked the intro and got excited about the details
, so it’s possible
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 …
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.
This is the path to the patched Qemu program.
For JunOS, you don’t have to set a binary image. Go to JunOS tab and put the path to your JunOS image.
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.
Qemu must be unzipped and patched. You put the path to the Qemu program. (qemu.exe on Windows for instance).
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.
Qemu must be unzipped and patched. You put the path to the Qemu program. (qemu.exe on Windows for instance).
if I understood ..
in qemu path – just qemu patched
in JunOS path – BSD/JUNOS img
correct?
jeremy,
is anyone still work to dynamips dev ?
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 ?
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 ?
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
thanks
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
I am definitely bookmarking this page and sharing it with my friends.
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?
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!
I’ve got exactly the same error message as spacy has mention before ..
Windows 7 Environment
Concerning wpcap:
I did my installation on Windows XP. I’ll test with Windows 7 and post about this problem, soon I hope.
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
Back again
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
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.
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.
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.
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
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
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
GCC is not installed. Therefore you obviously cannot compile.
Scapy, do you confirm you are able run JunOS in GNS3? (after the few corrections you did, thanks for that).
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
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
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
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,
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
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 ..
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
)
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
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
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
@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
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.
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
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.
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.
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