IMP:::This tutorial is based upon the assumption that you have installed GNS3 under /opt/GNS3, Please check here .
First I'll show you Qemu Patch/Compilation part .
First we'll have to install dependencies
[user@admin ~]$ su
Password: (Type in your root password here)
[root@admin /]# yum install ncurses ncurses-devel zlib zlib-devel SDL SDL-devel libpcap libpcap-devel
Let's download and compile Qemu
[root@admin /]#cd /opt/GNS3/
[root@admin GNS3]#wget http://download.savannah.gnu.org/releases/qemu/qemu-0.11.0.tar.gz
[root@admin GNS3]#tar xvzf qemu-0.11.0.tar.gz
[root@admin GNS3]#cd qemu-0.11.0
[root@admin qemu-0.11.0]#wget http://downloads.sourceforge.net/gns-3/qemu-0.11.0-olive.patch?download
[root@admin qemu-0.11.0]#patch -p1 -i qemu-0.11.0-olive.patch
[root@admin qemu-0.11.0]#./configure --target-list=i386-softmmu
[root@admin qemu-0.11.0]#make
[root@admin qemu-0.11.0]#make install
We are done with Qemu compilation, next is ASA.
[root@admin qemu-0.11.0]#cd ..
[root@admin GNS3]#cd IOS
[root@admin IOS]#mkdir ASA
[root@admin IOS]#chmod o+rw -R ./ASA
[root@admin IOS]#cd ASA
[root@admin ASA]#
now download and move if you need pre-configured files asa802-k8.bin leave a comment below along with your e-mail id I'll send the files ASAP or you can google 4 it to this ASA folder.
::coloured coded text is the output of the command::
[root@admin ASA]#hexdump -C asa802-k8.bin > asa802-k8.hex
[root@admin ASA]#grep '1f 8b 08 00 1d' asa802-k8.hex
001228b0 1f 8b 08 00 1d 3d 73 46 00 03 ec 3a 6d 54 14 57 |.....=sF...:mT.W|
[root@admin ASA]#ls -la asa802-k8.bin
-rwxrwxrwx 1 cyberwiz cyberwiz 14524416 Jun 25 18:48 asa802-k8.bin
[root@admin ASA]#echo "14524416 ; ibase=16 ; last - 1228B0" | bc | tail -n 1
13334352
[root@admin ASA]#tail -c 13334352 asa802-k8.bin > asa802-k8.gz
[root@admin ASA]#gzip -d asa802-k8
gzip: asa802-k8.gz: decompression OK, trailing garbage ignored
[root@admin ASA]#mkdir tmp ; cd tmp
[root@admin tmp]#cpio -i --no-absolute-filenames --make-directories < ../asa802-k8
cpio: Removing leading `/' from member names
cpio: Removing leading `/' from member names
61039 blocks
[root@admin tmp]#cp vmlinuz ../asa802-k8.kernel
[root@admin tmp]#cd asa/scripts/
[root@admin scripts]#gedit first_start.sh
Now copy and paste the following in the gedit:
#!/bin/sh
##
## Author: Jeremy Grossmann (2009)
## Contributor: J. Pedro Flor (28 january 2010)
##
FIRST_START=no
if test ! -e /mnt/disk0/lina_monitor
then
cd /asa/scripts/
echo "d" > /asa/scripts/fdisk.pf.in
echo "o" >> /asa/scripts/fdisk.pf.in
echo "n" >> /asa/scripts/fdisk.pf.in
echo "p" >> /asa/scripts/fdisk.pf.in
echo "1" >> /asa/scripts/fdisk.pf.in
echo "1" >> /asa/scripts/fdisk.pf.in
echo "" >> /asa/scripts/fdisk.pf.in
echo "t" >> /asa/scripts/fdisk.pf.in
echo "4" >> /asa/scripts/fdisk.pf.in
echo "w" >>/asa/scripts/fdisk.pf.in
echo ""
echo -n "Initializing partition..."
/sbin/fdisk /dev/hda < /asa/scripts/fdisk.pf.in > /dev/null 2> /dev/null
echo "done"
echo ""
echo -n "Formating and mounting partition..."
mkdosfs -F 16 /dev/hda1 > /dev/null 2> /dev/null
mount -t vfat -o umask=0000,noatime,check=s,shortname=mixed /dev/hda1 /mnt/disk0 > /dev/null 2> /dev/null
echo "done"
echo ""
cp /asa/bin/lina /mnt/disk0/lina
cp /asa/bin/lina_monitor /mnt/disk0/lina_monitor
FIRST_START=yes
fi
# load drivers
modprobe e100
modprobe e1000
ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up
ifconfig eth3 up
ifconfig eth4 up
ifconfig eth5 up
if test $FIRST_START = yes
then
echo ""
echo " Cisco ASA with Multiple Security Contexts"
echo " =============================================="
echo ""
echo "This is your first boot, please wait about 2 minutes for 'disk0' creation"
echo "and then execute the following commands inside the Linux prompt:"
echo ""
echo " # cd /mnt/disk0"
echo " # /mnt/disk0/lina_monitor"
echo ""
echo ""
echo ""
echo "Please note to use the following command under ASA to save your configs:"
echo ""
echo " ciscoasa(config)# boot config disk0:/.private/startup-config"
echo " ciscoasa(config)# copy running-config disk0:/.private/startup-config"
echo ""
echo ""
echo ""
echo "To get webvpn working, execute the following commands:"
echo ""
echo " ciscoasa# mkdir disk0:/var"
echo " ciscoasa# mkdir disk0:/var/log"
echo " ciscoasa# mkdir disk0:/csco_config"
echo " ciscoasa# mkdir disk0:/csco_config/97"
echo " ciscoasa# mkdir disk0:/csco_config/97/webcontent"
echo ""
echo " ( Powered by Pedro Flor )"
echo " ( pedro.flor@gmail.com )"
echo ""
exit
fi
echo ""
echo ""
echo "Starting Cisco ASA with Multiple Security Contexts..."
echo ""
cd /mnt/disk0
/mnt/disk0/lina_monitor
Save and close gedit.
[root@admin scripts]#chmod 755 first_start.sh
[root@admin scripts]#cd ../../etc/init.d/
[root@admin init.d]#gedit rcS
Comment out the lina_monitor line and add /asa/scripts/first_start.sh, it should look like.
#!/bin/sh
#------------------------------------------------------------------
# Copyright (c) 2006, 2007 by Cisco Systems, Inc.
# All rights reserved.
#------------------------------------------------------------------
export MOUNT_OPTS=umask=0000,noatime,check=s,posix,shortname=mixed
/bin/sh -c /etc/init.d/rcS.common
export LD_LIBRARY_PATH=/mnt/disk0/lib:/mnt/disk0/lib
# launch our user space processes
#/asa/bin/lina_monitor
/asa/scripts/first_start.sh
Save and close gedit.
[root@admin init.d]#cd ../../
[root@admin tmp]#find . | cpio -o -H newc | gzip -9 > ../asa802-k8.initrd.gz
61045 blocks
Lets cleanup ASA folder(Optional)
[root@admin tmp]#cd ..
[root@admin ASA]#rm -rf asa802-k8 asa802-k8.hex asa802-k8.bin tmp/*
[root@admin ASA]#rmdir tmp
Qemu Settings.
ASA Settings.
Drag and Start the ASA, then right click, Select Console.
First time you save your config, do as follows:
ciscoasa(config)# boot config disk0:/.private/startup-config
ciscoasa(config)# copy running-config disk0:/.private/startup-config
Before switching ASA off, run one more time the following:
ciscoasa#copy run disk0:/.private/startup-config
Hope this tutorial will help you guys to Setup Qemu and Emulate ASA successfully on GNS3.
Happy Learning :)