- 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 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.
The installation of Kqemu on Windows is relatively easy:
- Download Kqemu.
- Unzip it.
- 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
- Start Kqemu from the CMD prompt: net start kqemu
Kqemu on Linux (Ubuntu):
- Install kqemu with: sudo apt-get install kqemu-source
- 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.