It is currently Mon Dec 11, 2017 2:08 am


All times are UTC




Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: How to create a Junos Image for use in GNS3
PostPosted: Fri Jun 28, 2013 7:56 am 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
I have put together a slightly updated set of scripts to assist folk who wish to create a Junos router to use with GNS3

These scripts are based on the set of scripts called "junos-auto-unprotect-v0.2" and were availbale via this post

Improvements are:
  • Cross platfrom *nix script - works on both OS X and Linux (Tested on OS X 10.8.4 and Linux Mint 15.0 - not sure about other versions)
  • Creates a .iso image ready to be used with freebsd-4.11.img image. (Available from http://www.gns3.net/appliances)
Download the Windows script here
Attachment:
File comment: junos-auto-checkpic script for windows
junos-auto-fix-checkpic.win.zip [301.78 KiB]
Downloaded 9839 times

Download the Linux/OS X script here
Attachment:
File comment: junos-auto-fix-checkpic script for Linux/OS X
junos-auto-fix-checkpic.sh.zip [2.35 KiB]
Downloaded 4718 times


How to create a Junos image for GNS3

Part 1: Qemu Preparation
Part 2 Preparing a Junos olive image
Part 3: Configure Qemu/JunOS Preferences.


Part 1 Qemu Preparation

Start by opening GNS3 Preferences, Qemu settings [General Settings] tab.

Click the Test Settings button to ensure that your OS has paths to qemuwrapper, qemu and qemu-img. If not, check your GNS3 install directory and make sure these files are present. If necessary, specify the exact path to each by clicking on the ellipsis (…) next to the field where these paths are defined and find the appropriate directories.
Windows users should use
Path to Qemuwrapper: qemuwrapper.exe
Path to qemu: qemu.exe
Path to qemu-img: qemu-img.exe

Linux users should use:
Path to Qemuwrapper: /usr/share/gns3/qemuwrapper.py
Path to qemu: qemu
Path to qemu-img: qemu-img

OS X users should use:
Path to Qemuwrapper: /Applications/GNS3.app/Contents/Resources/qemuwrapper.py
Path to qemu: /Applications/GNS3.app/Contents/Resources/Qemu-0.11.0/bin/qemu
Path to qemu-img: /Applications/GNS3.app/Contents/Resources/Qemu-0.11.0/bin/qemu-img

Part 2 Preparing a Junos olive image

Step 1: Gather the required files.
Create a new directory called Junos off your Images directory (either ~/GNS3/Images/Junos or %HOMEPATH%\GNS3\Images\Junos) and place the following files there. I will refer to this directory as you Junos directory from now on
1. freebsd-4.11.img - available from the http://www.gns3.net/appliances page - or just click here
2. Your copy of the JunOS operating system. It will be a file with a name something like jinstall-9.6R1.13-domestic-signed.tgz.
3. This junos-auto-fix-checkpic script for OS X/Linux or Windows

Unzip the junos-auto-fix-checkpic file in your Junos directory. If you are using windows, you should also get a direcory called bin created off your Junos directory

In this example I will use jinstall-9.6R1.13-domestic-signed.tgz as the example Junos image file.

I suggest copying your base image freebsd-4.11.img to a name that will reflect the version of JunOS you plan to install. I will use the name olive-9.6R1.13.img. The copy will be the base file for the future operations.

Linux and OS X
cp freebsd-4.11.img olive-9.6R1.13.img

Windows
copy freebsd-4.11.img olive-9.6R1.13.img

Step 2: Patch JunOS source image.

IMPORTANT: Run the script (and all following commands) at a command prompt from your Junos directory.

Linux and OS X
sudo ./junos-auto-fix-checkpic.sh jinstall-9.6R1.13-domestic-signed.tgz

Windows
junos-auto-fix-checkpic.bat jinstall-9.6R1.13-domestic-signed.tgz


Step 3: Install JunOS.

Task 1: Install JunOS files.

Start by launching your FreeBSD virtual machine with 1G RAM

Linux
qemu -m 1G -hda olive-9.6R1.13.img -cdrom jinstall-9.6R1.13-domestic-olive.iso

OS X
/Applications/GNS3.app/Contents/Resources/Qemu-0.11.0/bin/qemu –m 1G -hda olive-9.6R1.13.img -cdrom jinstall-9.6R1.13-domestic-olive.iso

Windows
"%PROGRAMFILEs%\GNS3\qemu.exe" -m 1G -hda olive-9.6R1.13.img -cdrom jinstall-9.6R1.13-domestic-olive.iso

1. When the image boots, login with the username of root –password root.
2. Install the JunOS software using the following commands:
# mount /cdrom #Note: press <Enter> one more time once the mount is done
# pkg_add -f /cdrom/jinstall-9.6R1.13-domestic-olive.tgz

Note: Be patient. Very patient. There will be no visible output, but you can keep checking that olive-9.6R1.13.img is growing. Eventually you should see a message saying that:
A REBOOT IS REQUIRED TO LOAD THIS SOFTWARE CORRECTLY

4. Start by shutting down FreeBSD using the halt command:

# halt

6. When you see the message saying that

Quote:
The operating system has halted.
Please press any key to reboot.


quit Qemu by pressing <Ctrl>+<Alt>+2 and entering the quit command
(qemu) quit

Tip: In Qemu, you can return to the guest OS screen by pressing <Ctrl>+<Alt>+1

Task 2: Boot your image with console access.

1. Use the following command to boot your router with console access via TCP port 3001. The server option in the command line tells Qemu to wait for a telnet session to be established before booting:

Linux
qemu -m 1G -hda olive-9.6R1.13.img -serial telnet:0.0.0.0:3001,server

OS X
/Applications/GNS3.app/Contents/Resources/Qemu-0.11.0/bin/qemu -m 1G -hda olive-9.6R1.13.img -serial telnet:0.0.0.0:3001,server

Windows
"%PROGRAMFILEs%\GNS3\qemu.exe" -m 1G -hda olive-9.6R1.13.img -serial telnet:0.0.0.0:3001,server

2. This command will only initiate the boot – for the boot process to continue, you must start a telnet session to 127.0.0.1 on port 3001. For example:

telnet 127.0.0.1 3001


[Note: Windows users my have to enable telnet first, or use PuTTY or some other terminal app]

The output from the boot process will continue in your telnet session, and the install process will complete, and again, extreme patience is required (10-20 min). If you insist on watching, you will see your router reboot about half way through the process, and finally you will get to the login prompt. Note that your Qemu session will also open, but not all of the output will be seen there.

3. In the QEMU window, login with the username root – no password is required:

login: root

--- JUNOS 9.6R1.13 built 2009-08-01 09:02:46 UTC
[email protected]%

4. Shutdown the router with the halt command:

[email protected]% halt

5. Once your router has shutdown, exit Qemu in the usual way (Press <Ctrl>+<Alt>+2, then type quit).

(qemu) quit

Your JunOS image JunOS9.6R1.13 is now ready for use in GNS3.

Part 3 Configure Qemu/JunOS Preferences

In GNS3, open GNS3 Preferences, Qemu settings at the [JunOS] tab.
Give your image a name in the Identifier name: field, such as JunOS9.6R1.13.
In the Binary image: field, click on the ellipsis (…) and locate the olive-9.6R1.13.img file in your Junos directory.
Change the RAM: value to 512 MiB
Make sure the Nic Model is E1000

IMPORTANT: Make sure you click Save before you click OK, and you can see your saved image in the list of JunOS Images at the bottom of the dialogue.

Now when you add routers to your topology, the Junos router symbol will be available.



_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Last edited by rednectar on Thu Mar 20, 2014 5:02 am, edited 1 time in total.
http://forum.gns3.net/post26860.html#p26860


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Sat Jun 29, 2013 5:40 am 
Offline
Site Admin

Joined: Sat Oct 11, 2008 1:41 pm
Posts: 2668
Location: Canada
Awesome! may I use your howto to create a documentation page for JunOS emulation on http://gns3.net/documentation/ ?

_________________
Jeremy, GNS3 Programmer & Benevolent Dictator for Life.


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Sat Jun 29, 2013 7:28 am 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
Of course! I hope to put it into a blog post one day. It is actually a sort of excerpt from another larger piece I'm working on.

I have to say all I did was stand on the shoulders of the giants who put together the original method (Jeremy - http://blog.gns3.net/2009/10/olive-juniper/ and tranzitwww topic2840.html)

_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Sat Jun 29, 2013 6:25 pm 
Offline

Joined: Sat Jun 29, 2013 6:12 pm
Posts: 1
Thank you so much for this post. I've been trying to get Junos to work with GNS3 with no success, and with the instructions in this post, I finally feel like I'm getting close. But I'm getting tripped up here:

rednectar wrote:
Task 2: Boot your image with console access.

1. Use the following command to boot your router with console access via TCP port 3001. The server option in the command line tells Qemu to wait for a telnet session to be established before booting:

Linux
qemu -m 1G -hda olive-9.6R1.13.img -serial telnet:0.0.0.0:3001,server

OS X
/Applications/GNS3.app/Contents/Resources/Qemu-0.11.0/bin/qemu –m 1G -hda olive-9.6R1.13.img –serial telnet:0.0.0.0:3001,server

Windows
"%PROGRAMFILEs%\GNS3\qemu.exe" -m 1G -hda olive-9.6R1.13.img –serial telnet:0.0.0.0:3001,server

2. This command will only initiate the boot – for the boot process to continue, you must start a telnet session to 127.0.0.1 on port 3001. For example:

telnet 127.0.0.1 3001


The output from the boot process will continue in your telnet session, and the install process will complete, and again, extreme patience is required (10-20 min). If you insist on watching, you will see your router reboot about half way through the process, and finally you will get to the login prompt. Note that your Qemu session will also open, but not all of the output will be seen there.


I don't understand what exactly I'm supposed to be telnetting to or how to proceed. QEMU seems to launch properly and then simply stays on this screen, as your instructions seem to indicate that it should:

Image

But then I'm not able to open a telnet session to anything from the Windows command prompt, no matter what I try. I always get "Could not open connection to the host, on port 3001: Connect failed".

I'm sure I'm just doing something stupid or missing something obvious. Any guidance would be appreciated.

Thanks again for your great post!


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Sat Jun 29, 2013 11:41 pm 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
@gummint - thanks for the report:
What you need to do is run the
"%PROGRAMFILEs%\GNS3\qemu.exe" -m 1G -hda olive-9.6R1.13.img -serial telnet:0.0.0.0:3001,server
command from an administrator window.
Will update the post.
[Edit:2013-07-01 I have investigated this further - seems that in my original post the "-" character before the word "serial" was corrupted (it had been cut-and-pasted from a word document). So, if you cut and pasted my command from the post, you got the behaviour that gummint described. My first reaction was "run as administrator" - which I did, and it worked, so I put this reply. I have now edited the posts above so that cut-and-paste from above should work-RedNectar]
Have to admit, most of the development was done on Linux.

_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Thu Jul 18, 2013 10:35 pm 
Offline

Joined: Thu Jul 18, 2013 9:27 pm
Posts: 3
I'm running OSX 10.8.4 and have just installed GNS3 0.8.4. Qemu appears to be working at least somewhat as I was able to run an ASA image from it successfully.

I'm now trying to get Juniper to work and have made it through these instructions to Part 2, Step 3. From Qemu, I log in, mount the cdrom, and execute the pkg_add command (pkg_add -f /cdrom/jinstall-12.1R5.5-domestic-olive.tgz). After the checksum is verified, it returns the following output.

Adding jinstall…

gzip: stdin: not in gzip format
/usr/bin/tar: Child returned status 1
/usr/bin/tar: +CONTENTS: Not found in archive
/usr/bin/tar: Error exit delayed from previous errors
pkg_add: tar extract of /var/tmp/instmp.IZdQLU/jinstall_pkg failed!
pkg_add: unable to extract table of contents file from '/var/tmp/instmp.IZdQLU/jinstall_pkg' - not a package?
pkg_add: install script returned error status


The olive-12.1R5.5.img file increases in size from 363MB to 1.2GB so it looks like it's at least looking at the right path. I've tried this twice now with the same result.

Any ideas on how to get around this?


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Fri Jul 19, 2013 12:09 am 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
Looks like part of the checkpic process didn't work. See topic2840.html to find out more how this works (all I did was a) make it multi-platform and b) add the step to create a .iso

Thought #1

There may have been errors during the checkpic removal. During the running of the script, you should see some output like:
Code:
[Info]
Using file: jinstall-9.6R1.13-domestic-signed.tgz
This will go 4 times deep in archive structures
And will have 23 steps to complete.

[pwd = /home/user/GNS3/Images/Junos/level1]
1) - Unpacking '../jinstall-9.6R1.13-domestic-signed.tgz' ... [Done]
2) - Check if file 'pkgtools.tgz' exist for replace... [Not found]

