Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 743
richb01 Avatar asked Jul 21 '10 20:07

richb01


People also ask

How do I specify an interface in ping Windows?

To specify the source interface to use, use the -s option. (You use the interface number, not the IP address).

How do I ping an external website?

In Windows, hit Windows+R. In the Run window, type “cmd” into the search box, and then hit Enter. At the prompt, type “ping” along with the URL or IP address you want to ping, and then hit Enter.

Can you ping a specific IP?

Open the Command Prompt. Type “ping” in the black box and hit the space bar. Type the IP address you'd like to ping (e.g., 192.


2 Answers

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^ 
like image 192
Jack B Nimble Avatar answered Sep 21 '22 19:09

Jack B Nimble


ping also has an option in Windows:

-S srcaddr     Source address to use. 

So you can do something like

ping 10.10.10.1 -l 0 -S 192.168.1.1 

where 10.10.10.1 is the destination address and 192.168.1.1 is the address of the source adapter

like image 39
Subash Abhinov Kasiviswanathan Avatar answered Sep 23 '22 19:09

Subash Abhinov Kasiviswanathan