Printing from within a WinXP Virtualbox client with a Mac OSx host

I have an Mac OSx machine on which I have virtualbox installed. My most often used virtual client machine runs Windows XP. Almost everything works great, but I was having a lot of issues getting printing to work. I finally got everything figured out though and figured I’d write it up real quick. So here’s what I did.

The first thing I would recommend doing if you have a setup like mine is to find the driver for the printer that you need to print to. Why? Because the apple software that I point you to below will install a driver by default that technically works, but it makes everything you print come out super small. [Actually, as I'm writing this is occurs to me that it may be doing this when I print because Apple assumes an HP printer in their tool, but mine is an Epson.  So maybe the default installed by the program provided by Apple will work "out of the box" for an HP printer... But I would still go ahead and get the correct driver for your printer first.]

Then once you have the driver on the client do the following (found this at virtualbox.org forum and quoted from here):

1) Shutdown the VirtualBox machine
2) Under Mac OS X

  1. System Preferences, Print & Fax, Check “Share this printer on the network”
  2. System Preferences, Sharing, Check “Printer Sharing” and Check the printer

3) VirtualBox machine, Network:

  1. if only one adapter selected and it is attached as NAT [this is the default], then add Second adapter. Make it attached as Host-only Adapter and choose the name: vboxnet0 (see note B at the bottom if you can’t find this).
  2. if the adapter is attached as Bridged Adapter, then do nothing (you have a reason to be Bridged?)

4) Start up the Vbox machine – let it adjust to added Network Adapter
5) Download and install from Apple “Bonjour Print Services for Windows” http://support.apple.com/kb/DL999
6) start Bonjour Printer Wizard and follow the menus

Note A: That wizard will allow you to print from the client using the printer on the host MacOSx machine. But that wasn’t it for me because Apple defaulted to an HP driver which caused the pages to print all tiny on my Epson. It was an easy fix though. I just had to go back and run the brand specific printer driver install (or manually change the printer driver for the printer added by the apple wizard) so that it would use the brand specific driver instead of the Apple default.

Note B: I did a fresh vbox install to test this because some people weren’t seeing the vboxnet0 at this stage. I was able to reproduce the problem and fix it based on another reader’s suggestion. All I had to do to get it fixed was go to ‘VirtualBox’->’Preferences’->’Network’. It’s probably completely blank for you if you’re reading this note. What you want to do is just click the little green plus to add a new hostonly network and it’ll add ‘vboxnet0′. Now go back and finish the tutorial where you left off and you should be printing in no time. Hope that helps.

Note C: In the comments below you’ll see a couple of readers (Jeffrey Weber and Leigh Warren) that were only able to get things working by using Bridged instead of HostOnly (see step 3 above for where this matters). The “method” I defined in the main part of the post seems to work in most cases, but there is obviously some type of setup that requires bridged rather than host-only. I recommend that you try it the original way first and then double check everything if it doesn’t work. After that if the original way still doesn’t work you might try tweaking this setting going bridged instead. Keep in mind that if you’re already bridged and everything is working then, as the original write up says, do NOT add the host-only.

Bookmark the permalink.

