Step By Step Guide To Install JunOS on GNS3 [Part 1] [Updated]

Posted by Ahsan Tasneem | 9:17 AM | , , , | 3 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.
 
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.




Installation
Requirements
· 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).

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://downloads.sourceforge.net/gns-3/qemu-0.11.0-macosx.patch?download
patch -p1 -i qemu-0.11.0-macosx.patch wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download

patch -p1 -i qemu-0.11.0-olive.patch
./configure --disable-aio --disable-kvm --disable-kqemu --disable-sdl \
--target-list=i386-softmmu

make
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 ,
zlib, SDL, MSYS coreutils into your MSYS home directory (e.g. c:\Msys\public\username). I downloaded zlib-1.2.3.tar.gz, SDL-1.2.14.tar.gz and coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2. MSYS coreutils is necessary because Qemu signrom.sh uses tools such as dd, od, expr, cp and printf which are included in coreutils.
· 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:

cd
tar -xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3

./configure --prefix=/mingw
make
make install


Compile and install SDL
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=/mingw

make
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.

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://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu

make
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

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://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download
patch -p1 -i qemu-0.11.0-olive.patch
./configure --target-list=i386-softmmu

make
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:
Step By Step Guide To Install JunOS on GNS3 [Part 2] [Updated]
Step By Step Guide To Install JunOS on GNS3 [Part 3] [Updated]
[Video] Step By Step Guide To Install JunOS on GNS3

3 comments

  1. Anonymous // December 15, 2012 at 12:37 AM  

    this is crap, wasted two precious days behind this, getting error on each step. Better would have been is video of whole process have been posted. I don't trust this.

  2. Ahsan Tasneem // December 16, 2012 at 11:46 PM  

    @anonymous: it would be great if you could be a little specific about the error, I might be able to help you on that. As everything posted here is tested by myself also. For you convenience here is the Video link:

    http://ahsantasneem.blogspot.com/2011/12/video-step-by-step-guide-to-install.html

  3. Anonymous // February 2, 2013 at 7:05 PM  

    I realize this was posted some time ago, but it is out of date. The current version of Qemu I downloaded is 1.3.0. Since the purpose of this article is to work with GNS3 can we use the Qemu installation that comes with the current version of GNS3? If so, how much do we need to patch this version?

    I am trying to follow the Windows instructions. I see commands like “tar”, “./configure”, and “make”. These look more like Linux commands to me, not Windows commands. I have not gotten that far in the instructions, but I do not expect these instructions to work as written. Please clarify.

Related Posts Plugin for WordPress, Blogger...