traceroute code example
Example 1: traceroute
tracert [ipadress]
Example 2: traceroute command
Windows - $tracert ip or domain
Linux and MAC - $traceroute ip or domain
Example 3: what is traceroute
Traceroute is a network diagnostic tool used to track
in real-time
the pathway taken by a packet on an IP network from source to destination,
reporting the IP addresses of all the routers it pinged in between.
Traceroute also records the time taken for each hop the packet makes \
during its route to the destination.
Example 4: browserrouter
<BrowserRouter
basename={optionalString}
forceRefresh={optionalBool}
getUserConfirmation={optionalFunc}
keyLength={optionalNumber}
>
<App />
</BrowserRouter>
Example 5: Traceroute
param( [string]$strHost = '', [int]$nMaxHops = '', [int]$nMaxResponseTime = '' )
. 'C:\Program Files\ActiveXperts\Network Monitor\Scripts\Monitor (ps1)\_activexperts.ps1'
cls
$Error.Clear()
if( $strHost -eq '' -or $nMaxHops -eq '' -or $nMaxResponseTime -eq '' )
{
$res = 'UNCERTAIN: Invalid number of parameters - Usage: .\TraceRoute.ps1 "<Hostname | IP>" <MaximumHops> <MaximumResponseTimeMsecs>'
echo $res
exit
}
$objTraceRt = new-object -comobject AxNetwork.TraceRoute
$objTraceRt.ResolveHostName = $True
$objTraceRt.MaxHops = $nMaxHops
$objTraceRt.Timeout = $nMaxResponseTime
$nHops = 0
$objHop = $objTraceRt.FindFirstHop( $strHost )
if( $objTraceRt.LastError -ne 0 )
{
$res = 'ERROR: Route to [' + $strHost + '] not found; result=[' + $objTraceRt.LastError + ': ' + $objTraceRt.GetErrorDescription( $objTraceRt.LastError ) + '] DATA:0'
echo $res
exit
}
do
{
if( $objHop.Host -ne '' )
{
$strHopName = $objHop.Host
}
else
{
$strHopName = $objHop.IP
}
$nHops = $nHops + 1
if( $objHop.ResponseTime -gt $nMaxResponseTime )
{
$res = 'ERROR: Hop [' + $strHopName + '] response timeout [' + $nMaxResponseTime + 'ms] exceeded, time=[' + $objHop.ResponseTime + 'ms] DATA:' + $nHops
echo $res
exit
}
$objHop = $objTraceRt.FindNextHop()
} while( $objTraceRt.LastError -eq 0 )
$res = 'SUCCESS: TraceRoute succeeded, all [' + $nHops + '] hops replied within [' + $objTraceRt.Timeout + 'ms] DATA:' + $nHops
echo $res
exit
trap [Exception]
{
$res = 'UNCERTAIN: ' + $_.Exception.Message
echo $res
exit
}
Example 6: tracert
Tracing route to 11.1.0.1 over a maximum of 30 hops --------------------------------------------------- 1 2 ms 3 ms 2 ms 157.54.48.1 2 75 ms 83 ms 88 ms 11.1.0.67 3 73 ms 79 ms 93 ms 11.1.0.1 Trace complete.