I am building a Networked surveillance trailer with 2 networks, 1 3g and one wired. The connections work until the LAN is unplugged it doesn't revert to the 3g network. I read in this forum that windows will not revert back to other network, so.........I need to create a batch file to run checking for the LAN connection, if it fails it will netsh fall back IP so I can remote in and see what happened or see new locations router.
What I would like for it todo is kill all applications so computer will not hang, then force computer into reboot so it will run off new gateway if the LAN gateway is no longer available.
******************
This is the code I have so far. I would like to add second DNS but I can probably get that from Google, crap i mean Bing ;)
@echo off
:start
echo.
echo Checking Wifi Connection...
echo ***************************
echo.
ping 192.168.0.1 -n 4 |find "Request timed out." && (goto A)
ping 192.168.0.1 -n 5 >nul
goto start
:A
netsh interface ip set address "Local Area Connection" static 172.16.0.175 255.255.255.0 172.16.0.1 1
netsh interface ip set dns "Local Area Connection" static 8.8.8.8
netsh interface ip show config
ping localhost -n 30 >nul
******************
is this the command and where do I put it, after "ping localhost -n 30>nul"? I would just try it but I am 1 hour away from trailer.
shutdown /r /f /c "LAN ping failure"
******************
This is my Network configuration; I have 2 VPN's running on it as well but they are of no concern and function correctly.
Windows IP Configuration
Host Name . . . . . . . . . . . . : SUP2-Charlotte
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : X
PPP adapter Eye-VPN:
Connection-specific DNS Suffix . : X
Description . . . . . . . . . . . : Eye-VPN
Physical Address. . . . . . . . . :
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.10.10.148(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . : 208.180.42.100
66.76.175.100
10.10.10.251
10.10.10.250
8.8.8.8
8.8.4.4
Primary WINS Server . . . . . . . : 10.10.10.251
NetBIOS over Tcpip. . . . . . . . : Enabled
PPP adapter StrongVPN:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : StrongVPN
Physical Address. . . . . . . . . :
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : X>X>X>X
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 0.0.0.0
DNS Servers . . . . . . . . . . . : X>X>X>X
X>X>X>X
NetBIOS over Tcpip. . . . . . . . : Enabled
Wireless LAN adapter Wireless Network Connection 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : D-Link DWA-131 Wireless N Nano USB Adapte
r #2
Physical Address. . . . . . . . . :
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 172.16.0.175(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.16.0.1
DNS Servers . . . . . . . . . . . : 8.8.8.8
8.8.4.4
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
Physical Address. . . . . . . . . :
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.0.18(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : Thursday, February 21, 2013 11:12:11 AM
Lease Expires . . . . . . . . . . : Friday, February 22, 2013 11:12:11 AM
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.1
DNS Servers . . . . . . . . . . . : 192.168.0.1
NetBIOS over Tcpip. . . . . . . . : Enabled
or...... is there a better way?