Solved

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

Posted on 2004-10-07
3
542 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
3 Comments
 
LVL 13

Accepted Solution

by:
masterbaker earned 500 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Public DNS? 10 79
Viber-Only Restriction 6 46
How to calculate the netmask 5 57
Nimble Storage 3 69
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

832 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