If you are a beginner in this networking journey, or you are new to network engineer role, or you got a project where you need to know basics of networking then this post will surely help you. In this blog we will discuss few commands which you can run to get a fair understanding of the connectivity, and you might be able to fix the connectivity issue.
This post is the part one of the series and in this post we will discuss the basic process to troubleshoot a connectivity and in the next part we will take an example to understand it deeply.
Below is the step-by-step guide with commands. Here, you have to maintain the serial of the below steps.
Step – 1: Run ping
Run ping command. Ping is basically a network administration software utility which is used to test the reachability of a host. Ping test uses ICMP (Internet Control Message Protocol), so no port is being used in ping test.
If ping is successful, move to Step – 2 (Considering your requirement is to set the connectivity with a remote host over a particular port)
If ping gets failed, move to Step – 3.
Step – 2: Run telnet
Run telnet command. Telnet is basically a software utility which is used to test the connectivity with remote host at a particular port. Telnet uses TCP protocol, so we can test only the TCP ports on the remote host using telnet.
If telnet gets failed, move to Step – 3 and Step – 4. In Step – 3 you will get to know whether traffic is taking the correct path or not, if Step – 3 is successful, and you see traffic is taking the correct path then you need to follow Step -4.
Step – 3: Run traceroute/tracert
Run traceroute command (in Windows machines you have to run tracert and in Linux machine you have to run traceroute). Here, traceroute and tracert are network diagnostic commands for displaying the route taken by the network packets to reach the destination and measuring transit delays of packets.
On Linux, traceroute by default sends UDP packets with destination port in between 33434-33534. On Windows. tracert sends ICMP Echo request packets.
Traceroute will show the hops taken by the network packets to reach the destination. Now there can be two scenarios –
- Traceroute is successful, and you can see the destination IP is reached successfully. It means network packets are reaching the destination successfully. Now, move to Step-4.
- Traceroute got failed, now in this scenario there is some issue. We need to check few things like whether it is taking correct gateway (check the gateway IP) or not, what is the last hop taken and do we recognize that last hop IP address etc. So if you are following the correct serial order from Step – 1 to Step – 3 and in Step – 3 traceroute got failed then you will require more in depth network troubleshooting process which will include looking at the network topology. In this stage you need to clearly analyze your network topology and think about the possible routes & hops in between source and destination.
Step – 4: Analyze
If you are following this step in the process of network connectivity troubleshooting, then I think you have the below results –
- From Source to destination, telnet is not working over the target port.
- From Source to destination, traceroute works fine and traffic takes the intended path.
If you have the above result, now you have to check the remote host server whether the target port is listening or not in that remote host. Now there are two scenarios –
- If the target port is not listening, then anyway you have to make sure that target port is listening.
- If the target port is listening, then your connectivity should be working fine.
To check whether any target port is listening or not –
- On Windows, run the below command in CMD
- netstat -a | find “target_port”
- On Linux, run the below command
- netstat -tulpn | grep LISTEN
-t : TCP ports
-u: UDP ports
-n: Show IP address instead of host name
-l: listening port
Thank You for your time.
If you are interested in learning DevOps, please have a look at the below articles, which will help you greatly.
- Kubernetes Series: Part 1 – Introduction to Kubernetes | Background of Kubernetes
- Kubernetes Series: Part 2 – Components of Kubernetes cluster | Kubernetes cluster in detail
- Kubernetes Series: Part 3 – What is Minikube and How to create a Kubernetes cluster (on Linux) using Minikube?
- Introduction to Ansible | High Level Understanding of Ansible
- What is “Monitoring” in DevOps? Why do we need to Monitor App/DB servers, Transactions etc.?
- What is End-to-End Monitoring of any web application and Why do we need it?
- DevOps Engineer or Software Developer Engineer which is better for you?- Let’s discuss