Can I try to ping a website through a specific adapter?

richb01 picture richb01 · Jul 21, 2010 · Viewed 84.6k times · Source

I hope this isn't too basic a question. The title kind of asks it all. :-)

Answer

Jack B Nimble picture Jack B Nimble · Sep 3, 2010

The ping command will allow strict source routing so you can specify the default gateway to use on the way out. (This assumes your interfaces have distinct gateways i.e. are on different networks)

ping -k 192.169.1.1 microsoft.com
        ^ default gateway for desired interface

Using WMI Win32_PingStatus you can do the same thing where you specify SourceRoute and SourceRouteType (This is essentially the same as using ping -k)

Alternatively:

If your network interfaces are on the same network, like a LAN card and a wireless adapater you can add a custom ROUTE to your machine, which can send all traffic through a specific interface.

From ROUTE HELP:

route ADD 207.46.0.0 MASK 255.255.0.0  192.168.1.1 METRIC 3 IF 2
        destination^      ^mask        ^gateway     metric^    ^
                                                      Interface^