QEMU on OS X 10.5 running Linux guest with networking

Discussion in 'PowerPC Macs' started by Lastic, May 29, 2016.

  1. Lastic, May 29, 2016
    Last edited: Jun 28, 2016

    Lastic macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #1
    Finally after tinkering around on and off for the past month , I got it done.

    For my certification I play around with a virtual version of Cisco IOU ( the OS that runs on their routers/switches)
    http://ciscoiseasy.blogspot.be/2014/07/iou-forbidden-fruit.html
    to create network labs running on a Debian x86_64 VM in VMWare Fusion on my OS X 10.11 powered Macbook Pro Retina.

    I knew that I needed about 512 MB of RAM to boot the VM and any lab I wanted to have running.

    I've been trying to get the same VM setup on my Powerbook G4 12" for quite a while now.

    Things I've tried :

    - Debian/Ubuntu PPC with QEMU(-KVM) but then I can't play any video training because of the NO 3D acceleration for the Nvidia card in this Powerbook
    - FreeBSD PPC but that means compile from source (Ports) since it's a Tier 2 architecture and QEMU doesn't
    give me any console output because I didn't install X11
    ( I gave up after it was compiling for 2 full days with still no working install )

    The goal was to have QEMU work in OS X 10.5.8 PPC, I could play videos using Coreplayer and I don't have to boot into another OS.

    Steps taken :

    - Installed Macports
    Leopard
    - Installed QEMU 2.2.0 via Macports
    ( the more recent versions won't let me allocate all the free memory I can use )

    - Cheated by creating the Debian VM using qemu-system-i386 on my MBp Retina
    I used Debian Jessie i386 no Desktop Environment , text mode , only SSH .

    - Installed TUN/TAP drivers to bridge the NIC from the VM to my OS X host ( my Powerbook )
    https://sourceforge.net/projects/tuntaposx/files/tuntap leopard legacy/20080607/

    Then ran in OS X Terminal :
    sudo -i
    qemu-system-i386 -boot c -hda yourvmname -m 512M -net nic -net tap,script=no,downscript=no

    <Wait until your VM is booted>

    In a seperate Terminal tab :
    sudo -i
    ifconfig tap0 192.168.10.1 ( my real network devices use 192.168.1.x )

    Then in QEMU Debian i386 VM :
    sudo -i
    ifconfig eth0 inet 192.168.10.2
    route add default gw 192.168.10.1 ( send traffic to the tap0 device )

    < You can add this to /etc/network/interfaces so that it will be used at the next reboot
    auto eth0
    iface eth0 inet static
    address 192.168.10.2
    netmask 255.255.255.0
    gateway 192.168.10.1 >

    Et voila, I can now SCP files to the VM and basically leave my MBp at home.

    Sorry for the long tech rambling but hope this might help people to have a virtualisation option on their PPC machine.
     
  2. AphoticD macrumors 6502

    AphoticD

    Joined:
    Feb 17, 2017
    Location:
    Queensland, Australia
    #2
    The current nouveau driver on Ubuntu Mate 16.04.2 works fully 2D and 3D (NV34) accelerated on my PowerBook G4 12" 1.5Ghz with the Nvidia FX Go5200 (64MB). Surprisingly there were no special boot strings to get it working.

    I have acceleration working on my G5 DC 2.3Ghz with the Quadro FX 4500 (512MB PCIe) using "nouveau.config=NvMSI=0"

    G5 DP 1.8Ghz with GeForce FX 5200 (64MB AGP 8x) accelerated without any boot strings.

    But I haven't figured out how to get my G5 DP 2.0Ghz with an GeForce 6800 GT (256MB AGP 8x) to work with acceleration. It seems to be the odd one out.

    And then there is Radeon configs - which just get messy.
     
  3. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #3
    Do the brightness buttons work out of the box on PB 12" ?

    A member here found a way to get them to work by compiling a custom nouveau.ko
    after which we did extensive testing on video playback performance

    {UPDATED} DEBIAN/UBUNTU on Powerbook G4 12" Nvidia FX5200

    My conclusion
    https://forums.macrumors.com/thread...12-nvidia-fx5200.1985604/page-3#post-23306217

    was to go back to Leopard because on Ubuntu video playback would kill the fan/cpu/battery , no Javascript
    on the browsers and qemu didn't work as good as the Macports one on Leopard.

    How's your fps on glxgears on the PB 12" ? Do you run an SSD in it ?

    Can you give me any feedback on these points on Ubuntu Mate 16.04.2 before I wipe and clean install my PB 12" ?
     
  4. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #4
    I've been trying to achieve this exact setup (without the PPC hardware however) for a while now, but without much luck. It seemed that Debian at one point worked well with my tuntap setup, but internet stopped working after I upgraded Debian for some reason. Your method is a tad different from that of other macOS users, so I have a couple of questions.

    First of all, does still work for you, or does this method work on modern hardware and software at all? Secondly, when assigning an IP (? i have no knowledge of network-y stuff whatsoever) to tap0, does the address matter? (i.e. does the final adres '192.168.10.1' in "ifconfig tap0 192.168.10.1" have any special meaning?)
     
  5. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #5
    Well, I don't know which kind of network connectivity you want to have so I'll explain my case.

    I used the exact same setup on my OS X 10.11 only with Qemu 2.3.0 (dont' remember if I installed it via Macports or Homebrew) and a copy of the Qemu Debian image from my PowerPC.

    The Qemu Debian image was created on OS X 10.11 because it's way faster and the same architecture (x86_64/i686)
    so this was done with full network connectivity including Internet access for the net install.

    My setup that I use is what other vendors call : Host Only meaning from my OS X I can ssh/telnet to the the VM and the VM can do the same to OS X but it can't get to the Internet .

    addicted@biggie:~/Downloads$ ssh uz3r@192.168.10.2

    The authenticity of host '192.168.10.2 (192.168.10.2)' can't be established.
    ECDSA key fingerprint is SHA256:dbvZarbH+3WE0RPsBymjECckHXRkEEIkoOd62WEXLrQ.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '192.168.10.2' (ECDSA) to the list of known hosts.
    uz3r@192.168.10.2's password:

    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.

    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Sun Jul 9 07:50:13 2017
    uz3r@IOU:~$ uname -a
    Linux IOU 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) i686 GNU/Linux
    uz3r@IOU:~$ This is my VM accessed via SSH


    The tap0 interface (which is created once your VM boots) is hence the gateway between OS X and the VM so I assigned
    192.168.10.1 and assigned the VM 192.168.10.2 with a default gateway pointing to 192.68.10.1

    In this screenshot I try to ping to Google DNS and the IP adres of my MBp WiFi addres but the VM can only reach the tap0
    interface which is it's gateway

    Screen Shot 2017-07-09 at 07.51.32.png

    If you need any further help, just let me know
     
  6. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #6
    Ah right, thanks! I'm not really interested in ssh acces per se, and more looking to connect to the internet (with a method which once worked but now stopped). Can the method you have used here be extended to allow full internet access in the VM/guest as well?
     
  7. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #7
    My method is what VMWare calls "Host-Only" , not what you want.

    From Google searches , I found -net nic -net user should give you the ability to request a DHCP address in the VM and have access to the Internet.
     
  8. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #8
    Thank you for your answer! I'm not sure what you've googled or what you've determined my problem to be however, so I'm unsure how I should use those flags with my current call to qemu. Right now I'm using this guide: https://github.com/nerves-project/nerves_system_qemu_arm/blob/master/README.md. This guide worked at one point.

    Did you mean that I should append '-net nic -net user' to the qemu call from your OP? If I combine the flags with the setup from the github guide sudo tcpdump -i tapX on my host shows all the request correctly (although it already did without them), but I do not make any 'hops' at all with a traceroute on 8.8.8.8 within the guest. If I traceroute without the -net user flag, I get stuck on the first hop at my gateway IP of my guest, which is equivalent to the inet adress shown by ifconfig on my host for the bridge interface I created.
     
  9. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #9
    Hi, my OP will not work for your case.

    I just read that adding only -net nic -net user as network parameters should be enough for your purpose to have your guest VM access the Internet.

    The github setup guide that you are following indeed uses a TAP device which it bridges to a physical device and then
    it sets up the necessary routing , dhcp and DNS.

    This is what VMWare Fusion calls "Internet Sharing" , "Shared with my MAC" .

    It will use your en0 interface IP address to access the internet but NAT's the traffic back to your guest VM.

    However unfortunately I don't have any experience with such a setup in QEMU, maybe another forum-member might be able to chime in to help you ?
     
  10. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #10
    i love you why did I waste a full day on this
     
  11. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #11
    I'm not sure if I understood you correctly ?
     
  12. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #12
    Nothing, I greatly appreciate your tips! I had not found anywhere that setting up qemu internet networking was just a matter of two simple command line parameters, and tried to do something with taps/NATs/whatever for quite some time, to almost no avail.
     
  13. Lastic thread starter macrumors 6502

    Joined:
    Mar 19, 2016
    Location:
    North of the HellHole
    #13
    Ok, so using -net -nic works for you ? Just stumbled on it, most other explanations where also bridging a tap device and messing around with NAT/routes and stuff.

    Just so I know for future uses :
    1. Do you still have to add a bridge on your host or tap device ?
    2. Does DHCP and DNS work for your Guest or do you a static IP ?
    3. Did you have to change anything to your routing (default gateway,routes,etc) on your host and/or your guest VM ?
     
  14. rien334 macrumors newbie

    rien334

    Joined:
    Jul 8, 2017
    #14
    1. Nope, I do not use any taps or bridges anymore. The only net parameters I launch qemu with are -net user -net nic. I think '-net user' made it work though, as I had already tried '-net nic' per the github guide I posted earlier.
    2. I use the default configuration in /etc/network/interfaces, so I guess I leave most of the network connectivity in Debian (my guest) as is. I believe a Debain installation uses DHCP and DNS by default if it finds a working and connected eth0 device, but I barely know what DHCP and DNS are. I'm confident my IP is not static however. I had to edit /etc/resolv.conf and change the name server to something close to my inet address of the default eth0 device however, but that might have been due to previous incorrect edits to that file.
    3. I have installed a bunch of networking software on my host, but I think I made sure to disable as much of it as I could before I tried your suggestion. So I guess I did not have to make any changes to my routing. The weird thing is that just adding -net user -net nic did not work a few months ago (if my memory serves me correctly), but since then I have build qemu from source from the most recent sources, which is possibly the only required preconfiguration step.
     

Share This Page