Fixed: How to Run TRACEROUTE Linux COMMAND


 In this article we will discuss how to enable traceroute command on GNU / Linux terminals . A very common situation, is to use the ping command in GNU / Linux (I use Ubuntu ) and when we will detail the route of the packages with the traceroute , it does not work!

traceroute command linux

You need to make sure that the command must be installed via apt-get .
This situation occurs because in GNU / Linux, the traceroute is configured to use the UDP protocol via port 53.
We can verify this with the command:

# netstat -tunap 

The port 53 is already reserved for the use of local DNS server :

   tcp 0 0* HEAR 1483 / dnsmasq
One way to avoid this inconvenience is to simply use the ICMP traceroute (used in ping ) instead of the standard UDP and thus no longer use the already reserved port 53. 

For traceroute use with the ICMP protocol, use the -I key , as follows:

# traceroute -I [URL or IP number]

e.g # traceroute -I

In this way, it is possible to use traceroute normally in network analysis, since (in my opinion) it is not replaced by the MTR.

How traceroute works on Linux

comparing the particular route that network traffic follows (or finding the miscreant gateway it is discarding your packets) gives numerous troubleshooting demanding situations. Traceroute makes use of the IP protocol time to stay area to solicit an ICMP TIME_EXCEEDED reaction from each gateway along the course to a destination host.

The handiest parameter you must include while you execute the traceroute command is the host name or IP deal with of the vacation spot

Traceroute Syntax and Switches

Following are some optional switches those can be used with  traceroute command on LINUX.

-f: Enable the initial time-to-live used within the first outgoing probe packet.

-F: Set the “do not fragment” bit

-i: allow socket stage debugging.

-I: Use ICMP ECHO instead of UDP-datagrams.

-s: Use the following IP cope with as the source addressin outgoing probe packets. On multi-homed hosts  this feature can be used to pressure the source address to be some thing apart from the IP deal with of the interface the probe packet is despatchedon. If the IP cope with isn’t considered one of this device‘s interface addresses, an blunders is returned and not anythingis despatched.

-g: Specify a unfastened source path gateway

-d: Set the socket stage debugging.

-m: Set the max time-to-stay or live

-n: Print hop addresses numerically in place of symbolically and numerically

-p: Set the bottom UDP port quantity used in probes (default =33434). Traceroute hopes that nothing is listening on UDP ports base to base + nhops – 1 at the destination host. If something is listening on a port in the default varietythis option can be used to pick an unused port range.

-s:Use the following IP cope with as the source address in outgoing probe packets.

-t: Set the sort-of-carrier in probe packets to the following fee (default 0). The cost need to be a decimal integer in therange 0 to 255.

-r: by-pass the regular routing tables and send directly to a bunch on an connected network.

How to Stop the  traceroute command On Linux

You can stop the traceroute command by using the following keys:

  1. Ctrl/^ (also written as ^^)
  2. Ctrl-Shift-6