HINTS! Internet connectivity w/ Ubuntu 7.04 Guest & NAT

Discussions about using Linux guests in VirtualBox.
GonzoVBX-1
Posts: 9
Joined: 25. Oct 2007, 15:31

HINTS! Internet connectivity w/ Ubuntu 7.04 Guest & NAT

Post by GonzoVBX-1 »

NOTE: My solution is written with Ubuntu 7.04 in mind. For the uuber users, all we're doing here is setting the guest to use a static IP and netmask (whatever VB would serve anyway), but manually entering in the actual DNS servers used by the host instead of trying to let them filter in via DHCP.

I had to goof with this a few days so I figured I'd put up a post. I'm writing this for Noobs, so bear with me if you're more technically inclined.

This will apply, most likely, to those running at least UBUNTU 7.04 as a guest on a Windows or other system AND with a Wireless or other Router/Gateway between you and the 'net, with the router itself serving up DHCP requests information, including DNS.

I do not know why, but this combo failed utterly when I tried out VB for the first time using NAT connectivity. In fact, it also failed using a HOST adaptor bridged in XP, but I did not mess with it long enough to figure out why.

I do know that with NAT, disabling the host system's software firewall (or giving explicit everything permission) did not help; nor did putting the Host computer's IP in the "demilitarized zone" or even turning off all security on the router (which is dumb anyway).

While running UBUNTU, there simply was no getting through to the internet, no web pages searched or accessed, and Synaptic and the Ubuntu software updaters could not see the 'net.

I was about to write off Virtual Box when, out of morbid curiosity, I installed a Windows 98 Virtualization. It looked horrible with 16 colors and 640x480 resolution, BUT it promptly DHCP'd everything it needed and connected to the internet!

The Problem: Best I can tell, some combination of Host systems, VB, UBUNTU, and home routers do not play well together when it comes to getting working DNS information all the way into Ubunto in Virtual Box. I'd guess Ubunto so strictly implements the protocol that something gets lost and it simply fails.

On to the solution.

Its several steps:

First, on your host machine, you need to figure out what DNS servers that box is using. On a Windows host, the easiest way to do this is to:

START:RUN (type in "command" and hit enter).

