|< Day Day Up >|| |
Whether your computer is on a local network or using the Internet, there are several network commands that you may find quite useful. There are several basic network-oriented commands you probably need to be familiar with. Each of these can provide very useful information about your connection to a network or the Internet, as well as help diagnose specific connectivity problems.
This is the first network command we will examine. The Windows equivalent is ipconfig, and it provides virtually identical information to ifconfig. The ifconfig command just gives a little extra data. Basically, the information it supplies regards the status of your network card and your connection to the Internet. The output of this command is shown in Figure 18.11.
Figure 18.11: The ifconfig command.
The ifconfig command will tell you if your network card is up and running. If you are currently connected to a local network or the Internet, it will send out packets periodically to ensure that you still are connected. This command also will display the IP address of your computer’s network card. ifconfig is discussed in more detail in Chapter 19, “Linux Administration from the Shell.”
The ping utility is much like a SONAR ping on a submarine. It sends out packets to a given IP address, as shown in Figure 18.12, and tells you whether or not they were received. One of the first things to check if you are having trouble getting on a network or the Internet is to try and ping a known IP address. You also can ping Internet sites by their names. For example, you can try to ping www.chuckeasttom.com. If you find that you cannot get a response from any site you ping, then you are probably not connected to the Internet. If you can get some sites to respond and not others, then the problem most likely lies with those sites. The ping command works exactly the same from a Windows command prompt as it does in a Linux or Unix shell.
Figure 18.12: The ping command.
This command is essentially an improved ping. Instead of just telling you if it got to a given IP address, it will tell you how it got there. When you go to an Internet Web site, the odds are that your package goes through several intermediary sites. The traceroute command will tell you where it’s going and how long each hop takes. This is very important diagnostic information. If you are having slow response time from Web sites and find that the slowest hop is from your Internet service provider to the next hop, your ISP might be having a problem. You can see an example of traceroute in Figure 18.13.
Figure 18.13: The traceroute command.
The traceroute command is not unique to Linux and Unix. Windows provides the same functionality via its tracert command. It is called in the exact same manner, by typing in tracert followed by the IP address, and it returns the same information.
In the figures for the preceding examples, you may have noticed the address 127.0.0.1 to ping or traceroute to. This is called the loopback address. It is used to check your own machine. It is often viewed as being a way to address your own network interface card; however, you should realize that you will have a loopback address even if no NIC is found in your machine. It is commonly used to diagnose network problems. If you cannot successfully ping your network card, then you may have a bad network card.
|< Day Day Up >|| |