Page 1 of 1

Redirect Network of virtual machine to host

Posted: 13. Jan 2014, 22:48
by LukasBieri
Hello everyone,
I just registered so I am sorry for any mistakes I make :)
I don't speak english that good and I have not that much experience with virtual machines, so please don't be to rude if I make any stupid mistakes :mrgreen:

I bought an ALFA awus036h a few years ago and used it under snow leopard on my macbook pro and in a virtual machine running linux. I was really happy with the combination because I could work over the external wifi dongle on Mac OSX and Linux at the same time. I could also share the connection of the wifi-dongle over the built-in wifi-antenna of the MacBook under Mac OSX. For this I used the "network sharing" function which can be found in the System Settings.

About a week ago I bought a newer MacBook Pro and installed Mavericks onto it. I moved the VirtualBox-image onto my new system and it runs fine as it should. But unfortunately MAC OSX Mavericks does not support the Network utilities for my wifi dongle. I can use it under Linux in my virtual machine but I can't use it to work with Mac OS X.

I have had an idea how I could possibly solve this problem: If it would be possible to share the internet connection of my virtual linux-machine with my Mac OSX I could work in Mac OSX and even share the network connection over the "network sharing"-function.

My problem is now: How can I share a network of a virtual machine to use it on the host machine? The tricky part is of course that I don't want to use the built-in wifi antenna because I would like to use it to share the network for other devices like my iPhone.

How can I set this up? Is it possible to emulate something like a virtual networkcard for the HOST and send the signal of the virtual machine to this virtual network card on my host system? Or is there an even simpler solution?

I would be so glad if anyone could help me!
Thank you very much!

Best wishes from Switzerland :)

Lukas

Re: Redirect Network of virtual machine to host

Posted: 13. Jan 2014, 23:45
by noteirak
Use a host-only interface! This would be like a direct cable between your host and your VM. You can then configure the guest to be the default gateway on the host.

Re: Redirect Network of virtual machine to host

Posted: 14. Jan 2014, 00:24
by LukasBieri
Thank you very much for the tip!
I have created a host-only-network called vboxnet0 in the virtualbox-settings. Then I created a secons network-adapter for my virtualmachine, chose the option "host-only-adapter" and chose my created network.

What should I do now? I guess I should see the created "Network card" on the host system, shouldnt I? And how can I set the default gateway on the host?

Thank you :)

Re: Redirect Network of virtual machine to host

Posted: 14. Jan 2014, 10:59
by noteirak
You already have the network card in your host, that's the vboxnet0.
Add a gateway to it, being the IP of the guest, and configure the guest properly.

Re: Redirect Network of virtual machine to host

Posted: 15. Jan 2014, 00:29
by LukasBieri
Thank you for the help, but I still don't get it :(

I am really new in this subject, so I would be glad if you could give me some more details.

I googled for it but did not understand what I should do next. Could you eventually make a step-by-step guide how to set that thing up correctly?
That would help me a lot!

If not, could you eventually send me a link to a tutorial or something similar?

Sorry for acting that amateurish, I try my best to understand everything :wink:

Thank you in advance!

Re: Redirect Network of virtual machine to host

Posted: 15. Jan 2014, 11:45
by noteirak
I'm not sure what you don't understand here : how to configure a network card? Google would give you a lot of step-by-steps.
how to configure the host-only network between the host and guest?

Re: Redirect Network of virtual machine to host

Posted: 15. Jan 2014, 23:50
by LukasBieri
Well, to be honest I don't undestand both of them... :(

I don't want to sound lazy, but a tutorial to solve my problem would be very nice! I can understand if you would like more to show me the right way, but right now I have no idea for what I should google or how I could set that whole thing up...

I think that I need to "marry" my wifi-dongle with the host-only-network, am I right? But how ca I do this? And how can I then cause my mac to receive and send packets trough that connection? I would also like to have a solution for easy switching between my internal AirPort-Card and this "virtualmachinte-to-wifi-dongle-connection". Will this be possible once the setup is done? Or do I need to use Terminal every time I want to connect to my VM and back to my AirPort-Card?

Thank you for your patience and your helpfulness :)

Re: Redirect Network of virtual machine to host

Posted: 16. Jan 2014, 10:09
by noteirak
I don't have a OSX host I am afraid, so I can't really give you a step by step guide.
What you should search for is : configure default gateway in OSX - you don't want to configure it on the interface but in the system directly, making it point to the good gateway (the guest IP).
In the guest IP, you need to use the program you were talking about to share the network connection on the host-only interface, the one with the IP starting with (by default) : 192.168.56

Re: Redirect Network of virtual machine to host

Posted: 16. Jan 2014, 21:00
by LukasBieri
Thank you again very much for the help!

I think I now successfully connected the host and the guest trough a Host-only-Adapter. I can at least ping the guest from the host with the ip 192.168.56.1 and the host from the guest with the ip 192.168.56.1. The next step ist now connecting the wlan0 of the guest to the eth0-connection which is the Host-only-Adapter. I think you got me wrong, the program I meant is a tool of Mac OSX (the host, not the guest).

To connect to a network interface with my guest I use the application "wicd network manager". The problem with it is, that I can only connect to one network a time. I should be able to connect to two networks, once the eth0 and once to the wlan0. Then I should force the guest to forward all the traffic of wlan0 to eth0 and all the traffic of eth0 to wlan0. How can I do this?

The last step then would be to set the network adapter "vboxnet0" which can be seen on the host by typing "ifconfig" into the terminal as the default adapter of Mac OS X. Unfortunately the interface is not shown in the network interface-list in the system settings. I don't know how I could add it to this list, so I have to google for that.

Thank you for your help in advance!

Re: Redirect Network of virtual machine to host

Posted: 17. Jan 2014, 13:25
by noteirak
I am afraid the rest is up to you - this is very much out of scope of this forum but I gave you the extra bit of info already.
Also, I really don't know OSX so I can't tell you more or I could give you wrong info and break your networking.

If you can find some local support, or a OSX/routing forum, that would be best in your case.