On Windows, how to determine route for IP destination?

How can I determine the IP route taken for a specific IP destination (without looking at "route print" and figuring it out manually)?

In OS X there's route get 1.2.34 and in Linux there's /sbin/ip route get 1.2.3.4. Is there anything like that on Windows?

1

3 Answers

Yep. Open a command line and type tracert 1.2.3.4

5

In Powershell:

Find-NetRoute -RemoteIPAddress "10.0.0.34" | Select-Object ifIndex,InterfaceAlias,DestinationPrefix,NextHop,RouteMetric -Last 1
ifIndex : 10
InterfaceAlias : Ethernet 2
DestinationPrefix : 10.64.0.0/10
NextHop : 0.0.0.0
RouteMetric : 0
3

The pathping command is similar to tracert but includes the outgoing interface.

Using cygwin, this command gives the outgoing IP/interface for a particular destination (specified by $HOST):

pathping -n -w 1 -h 1 -q 1 $HOST | head -n 4 | tail -n 1 | awk '{print $2}'

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like