Solve connection error on Ubuntu Server on VMware Workstation

Thursday, May 9, 2013
Virtualization has been a necessity for quick deployment of server. However there is a drawback of connection in case like VMware Workstation 7.0 where ubuntu server loose internet connection due to failure of  VMware NAT Service. A restart for NAT service is required to bring everything in working order. I don't exactly why vmnat.exe stop working but this error causes severe loss to server based on vmware so to resolve this problem I have made custom batch script. You can schedule task it as per your severity. For my preference I shall schedule it for every 5 minutes.


@setlocal enableextensions enabledelayedexpansion
@echo off
set ipaddr={YOUR VMWARE LOCAL  IP} Eg. 192.168.xxx.128
set oldstate=neither
:loop
set state=up
ping -n 1 !ipaddr! >nul: 2>nul:
if not !errorlevel!==0 (
 set state=down
taskkill /im vmnat.exe /T /F
net start "VMWare NAT Service" 
)
if not !state!==!oldstate! (
    echo.Link is !state! 
    set oldstate=!state!
 exit /B
)
ping -n 2 127.0.0.1 >nul: 2>nul:
goto :loop
endlocal

I hope this might solve the problem.
Many Thanks to Tim for his blog post.

1 comment:

Ellena F said...

Veery creative post