Troubleshooting Your Network

We ve discussed troubleshooting techniques throughout this book. Troubleshooting a network is no different. If you have a problem, collect data, identify and isolate the cause, research the symptoms with others, and if none of this works, apply the scientific method.

As noted earlier, the number one cause of network problems is physical: bad connections, cables, power, and so on. Once you ve checked the physical problems, Linux has a number of troubleshooting commands that can help. While the netstat command allows you to collect data, the ping and traceroute commands help you isolate the problem.

Checking Network Status

There are two things you should do to check the status of your network. First, run the ifconfig command to make sure that your network card is still active. As discussed earlier, you can run the ifconfig eth0 up command to activate the eth0 network card. If your network card is working, the next step is to check the status of your network with the netstat command.

This command displays routing tables, proxy connections to outside networks, interface statistics, and more. For example, the netstat -a command displays all available connections. As shown in Figure 21.11, the Local Address column displays names and numbers , which correspond to TCP/IP ports described in earlier chapters. In the Foreign Address column, you can see telnet , http , and ssh connections that are established between the local computer and two others.

click to expand
Figure 21.11: netstat -a output

A routing table lists currently configured paths from your computer to another computer on or outside your network. Linux uses these paths to find the computers to which you want to connect. A variation of netstat enables you to inspect your routing tables. We ve shown a fairly simple routing table in Figure 21.12. It includes three different types of IP addresses, as described in Table 21.5.

click to expand
Figure 21.12: A routing table
Table 21.5: A Routing Table

Destination

Comment

192.168.0.0

No gateway is required for addresses on this network, since it is on the current LAN.

127.0.0.0

No gateway is required for the loopback address, since it is on the local computer.

0.0.0.0

Use 192.168.0.113 as the default gateway for all IP addresses not specified earlier in this routing table. ( You may see default in place of 0.0.0.0 in the Destination column.)

If needed, you can use the route command to add to your routing table. For example, assume you just added another LAN, with a network address of 10.0.0.0 and a network mask of 255.255.0.0, and connected it to a different network adapter, eth1 . Add it to your routing table with the following command:

 # route add -net 10.0.0.0 netmask 255.255.0.0 dev eth1 

Checking Connections with ping and traceroute

If you have a specific problem on your network, such as a user who no longer has web or e-mail access, start by talking to the user. Based on your knowledge of browsers and e-mail managers, make sure the user knows how to access the desired service. You may also be able to log onto that user s computer through ssh or telnet and check the user s computer for yourself.

Linux includes a number of tools that allow you to work from the most basic network connection all the way to the connections required for the application. These command tools are based on the ping and traceroute commands. When diagnosing network connections, try the following commands. If they work, you ll need to press Ctrl+C to stop the response:

  1. ping 127.0.0.1 : This checks connectivity to the loopback address. If you see a continuous response such as 64 bytes from 127.0.0.1 TCP/IP is properly installed on your computer.

    Tip  

    One alternative to a continuous ping is the ping -c 4 ip_address command, which sends four ping packets to the destination computer and then stops automatically. You can even set alias ping= ping -c 4 ; for more information on the alias command, see Chapter 08 .

  2. ping your_ip_address : Substitute the IP address defined for your network card for your_ip_address , based on the output from the ifconfig command. If you see a similar continuous response, your network card is properly configured.

  3. ping your_host_name : Substitute the hostname for your computer, which usually can be found in /etc/sysconfig/network . If you see the same response as with the previous command, hostnames are properly configured on your computer.

  4. ping another_ip_address : Substitute the IP address of another computer on your LAN for another_ip_address . You can use ifconfig to find IP addresses on Linux computers. (The corresponding Microsoft Windows command is IPCONFIG .) If you see a similar continuous response, communication is working on your LAN. You ve at least configured those two computers with at least the same network address and netmask. As a follow-up, try the IP address for the default gateway on your LAN.

  5. ping another_hostname : Substitute the name of a computer on a connected network for another_hostname . If you re connected to the Internet, one example is ping www.Sybex.com . If this works, your LAN s gateway or router is properly configured, and communication is possible to and from your LAN.

  6. traceroute another_hostname : Use another name on a connected network. If you re connected to the Internet, run the traceroute www.Sybex.com command. Watch as you see the path your messages take from your computer to the Sybex website. If you re diagnosing a problem on interconnected networks, this command stops either at the destination or at the router or gateway that is having a problem.

For example, if you re having trouble with the ping command for the IP address of the router or gateway on your LAN, check the IP address of some other computer on your network. If you cannot connect to other computers on your LAN, there may be a problem with the cables or connections. Otherwise, it may be a problem with the hardware on the router computer.

 


Mastering Red Hat Linux 9
Building Tablet PC Applications (Pro-Developer)
ISBN: 078214179X
EAN: 2147483647
Year: 2005
Pages: 220

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net