To test network connectivity between your computer and other computers, you can use several tools and commands available in Debian/Ubuntu. Here are the most common methods:
1. Ping – Basic Connectivity Test
ping <IP-address or hostname>
Example:
ping 192.168.1.1 ping google.com
Explanation:
- Sends ICMP echo requests to the target.
- If the target responds, it indicates basic connectivity.
- Useful for checking if a machine or server is reachable.
Options:
-c <number>
– Limit the number of packets.ping -c 4 google.com
-i <seconds>
– Set interval between pings.ping -i 2 192.168.1.1
-t <ttl>
– Set time to live (TTL).ping -t 64 8.8.8.8
2. Traceroute – Path and Latency Test
traceroute <IP-address or hostname>
Example:
traceroute google.com
Explanation:
- Shows the path packets take to reach the target.
- Displays each hop along the way with latency details.
Install Traceroute (if not installed):
sudo apt install traceroute
3. Netcat (nc) – Port Connectivity Test
nc -zv <IP-address or hostname> <port>
Example:
nc -zv 192.168.1.100 22
Explanation:
- Tests if a specific port is open on the target.
-z
– Scan without sending data.-v
– Verbose output.
4. Telnet – Port Testing
telnet <IP-address or hostname> <port>
Example:
telnet 192.168.1.1 80
Explanation:
- Checks if a port is open by initiating a connection.
Install Telnet (if not installed):
sudo apt install telnet
5. Nmap – Comprehensive Network Scanning
nmap <IP-address or subnet>
Example:
nmap 192.168.1.0/24
Explanation:
- Scans for active hosts and open ports.
- Provides detailed information about available services.
Install Nmap (if not installed):
sudo apt install nmap
6. Checking Routes – IP Route
ip route
Explanation:
- Displays the current routing table.
- Shows how packets will reach different networks.
7. Checking DNS Resolution – Dig or Nslookup
dig <domain-name> nslookup <domain-name>
Example:
dig google.com nslookup google.com
Explanation:
- Tests if the system can resolve domain names to IP addresses.
Install Dig (if not installed):
sudo apt install dnsutils
8. Curl or Wget – HTTP/HTTPS Connectivity Test
curl -I <URL> wget --spider <URL>
Example:
curl -I https://www.google.com wget --spider https://www.google.com
Explanation:
- Tests HTTP/HTTPS connectivity and checks if a webpage is accessible.
9. ARP (Address Resolution Protocol) Test
arp -a
Explanation:
- Displays the ARP table showing IP-to-MAC mappings for hosts on the local network.
10. Advanced – TCPDump for Network Traffic Analysis
sudo tcpdump -i eth0
Explanation:
- Captures and analyzes packets in real-time.
Install TCPDump (if not installed):
sudo apt install tcpdump
Example Workflow for Testing Connectivity to Multiple Computers:
Ping multiple systems:
ping -c 3 192.168.1.1 ping -c 3 192.168.1.2 ping -c 3 google.com
Traceroute to check path:
traceroute 8.8.8.8
Scan the network to discover active hosts:
nmap 192.168.1.0/24
- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Comments
Post a Comment