Description

In older releases of JUNOS (before 17.x) the feature to traceroute any destination IP using the port number option was not available.

This article demonstrates how to achieve this using the shell.

Solution

In old releases (before17.x), there is no port options while doing the traceroute in the CLI:

root@Device> traceroute ?
Possible completions:
  <host>                Hostname or address of remote host
  as-number-lookup     Look up AS numbers for each hop
  bypass-routing       Bypass routing table, use specified interface
  gateway              Address of router gateway to route through
  inet                 Force traceroute to IPv4 destination
  inet6                Force traceroute to IPv6 destination
  interface            Name of interface to use for outgoing traffic
  monitor              Monitor network connection to remote host
  mpls                 Trace MPLS paths
  no-resolve           Don't attempt to print addresses symbolically
  overlay              Traceroute overlay path
  propagate-ttl        Enable propagate-ttl for locally sourced RE traffic
  routing-instance     Name of routing instance for traceroute attempt
  source               Source address to use in outgoing traceroute packets
  tos                  IP type-of-service field (IPv4) (0..255)
  ttl                  IP maximum time-to-live value (or IPv6 maximum hop-limit value)
  wait                 Number of seconds to wait for response (seconds)

To perform a traceroute with port number option:

{master:0}
root@Device> start shell   
root@Device:RE:0% traceroute -p 443 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 40 byte packets
 1  10.85.151.131 (10.85.151.131)  13.830 ms  20.162 ms  21.959 ms
 2  10.85.128.129 (10.85.128.129)  0.947 ms  0.904 ms  0.980 ms

Here, the port number is 443 and the destination IP is 8.8.8.8. The order of the argument should be as per the example.

Note: The traceroute without port option works in all releases.