It is currently Fri Apr 19, 2019 8:33 pm


All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Sun Aug 26, 2012 10:08 am 
Offline

Joined: Thu Jul 26, 2012 11:19 pm
Posts: 143
Location: U.K.
Following on from my earlier post for compiling Qemu 1.1.1 from sources on 10.6.

I had some issues getting Qemu to load the tap driver - tun/tap is more limited in OSX, there is no ethernet bridge so you can only use it to connect to the host. When I tried to start my VM I was getting the following error:
Code:
warning: could not open /dev/tap: no virtual network emulation: No such file or directory
qemu-system-i386: -net tap,id=hostnet0: Device 'tap' could not be initialized


It turns out that the tap devices as installed on OSX are /dev/tap0 -> /dev/tap15. This version of Qemu was looking for /dev/tap, which didn't exist. My solution was to create a symbolic link from /dev/tap15-> /dev/tap which gets Qemu running. The host end of the tap can now be ifconfigured as interface tap15.
Code:
sh-3.2# ifconfig tap9 10.10.10.2 up
sh-3.2# ifconfig tap9
tap9: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
   ether 36:37:7f:f4:3a:ad
   inet 10.10.10.2 netmask 0xff000000 broadcast 10.255.255.255
   open (pid 405)

This leaves a few things to tidy up such as
  • Change the device permissions so that Qemu doesn't need to be started as the superuser.
  • Configure a script for Qemu to call to bring up the tap[
  • Note the /dev/tap you create does not persist across reboots.
  • You can only use one tap with OSX.

Apart from those it's quite useable and I can happily run the ASA 8.4.2 kernel mentioned elsewhere. I have noticed the odd crash when ASDM reads the config from the ASA though.

Edit - fixed the tun/tap issue for multiple interfaces. See http://forum.gns3.net/post17679.html#p17679



_________________
GNS3 0.8.4 running on Windows 8.1
GNS3 0.8.4 running on CentOS 6.5


Last edited by nickbeee on Thu Nov 22, 2012 2:49 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Sun Sep 30, 2012 8:17 am 
Offline

Joined: Sun Sep 30, 2012 8:12 am
Posts: 1
hy, thanks for the usefull guide.
i've mange to install and make qemu run over 10.8 with the instruction you gave for 10.6 (so qemu 0.11 patched) but it keeps crashing no matter what i load on it (junos and asa)


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Sun Nov 11, 2012 12:56 am 
Offline

Joined: Fri Feb 03, 2012 7:16 pm
Posts: 29
hey just to say i am successfully running qemu on mountain lion (10.8). i will do a write up on monday as i don't have time do this now.

And as a point you will not need to compile anything as I have done all this for you so going to be simple :-)

and as proof

Image


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Thu Nov 22, 2012 2:47 am 
Offline

Joined: Thu Jul 26, 2012 11:19 pm
Posts: 143
Location: U.K.
nickbeee wrote:
I had some issues getting Qemu to load the tap driver - tun/tap is more limited in OSX, there is no ethernet bridge so you can only use it to connect to the host. When I tried to start my VM I was getting the following error:
Code:
warning: could not open /dev/tap: no virtual network emulation: No such file or directory
qemu-system-i386: -net tap,id=hostnet0: Device 'tap' could not be initialized


It turns out that the tap devices as installed on OSX are /dev/tap0 -> /dev/tap15. This version of Qemu was looking for /dev/tap, which didn't exist. My solution was to create a symbolic link from /dev/tap15-> /dev/tap which gets Qemu running. The host end of the tap can now be ifconfigured as interface tap15.


I'm pleased to report I have a fix for this and I've built/tested Qemu 1.2.1 from sources. It requires one line changing in net/tap-bsd.c.
Code:
macbookpro:qemu_tap_fix nickb$ diff -c tap-bsd-original.c tap-bsd.c
*** tap-bsd-original.c   2012-11-19 20:08:21.000000000 -0500
--- tap-bsd.c   2012-11-21 21:27:12.000000000 -0500
***************
*** 43,49 ****
      struct stat s;
  #endif
 
! #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
      /* if no ifname is given, always start the search from tap0/tun0. */
      int i;
      char dname[100];
--- 43,50 ----
      struct stat s;
  #endif
 
! #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__APPLE__)
!    /* Added APPLE to above definitions to fix OSX - Nick B. 21-11-12 */
      /* if no ifname is given, always start the search from tap0/tun0. */
      int i;
      char dname[100];


Test script to call Qemu:
Code:
qemu-system-i386 \
-cpu pentium2 \
-m 1024 \
-net nic,vlan=0 -net tap,ifname=tap0,script=no \
-net nic,vlan=1 -net tap,ifname=tap1,script=no \
-net nic,vlan=2 \
-net nic,vlan=3 \
-net nic,vlan=4 \
-net nic,vlan=5 \
-kernel asa842-vmlinuz \
-append "ide_generic.probe_mask=0x01 ide_core.chs=0.0:980,16,32 console=ttyS0,9600n8 \
bigphysarea=65536 auto nousb ide1=noprobe no-hlt" \
-initrd asa842-initrd.gz \
-icount auto \
-nographic \
FLASH \
-serial telnet::4444,server,nowait \
-writeconfig working.cfg


And finally check for existence of the interfaces in OSX:
Code:
macbookpro:qemu_tap_fix nickb$ ifconfig -l
lo0 gif0 stf0 en0 fw0 en1 en3 en2 tap0 tap1


Now if someone could help me get this into the Qemu sources...