37 Responses to Printing from within a WinXP Virtualbox client with a Mac OSx host

  1. Jan van der Ploeg says:

    Great! That worked for me! Thanks for posting :)

    Regards, Jan van der Ploeg
    the Netherlands

  2. Zvi says:

    Thanks for writing about this. I am running Windows 7 Prof on my Virtual Machine.
    I was only able to get up to step 3a, and I got stuck.

    Only one adapter is initially there, NAT. When I try to add a new adapter, by checking enable adapter, and selecting ‘Host-only Adapter’, there are no options for Names found in the drop-down menu.

    Any advice?

  3. Peter Nosko says:

    Many thanks for posting this. It worked for me using a Windows7-64 Pro guest!

  4. dwhoser says:

    Thanks. I had to make the second adapter bridged and it worked perfectly!!!! VirtualBox be praised!!! I can do all Windoze thiings on my MacBook Pro!!!!!

  5. Darren says:

    I have the exact same problem as Zvi:
    “I was only able to get up to step 3a, and I got stuck.

    Only one adapter is initially there, NAT. When I try to add a new adapter, by checking enable adapter, and selecting ‘Host-only Adapter’, there are no options for Names found in the drop-down menu.”

  6. Raffael says:

    As described in this german article: http://bytelude.de/2011/10/14/host-only-netzwerk-adapter-mit-virtualbox/#comment-1164,
    you first have to open Virtual Box preferences (not the ones of your virtual machine) and go to the Network tab and click on the green plus on the right side. Copy the IP address into the first field of the DHCP tab and define the IP range.

    After that, go back to this How To, now the error message should not appear anymore! (worked for me)

  7. admin says:

    I don’t remember having to do this when I set it up, but I’ll take a look at my configuration. If I see that it looks like I did this (maybe for some different reason) then I’ll let everyone know. For the person receiving that particular error maybe this is the solution. Thanks for the comment.

  8. admin says:

    @Darren and @zvi, I’m sure you got this figured out by now, but the issue you were having was that you had not yet added a hostonly adapter to your virtualbox setup. I did a fresh vbox install to test it and all I had to do to get it fixed was go to ‘VirtualBox’->’Preferences’->’Network’. It’s probably completely blank for you. What you want to do is just click the little green plus to add a new hostonly network and it’ll add ‘vboxnet0′. Now go back and finish the tutorial and you should be printing. Hope that helps. I’ll be adding this to the tutorial itself also.

  9. Josh says:

    I’m using a mac os x as my host and xp on VB is there a way to connect to a printer on a wireless network?

    Thanks
    Josh

  10. admin says:

    @josh – I pretty certain that this tutorial covers what you’re asking just fine – because I’ve got the exact same setup you’re asking about.

    My Macbook is running OSX with virtual box installed and connected wirelessly to a printer. So – MacOSX host with Windows XP as the guest OS. The fact that the printer is wireless doesn’t matter here because we’re not printing directly to the printer. We’re printing to a shared printer on the host… atleast that’s the way I did it. Were you trying to do something else?

  11. Jeffrey Weber says:

    I got as far as running the Bonjour Printer Wizard but the Wizard comes back with an “Error 1796 – You do not have sufficient access to your computer to connect to the selected printer,” even though I’m logged on to administrator accounts in both the host and guest environments.

  12. Jeffrey Weber says:

    I found an Apple tech note at http://support.apple.com/kb/TS2234 that supposedly addressed my issue but I still could not get the wizard to run successfully. I only include it here for the benefit of anyone else who might encounter this issue. It might work for you but it didn’t work for me. I finally got it to work but I had to do it with a bridged adapter instead of a host-only adaptor. I’m guessing the reason is that my printer has wireless capability and I have it connected wirelessly to my base station instead of having it plugged in directly.

  13. admin says:

    @JeffreyWeber, I’m glad you found a workaround and thanks for posting it back here. Maybe it will help someone. Unfortunately your guess about it being a wireless printer that was causing the difficulty is wrong since I’ve got the same setup and it is what I based this post around.

  14. Skip W says:

    Bonjour installed as advertised but the “Add a Printer” routine in Win XP isn’t completing the routine.
    It finds the name of my workgroup, shows an hour glass, then gives up (the hourglass disappears).

    Any suggestions. (and thanks for this really useful article)

  15. Skip W says:

    I spoke too soon.
    Bonjour Printer Wizard finds the printers attached to other PC’s — but not a networked printer (which is what I need).

    Perhaps this is not a Virtual Box issue.

  16. admin says:

    @Skip W
    You need to make sure that your host has the printer set up so that the host can print to the printer. Then you share that printer. I don’t think you can print from a client directly to a network printer… Instead you’re going to be using the host on which the client is running as sort of proxy to the printers that it has access to. Hope that helps

  17. Martin H says:

    Yes, you can print directly from the client to a network printer. I made this work by simply changing the VM’s network adapter to bridged mode. The XP VM gets it’s address via DHCP from the main router, just like the host Mac, and the network printer installs in XP just as it would on a real PC. Having the VM(s) on the same subnet as the Mac(s), real PC(s), and other network devices (i.e, printers) makes it simple. No Bonjour or printer-sharing needed. It even works on a mixed wired/wireless network!

  18. Graham says:

    I am following the directions suggested but get up to VirtualBox / Devices / Network Adapters and there is no green “add an adapter” button. Adapter 2, 3….etc is greyed out as is “Enable Network Adapter” check box (which is checked).

    Help will be greatly appreciated.

    I am running XP guest on Lion host.

  19. Graham says:

    Yep. I had XP guest running!
    Thunk it through a bit……..now running OK.
    Thank you for being there.

  20. Fook says:

    Worked a treat, thanks heaps!

  21. xavier says:

    super, thanks.

  22. Phil Champ says:

    Guest = Windows 7 Ultimate
    Host = Mac OS X 10.8.2
    Wireless Brother HL-4570CDW laser printer

    Worked for me! Props for the post.

  23. vanilla says:

    Guest = win7
    Host = osx 10.7
    vbox 4.2.4 (newest as of 2012-12-12)

    When I try to select Attached to “Host only”, vbox won’t let me select vboxnet0 nor any name at all, and “invalid settings detected” is by red warning lite.

    However, I think I’ll be able to get it to print with:
    (*) No additional vnets (just the one NAT adapter).
    (*) No printer sharing on mac host
    (*) No bonjour on windows guest

    If I do an IPCONFIG in win guest, it shows gateway for NAT adapter is 10.0.2.2. If I turn on websharing on mac, then win can see http://10.0.2.2 and http://10.0.2.2/~username (if you want to share from mac to win readonly, just put files in your ~/Sites folder).

    And http://10.0.2.2:631 gets through, but says “Bad Request”. So I think all I need to do is tweak cupsd.conf to allow 631 and/or 515 through from 10.0.2.x (or LOCAL?). If I get it working, I’ll post back here with a complete step-by-step that even a compleat idiot like me could follow.

  24. admin says:

    @vanilla,

    I’m at work right now so I can’t see it, but the most often overlooked step relative to what you are talking about is “Note B” in the post. You have to add the new virtual interface at the VirtualBox application level – not just at the individual virtual machine level. Let me know if that helps!

    I get quite a few comments saying it works great exactly as I describe so you might want to make sure you followed the post step by step before spending too long chasing down a different solution. Good luck!

  25. DaveN says:

    Great stuff–I’m printing from XP VM to HP printer connected directly to my wireless router. I needed to change the adapter type (Advanced) of the new Adapter I set up to match the adapter type of my default NAT adapter. Both needed to be Intel PRO/ 1000 T Server. Once I made this change, everything worked as you described.

  26. admin says:

    @DaveN Glad to hear it helped you! Thanks for including your tweaks.

    I didn’t personally have to make the adjustment you described, but it’s possible mine may have defaulted to the correct value. Good bit of info for others though!

  27. Patrick says:

    Thanks, big help.

  28. Dedi says:

    Great tutorial, work great on my Mac.

    May i copy it to my blog with indonesian translation.

    Thank

  29. Jakota says:

    You are a lifesaver! Thank you :)

  30. Nige Morgan says:

    Excellent tutorial. Macbook running OS X Mountain Lion with a fresh install of VB. Had to go to note B and took me a couple of goes to spot that network>preferences was in the main VB menu, not the machine one. Works a treat running Windows XP connecting to my HP6500 wireless. Many thanks

  31. Leigh Warren says:

    Like Jeffrey Weber stated below I also had to do the below to get it to work and it did so thanks Admin and thanks also to Jeffrey Weber.

    “Jeffrey Weber says:
    June 20, 2012 at 1:16 pm
    I found an Apple tech note at http://support.apple.com/kb/TS2234 that supposedly addressed my issue but I still could not get the wizard to run successfully. I only include it here for the benefit of anyone else who might encounter this issue. It might work for you but it didn’t work for me. I finally got it to work but I had to do it with a bridged adapter instead of a host-only adaptor. I’m guessing the reason is that my printer has wireless capability and I have it connected wirelessly to my base station instead of having it plugged in directly.”

  32. admin says:

    Thanks, Leigh. I’m glad you got it working and found this useful. I think I’m going to add another Note to the tail of the article pointing out what you and Jeffrey Weber are saying. I still don’t think that it’s the norm, but it obviously works in certain cases and may be useful for others with set ups like your own. Thanks again.

  33. Andrew says:

    You are a lifesaver, thanks for the help!

  34. Corey says:

    Thanks you’re a life saver. Less head mashing, more happiness.

  35. CastleW says:

    Thanks a lot. It worked fine for me with a Windows 7 x64 VM.

  36. Pingback: Printing from within a WinXP Virtualbox client with a Mac OSx host – Pool Of Thought | Spice Ridge Journal

  37. Marco Lagace says:

    Xcellent! worked for my xp64 virtualbox setup!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>