Traceroute linux установка centos

10+ traceroute command in Linux [Cheat Sheet]

traceroute is a command-line tool that displays the routes taken by network packets to reach the given host. It also helps to find slow traffic between source and destination. traceroute can come in handy when troubleshooting connectivity issues.

How to install traceroute

traceroute command is not available by default on most Linux distributions. You can use the following commands to install traceroute on your system.

Install traceroute on CentOS, RHEL, Fedora

$ sudo dnf install traceroute

Install traceroute on Ubuntu and Debian

$ sudo apt install traceroute

Syntax to use traceroute command

The syntax for the traceroute command is as follows:

host indicates the name or IP address of the destination host.

Different examples to use traceroute command

1. Trace the route to a network host

You can specify the domain name or IP address to trace the route to a network host.

The following example prints the route taken by packets to reach the host golinuxcloud.com .

$ traceroute golinuxcloud.com

Sample Output:

trace the route to a network host

The traceroute command displays the IP addresses through which the packets pass and the time taken by packets to reach the destination.

There are three instances of time in milliseconds as traceroute sends three packets in each hop.

If the destination is not reached, it prints asterisks like in hop 9. It can be caused due to a firewall blocking the network.

2. Trace the route using IPv4

The -4 option enables only IPv4 tracerouting to a network host.

$ traceroute -4 golinuxcloud.com

Sample Output:

traceroute using ipv4 protocol

3. Trace the route using IPv6

The -6 option allows you to use IPv6 protocol to trace the route to a network host.

$ traceroute -6 gtraolinuxcloud.com

Sample Output:

~]# traceroute -6 2a00:8a00:4000:293::1e0 traceroute to 2a00:8a00:4000:293::1e0 (2a00:8a00:4000:293::1e0), 30 hops max, 80 byte packets 1 2a00:8a00:4000:293::1e0 (2a00:8a00:4000:293::1e0) 0.074 ms 0.019 ms 0.016 ms

Or alternatively we can also use traceroute6 as shown below:

~]# traceroute6 2a00:8a00:4000:293::1e0 traceroute to 2a00:8a00:4000:293::1e0 (2a00:8a00:4000:293::1e0), 30 hops max, 80 byte packets 1 2a00:8a00:4000:293::1e0 (2a00:8a00:4000:293::1e0) 0.063 ms 0.017 ms 0.016 ms

4. Use ICMP ECHO

By default, the traceroute command uses the UDP ports for tracerouting. To use ICMP ECHO instead of UDP, run the command with -I option.

$ traceroute -I golinuxcloud.com

Sample Output:

Читайте также:  Эмулятор sega mega drive linux

traceroute using ICMP ECHO

5. Specify the maximum number of hops

The default maximum hops number is 30. You can change its value using the -m option.

$ traceroute -m hop_num golinuxcloud.com

Sample Output:

specify max hops in traceroute

6. Specify the interface

With -i flag, you can specify the interface you want to use to send packets to a host.

$ traceroute -i interface google.com

Sample Output:

specify interface in traceroute

7. Do not fragment packets

The -F option tells traceroute not to fragment probe packets.

$ traceroute -F golinuxcloud.com

Sample Output:

traceroute command to not fragment packets

8. Set the wait time

You can use the -w option to define time in seconds to wait for a response to the next hop. The default value is 5.0 seconds. The float point value is also allowed.

$ traceroute -w time golinuxcloud.com

Sample Output:

set wait time for a response

9. Set the number of probe packets per hop

The -q option lets you specify the number of probe packets for a hop. The default is 3.

$ traceroute -q num golinuxcloud.com

Sample Output:

The following example sends two packets in each hop to a host.

set number of probe packets per hop

10. Do not resolve IP addresses to their domain names

The -n option forces the traceroute command not to map IP addresses to their domain names when displaying them.

$ traceroute -n golinuxcloud.com

Sample Output:

do not resolve ip addresses to their domain names

11. Specify the destination port

The -p option is used to specify the destination port number for UDP tracing. The default port value is 33434.

$ traceroute -p port_num golinuxcloud.com

Sample Output:

specify the destination port

12. Set the full packet length

The default value of the full packet length is equal to the length of an IP header plus 40. You can change it by passing a new length to the traceroute command.

$ traceroute golinuxcloud.com packetlen

Sample Output:

change full packet length in traceroute

Conclusion

Now you should have understood how to use traceroute command to track the packet’s route to a network host. We have discussed the most common options used in traceroute commands. We hope you find this tutorial helpful.

If you have any confusion, let us know in the comment section.

Источник

How to Install traceroute command on RHEL/CentOS 7/8 Using 5 Easy Steps

How to Install traceroute command on RHEL/CentOS 7/8 Using 5 Easy Steps 1

In this article, I will explain how to install traceroute command on RHEL/CentOS 7/8 Using 5 Easy Steps. traceroute command is a network diagnostic tool used in Linux based Systems to check and identify the network connectivity problems from source to destination. By default it will send the 60 byte packets for max 30 hops after that it will drop the packets. Using this tool, you will be able to see the number of hops it takes for a packets to reach the destination and also the av.time it takes on each hops. So this is a very useful tool to understand and use if you are planning to perform some network troubleshooting.

Читайте также:  Linux горячая клавиша вставить

How to Install traceroute command on RHEL/CentOS 7/8 Using 5 Easy Steps 2

Install traceroute command on RHEL/CentOS 7/8

Step 1: Prerequisites

a) You should have a running RHEL/CentOS 7/8 System.