_________________
GNS3 0.8.4 running on Windows 8.1
GNS3 0.8.4 running on CentOS 6.5


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Thu Mar 07, 2013 3:00 pm 
Offline

Joined: Thu Mar 07, 2013 2:57 pm
Posts: 5
Hi guys,

I have been playing around with this trying to get it working... finished all the building and compiling and installing... fire up qemu... fire up GNS3... try to boot up ASA and fail...


Gmaz:~ kenan$ python /Applications/GNS3.app/Contents/Resources/qemuwrapper.py
Qemu Emulator Wrapper (version 0.8.3.1)
Copyright (c) 2007-2011 Thomas Pani & Jeremy Grossmann

Qemu path (qemu) is valid
Qemu-img path (qemu-img) is valid
Qemu TCP control server started (port 10525).
Listening on all network interfaces

Connection from ('127.0.0.1', 52276)
[Errno 54] Connection reset by peer
Connection from ('127.0.0.1', 52277)
Shutdown in progress...
Shutdown completed.
Qemu path is now /Applications/GNS3.app/Contents/MacOS/qemu
Qemu-img path is now /Applications/GNS3.app/Contents/MacOS/qemu-img
Working directory is now /tmp
!! ASA1.console = 3001
!! ASA1.netcard = e1000
!! ASA1.kernel = /Users/kenan/GNS3/Images/asa842-vmlinuz
!! ASA1.initrd = /Users/kenan/GNS3/Images/asa842-initrd.gz
!! ASA1.kernel_cmdline = console=ttyS0,9600n8 bigphysarea=16384 auto nousb ide1=noprobe hda=980,16,32
Deleting old flash file: /tmp/ASA1/FLASH
Formatting '/tmp/ASA1/FLASH', fmt=qcow2 size=268435456 encryption=off cluster_size=0
/Applications/GNS3.app/Contents/MacOS/qemu-img returned with 0
Starting Qemu => /Applications/GNS3.app/Contents/MacOS/qemu -name ASA1 -m 256 -hda "/tmp/ASA1/FLASH" -kernel "/Users/kenan/GNS3/Images/asa842-vmlinuz" -initrd "/Users/kenan/GNS3/Images/asa842-initrd.gz" -append "console=ttyS0,9600n8 bigphysarea=16384 auto nousb ide1=noprobe hda=980,16,32" -net nic,vlan=0,macaddr=00:00:ab:7d:01:00,model=e1000 -net nic,vlan=1,macaddr=00:00:ab:8a:15:01,model=e1000 -net nic,vlan=2,macaddr=00:00:ab:64:cb:02,model=e1000 -net nic,vlan=3,macaddr=00:00:ab:08:26:03,model=e1000 -net nic,vlan=4,macaddr=00:00:ab:59:6d:04,model=e1000 -net nic,vlan=5,macaddr=00:00:ab:41:11:05,model=e1000 -serial telnet::3001,server,nowait
Warning: vlan 0 is not connected to host network
Warning: vlan 1 is not connected to host network
Warning: vlan 2 is not connected to host network
Warning: vlan 3 is not connected to host network
Warning: vlan 4 is not connected to host network
Warning: vlan 5 is not connected to host network
Qemu has exited with return code -11
Unable to stop Qemu instance ASA1
[Errno 3] No such process
[Errno 32] Broken pipe
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52277)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
self.finish()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
self.wfile.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Thu Mar 07, 2013 8:38 pm 
Offline

Joined: Fri Feb 03, 2012 7:16 pm
Posts: 29
are you using the latest pre release or build qemu yourself ?


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Thu Mar 07, 2013 10:47 pm 
Offline

Joined: Thu Mar 07, 2013 2:57 pm
Posts: 5
franco64 wrote:
are you using the latest pre release or build qemu yourself ?


I built Qemu myself. I build the 0.11 ver but it didnt work. I then built 0.11. but still no luck. From what I can see Qemu is actualy running... so is the Cisco ASA 5520 ... but connections to the console are refused... I will try the method described in your post tommorow... I'll have to wipe all the stuff I did first to make it a clean install.


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Tue Jun 18, 2013 8:21 pm 
Offline

Joined: Fri Aug 26, 2011 4:38 am
Posts: 5
After removing QEMU and trying to install again I get the following error:

Jorge-Avelars-MacBook-Pro-2:QEMU-0.11.0-GNS3-OSX jorgelavelar$ ls
Qinstall Qinstall.c README.TXT install src
Jorge-Avelars-MacBook-Pro-2:QEMU-0.11.0-GNS3-OSX jorgelavelar$ ./Qinstall

Segmentation fault: 11

I can't figure out how to get passed this.

Pls help! Dying to get the ASA to work on my MacBook Pro.


Top
 Profile  
 
 Post subject: Re: How to install Qemu on MAC OSX 10.6 & 10.7
PostPosted: Thu Jun 20, 2013 3:24 am 
Offline

Joined: Tue Jul 17, 2012 1:34 pm
Posts: 214
jorgelavelar wrote:
Pls help! Dying to get the ASA to work on my MacBook Pro.

I recommend downloading a precompiled binary from: http://sourceforge.net/projects/gns-3/f ... %20OS%20X/

There you can find Qemu-0.11.0 and Qemu 0.14.1. Both have been extensively tested with ASA and work well on OS X.

Best of luck,
Jason



_________________
J.Neumann, GNS3 Contributor & Forum Moderator (Minion ID: sin.zx81.1981ad)
Author: Cisco Routers for Small Business (Apress)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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