HOW TO, Script, use specific tcp route 1 NIC, THX

C

crlawler

Win 2000 Svr. with 2 NICs. Need a script to direct
a command (such as ping) through a specific
NIC or IP address. Something like...(oversimplified)

use NIC 123.234.345.567
out NIC, ping yahoo.com
if result = 0, print "success"
else print "fail"
end if
exit

I think I can do everything but directing the ping
or other command through a specific NIC.

Somebody drop me a hint PLEASE!

Thanks in Advance for your time.

Cary
 
H

Herb Martin

I don't think you can do it DIRECTLY, but consider this:

A batch that places a SPECIFIC ROUTE (mask 255.255.255.255)
to that location through the default gateway on THAT net, runs the
ping, then removes the (temporary) specific route.

You could also have an optional spec fo the SPECIFIC router or
direct network through that interface.....

Something like (untested)
route add %1 mask 255.255.255.255 router-ADDR-that-way
ping %*
route delete %1 mask 255.255.255.255 router-ADDR-that-way

Put your router address in for the final parm- you can build a complicated
batch to handle multiple interfaces automatically or just build two -- or
more, one for each interface....pingint1.cmd, pingint2.cmd etc.

For the LOCAL net, you need the IP address of that NIC (not the actual
gateway.)

It's not perfect but it's the same way you would make ANY network
client prefer THAT interface for THAT destination.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top