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,089

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
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