You can check network connectivity using several methods. Here are some common commands:
-
Ping Command:
Thepingcommand is used to test the reachability of a host on a network. For example, to check connectivity to a specific IP address or hostname:ping <hostname_or_IP>Example:
ping 8.8.8.8 -
Traceroute Command:
Thetraceroutecommand shows the path packets take to reach a destination. It can help identify where connectivity issues occur:traceroute <hostname_or_IP>Example:
traceroute google.com -
Netstat Command:
Thenetstatcommand displays network connections, routing tables, and interface statistics. You can use it to check active connections:netstat -tuln -
Curl Command:
Thecurlcommand can be used to check if a specific service is reachable. For example, to check if a web server is responding:curl -I http://<hostname_or_IP>Example:
curl -I http://example.com -
Ifconfig or Ip Command:
Useifconfigoripto check your local network interfaces and their statuses:ifconfigor
ip addr -
Network Diagnostic Tools:
Tools likenmapcan be used to scan for open ports and services on a network:nmap <hostname_or_IP>
By using these commands, you can effectively diagnose and troubleshoot network connectivity issues.