[pwd = /home/user/GNS3/Images/Junos/level1/level2]
3) - Unpacking '../jinstall-9.6R1.13-domestic.tgz' ... [Done]
4) - Check if file 'pkgtools.tgz' exist for replace... 63e0a5612156c54d0ba2ba31518bdba6  /tmp/JunOS_Pkgtools/pkgtools.tgz
[Replaced]

[pwd = /home/user/GNS3/Images/Junos/level1/level2/level3]
5) - Unpacking '../jbundle-9.6R1.13-domestic.tgz' ... [Done]
6) - Check if file 'pkgtools.tgz' exist for replace... [Replaced]

[pwd = /home/user/GNS3/Images/Junos/level1/level2/level3/level4]
7) - Unpacking '../jpfe-9.6R1.13.tgz' ... [Done]
8) - Check if file 'pkgtools.tgz' exist for replace... [Replaced]
9) - Repacking '../jpfe-9.6R1.13.tgz' ... [Done]

[pwd = /home/user/GNS3/Images/Junos/level1/level2/level3]
10) - Erasing 'level4' ... [Done]
11) - Check if file 'jpfe-9.6R1.13.tgz.sha1' exist for replace ... [Recalculate]
12) - Repacking '../jbundle-9.6R1.13-domestic.tgz' ... [Done]

