Network Troubleshooting Basics
Network Troubleshooting Basics
Ping is a versatile command-line tool used to check network connectivity between devices. It
sends ICMP echo requests to a specified destination and waits for an ICMP echo reply.
Created by Athira KK
1
traceroute
The traceroute command is used to trace the path that packets take from our device to a
destination host.
Created by Athira KK
2
telnet
The telnet command is used to establish a TCP connection to a remote host.
While ping and traceroute can indicate server responsiveness, it doesn't guarantee
operational status. For instance, a server may respond to ping but lack essential services like
Apache, rendering it inaccessible. Conversely, servers not responding to ping may still be
reachable via other protocols due to firewall configurations.
To test network connectivity and protocol allowance effectively, Telnet proves invaluable.
Although outdated for remote access due to lack of encryption, Telnet remains useful for
protocol testing.
For example, testing a connection to google.com at port 443 with Telnet can confirm
successful network connections.
Created by Athira KK
3
curl
The curl command is a versatile tool for transferring data using various protocols.
curl supports various protocols, primarily used for sending HTTP requests.
To perform a basic HTTP GET request,
curl http://example.com
For checking response codes and viewing headers only,
curl -I http://example.com
To utilize different request methods, such as POST, utilize the -X flag:
curl -X POST http://example.com
Moreover, curl excels at file downloads or storing responses with the -o flag:
curl http://example.com/file -o output.file
Created by Athira KK
4
dig
The dig command is a DNS lookup utility used to query DNS servers for information about
domain names. It retrieves various DNS records, including A, AAAA, CNAME, MX, and TXT
records.
Example : dig google.com - will query the DNS server for the IP address of "google.com".
For instance, querying the DNS record for google.com with dig google.com returns vital
information like the queried server, TTL, query class, query type, and the associated IP
address, such as 172.217.0.46.
Created by Athira KK
5
netstat
The netstat command displays network connections, routing tables, interface statistics,
masquerade connections, and multicast memberships. It provides information about network
connections, routing information, and interface statistics.
Example: netstat -lp - shows the protocol, local address, and process ID (PID) of the listening
program.
Created by Athira KK
6
nmap
The nmap command is a network scanning tool used to discover hosts and services on a
computer network. It sends packets to target hosts and analyses the responses to identify open
ports, running services, and potential vulnerabilities.
Example: nmap -sS target_ip scans the target IP address using TCP SYN scan.
For example, by conducting a ping scan to discover hosts and then probing specific hosts to
reveal active services like SSH and HTTP, facilitating further diagnostics or actions like SSH
connections or HTTP requests using tools like curl.
Created by Athira KK
7
ssh
SSH, or Secure Shell, is a protocol used to securely access and control remote computers over a
network. It encrypts all data transferred between the local and remote machines, making it safe
to use even on untrusted networks. This level of security is essential for protecting sensitive
data and troubleshooting networks with unknown security levels.
After executing the command, we'll be prompted to enter the password associated with the
remote user account for authentication. While passwords are a common method, it's advisable
to set up password less authentication for added security whenever feasible.
Created by Athira KK
8
scp
SCP, or Secure Copy Protocol, is a secure method for transferring files between a local and
remote host. Unlike SSH, which allows us to execute commands on a remote server, SCP focuses
solely on file transfer.
If we want to copy a file named "example.txt" from our local machine to a remote server.
Example of SCP command like this:
scp example.txt user@example.com:/path/to/destination
Created by Athira KK
9