?
Solved

advanced batch file, write or append ping result to file >.txt, load balancing, persistent routes, metrics.

Posted on 2004-10-07
3
Medium Priority
?
560 Views
Last Modified: 2012-06-21
Further to this, i'm trying to find a way to run diagnostics on the whole set up.

What i've come up with so far, is another batch file as follows:

route delete 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.1   -p
ping www.google.com >c:\ADSL\router1.txt
route delete 0.0.0.0

route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.2   -p
ping www.google.com >c:\ADSL\router2.txt

route delete 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.3   -p
ping www.google.com >c:\ADSL\router3.txt

route delete 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.4  -p
ping www.google.com >c:\ADSL\router4.txt

Is there a way of using dos commands to append to a batch file the ping results from each router?

Anyone got any better ideas?

I need a free window's proxy that's free, stable, load balancing, auto switching, (is bonding possible with ADSL when you use different isps??) that will do basically what the firebrick does.  www.firebrick.co.uk <- maybe time to plug aaisp.net, thanks for the £1000+ quote!

Jasef, still only got 5 comps on, will add 5 more tomorrow, maybe another router too.
0
Comment
Question by:jondanger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Accepted Solution

by:
masterbaker earned 1500 total points
ID: 12253011
Yes, just use ">>" instead of ">" in your batch file.  Like this:

ping www.google.com >> c:\adsl\router.txt
ping www.microsoft.com >> c:\adsl\router.txt
echo Howdy >> c:\adsl\router.txt

That should do it.

Jeff
0
 
LVL 3

Expert Comment

by:jasef
ID: 12295901
Bugger... Too Busy. Hope you catch this anyway... I know you said Windows Proxy, but Smoothwall is very nice, stable and easy peasy to setup as a basic config.  You need a dedicated box. For load balancing try here...
http://community.smoothwall.org/forum/viewtopic.php?t=3365
The implementation is slightly different, but is probably 'portable' (for want of a better word).  I'd try posting a q or two here or at some Smoothwall support forums before doing much though as I may be giving you a bum steer.  But theoretically, you just want to add further alternative routes through the same red interface and have the script sort out the trickys.

PS. Don't worry about the points.
0
 

Author Comment

by:jondanger
ID: 12295940
Jasef,

I'm sticking with the windows solution, it's working really well at the moment.

ADSL.bat
route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.1 METRIC 1 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.2 METRIC 2 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.3 METRIC 3 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.4 METRIC 4 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.5 METRIC 5 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.6 METRIC 6 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.7 METRIC 7 -p
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.8 METRIC 8 -p
netsh interface ip DELETE dns LOCAL ALL
netsh interface ip ADD dns LOCAL 192.168.0.1 index=1
netsh interface ip ADD dns LOCAL 192.168.0.2 index=2
netsh interface ip ADD dns LOCAL 192.168.0.3 index=3
netsh interface ip ADD dns LOCAL 192.168.0.4 index=4
netsh interface ip ADD dns LOCAL 192.168.0.5 index=5
netsh interface ip ADD dns LOCAL 192.168.0.6 index=6
netsh interface ip ADD dns LOCAL 192.168.0.7 index=7
netsh interface ip ADD dns LOCAL 192.168.0.8 index=8
ipconfig /flushdns

and the test script looks like this:

ADSLTEST.bat
del c:\ADSL\jon.txt
ECHO ******************************************************************* >> c:\ADSL\jon.txt
ECHO ******************************************************************* >> c:\ADSL\jon.txt
ECHO [                                                                 ] >> c:\ADSL\jon.txt
ECHO [               Super Network MULTI-ADSL Tester                   ] >> c:\ADSL\jon.txt
ECHO [                        (by Shoulders)                           ] >> c:\ADSL\jon.txt
ECHO [                                                                 ] >> c:\ADSL\jon.txt
ECHO ******************************************************************* >> c:\ADSL\jon.txt
ECHO ******************************************************************* >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt




ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router1 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.1 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt





ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router2 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.2 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt



ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router3 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.3 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt




ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router4 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.4 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt




ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router5 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.5 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt


ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router6 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.6 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt




ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router7 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.7 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt




ECHO  _____________________ >> c:\ADSL\jon.txt
ECHO [   Router8 Status    ] >> c:\ADSL\jon.txt
ECHO  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ >> c:\ADSL\jon.txt

route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 192.168.0.8 METRIC 1 -p
PING www.google.com -n 1 >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO ------------------------------------------------------------------------ >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
ECHO. >> c:\ADSL\jon.txt
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
This program is used to assist in finding and resolving common problems with wireless connections.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question