views:

4369

answers:

4

I have a virtual machine (made with vmware) with a linux ubuntu os installed on it (i have a series of them), with NAT network connection - i am running vmware on Windows XP (my host system); the virtual machine can't connect to the internet. All the vmware services seem to be working fine from windows point of view, but inside the machine i can't connect to the internet. What is strange is that the virtual machine was able to use the internet some time ago, but all of a sudden, i just can't use my internet on the virtual machine - i have made no changes to the settings, nor in windows, nor in the virtual machine - so i don't understand.

+2  A: 

The most common problem with VMware and Ubuntu is a (minor) kernel update in combination with vmware-tools. The kernel modules of vmware tools are compiled for your specific kernel version, and need to be rebuilt when the kernel is upgraded. So try reinstalling VMware Tools.

Of course before trying something else, check if your network adapter is enabled and set up correctly in the VM preferences :)

If you are not running the VMware Tools package your system should detect your network card as a "AMD PCnet Fast 79C971" or some other PCnet revision depending of your VMware version. Use "ifconfig" to see if your eth0 device is up or "dmesg" to find out which card type was detected by your kernel.

Try

sudo ifconfig eth0 up

to see if you can bring up your device.

If you are using vmware-tools, you should find the vmnet module somewhere in the modules list:

sudo lsmod | grep vmnet

If your interface is up and running, check if it got an IP address via dhcp. If it doesn't have an address try

sudo dhclient eth0

And if it got one try pinging the host system - the IP is the first host on the subnet your vm was assigned to (usually 172.16.148.1 for VMware using NAT). If this works check if you have a DNS server entry in your /etc/resolv.conf (usually 172.16.148.2 is used) and try resolving something (e.g. ping www.ubuntu.com). If this all goes well you can be pretty sure that you have a networking problem on your host system like a firewall interfering with vmware or something like that.

VolkA
A: 

I think this has happened to me too... the issue appears to me to be related to powering down or hibernating the host machine (Windows XP). For some reason, after I hibernate and bring VmWare to life again, the network was sometimes lost in exactly this manner. The only solution that I managed to find was to reboot the guest machine.

The problem looks like it resides rather in the VmWare program itself, not in anything the guest can do. Which is jolly strange.

Update: it seems to usually help to disable and reenable the eth0 interface on the guest OS. Looks like renegotiating DHCP from the guest OS helps reestablish the connection between virtual machine and host OS network. So it looks like the core issue is on the virtual machine side of things, inside the guest OS.

jakobengblom2
+1  A: 

I have recently discovered an interesting interaction between Debian/Ubuntu and Virtualization servers that may prove helpful to you.

VM servers will assign MAC addresses for virtual network cards; this is expected and good. If you clone a VM, it should get a new MAC address (so as not to conflict with the source VM); this is expected and good. Sometimes the VM server will choose to assign a new MAC address for its own reasons, which may or may not be expected or good, but it can happen.

Traditionally, Linux kernels look for ethernet cards and assign interface names based upon the order the cards are detected. Thus if you were to shift the network cards around, or replace them, you may end up with a different interface name for any given card. In recent Debian (and thus Ubuntu) releases, the Udev subsystem creates a map between MAC addresses and interface names, and when it finds a new MAC address it assigns a new ethernet interface name. Thus the first time you create an Ubuntu VM, the VM server assigns a MAC address, and your VM will map it to eth0. If you clone the VM, or move it, the VM server assigns a new MAC address, and your VM maps the new address to eth1. At this point, your network configuration (/etc/network/interfaces) no longer matches the hardware, and your VM no longer sees the network. Oops.

If this is the problem, you will see messages like this in your /var/log/kern.log file:

udev: renamed network interface eth0 to eth1

You can fix this in one of several ways:

  1. Change your interface configuration (/etc/network/interfaces) to match the new ethernet interface.
  2. Delete the Udev MAC address map (/etc/udev/rules.d/70-persistent-net.rules), reboot, and let Udev rebuild the map.
  3. Edit the Udev MAC address map (/etc/udev/rules.d/70-persistent-net.rules) and map the current MAC address back to eth0. This is the preferred solution if you have multiple interfaces defined.

You'll probably need to reboot the VM after any of these changes...

Craig Trader