[pwd = /home/user/GNS3/Images/Junos/level1/level2]
13) - Erasing 'level3' ... [Done]
14) - Check if file 'jbundle-9.6R1.13-domestic.tgz.sha1' exist for replace ... [Not found, Skip]
15) - Repacking '../jinstall-9.6R1.13-domestic.tgz' ... [Done]

[pwd = /home/user/GNS3/Images/Junos/level1]
16) - Erasing 'level2' ... [Done]
17) - Check if file 'jinstall-9.6R1.13-domestic.tgz.sha1' exist for replace ... [Recalculate]
18) - Repacking '../jinstall-9.6R1.13-domestic-olive.tgz' ... [Done]

[pwd = /home/user/GNS3/Images/Junos]
19) - Erasing 'level1' ... [Done]
20) - Check if file 'jinstall-9.6R1.13-domestic-olive.tgz.sha1' exist for replace ... [Not found, Skip]
21) - Clear temp '/tmp/JunOS_Pkgtools' ... [Done]

22) - Unprotected file: 'jinstall-9.6R1.13-domestic-olive.tgz'


Do you see any errors in that part?

Thought #2
You are using v12 - I teseted on v9. Maybe v12 need more memory. Try

qemu -m 2G -hda olive-9.6R1.13.img -cdrom jinstall-9.6R1.13-domestic-olive.iso

