I think the short answer you are looking for is the command dig
, but let me tell you all the commands I use, FWIW. My experience is in debugging a simple home network setup, with my computer, a wireless router, and a cable modem.
First I start with dig website
, which does a DNS lookup.
LAN and DHCP
If dig times out, then I likely don't have a proper connection to the LAN. For wired connections, I just check for the blinking lights on the modem. I don't know of a command that checks for that. For wireless connections, I use iwconfig
and check the ESSID value, making sure that it is set to my network.
Once you have the hardware part checked out, the other thing to check for LAN connectivity is DHCP. I check ifconfig
(which is similar to the windows ipconfig) to see if I have an ip address or not. eth0 is your wired connection, and wlan0 is your wireless connection. Look at the second line for the value labeled "inet addr". That is the ip address. Having an ip address of the form 192.168.x.x or 10.0.x.x means I am connected to my LAN, and I am getting an ip address from the router.
DNS and Internet
If dig comes back with a response, but it is empty, then I am probably connected to my wireless router (ie, the LAN), but there is a problem with my internet connection (ie, the modem). I will log into my router's web interface and try to debug the issue there. Or, I will plug in my computer directly to the modem, and recheck the commands above (dig and ifconfig. Note, the ip address should not be as described above)
Connected but still not working
Lastly, if dig returns at least one ip address (most small websites have a single ip, where as big sites like google have multiple ips), then I figure I am at least connected and DNS is working. The problem must exist on the internet somewhere.
I will then use mtr website
as a more comprehensive ping. Mtr is the same as the windows tracert command; it pings the website along with all intermediate nodes and displays it in a real time visual fashion on the terminal, thus showing me where on the internet I am having trouble.
Hope that is useful!