Page 1 of 1

Understunding TAP a bridging

Posted: 5. Sep 2008, 14:59
by sirio81
Hi all, this is my first experience with vbox and virtualization in general.
I virtualized a distribution called debian-edu (guest) insede a debian lenny (host).

I test the "internal network" with another guest and it works fine.

Now I'm studing HIF (host interface networking).
When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable:
Since the Linux kernel has built-in support for virtual network devices (so-called TAP interfaces), VirtualBox on Linux makes use of these
From the point of view of the host, it looks like the guest’s network card is connected to the TAP interface with a network cable.
So, from that I understund that , even before create the bridge, the guest and the host are i contcatc bye the virtual network card vbox0.

Code: Select all

host-eth0 (phisical)
       -vbox0 (virtual)
            |
            |
guest-eth0
In theory, i should be capable of pinging the host from the guest because the ICMP request goes from guest eth0 to vbox0 on the host.
Is it right?

I created the vbox interface (VBoxAddIf vbox0 myuser) and checked that myuser is in the vboxusers group.
I enabled only a netowrk card in the virtual machine (guest) choosing "host interface" and setting "vbox0" like "interface name".
When I start the virtual machine, the guest doesn't show any interface (ifconfig). Why is it not correct? What should I do?


Actualy I'm not trying to create a bridge. I'm just trying to understund the theory and functions of vbox (and networking in general).

If what I say is right, any request (tcp packages) from guest interface, arrive to vbox0 and stop there (without the bridge).
Setting up the bridge between the host interfaces (eth0 and vbox0) will forward the rquest from the guest (from its eth0) to exit from the host eth0, reaching the true network.
Is it right?

Code: Select all

                         
computer1---------
                  switch
computer2---------
                   |
                   |
host-eth0 (phisical)--
       -vbox0 (virtual)
            |
            |
guest-eth0

Posted: 5. Sep 2008, 19:39
by Sasquatch
You are spot on on your assumptions. This is exactly how HIF works. As for your eth0 issue, did you change the MAC address by chance that is send to the VM? If you did, then you need to modify your rules file to reflect this. Default location for it (on my Ubuntu) is /etc/udev/rules.d/70-persistent-net.rules. Either remove the lines or edit it, then reboot the Guest system.

Posted: 5. Sep 2008, 23:07
by jschellhaass
What does ifconfig -a show on the guest?

jeff

Posted: 6. Sep 2008, 12:14
by sirio81
As for your eth0 issue, did you change the MAC address by chance that is send to the VM?
What do you mean? Why should I chagne the MAC address? Are you speaking about the guest eth0?
Actualy, what I want is to have an eth0 on the guest that comunicates with vbox0 with the host.

From the "ifconfig" of the guest, I see only the loopback, no eth0.
On the vritual machine settings I enabled only a network card (HIF).


On the host (didn't configure yet)

Code: Select all

vbox0     Link encap:Ethernet  HWaddr 00:ff:31:37:63:fd
          inet6 addr: fe80::2ff:31ff:fe37:63fd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:16 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
Should I see an eth0 or not adding an HIF in the virtual machine?

The geust distribution run a dhcp itself, can it be a problem?

Thanks

Posted: 6. Sep 2008, 14:16
by Sasquatch
You did add the vbox0 interface to the config of your Guest system where it supposed to be? If you create a HIF and attach it to your VM, you get what you want, a 'tunnel' from Guest eth0 (or 1,2 or 3, depending on which interface you set it ;)) to the Host vbox0 (or other name you specify).

You did read the manual about Host Interface Networking, right? A bridge as desribed there is only needed if you want to go outside of your Host.

Posted: 6. Sep 2008, 16:22
by sirio81
You did add the vbox0 interface to the config of your Guest system where it supposed to be?
Yes. Actualy I set it on "interface 2" (o and 1 are disabled and I use them for internal network).
In the field "interface name" I wrote "vbox0".
In the fiels "install application" and "end apllication" I didn't insert anything because I do not know what they are used for.
Anyway, on the guest, with these settigns, I have only the loopback :(
I'm using vbox 1.6.6 OSE.

Posted: 6. Sep 2008, 16:23
by Sasquatch
Check lshw -C network, there you see if the VM actually sees the NIC and what name and driver it uses. If no driver is set for it, it will show as "DISABLED". If you see that, use modprobe and the correct module name to get it working.

Posted: 10. Sep 2008, 09:11
by sirio81
I got it :P
I don't know why but the guest interface is simply down.
It's sufficient to take it up and configure it:

Code: Select all

ifconfig eth2 up
ifconfig eth2 192.68.0.27/24
After the last command I receive this strange message:
SIOCSIFNETMASK: Impossible to assigne the required address
but it does it: eth2 on the guest is configuer as I asked.
I tried to ping the guest (so to ping the IP assigned to vbox0) and it worked!

What do you think about this message?
Why do you think the host interface is down whene used like HIF?
Any other commet?

Posted: 10. Sep 2008, 10:20
by Sasquatch
Don't set the exact same IP on vbox0 Host sided and eth0 Guest sided, this will cause conflicts. If you want to ping the Guest from the Host, use the real Guest IP, not the Guest end on the Host (vbox0).