{"id":4714,"date":"2013-06-05T00:19:31","date_gmt":"2013-06-04T16:19:31","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=4714"},"modified":"2023-04-28T09:48:21","modified_gmt":"2023-04-28T09:48:21","slug":"how-to-install-and-use-traceroute-in-linux-centos-6-4","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-use-traceroute-in-linux-centos-6-4\/","title":{"rendered":"How to Install and Use Traceroute in Linux RHEL 6\/7, CentOS 6\/7, Oracle Linux 6\/7"},"content":{"rendered":"<p>Traceroute command is a network diagnostic tool for displaying the route packets take to network host or destination. It shows how long each hop will takes and how many hops that the packet requires to reach the specify destination. In linux, traceroute command is used while in windows and dos environment, they used tracert command. In this post i will show you how to install and how to use traceroute command to diagnose your IP network related issues. This steps has been tested on RHEL 6\/7, CentOS 6\/7 and Oracle Linux 6\/7.<\/p>\n<p>1. If your linux VPS or dedicated server does not installed with traceroute, it will return this warning :<\/p>\n<pre># traceroute www.google.com\n-bash: traceroute: command not found<\/pre>\n<p>Or you can verify the traceroute install or not by issue which command :<\/p>\n<pre>\n# which traceroute\n\/usr\/bin\/which: no traceroute in (\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/root\/bin)\n<\/pre>\n<p>2. To install traceroute, run the following command :<\/p>\n<pre># yum install traceroute -y<\/pre>\n<p>3. Verify the command install or not :<\/p>\n<pre>\n# which traceroute\n\/bin\/traceroute\n<\/pre>\n<p>4. How to use traceroute command :<\/p>\n<p>a. Find the network path from my centos6 server to google.com :<\/p>\n<pre># traceroute [options]<\/pre>\n<p>Example :<\/p>\n<pre># traceroute www.google.com\ntraceroute to www.google.com (58.27.108.153), 30 hops max, 60 byte packets\n 1  192.168.2.1 (192.168.2.1)  9.233 ms  9.020 ms  8.857 ms\n 2  219.93.218.177 (219.93.218.177)  20.717 ms  20.529 ms  27.526 ms\n 3  60.49.55.93 (60.49.55.93)  57.368 ms  57.446 ms  57.187 ms\n 4  10.55.32.58 (10.55.32.58)  76.846 ms 10.55.32.56 (10.55.32.56)  66.418 ms  66.906 ms\n 5  58.27.105.125 (58.27.105.125)  75.779 ms  65.556 ms  65.592 ms\n 6  * * *\n 7  * * *\n 8  * * *\n 9  * * *\n10  * * *\n11  * * *\n12  * * *\n13  * * *\n14  * * *\n15  * * *\n16  * * *\n17  * * *\n18  * * *\n19  * * *\n20  * * *\n21  * * *\n22  * * *\n23  * * *\n24  * * *\n25  * * *\n26  * * *\n27  * * *\n28  * * *\n29  * * *\n30  * * *<\/pre>\n<p>1 is the internet gateway on the network this traceroute was done (ADSL modem local IP)<br \/>\n2 is the ISP the origin computer is connected to.<\/p>\n<p>My PPPoE modem WAN IP details :<br \/>\n<img decoding=\"async\" alt=\"1\" data-src=\"https:\/\/www.bloggerbaru.com\/wp-content\/uploads\/2013\/06\/1.png\" width=\"358\" height=\"138\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 358px; --smush-placeholder-aspect-ratio: 358\/138;\" \/><\/p>\n<p>b. Find the network path from my centos6 server to google.com and do not resolve IP addresses to their domain names :<\/p>\n<pre># traceroute www.google.com -n\n<\/pre>\n<p>c. Find the network path from my centos6 server to google.com and set the number of seconds to wait for response to a probe to 0.1 seconds (Default is 5.0) :<\/p>\n<pre># traceroute www.google.com -w 0.1\n<\/pre>\n<p>d. Find the network path from my centos6 server to google.com and set the number of probes per each hop to 5 (Default is 3) :<\/p>\n<pre># traceroute www.google.com -q 5\n<\/pre>\n<p>5. Display basic command line options help for more usage :<\/p>\n<pre>\n# traceroute --help\nUsage:\n  traceroute [ -46dFITnreAUV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w waittime ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] host [ packetlen ]\nOptions:\n  -4                          Use IPv4\n  -6                          Use IPv6\n  -d  --debug                 Enable socket level debugging\n  -F  --dont-fragment         Do not fragment packets\n  -f first_ttl  --first=first_ttl\n                              Start from the first_ttl hop (instead from 1)\n  -g gate,...  --gateway=gate,...\n                              Route packets through the specified gateway\n                              (maximum 8 for IPv4 and 127 for IPv6)\n  -I  --icmp                  Use ICMP ECHO for tracerouting\n  -T  --tcp                   Use TCP SYN for tracerouting\n  -i device  --interface=device\n                              Specify a network interface to operate with\n  -m max_ttl  --max-hops=max_ttl\n                              Set the max number of hops (max TTL to be\n                              reached). Default is 30\n  -N squeries  --sim-queries=squeries\n                              Set the number of probes to be tried\n                              simultaneously (default is 16)\n  -n                          Do not resolve IP addresses to their domain names\n  -p port  --port=port        Set the destination port to use. It is either\n                              initial udp port value for \"default\" method\n                              (incremented by each probe, default is 33434), or\n                              initial seq for \"icmp\" (incremented as well,\n                              default from 1), or some constant destination\n                              port for other methods (with default of 80 for\n                              \"tcp\", 53 for \"udp\", etc.)\n  -t tos  --tos=tos           Set the TOS (IPv4 type of service) or TC (IPv6\n                              traffic class) value for outgoing packets\n  -l flow_label  --flowlabel=flow_label\n                              Use specified flow_label for IPv6 packets\n  -w waittime  --wait=waittime\n                              Set the number of seconds to wait for response to\n                              a probe (default is 5.0). Non-integer (float\n                              point) values allowed too\n  -q nqueries  --queries=nqueries\n                              Set the number of probes per each hop. Default is\n                              3\n  -r                          Bypass the normal routing and send directly to a\n                              host on an attached network\n  -s src_addr  --source=src_addr\n                              Use source src_addr for outgoing packets\n  -z sendwait  --sendwait=sendwait\n                              Minimal time interval between probes (default 0).\n                              If the value is more than 10, then it specifies a\n                              number in milliseconds, else it is a number of\n                              seconds (float point values allowed too)\n  -e  --extensions            Show ICMP extensions (if present), including MPLS\n  -A  --as-path-lookups       Perform AS path lookups in routing registries and\n                              print results directly after the corresponding\n                              addresses\n  -M name  --module=name      Use specified module (either builtin or external)\n                              for traceroute operations. Most methods have\n                              their shortcuts (`-I' means `-M icmp' etc.)\n  -O OPTS,...  --options=OPTS,...\n                              Use module-specific option OPTS for the\n                              traceroute module. Several OPTS allowed,\n                              separated by comma. If OPTS is \"help\", print info\n                              about available options\n  --sport=num                 Use source port num for outgoing packets. Implies\n                              `-N 1'\n  -U  --udp                   Use UDP to particular port for tracerouting\n                              (instead of increasing the port per each probe),\n                              default port is 53\n  -UL                         Use UDPLITE for tracerouting (default dest port\n                              is 53)\n  -P prot  --protocol=prot    Use raw packet of protocol prot for tracerouting\n  --mtu                       Discover MTU along the path being traced. Implies\n                              `-F -N 1'\n  --back                      Guess the number of hops in the backward path and\n                              print if it differs\n  -V  --version               Print version info and exit\n  --help                      Read this help and exit\n\nArguments:\n+     host          The host to traceroute to\n      packetlen     The full packet length (default is the length of an IP\n                    header plus 40). Can be ignored or increased to a minimal\n                    allowed value\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Traceroute command is a network diagnostic tool for displaying the route packets take to network host or destination. It shows how long each hop will takes and how many hops&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6280,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,1020,2058],"tags":[1255,1256,1258,1627,1717,1844],"class_list":["post-4714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-oracle-linux-7","category-rhel","tag-centos-6-4","tag-centos-6-5","tag-centos-7","tag-oracle-linux-7","tag-rhel-7","tag-traceroute"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/4714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=4714"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/4714\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6280"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=4714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=4714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=4714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}