π‘ Testing Connectivity (ping, traceroute)
Once you know your IP, the next step is making sure your computer can talk to other devices or the internet. This is like checking if your mail can actually reach other houses in the city. Two key tools help us: ping and traceroute.
Using ping
The ping command sends small packets of data to a destination and waits for a reply. This tells you if the destination is reachable and how long it takes for data to go there and back (latency).
64 bytes from 142.250.190.78: icmp_seq=1 ttl=116 time=15.2 ms
In the output, time=15.2 ms shows the round-trip time. Use Ctrl+C to stop pinging.
Using traceroute
The traceroute command shows the path your data takes to reach the destination. It lists all the "hops" (routers) along the way.
1 192.168.1.1 1.2 ms 1.0 ms 1.1 ms 2 10.10.0.1 12.3 ms 12.1 ms 12.2 ms 3 142.250.190.78 15.2 ms 15.1 ms 15.2 ms
Each line represents one hop. The last line shows the destination IP. If ping fails, traceroute can help you see where the connection is breaking.
Ping: DNS vs IP
There are two ways to use ping, and understanding the difference is important for troubleshooting:
1. Pinging with DNS (Domain Name System):
What happens:
- Your computer first asks a DNS server, "Hey, what's the IP address for google.com?"
- The DNS server replies with the IP, e.g., 142.250.190.78.
- Then your computer sends ICMP packets to that IP.
This confirms that your DNS resolution is working and tests connectivity using human-readable names, which is what most apps use.
2. Pinging with IP directly:
What happens: Your computer skips DNS and directly sends packets to the IP. If DNS is broken, pinging the name will fail, but pinging the IP can still work. This helps isolate problems: network issue vs DNS issue.
Real-life analogy
For ping: It's like shouting "Hello!" across the street and timing how long it takes for your neighbor to shout back. For DNS vs IP: DNS is like asking a friend, "Where does Alex live?" and then walking to their house (you don't know the address off the top of your head, so you ask someone who knows). Pinging with IP directly is like already knowing Alex's address, so you walk straight there without asking anyone. Testing connectivity is the heartbeat of networkingβyou need to know that your "messages" can actually leave your computer and come back.