VMWare style host only networking

This is for discussing general topics about how to use VirtualBox.
Post Reply
kfries6
Posts: 6
Joined: 20. May 2007, 19:43
Location: Denver, Colorado
Contact:

VMWare style host only networking

Post by kfries6 »

Does anyone know how to setup using VirtualBox a network strictly between the VMs and the host? Here is what I have using VMware, and would like to recreate using VirtualBox:

My computer has 2 physical interfaces: eth0 and eth1. The first interface is attached to a land-line nic. The second interface is attached to a wireless nic.

When I installed VMWare, it created two additional network interfaces: vmnet1 and vmnet8. I rarely use vmnet8, but this interface bridges to the internet (what Virtualbox incorrectly calls host networking). The other interface vmnet1 only exists in the memory of my laptop. It provides dhcp to assign addresses, and does not route to the internet. The vmnet1 interface on the host has an IP address on the same network as the virtual machines using the host only network. This allows the virutal machines to see and interact with the host and other VMs, but not to the internet as a whole (except for software update, but that is done by installing apt-cacher on the host, so the VM does not see the internet, it sees the proxy).

How can I create the same setup in VirtualBox?
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Post by Technologov »

Easily:

tunctl -t tap0 -u tuxuser
ifconfig tap0 10.0.0.1up

Now attach you're guest to tap0, and make guest's IP: 10.0.0.2 and you're done !

Unfortunately there is no GUI way to do that. :(
kilou
Posts: 53
Joined: 14. May 2007, 10:16

Post by kilou »

noob question: how do you assign a fix IP (here 10.0.0.2) to a XP guest?

Does this method allow to use both eth0 (wired) and eth1 (wireless) in the VM?
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Post by Technologov »

LOL: how can you speak about wireless if we are speaking about connecting to host-only ?! he-he

You give fixed IP in Windows XP via "Network Connections" GUI. Even Windows 95 has this feature.
kilou
Posts: 53
Joined: 14. May 2007, 10:16

Post by kilou »

Technologov wrote:LOL: how can you speak about wireless if we are speaking about connecting to host-only ?! he-he
:oops: I see. So this is used just to enable file sharing between host and VM but nothing related to external network connections?
Technologov
Volunteer
Posts: 3342
Joined: 10. May 2007, 16:59
Location: Israel

Post by Technologov »

kilou:
Well, theoretically you can bridge to Wireless, like this:
tunctl -t tap0 -u tux
ifconfig tap0 0.0.0.0 up
brctl addbr br0
brctl addif br0 ra0 tap0
dhcpcd br0
ifconfig ra0 0.0.0.0

ra0 is your WiFi connection.
Look at my VirtualBox guide:
http://forgeftp.novell.com/lfl/.html/virtualbox.html
See chapter: "Intermediate Topic: Networking via Host Bridging"
kilou
Posts: 53
Joined: 14. May 2007, 10:16

Post by kilou »

Thanks Technologov, I'll look into this!
kfries6
Posts: 6
Joined: 20. May 2007, 19:43
Location: Denver, Colorado
Contact:

VMWare style host only networking

Post by kfries6 »

Technologov wrote:Unfortunately there is no GUI way to do that. :(
PERFECT!

This is just what I was looking for. Now at the risk of starting a flame war...

I can think of several ways of automating this. In my most demanding situation, I have machines that I need to have running right from startup (even before login if possible). I have seen some postings on editing the inittab directly, which is not a good idea for so many reasons. The other way that makes sense to me to to provide a init.d startup script.

Does anyone know if there is a preferred way to start up one or more VMs automatically on startup?

Thx
kilou
Posts: 53
Joined: 14. May 2007, 10:16

Post by kilou »

Technologov wrote:kilou:
Well, theoretically you can bridge to Wireless, like this:
tunctl -t tap0 -u tux
ifconfig tap0 0.0.0.0 up
brctl addbr br0
brctl addif br0 ra0 tap0
dhcpcd br0
ifconfig ra0 0.0.0.0

ra0 is your WiFi connection.
Look at my VirtualBox guide:
http://forgeftp.novell.com/lfl/.html/virtualbox.html
See chapter: "Intermediate Topic: Networking via Host Bridging"
I've tried that (replaced ra0 with eth1 since my wireless is eth1) but I have no connection in the guest :( I'm looking for a way to setup networking so that I always have network between host and guest, wired internet access when eth0 is connected and wireless internet access when eth1 is connected. Is this possible to do?
michael
Oracle Corporation
Posts: 682
Joined: 10. May 2007, 09:46
Contact:

Post by michael »

Many wireless cards do not support bridging. You might want to set up routing between the host interface and the wireless card (see http://virtualbox.org/wiki/Advanced_Networking_Linux in the user-contributed HOWTOs section of http://virtualbox.org). Or you might want to consider whether you really need host networking (if you just want a couple of servers on the virtual machine to be accessible from the network you can set up port forwarding to the guest).
Post Reply