My Linux guest and NAT does work in VBox2.2

Discussions about using Linux guests in VirtualBox.
Post Reply
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

My Linux guest and NAT does work in VBox2.2

Post by Perryg »

Ok with that said I need to see if this is reproducible.
I have tested this in Debian Lenny but it should work on other Debian distros (maybe more).
I have found like others that if I select NAT in the first adaptor tab it simply does not work (in VBox 2.2). That got me to thinking and I setup the NAT connection in the second adapter tab instead and it kicked off without problems.
It does not appear to matter what you have in the first tab and I removed the tick to use this adapter meaning that I was using the second adapter only.

Web works fine and ping to host worked as well.
I have only tested this from a Windows host at this point, but if NAT is not working for you in a Linux guest let me know if this also works for you.

Input to this would be greatly appreciated.
stephanecharette
Volunteer
Posts: 300
Joined: 10. Nov 2007, 22:03
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu-64bit, Windows
Location: Kelowna, British Columbia, Canada
Contact:

Re: My Linux guest and NAT does work in VBox2.2

Post by stephanecharette »

NAT is working for me on my Debian Etch guest after upgrading to VB220. Interesting work-around you posted... What if you switch the virtual network device type, does that also get things working?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: My Linux guest and NAT does work in VBox2.2

Post by Perryg »

stephanecharette wrote:NAT is working for me on my Debian Etch guest after upgrading to VB220. Interesting work-around you posted... What if you switch the virtual network device type, does that also get things working?
Yes they do (at least for me) in the second tab.
I was looking at the vbox xml file and read the manual about how they changed the way that NAT worked and well I tried to put 1 and 1 together. If this truly is a work around (still too early to tell) I bet it will also let the DEV people know where the glitch is. At least I hope so.
jcfiala
Posts: 1
Joined: 19. Apr 2009, 02:59
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: ubuntu

Re: My Linux guest and NAT does work in VBox2.2

Post by jcfiala »

That seemed to work for me - I tried switching my NAT to the second tab under networking, and now the internet is working inside of my virtual ubuntu. Thanks for the hint!
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: My Linux guest and NAT does work in VBox2.2

Post by Sasquatch »

I found out that my Jaunty VM doesn't always get a DHCP address on boot. First adapter set to NAT. It used to do so before I ran the final few updates. Now I have to run dhclient after each boot. Will try this option, set NAT to the second NIC.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Beno@
Posts: 34
Joined: 4. Jun 2008, 18:54
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OpenSuse Factory

Re: My Linux guest and NAT does work in VBox2.2

Post by Beno@ »

same problem with window Xp host and OpenSuse factory.

dhcpcd gives opensuse a false adress, i have to run dhclient after the boot to get a valid adress
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: My Linux guest and NAT does work in VBox2.2

Post by Sasquatch »

Just switched my interfaces. The second NIC does get an IP at boot. It seems that the first NIC times out at the first request, and you will get the 169.254.x.y address.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: My Linux guest and NAT does work in VBox2.2

Post by Perryg »

Here is what I believe so far.
The First adapter is where VBox does a lot of its sniffing and records this in its XML file.
The address that you gave Sasquatch is what windows gives its loop back or the internal network address if you do not have a network connection.
You can replicate this by pulling the network and seeing what Windows uses for the network in IPconfig.
It appears that VBox sees the Windows local DHCP scheme as a valid server answer and attaches to it on the first adapter only.
Kind of some of the perils of having multiple DHCP servers on the same network with different address schemes.
Interesting isn't it.

Anyway thanks for the feed back.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: My Linux guest and NAT does work in VBox2.2

Post by Sasquatch »

Perryg, we're talking about NAT only here, right? So the Guest will only see the DHCP responses, not the Host. And I use Linux as host, not Windows.

As for the IP address I mentioned, it's not only limited to Windows, Linux does that too. The Avahi daemon will give the interface that IP range if you configure the NIC for DHCP and no response is given. Pulling the cable will NOT give you this kind of IP, because the interface is brought down. It only happens when there is no DHCP server, or it doesn't respond (fast enough).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: My Linux guest and NAT does work in VBox2.2

Post by Perryg »

That's true. As I said I have only tested this on a Windows host at this point. But even with NAT you must get this address from somewhere as you say DHCP. I was suggesting that the first adapter appeared to be getting the information (from the windows local only) address scheme (not that it actually did get it from there). Much like Windows does when you have networking enabled and no access to a network. I was using this only as a demostration and not what actually happens. The statement should have been if you have networking enabled in Windows and no network, this is the address that you would get from Windows.

So with this extra data does it appear that the guest is not seeing the network or at least not fast enough to respond correctly? Very possible, but the question is why is it only in the first adapter and not the second adapter that fails to work properly? That is the real question since most people use the default (1st) adapter when they setup their Virtual system.

At this point I am sure that it does not matter as to why but does this work around work for you? Hopefully this discussion will be enough for the DEV's to figure out what happened and how to fix it. Until then maybe this work around will help others that are having problems with this. And Sasquatch I do value and appreciate your response and taking time to address this issue. Thank you very much.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: My Linux guest and NAT does work in VBox2.2

Post by Sasquatch »

Ok, a little more info for you on how NAT works in VB. First, the Guest OS requests an IP on the network. The direct connection to the network is VB itself. VB has it's own DHCP server for this, just like the Host-Only DHCP option, only this one isn't as configurable.
When accessing the internet from the Guest, it will talk to VB. VB will then encapsulate the network packets and make it appear that VB itself is accessing the internet, not a VM. So the Host sees a program accessing internet, just like how it sees your browser that accesses this page.
Now you also need packets back from the web to the Guest, else you won't get any webpage. This is done by VB too. The Host gives the recieving packets to VB, which extracts them and sends them to the proper VM according to the previously encapsulated data it added.


As for the problem here, where DHCP doesn't repond, I would say that it's similar to the Windows Host/Guest issue. There you won't have a DHCP response either. Maybe setting it to the second NIC also helps. Anyway, in this case, it's just that the first NIC somehow doesn't start properly when the Guest is booted and is working fine after it's all done loading, which would explain that I get a nice IP when I issue a dhclient. However, it doesn't explain why it worked during and right after setup. And it still works on my other VMs.
I think it's more complicated than what meets the eye.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: My Linux guest and NAT does work in VBox2.2

Post by Perryg »

I knew and understood what you are saying. Thanks for putting it here so others can see. As you say it probably is more complicated than what the indications imply. As far as I can tell the only work around that I can find (besides what I have provided as a temporary relief) is to replace the VBoxDD.dll with a previous version. that is down loadable or wait until the next release.

Oh well enough of this. Time to move on.

Brighter futures await us my friend.
Beno@
Posts: 34
Joined: 4. Jun 2008, 18:54
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: OpenSuse Factory

Re: My Linux guest and NAT does work in VBox2.2

Post by Beno@ »

using the 2nd card effectively works...
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: My Linux guest and NAT does work in VBox2.2

Post by Sasquatch »

Yeah, it works, for a while. I just started my Jaunty test VM, wanted to update some packages so I start Aptitude, want to update the headers, BAM, no internet. Checked my network settings, second is NAT. No IP was set to the second NIC. Had to run a dhclient again. So changing it's NIC helps for a few boots, I guess about 10-20 or so.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply