cannot connect to internet from virtual machine

35.3k views Asked by At

I am using Vmware Player to use Ubuntu 14.04 but I am unable to get any internet connection in my virtual machine even though my system is connected to the internet. The original OS in my system is Windows 7. Can anybody suggest the way out.

4

There are 4 answers

2
vempo On

Depending on how you are connected to the network, try either Bridged or NAT mode for the VM's network adapter. Keep in mind that you may lose connectivity from the host machine to the VM. In this case you'll need another network adapter.

In most cases NAT should work. In this case only your host machine's IP is visible to the network, and ports are allocated for the VM to communicate to the outside world. The problem is that you can't connect to the VM from the host machine if you need to. Add another adapter as I mentioned above and connect to its IP address. You will have two adapters - one for the Internet and the other for host-to-guest.

In the bridge mode the VM is visible to the outside network, so a network configuration is required that enables the VM to get an IP address and participate in the network (for example, network administrators may block unknown MAC addresses). The host machine talks with the VM as it were just a computer on the network.

Update your question with additional information if my suggestion does not work: guest OS, how your host computer is connected to the network, what the current configuration of the VM's network adapters is. Is it a home or a workplace computer?

UPDATE

So I guess if you are connected to a corporate LAN, then NAT will work while Bridge will not. To add another interface 1) add an adapter in VMWare Player; 2) Add an interface in Ubuntu. Assuming your existing interface is eth0, edit /etc/network/interfaces, adding these lines:

auto eth1
iface eth1 inet dhcp

Then restart the networking service:

sudo /etc/init.d/networking restart

UPDATE 2

Another reason for your not being able to connect to the Internet may be a proxy server. Make sure that the proxy configuration in the VM is the same as in the host machine.

1
Harshit Pant On

Found the solution by browsing through multiple threads. Compiling it here.

EDIT : Please check if your network is in bridged mode or not if you are using VMWare/ VirtualBox before following the steps below. Enabling bridge mode and restarting guest OS can resolve the issue.

First check if your network is disabled by using the following cmd in terminal:

sudo lshw -C network

If it shows disabled after the name of your adapter ( note down the logical name for later use)

 *-network DISABLED        
       description: Ethernet interface
       product: 82545EM Gigabit Ethernet Controller (Copper)
       vendor: Intel Corporation
       physical id: 1
       bus info: pci@0000:02:01.0
       logical name: ens33

All we need to do is enable the adapter, so lets get started.

open up your interfaces file by using the following cmd:

sudo gedit /etc/network/interfaces

My file had the following data written:

auto lo
iface lo loopback

But the logical name of my NIC was ens33 ( not lo), so i changed it to read the following and saved the file.

auto lo
iface lo inet loopback  
auto eth0
iface eth0 inet dhcp  
auto wlan0
iface wlan0 inet dhcp

Now time to restart the networking service.

sudo /etc/init.d/networking restart

check if network is back up, it shouldn't have that disabled tag anymore.

sudo lshw -C network

Enjoy your internet :)

If that doesn't work -> But as explained earlier change the network adaptor settings to bridged in your virtual machine settings.

If all that does not work, the best way to resolve the issue is

Restore your VM network settings

If you are using an older version download a new version (trial version would also work) - we are just updating your settings

Follow the steps:

enter image description here

0
Zrn-dev On

change to bridge network -> reboot ubuntu, if still doesn't work -> reboot host computer.



Explanation: I was using NAT I needed to change dynamic IP to static IP, NAT to bridge.

changed both, rebooted ubuntu in wmware, but didn't work.

then I restarted host computer, everything is working fine now.


I guess it was because of mismatching already configurated physical device and new changed ip address(??)
0
RST On

CLose VM,
Go to VM Settings and Network adapters
Then click on adapter 1 and select Shared Networking NAT.

Start VM