php
xml
ajax
mysql
linux
xcode
ruby-on-rails
objective-c
multithreading
silverlight
html5
json
perl
algorithm
facebook
cocoa
tsql
mvc
php5
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:
On VirtualBox, when you clone a machine and choose to give the machine a new ip address, simply issuing step no. 2. solves the problem, even though no new interfaces were created.
You'll probably need to reboot the VM after any of these changes...
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.
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.
I think this article may help:
http://ehealth-aussie.blogspot.com/2010/06/static-ip-on-debian-based-guest-vm.html
I also had this sort of problem. But In my case, Ubuntu 11.10 was on VirtualBox on Windows 7 Enterprise, and tightly secured corporate network. But the issue, I think, was on host side.
What I did, is as follows: 1. On VirtualBox's Network setting, choose "NAT", and check "Cable connected" 2. On host machine's network adapter settings, re-check that "VirtualBox Host-Only Network" has DHCP, all other settings are set to automatic. 3. On host machine's own "Local Area Connection", went to "Properties">>"Sharing", and check "Allow other network users ...". And "OK" 4. On virtual machine, Disconnect once by "Uncheck"ing "Enable Networking", then "check" again. Bingo!, then Internet was working fine.