What are Traceroute, Ping, Telnet and Nslookup commands?

What are Traceroute, Ping, Telnet and Nslookup commands?

Traceroute
Ping
Telnet
Nslookup

Traceroute

Traceroute is one of the most common utilities built into most operating systems. It is useful for diagnosing network connections. It shows the path of a packet going from your host/computer through each of the individual routes that handle the packet and time required for it to go from one router to another up to the final host/destination.

How it works

When you start the traceroute command, it sends a packet (using the Internet Control Message Protocol or ICMP) with a time limit value (known as the ‘time to live’ – TTL). The first packet has a TTL of 1, the second packet has a TTL of 2 etc. Increasing TTL in such a manner, it resends the packet so that you can reach the first, the second and other routers on the way to the destination. When a router receives the packet, it sends a Time Exceeded message, which provides an opportunity to determine the time required for the hop to the router. Each time a packet is passed to a new router, the TTL is decreased by 1. When it reaches 0, the packet is discarded, and the router returns an error message.

Traceroute determines that the packet has reached the destination by including a port number that is outside the normal range. When it’s reached, the Port Unreachable message is sent in return, which defines the time length of the final hop. Traceroute provides you with the information hop by hop. Each hop is determined three times. When a website is unreachable or slow, traceroute allows you to see where the connection fails or has delays.

How to use traceroute

For MAC:

In order to run a traceroute, follow the steps below:

  • From your hard drive, open the Applications folder and click to open the Utilities folder.
  • Double-click Terminal.
  • Input: traceroute -I -e *******
  • Press Enter.

For Windows:

Perform the following actions to run the tracert command:

  • Select the Start button > click on the Run option.
  • In the command line, type in cmd and press Enter.
  • Input: tracert *******
  • Press Enter.

You need to use the domain name, the server’s name or its IP instead of *******.

How to read traceroute

Here are the most common examples of a traceroute output, which can help to investigate the issue:

Example 1

As we can see, traceroute to nctest.info (162.213.255.51) means that we are trying to reach the nctest.info domain which resolves to 162.213.255.51 IP address.

Example 2

When you can’t access your website, cPanel or email account and results look like this, it means that your computer can’t reach the server. It usually happens because your IP is blocked on the server. You need to contact our hosting support via live chat or the ticket system in order to check the IP.

Example 3

When your website is slow and you get *** Request timed out and high latency from the beginning, it means that the connection to the server is unstable.
When you see a trace like this, it means overall poor quality of connection, and you can try connecting to cPanel/website using another ISP/different connection.

Understanding errors

Unable to resolve target system name domain.com Domain is not registered or does not exist.
Unknown host domain.com
Timeout

Tracing route to domain.com [64.13.192.208]

over a maximum of 30 hops:

1    <1 ms    <1 ms    <1 ms  72.10.62.1

2    <1 ms    <1 ms    <1 ms  10.101.248.1

3        *        *        *  Request Time Out

4        *        *        *  Request Time Out

5        *        *        *  Request Time Out

6        *        *        *  Request Time Out

A network/firewall issue that is preventing you
from reaching your server,
or your local ISP may drop ICMP traffic.
A or !X Administratively prohibited (example, access-list).

The network administrator has blocked traceroute at this router.

Q Source quench (destination too busy).
I User interrupted test.
U Port unreachable.
H Host unreachable. The router has no route to the target system.
N Network unreachable.
P Protocol Unreachable.
T Timeout.
? Unknown packet type.
!S Source route failed. You tried to use source routing, but the router is configured
to block source-routed packets.
!F Fragmentation needed. This indicates that the router is misconfigured.

Ping

The ping command is used to determine the ability of a user’s computer to reach a destination computer.

The main purpose of using this command is to verify if the computer can connect over the network to another computer or network device. It also helps to find out the IP address using the host name:

For Windows:

  • Select the Start button > click on the Run option.
  • In the command line, type in cmd and press Enter.
  • After that, type in the following and press Enter:

    ping domain.com

    or

    ping IP address

  • Ping continues to run until you stop it. Press Ctrl+C to end the command.

For Mac OS:

  • From your hard drive, open the Applications folder and click to open the Utilities folder.
  • Double-click Terminal.
  • After that, type in the following and press Enter:

ping domain.com

or

ping IP address

  • Wait for some time and then stop it. Press Ctrl+C to end the command.

Telnet

The telnet command is used for connection and communication with a remote or local host via the Telnet TCP/IP protocol.

You can enter a domain or IP address and try connecting to it via the chosen port. In case the port is not specified, telnet utility tries to connect via the default port 23.

The command is really useful in cases, when you need to check whether the needed port is open on your computer and on the side of remote host.

How to use Telnet

For Windows:

Telnet is disabled on Windows by default. To enable it, perform these steps:

1. Press the Start button > Control Panel:

2. Go to the Programs section:

3. Select Programs and Features > Turn Windows Features on or off:

4. Scroll down the list available in the Windows Features window > check Telnet Client option > press OK > wait a few moments for the changes to be applied:

5. Telnet is enabled now, so we can run it in the same way as other commands:

  • Select the Start button > click on the Run option.
  • In the command line, type in cmd and press Enter.
  • After that, type in the following and press Enter:

telnet [domain name or IP] [port number]

for example:

telnet naijadomains.com 80

If you see the blank output after that, you have connected successfully. To quit you can press CTRL + C or any key:

As a result of successful telnet, we can conclude, that the entered domain or IP exists, and the chosen port is open on your computer and on the side of the target host.

If connection has not been established, the following error will appear:

Possible reasons for it are:

  • domain or IP does does not exist/not available/entered with a typo
  • the chosen port is closed by a security software or via network configurations on your computer or on the side of the host you connect to
  • connection/networking issue has ocurred

For Mac:

1. Select Go menu > Applications:

2. Find and press Utilities:

3. Go to Terminal:

4. Now you can run the command:

telnet [domain name or IP] [port number]

for example:

telnet naijadomains.com 80

Successful connection will look this way:

To close the session, type quit and press Enter.

Some possible errors are:

  • Connection refused. telnet: Unable to connect to remote host

This error means, that the entered port is closed on the source or a destination host or the IP address/host is not available.

  • nodename nor servname provided, or not known

The error is displayed, when you entered

  • an unregistered domain
  • a domain with a typo
  • local domain not available in your local network
  • a domain, which does not have proper nameservers or A-record set.

Also, DNS resolution issue or ISP connection issue is possible.

Nslookup

The Nslookup command is a DNS lookup utility. You can use the following commands to look up the information for a selected hostname: nslookup hostname – provides an A record for the hostname:


nslookup -type=RecordType hostname
– gives the specified record for the set hostname (i.e., if you enter nslookup -type=txt hostname it will provide you with the txt record, etc.):

nslookup hostname nameserver (nameserver address or nameserver IP address) – provides you with a DNS record stored in the specified DNS server:

That’s it!

Need any help? Contact our HelpDesk