最近有台windows服务器主机偶尔会出现网络断掉的情况,网络图标感叹号状态。其他电脑的网络都是正常。
关路由器什么事呢? 确实,是无关的。
原因分析与处理:
1.可能是服务器主机的ip被人顶掉?这个可能是有的,但应该比较小。
2.系统漏洞导致?
所以,更新了系统漏洞。
3.硬件驱动问题?
重新下载网卡驱动程序,重新安装。
4.网卡硬件问题,那只能换网卡了。现在还无法判断。
鉴于还是有可能出现断网的情况,为此,整理一段检查网络情况的代码,网络无法连接,可自动重启网卡。
代码如下,仅供参考:
@echo off
echo "网卡自动检查重启服务正在进行中......."
echo "停止服务请按 Ctrl+C"
:begin
echo %date% %time% "ping......" >>ping.txt
ping 192.168.1.1 >>ping.txt
rem echo %errorlevel%
if %ERRORLEVEL% == 1 goto reboot
goto loop
:reboot
echo %date% %time% "网卡已重新启动" >>errlog.log
echo %date% %time% "网卡停用中...."
netsh interface set interface "本地连接 2" disabled
echo %date% %time% "网卡启动中...."
netsh interface set interface "本地连接 2" enabled
echo %date% %time% "网卡已重新启动...."
:loop
ping 127.0.0.1 -n 300 > nul
goto begin
说明:
netsh interface set interface "本地连接 2" enabled
这个本地连接 2 是可以换成某个网卡的,譬如 eth0或者eth1
将代码保存成bat文件,添加到计划任务中,启动时执行。如图:
其他设置默认就好。
问题搞定。