5 Essential Networking commands for quick Troubleshooting

Siddesh G V
5 min readFeb 14, 2021

--

As most of the organization these days have asked their employees to work from remote location due to covid crises and the duration may continue for some more time , even if the worksites are reopened most companies will probably support hybrid work mode, taking this into consideration most organization is transferring their work loads to cloud and asking their employees to start using virtual machines and containerized platforms like docker to deploy , build , test and integrate the projects so that things can done seamlessly in cloud.

As explained in the above paragraph to achieve the target criteria the process involves many Networking tasks for IT admin or for any developer in order to have smooth transition and setups. As a human nature we tend to create mistakes in the process hence here are few commands which can come handy during the process to troubleshoot Network related issues.

1. ipconfig

This command typically displays all the TCP/IP network configuration details including DNS, DHCP , netmask, IP version and gateway.

Following is the general syntax that is used :

ipconfig [/allcompartments] [/all] [/renew [<adapter>]] [/release [<adapter>]] [/renew6[<adapter>]] [/release6 [<adapter>]] [/flushdns] [/displaydns] [/registerdns] [/showclassid <adapter>] [/setclassid <adapter> [<classID>]]

The results looks something like below on windows host on linux the command is “ifconfig” does the same job as ipconfig.

ipconfig : Typically used to get IPAddress of the host

ipconfig command results

ipconfig /all : This will print details including hostname , status of DHCP and many more details.

2. nslookup

The command is used to check the Name server resolution and can also be used to check reverse forwarding meaning can check the DNS assigned for a given IP

  1. To check Nameserver details of the given IP : In this example it is resolving to reliance.reliance
DNS of given IP

2. performing a reverse lookup on the IP to get Nameserver details: In this example it is resolving to 192.168.29.1

reverse lookup of a given DNS

3. ping

ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution.

  1. ping used without parameters, displays Help content.
results of ping without parameters

ping to check the connectivity :

ping command used to check the connectivity

default number of packets sent is always = 4 , it can be modified using the count flag as below

ping command sending 10 packets

Failure case when not reaching to a destination host for each packet it will print time out messages looks something like this

ping command with packet not reaching to destination

4. traceroute

A command-line utility that you can use to trace the path that a packet takes to its destination host.

tracert of packets to google.com server from client

Instead of nameserver we can also type in the IP of the destination that we are interested in , here each row indicates a hop that packet has made during its journey to reach the destination.

If the packet fails in the middle , lets say at row 6 and the packet is not finding no other machine to forward the data it indicates the failure in that particular junction helps to troubleshoot network connections very easily.

5. netstat

Displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, IPv4 statistics (for the IP, ICMP, TCP, and UDP protocols), and IPv6 statistics (for the IPv6, ICMPv6, TCP over IPv6, and UDP over IPv6 protocols).

One of the main usecase of netstat is used to identify a PID of a process to to kill and restart process as and when required during the execution of testcases.

Used without parameters, this command displays active TCP connections.

netstat command without parameters

To list the routing table details using -s flag → netstat -s

netstat tp list routing table info

To define a fully qualified name of Domain Name (FQDN) → netstat -f

netstat to list FQDN of the host

The second column indicates the port number to which the process is binding to.

command to list the port number , PID and protocol of a given process : netstat -ano -p tcp

furthur we can use → taskkill /F /PID command to kill the process using processID that we fetch from previous netstat command.

--

--

Siddesh G V
Siddesh G V

Written by Siddesh G V

Software Engineer — A Technology Enthusiast

No responses yet