Пинг с определенного интерфейса windows

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

shamittomar's user avatar

shamittomar

46.3k12 gold badges75 silver badges79 bronze badges

asked Jul 21, 2010 at 20:30

richb01's user avatar

4

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

wjandrea's user avatar

wjandrea

28.6k9 gold badges62 silver badges82 bronze badges

answered Aug 31, 2013 at 0:10

Subash Abhinov Kasiviswanathan's user avatar

2

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^

answered Sep 3, 2010 at 15:49

Jack B Nimble's user avatar

Jack B NimbleJack B Nimble

5,0494 gold badges40 silver badges62 bronze badges

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

shamittomar's user avatar

shamittomar

46.3k12 gold badges75 silver badges79 bronze badges

asked Jul 21, 2010 at 20:30

richb01's user avatar

4

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

wjandrea's user avatar

wjandrea

28.6k9 gold badges62 silver badges82 bronze badges

answered Aug 31, 2013 at 0:10

Subash Abhinov Kasiviswanathan's user avatar

2

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^

answered Sep 3, 2010 at 15:49

Jack B Nimble's user avatar

Jack B NimbleJack B Nimble

5,0494 gold badges40 silver badges62 bronze badges

  • Remove From My Forums
  • Question

  • Is there a option to select the interface from which to ping other computers?
    or how can it be done with out disabling the other interfaces on the pc from where im pinging.ž

    thanks!!! 

Answers

  •   Are you talking about Windows 7/Windows Server 2008 R2?

      To force IPv4 or IPv6, use -4 or -6  . To specify the source interface to use, use the -s option. (You use the interface number, not the IP address). 

      To ping 192.168.0.1 using ipv4 from interface 1, use the command  «ping  -4 192.168.0.1 -s 1»


    Bill

    • Marked as answer by

      Tuesday, January 12, 2010 1:15 PM

Probably easier is to use the -S switch, which lets you specify the source IP address (see ping /? for more infos).

Another thing you can do is change the binding order, which meets your «option to prefer one adapter over the other». Although it varies from Windows OS to OS, it is in a similar location as this example: For Windows 7 you right click on Network, and click properties. Then you click on «»Change adapter settings». Then click on the menu Advanced>Advanced Settings and move the connection you want to have priority to the top.

From Windows 7 (Version 6.1 Build 7601: Service Pack 1)
ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
        [-r count] [-s count] [[-j host-list] | [-k host-list]]
        [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name


Options:
-t             Ping the specified host until stopped.
               To see statistics and continue - type Control-Break;
               To stop - type Control-C.
-a             Resolve addresses to hostnames.
-n count       Number of echo requests to send.
-l size        Send buffer size.
-f             Set Don't Fragment flag in packet (IPv4-only).
-i TTL         Time To Live.
-v TOS         Type Of Service (IPv4-only. This setting has been deprecated
               and has no effect on the type of service field in the IP Header).
-r count       Record route for count hops (IPv4-only).
-s count       Timestamp for count hops (IPv4-only).
-j host-list   Loose source route along host-list (IPv4-only).
-k host-list   Strict source route along host-list (IPv4-only).
-w timeout     Timeout in milliseconds to wait for each reply.
-R             Use routing header to test reverse route also (IPv6-only).
-S srcaddr     Source address to use.
-4             Force using IPv4.
-6             Force using IPv6.

Microsoft TechNet Ping Documentation which states it can only be used for IPV6 (not correct)
Applies to: Windows Server 2003, Windows Vista, Windows XP, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2000, Windows Server 2012, Windows 8

Microsoft TechNet — Using the Ping Command (Windows 7 and Server 2008 R2) (also missing -S srcaddr)

You are confusing me with the «default gateway» thing. The source address is the address on the device from which you are pinging, not the gateway for that subnet.

Suppose I have two addresses, 10.11.12.13 and 172.16.17.18 on my computer. I want to ping on the respective interfaces (logical or physical). I ping from the source (-S) with each of the addresses on my computer, not the gateways for those addresses.

For instance, I have a VPN tunnel and a physical interface on one of my computers, each with IP addresses. The VPN doesn’t allow me to ping outside the network on the other end of the tunnel.

Assume they are addressed like this: Tunnel=172.16.17.18, Ethernet=10.11.12.13.

 C:\>ping -S 10.11.12.13 time1.google.com

 pinging time1.google.com [216.239.32.15] from 10.11.12.13 with 32 bytes of data: 
 Reply from 216.239.32.15 bytes=32 time=21 ms TTL=43
 Reply from 216.239.32.15 bytes=32 time=22 ms TTL=43
 Reply from 216.239.32.15 bytes=32 time=23 ms TTL=43
 Reply from 216.239.32.15 bytes=32 time=22 ms TTL=43

 Ping statistics for 216.239.32.15:
     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
     Minimum = 21ms, Maximum = 23ms, Average = 22ms

 C:\>ping -S 172.16.17.18 time1.google.com

 pinging time1.google.com [216.239.32.15] from 172.16.17.18 with 32 bytes of data:
 Request timed out.
 Request timed out.
 Request timed out.
 Request timed out.

 Ping statistics for 216.239.32.15:
     Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\>

  • Пинг по мак адресу windows
  • Пиксельные иконки для windows 10
  • Пин код для windows hello как удалить
  • Печать невозможна из за неправильной настройки принтера windows 10 по сети
  • Пин код windows hello как выключить