Then, type "IPCONFIG /all" and hit enter. (Don't type the quotes)

You'll see a print out. Write down the two or three addresses it shows for DNS servers. You'll need those later.

Next, set your VB network Virtualization to NAT, boot into Ubuntu Linux with VirtualBox and go to the network configuration utility in the upper right. (Its on the menu bar and looks like two monitors behind each other). Confirm set up of the network for DHCP and reboot the Ubuntu virtualization.

Next, back in Ubuntu, go to the System:Administration:Network Tools. Switch the pulldown menu in the middle to Ethernet Interface, and get a read on what Ubuntu pulled from VB in terms of IP address, etc. You'll need to write down the IP address and NetMask. In the same utility, go into the "NetStat" tab and click the green arrow to get routing table information. You want to look in the column labeled Gateway. The values, save one, will be zeros. Write down the one that's not a bunch of zeros.

Next go back into the manual configuration utility on the main Ubunto menu bar and do the following:

1. Get the "properties" for the ethernet connection. Set the thing to static IP. Enter the IP address, NetMask, and Gateway you found above into the "properties" tab for the ethernet connection. Close out of that.

2. Back in the manual configuration utility go to the DNS tab. Delete anything in the DNS Servers list that comes up. Now type in the DNS server addresses you pulled off your host computer earlier. Click "+add", then type the address just as you wrote it down and hit "enter" to make it stick. Do this for all the addresses.

Close it down and reboot the virtualization (may be unnecessary to reboot, but can't hurt). You should be able to access the internet now via FireFox and install the first round of 100+ Ubuntu updates. (Importantly, this fixes the issue where the Ubuntu software selector won't let you download anything because it's mis - perceiving the processor on the VB virtualization).

Good luck!

This is GREAT software, by the way.
Last edited by GonzoVBX-1 on 26. Oct 2007, 21:43, edited 1 time in total.
Oblong7
Posts: 14
Joined: 11. Oct 2007, 23:11

Post by Oblong7 »

Thanks GonzoVBX-1 !! Your solution works - nice job. I struggled with this for 2 weeks.

Hopefully, the VBox developers will recognize this as a problem, and fix it in a future version.
GonzoVBX-1
Posts: 9
Joined: 25. Oct 2007, 15:31

Post by GonzoVBX-1 »

I'm not sure its strictly a Virtual Box problem. I mean a Windows 98 machine connected right on, using the default DNS information -- the exact same information, as a matter of fact -- as I wrote down had been served to Ubuntu.

That to my mind rules out any possible issue with the host, and suggests there is an issue with how the guest is talking TO the host VIA Virtual Box. Some stuff gets through correctly (Win 98, for example), some does not.

The work-around I posted should be useful for a lot of newbies looking to try things out.
GonzoVBX-1
Posts: 9
Joined: 25. Oct 2007, 15:31

Post by GonzoVBX-1 »

UPDATE:

This same solution works in Damn Small Linux except that you'll need to enter the static IP and DNS servers at another location.

(DLS is actaully really impressive for such a lean offering).
upstream
Posts: 1
Joined: 27. Nov 2007, 23:29

same problem with windows guest... fixed

Post by upstream »

Mint Linux (ubuntu) host / winxp guest

I basically hard coded the IP, gateway, then used my external DNS nameserver IP in winXP

So for some reason the virtualbox VM is not able to pick up the host's DNS nameserver config automatically. Perhaps it would be cool to have an interface to either manaully point it to a config or hard code it in the virtual machine.

This would suck if I was on a laptop switching environments (and DNS nameservers) all the time
Cerin
Posts: 21
Joined: 7. Oct 2007, 20:50

Post by Cerin »

Thought I'd post this, since it's a solution to related problem.

I had all the same symptoms as you. I have a Linksys router and the Guest could get the router's admin page just fine, but no internet. I tried matching the Guest's IP and DNS to the Host, but that didn't work. Then I remembered my ISP is Comcast, and they bind my connection to a specific MAC address. Sure enough, when I set the Guest's MAC address to the same thing as the Host's in VirtualBox's NAT settings, the Guest gained full internet access! I even reset the Guest's IP and DNS, so they're polled dynamically. The MAC address was the only thing I needed to change.
Matty4467
Posts: 1
Joined: 7. Feb 2008, 01:56

not working for me

Post by Matty4467 »

This ,unfortunaly, didnt work for me. ive done and checked all the instructions, but nothing.
im sort of a noob, so has anyone got any ideas why its not working for me?
thanks.
Cerin
Posts: 21
Joined: 7. Oct 2007, 20:50

Post by Cerin »

Are you sure it's not working? When I first tried it, I thought it didn't work because I couldn't ping anything, but then I realized I could browse the web just fine. Also, at first make sure your firewalls (host, guest, router, etc) are down, although mine still worked when I brought them up.
singh.gurjeet
Posts: 2
Joined: 15. May 2008, 08:36

Post by singh.gurjeet »

Great software.. just great.

And thanks a lot for this method. Just worked.

BTW, I didn't have to perform the last reboot of the guest box.
Cerin wrote:Are you sure it's not working? When I first tried it, I thought it didn't work because I couldn't ping anything, but then I realized I could browse the web just fine. Also, at first make sure your firewalls (host, guest, router, etc) are down, although mine still worked when I brought them up.
It is well documented in the networking section that ping won't work on NAT mode; docs give the reason too.

So the test you should be doing is

wget google.com

Best regards,
oncemore
Posts: 1
Joined: 11. Jun 2008, 03:20

Post by oncemore »

I'm using Windows XP SP2 as host and Knoppix 5.1.1 as guest. My internet connection is dialling up to a 3G phone modem. Can't get it to work with NAT or Host Networking.

With "ipconfig /all" I find two DNSes corresponding to the phone modem and try entering them into "/etc/resolv.conf" which leaves the text file like so:

nameserver x.x.x.x
nameserver x.x.x.x


I then enter the command "ifdown --all" followed by "ifup --all" for the new settings to take effect.

No joy...
ravenwingx
Posts: 1
Joined: 17. Jul 2008, 02:06

Thanks!

Post by ravenwingx »

Thanks for taking the time to submit such a detailed post! I've spent hours going through forums and this solution was the only one that worked. I'm running an XP host with a wireless Internet connection and Ubuntu as a guest...
nashjc
Posts: 3
Joined: 21. Sep 2007, 19:10

But what if eth0 doesn't get up at all?

Post by nashjc »

I've usually had good success with VBox, but a new "minimal" machine to be used as a prototype for a build farm behaves very oddly. I can get it to work find on the machine on which it was installed (minimal debian, manual addition of xfce and a few other things), including cloned VDIs. But if I move it to another machine, eth0 doesn't get set up. This isn't the case with other "machines" e.g., a minimal WinXP and an Ubuntu -- but they are 4-5 GB compared to 1.3GB.

I've tried static IP setting in /etc/network/interfaces and correcting /etc/resolv.conf.

With either static or dhcp, I get
'SIOCSIFADDR: No such device'

I suspect some mismatch of NAT parameters, but haven't found where to change/fix them.

Suggestions welcome.

JN
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post by TerryE »

Its probably your udev rules going wrong. man udev for more info. udev latches any mac addresses it finds to an ethernet port. When you move to another device VBox can autogenerate a new mac addr. See http://forums.virtualbox.org/viewtopic. ... light=udev for a fuller discussion.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
chor
Posts: 1
Joined: 6. Oct 2008, 14:18

HINTS! Internet connectivity w/ Ubuntu 7.04 Guest & NAT

Post by chor »

Thank you Gonzo for a good piece solution, it also work for me. I am using Ubuntu8.04, VB version 1.6.4.. :D
omegak
Posts: 1
Joined: 25. Oct 2008, 09:12

Post by omegak »

Actually Gonzo was partially right. I agree this is a DNS issue. However, I tried the other things that he suggested, but they did not work for me.

The following did work for me however...

Configuration:
Host - WindowsXP
Guest - Ubuntu

Step 1:
The first thing I did was to change the DNS entry on the Ubuntu guest. I changed it to the DNS entry I found when I ran the ipconfig command on my WinXP host. I also made sure that the guest was configured to use dhcp, and NOT static.

Step 2:
Next I made sure that the configuration settings for the VirtualBox Network Adapter was set to NAT.

Step 3:
To test things out, I opened a web browser, and surfed to a website. Normally, I would use ping, however, support for ICMP packets, and ping is very limited in VirtualBox.

Summary:
The key lies in the fact that VirtualBox's networking engine has a dhcp server, which hands out addresses (10.0.2.0) to the guest vm's. The engine is also responsible for the network communication between the guest and host network stack. Overcall, VB appears to be a really great product.

Hope this helps...
Post Reply