rather than

qemu -m 1G -hda olive-9.6R1.13.img -cdrom jinstall-9.6R1.13-domestic-olive.iso


HTH

_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Fri Jul 19, 2013 12:21 am 
Offline

Joined: Thu Jul 18, 2013 9:27 pm
Posts: 3
Thanks for the response!

Here's the output from the checkpic process...

=== Remove JunOS Checkpic Protection For Olive Platforms v1.1 ===

[Info]
Using file: jinstall-12.1R5.5-domestic-signed.tgz
This will go 4 times deep in archive structures
And will have 23 steps to complete.

[pwd = /Users/.../GNS3/Images/Junos/level1]
1) - Unpacking '../jinstall-12.1R5.5-domestic-signed.tgz' ... [Done]
2) - Check if file 'pkgtools.tgz' exist for replace... [Not found]

[pwd = /Users/.../GNS3/Images/Junos/level1/level2]
3) - Unpacking '../jinstall-12.1R5.5-domestic.tgz' ... [Done]
4) - Check if file 'pkgtools.tgz' exist for replace... 9124166f222f5cd10b0483dbf8e9f0da /tmp/JunOS_Pkgtools/pkgtools.tgz
[Replaced]

[pwd = /Users/.../GNS3/Images/Junos/level1/level2/level3]
5) - Unpacking '../jbundle-12.1R5.5-domestic.tgz' ... [Done]
6) - Check if file 'pkgtools.tgz' exist for replace... [Replaced]

[pwd = /Users/.../GNS3/Images/Junos/level1/level2/level3/level4]
7) - Unpacking '../jpfe-12.1R5.5.tgz' ... [Done]
8) - Check if file 'pkgtools.tgz' exist for replace... [Replaced]
9) - Repacking '../jpfe-12.1R5.5.tgz' ... [Done]

[pwd = /Users/.../GNS3/Images/Junos/level1/level2/level3]
10) - Erasing 'level4' ... [Done]
11) - Check if file 'jpfe-12.1R5.5.tgz.sha1' exist for replace ... [Recalculate]
12) - Repacking '../jbundle-12.1R5.5-domestic.tgz' ... [Done]

[pwd = /Users/.../GNS3/Images/Junos/level1/level2]
13) - Erasing 'level3' ... [Done]
14) - Check if file 'jbundle-12.1R5.5-domestic.tgz.sha1' exist for replace ... [Not found, Skip]
15) - Repacking '../jinstall-12.1R5.5-domestic.tgz' ... [Done]

[pwd = /Users/.../GNS3/Images/Junos/level1]
16) - Erasing 'level2' ... [Done]
17) - Check if file 'jinstall-12.1R5.5-domestic.tgz.sha1' exist for replace ... [Recalculate]
18) - Repacking '../jinstall-12.1R5.5-domestic-olive.tgz' ... [Done]

[pwd = /Users/.../GNS3/Images/Junos]
19) - Erasing 'level1' ... [Done]
20) - Check if file 'jinstall-12.1R5.5-domestic-olive.tgz.sha1' exist for replace ... [Not found, Skip]
21) - Clear temp '/tmp/JunOS_Pkgtools' ... [Done]

22) - Unprotected file: 'jinstall-12.1R5.5-domestic-olive.tgz'
Creating hybrid image...
.....................................................................................................................................


23) - Finished: Produced iso file: 'jinstall-12.1R5.5-domestic-olive.iso'

================ Start Time: 15:53:21 - End Time: 15:54:32 ================


Looks like it matches what you're expecting.

I'll try your suggestion to add memory to the qemu process and give it another go... There's also a 64bit version of the image I could try out if the memory change doesn't work.

Thanks for the suggestions.


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Fri Jul 19, 2013 12:47 am 
Offline

Joined: Fri Mar 05, 2010 11:33 am
Posts: 1494
Location: Australia
let me know how it goes - if it works I'll know to update the post

_________________
RedNectar
http://rednectar.net
@rednectarchris
GNS3 WorkBench-a VMware image of Ubuntu with GNS3 and VPCS installed and a collection of exercises/labs


Top
 Profile  
 
 Post subject: Re: How to create a Junos Image for use in GNS3
PostPosted: Fri Jul 19, 2013 9:02 pm 
Offline

Joined: Thu Jul 18, 2013 9:27 pm
Posts: 3
OK, I've got this working now with 12.1 but I had to revert to using a largely modified method based on the info posted here:
http://blog.gns3.net/2009/10/olive-juniper/

I tried 6 different Juniper versions from 10.4 to 12.1 with no success utilizing the junos-auto-fix-checkpic script. I even tried it using both OSX and Windows. I think the primary issue is a structural change in the file system for the newer images.

I'll try and post a write up for what worked for me as soon as I have time to validate the process and get it documented.

Thanks again!




Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO