How To - Step By Step Installation of JunOS on GNS3 [Part 1]

Posted by Ahsan Tasneem | 10:22 PM | , , , , , , , , , , , , , , , , | 6 comments »

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 asHimawan 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 

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.



  • JunOS runs on top of FreeBSD. So you need to download the mini installation ISO, version >= 4.5 because earlier versions don’t support the Intel e1000 interface (em driver). Personally, I used the FreeBSD 4.11 mini-inst ISO but you could use FreeBSD 6 or 7.
  • JunOS itself. If you are smart and patient you will find it. I used jinstall-8.5R1.14-domestic-signed.tgz for my installations.
  • Qemu source code. Again, I used Qemu 0.11.0. You can choose to download it later with wget (I’ll show you how).
  • Download OpenVPN to create TAP interfaces (Windows only, optional).
  • More stuff whether you compile Qemu on Mac OS X, Windows or Linux.

Qemu compilation and patching on Mac OS X

The following procedure has been tested on Mac OS X Snow Leopard.
First you have to install the MacPorts and its dependencies (e.g. latest Apple’s Xcode Developer Tools).
Open a terminal window and install zlib, wget and libpcap via the MacPorts:
sudo port install zlib wget libpcap
Unzip qemu somewhere (e.g. in Documents/JunOS). Then from the qemu directory, patch and compile qemu:
Because FreeBSD hanged a few times when I was installing it inside Qemu, I applied a patch (qemu-0.11.0-macosx) which apparently fixed the problem (this is totally optional, maybe you won’t have any issue if not applied).
tar xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0
patch -p1 -i qemu-0.11.0-macosx.patch
patch -p1 -i qemu-0.11.0-olive.patch
./configure --disable-aio --disable-kvm --disable-kqemu --disable-sdl \
sudo make install

Qemu compilation and patching on Windows

If you do not want to compile Qemu on Windows (I can understand that ;) I provide a static version that you can download here.
First some dependencies must be installed, I chose to almost compile everything:
  • Download MinGW and install it (choose custom installation with g++ and make included). The file I downloaded was MinGW-5.1.6.exe
  • Download MSYS and install it, answer yes to post-installation questions and put the correct path to MinGW directory (should be C:\MinGW). The file I downloaded was MSYS-1.0.11.exe.
  • Download and install  Winpcap Developer Pack: extract the contents of \lib and \include folders into \lib and \include folders of your MinGW installation location (should be C:\MinGW\lib and C:\MinGW\include)
  • Start MSYS.
  • Compile and install zlib:
tar -xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/mingw
make install
  • Compile and install SDL
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=/mingw
make install
  • Install coreutils
tar -xvjf coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2
Copy the content of coreutils-5.97-MSYS-1.0.11-snapshot in the MinGW directory (e.g. C:\MinGW). You can also compile and install wget in MSYS or simply use your preferred browser to download Qemu and the patch in the correct directories.
tar -xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu
make install
Qemu compilation and patching on Linux
Compiling Qemu on Linux (Ubuntu) is quite simple.
First install the dependencies: ncurses, zlib, libpcap-dev and SDL libraries. SDL is optional, you can still use Qemu in a console with the –ncurses option. Then apply the patch and compile Qemu.
sudo apt-get install libncurses5-dev zlib1g-dev libsdl-dev libpcap-dev
tar xvzf qemu-0.11.0.tar.gz
cd qemu-0.11.0
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu
sudo make install

Qemu acceleration

Qemu provides some ways to speed up the emulation, I’ll talk about 2 of them: Kqemu and KVM. Kqemu can be used on both  Windows and Linux. KVM is only for Linux. I do not know if something exists for Mac OS X.
For more details about Kqemu, please have a look at the documentation. For KVM, see thewebsite.
The installation of Kqemu on Windows is relatively easy:
  1. Download Kqemu.
  2. Unzip it.
  3. Locate kqemu.inf and install it (right-click and select Install). In Windows Vista, install Kqemu using the CMD prompt and this command: rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 kqemu.inf
  4. Start Kqemu from the CMD prompt: net start kqemu
Kqemu on Linux (Ubuntu):
  1. Install kqemu with: sudo apt-get install kqemu-source
  2. If you do not want to use sudo each time you start Qemu, give the permissions to /dev/qemu with the following command: sudo chmod o+rw /dev/kqemu
For manual installation or other Linux distributions, please see the documentation.
KVM on Linux:
Qemu requires your kernel version to be >= 2.6.29 to enable the KVM support. You have to ensure this is ok before you compile Qemu.
Don’t forget to add the -kernel-kqemu or -enable-kvm command line options when starting Qemu (I didn’t do it in this tutorial). I would recommend to activate Kqemu only when you have your Olive image ready and working.

Related Articles


  1. vpn proxy service // January 16, 2012 at 6:23 AM  

    Very nice blog keep up the good work. I love finding a place with some quality information

  2. Ahsan Tasneem // January 18, 2012 at 10:52 AM  

    @ vpn proxy service .. Really appreciate your response .. Keep sharing your views for improving the content of this blog

  3. Anonymous // October 6, 2012 at 10:34 PM  

    I have windows 7 64bit, I tried the above steps but no luck I was getting an error message
    "please use win32/makefile.gcc instead zlib" while running ./configure. I googled and found I need to compile it again and tried couple of solutions provided there. It didn't help. It would be great if some one can show me a similar link that shows the steps to intall it in windows 7 64bit.

  4. Ahsan Tasneem // October 8, 2012 at 12:05 AM  

    @ Anonymous: for windows vista or later, try to run the console (cmd) as administrator and run the normal post installation script manually within this console with administrator rights…
    if you want to get zlib-1.2.3:

    Let me know the outcome.

  5. Anonymous // October 8, 2012 at 2:00 AM  

    Anyone can know how to emulate juniper screenos into GNS3?

  6. Ahsan Tasneem // October 10, 2012 at 5:39 AM  

    Dear Anonymous: Already replied to you on FB but here it is again
    "friend as per my knowledge ScreenOS is NOT yet supported on GNS3 (they are working on it may be the future verisions of GNS will be able to support ScreenOS) , they best way can be to buy a used NS-5GT or SSG 5 firewall."

Related Posts Plugin for WordPress, Blogger...