b) You should have yum utility installed in your System. Please Check Top 22 YUM Command Examples in RedHat/CentOS 7 to know more about yum utility.

c) You should have sudo access to run privilege commands. Please Check How to Add User to Sudoers to know more about providing sudo access to the User.

Step 2: Update Your Server

Before going through the steps to install traceroute command it is highly recommended to update your Server first with all the latest available updates using yum update -y command as shown below. This is specially requires if you have not updated your system from long time.

[root@localhost ~]# yum update -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: download.nus.edu.sg * extras: mirrors.piconets.webwerks.in * updates: centos.hbcse.tifr.res.in Resolving Dependencies --> Running transaction check ---> Package ca-certificates.noarch 0:2019.2.32-76.el7_7 will be updated ---> Package ca-certificates.noarch 0:2020.2.41-70.0.el7_8 will be an update ---> Package curl.x86_64 0:7.29.0-57.el7 install traceroute will be updated ---> Package curl.x86_64 0:7.29.0-57.el7_8.1 will be an update ---> Package dbus.x86_64 1:1.10.24-13.el7_6 will be updated ---> Package dbus.x86_64 1:1.10.24-14.el7_8 install traceroute will be an update ---> Package dbus-libs.x86_64 1:1.10.24-13.el7_6 will be updated ---> Package dbus-libs.x86_64 1:1.10.24-14.el7_8 will be an update ---> Package grub2.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2.x86_64 1:2.02-0.86.el7.centos install traceroute will be an update ---> Package grub2-common.noarch 1:2.02-0.81.el7.centos will be updated ---> Package grub2-common.noarch 1:2.02-0.86.el7.centos will be an update ---> Package grub2-pc.x86_64 1:2.02-0.81.el7.centos install traceroute will be updated ---> Package grub2-pc.x86_64 1:2.02-0.86.el7.centos install traceroute will be an update ---> Package grub2-pc-modules.noarch 1:2.02-0.81.el7.centos will be updated ---> Package grub2-pc-modules.noarch 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools-extra.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools-extra.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package grub2-tools-minimal.x86_64 1:2.02-0.81.el7.centos will be updated ---> Package grub2-tools-minimal.x86_64 1:2.02-0.86.el7.centos will be an update ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated ---> Package java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.262.b10-0.el7_8 will be an update ---> Package java-1.8.0-openjdk-demo.x86_64 1:1.8.0.252.b09-2.el7_8 will be updated

Step 3: Install traceroute command on RHEL/CentOS 7/8

After updating your Server you need to use yum install traceroute -y command to install this tool on RHEL/CentOS 7/8 as shown below.

[root@localhost ~]# yum install traceroute -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: download.nus.edu.sg * extras: mirrors.piconets.webwerks.in * updates: centos.hbcse.tifr.res.in Resolving Dependencies --> Running transaction check ---> Package traceroute.x86_64 3:2.0.22-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: traceroute x86_64 3:2.0.22-2.el7 base 59 k Transaction Summary ======================================================================================================================================================================== Install 1 Package Total download size: 59 k Installed size: 92 k Downloading packages: traceroute-2.0.22-2.el7.x86_64.rpm | 59 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 3:traceroute-2.0.22-2.el7.x86_64 1/1 Verifying : 3:traceroute-2.0.22-2.el7.x86_64 1/1 Installed: traceroute.x86_64 3:2.0.22-2.el7 Complete!

Step 4: Check traceroute version

If you want to check current traceroute tool version then you need to use traceroute —version command as shown below. As shown in the below output. current traceroute version is 2.0.22 .

[root@localhost ~]# traceroute --version Modern traceroute for Linux, version 2.0.22 Copyright (c) 2008 Dmitry Butskoy, License: GPL v2 or any later

Step 5: Run traceroute command

If you want to test the traceroute command then you can simply run the traceroute for google.com to trace its path as shown below. It will show you all the encountered hop between source and destination. Let’s say if you have some network issues(like cabling/routing/medium issues) between the source Server and the destination google.com server then it will start dropping the packets and you will probably see some error like «request timed out» . This error will also be visible when router does not want to show you the hop information. Please check traceroute Man Page to Know more about all the available options.

[root@localhost ~]# traceroute google.com traceroute to google.com (142.250.67.78), 30 hops max, 60 byte packets 1 gateway (192.168.0.1) 2.634 ms 3.696 ms 3.607 ms 2 10.234.8.1 (10.234.8.1) 4.049 ms 4.036 ms 4.014 ms 3 br.corp.us (202.13.20.43) 4.163 ms 4.109 ms 4.087 ms 4 14.141.145.5.static-city.corp.net.us (24.141.145.5) 4.674 ms 4.638 ms 4.540 ms 5 172.31.167.58 (172.31.167.58) 15.056 ms 10.642 ms 10.574 ms 6 14.140.100.6.static-city.corp.us (24.140.100.6) 13.184 ms 10.948 ms 10.855 ms 7 115.112.71.65.STDILL-texas.city.corp.us (15.112.71.65) 10.851 ms 12.587 ms 12.558 ms 8 121.240.1.50 (121.240.1.50) 11.767 ms 11.750 ms 14.332 ms 9 74.125.242.145 (74.125.242.145) 11.639 ms 10.655 ms 12.232 ms 10 142.250.228.223 (142.250.228.223) 30.950 ms 30.918 ms 30.800 ms 11 maa05s13-in-f14.1e100.net (142.250.67.78) 10.077 ms 11.364 ms 11.054 ms

Recommended Posts:-

Читайте также:  Sending sms in linux

Источник

Оцените статью
Adblock
detector