2

I use MacBook with Mac OS X Lion 10.7.5. I have installed VMWare Fusion 5.0.2, under which Windows 7 and Ubuntu 12.04 LTS have been installed as virtual machines. Under Ubuntu vmware-tools-distrib 9.0.1 (01 nov 2012) has been installed.

Everything worked well including network: once mac is connected to internet, Windows and Ubuntu are connected.

However, for 2 days Ubuntu cannot be connected to interent anymore. When I log in, it shows "Network Disconnected - you are now offline". Network under Windows still works well. I tried to restart, reinstall WMware tools, it didn't help.

Could anyone help?

PS: the problem has been solved: we re-edited interfaces, and restarted networking.

SoftTimur
  • 3,019
  • 9
  • 37
  • 45
  • Did you make certain that the virtual network adapter of the VM is connected? (That is a setting for each VM). – guntbert Feb 24 '13 at 20:57
  • It's `NAT`, I uploaded a screenshot, I think it has been always like that... – SoftTimur Feb 24 '13 at 21:54
  • Have you tried to restart the network service and card on Ubuntu? – LnxSlck Feb 25 '13 at 14:11
  • 6
    As you solved the problem yourself it would be helpful for others if you wrote an answer describing exactly how and why you edited `/etc/network/interfaces`. – guntbert Feb 25 '13 at 18:11

2 Answers2

4

I have seen this problem, mucked around with editing the network interfaces and had it somehow seem to fix itself, only to discover days or weeks later that the problem was back. After months of trying to fix this I finally found the one solution that seems to always work (but not permanently, so reapply as needed):

1) cat /var/lib/NetworkManager/NetworkManager.state

if you see "NetworkingEnabled=false" then continue. Otherwise, you have a different problem.

2) sudo vi /var/lib/NetworkManager/NetworkManager.state

change "NetworkingEnabled=false" to "NetworkingEnabled=true"

3) sudo service NetworkManager restart

I'd love to be able to figure out what is toggling the value for NetworkingEnabled and why, but after months of dealing with this problem, I'll settle for being able to fix whatever some other process is breaking.

GregK
  • 41
  • 1
  • After a hard restart of Ubunt 16.04 VM in Fusion, I had exactly the same symptoms, and your instructions fixed the problem, thanks! – ocroquette Oct 16 '16 at 09:37
0

Based on GregK's answer, here is a one liner that will check if the network is currently disabled, and enable it if required:

sed -i.bak -e 's/NetworkingEnabled=false/NetworkingEnabled=true/' /var/lib/NetworkManager/NetworkManager.state ; diff /var/lib/NetworkManager/NetworkManager.state /var/lib/NetworkManager/NetworkManager.state.bak || ( echo "Networking was disabled and is now enabled" && service NetworkManager restart  )

Run it as root. If it doesn't print anything, the network is already enabled, otherwise it will print:

2c2
< NetworkingEnabled=true
---
> NetworkingEnabled=false
Networking was disabled and is now enabled
ocroquette
  • 111
  • 3