there are are alot of network diagnostics utilities that come with many Linux distributions. when you get your Linux server, there are many network configurations set on your server, so when things go wrong, its important to know which programs you can use to troubleshoot problems. there are a few commands which can help you diagnose a problem. the main three are:
- ping
- traceroute
- netstat


each tool tests the network in a particular and different way and provide inforamtion that can help you track down the source of the problem you are having on your linux server.

lets take a look at them

ping

the most basic network test you can do is with ping. pings sends a simple packet to the system your name and waits for a reply. the most common pinged site is yahoo.com so you can test connectivity to make sure you have internet access to your server by pinging yahoo.com

# ping yahoo.com

the output may look like this:
PING yahoo.com (209.131.36.159) 56(84) bytes of data.
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=1 ttl=58 time=4.72 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=2 ttl=58 time=4.54 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=3 ttl=58 time=4.48 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=4 ttl=58 time=4.70 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=5 ttl=58 time=4.72 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=6 ttl=58 time=4.85 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=7 ttl=58 time=4.60 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=8 ttl=58 time=4.61 ms
64 bytes from b1.www.vip.sp1.yahoo.com (209.131.36.159): icmp_seq=9 ttl=58 time=4.51 ms

--- yahoo.com ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8003ms
rtt min/avg/max/mdev = 4.485/4.642/4.854/0.140 ms


NOTE: to stop pinging, hit control + c


traceroute

when you pinged yahoo.com, you got their ip address, so lets use that ip address to traceroute.

the traceroute command sends a series of three test packets to each computer between your system and the specific target. basically, you are tracing the route from your system to the destination system, in our example, the yahoo.com server - it shows you which systems it takes to route your connection. a sample output may look like this:

traceroute to 209.131.36.159 (209.131.36.159), 30 hops max, 40 byte packets
 1  208.86.46.99  0.376 ms  0.419 ms  0.489 ms
 2  208.74.8.30  2.324 ms  2.313 ms  2.295 ms
 3  206.169.208.33  3.636 ms  3.624 ms  3.823 ms
 4  66.192.243.98  5.084 ms  5.068 ms  5.047 ms
 5  216.115.107.49  5.787 ms 216.115.107.77  5.756 ms  5.932 ms
 6  209.131.32.23  6.328 ms 209.131.32.19  6.341 ms  6.220 ms
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *

netstat

netstat is kinda like a swiss army knife for network tools because it can be used in place of other utilities. netstat can also return inforamtion thats not easily obtiained in other ways.

this is an example of the netstat command:

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 ns1.yahoo.com:ssh         mobile-032-152-176-03:56086 ESTABLISHED
tcp        0      0 ns1.yahoo.com:ssh         mobile-032-152-105-11:55930 ESTABLISHED
tcp        0    284 ns1.yahoo.com:ssh         mobile-032-157-004-00:56178 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         DGRAM                    1218   @/org/kernel/udev/udevd
unix  2      [ ]         DGRAM                    5567   @/org/freedesktop/hal/udev_event
unix  27     [ ]         DGRAM                    4806   /dev/log
unix  2      [ ]         DGRAM                    54839
unix  3      [ ]         STREAM     CONNECTED     54782
unix  3      [ ]         STREAM     CONNECTED     54781
unix  2      [ ]         DGRAM                    54777
unix  2      [ ]         DGRAM                    54592
unix  2      [ ]         DGRAM                    54591