Unix Advanced [Electronic resources]

Chris Herborth

نسخه متنی -صفحه : 115/ 28
نمايش فراداده

l xmlns="http://www.w3.org/1999/l">

  • Testing Your LAN

    Even though you configured your Internet connection while installing your operating system, you might need to test it to help diagnose network problems.

    To test your connection with ping

    • ping hostname

      Use the ping command (Code Listing 3.7) to test your connection to the specified hostname. ping sends out small network packets and waits for a response from the remote system, keeping track of how much time it takes.

    Tips

    • If you're using ping on Linux, FreeBSD, or Mac OS X, you'll have to press Ctrl-C to stop the pinging and get the summary. By default, the Windows ping command stops after four packets.

    • As you can see from the code listing, this will also tell you the "true" name of the system you're pinging. For example, the URL www.cbc.ca resolves to a Web host in the network of a big hosting company called Akami.

    If your ping attempts fail, you can use traceroute to see where the problem might be.

    Code listing 3.7. Using the ping command to test your Internet connection.
    chrish@taffer [501]: ping www.cbc.ca
    Pinging a1849.gc.akamai.net [199.232.61.145] with 32 bytes of data:
    Reply from 199.232.61.145: bytes=32 time=42ms TTL=52
    Reply from 199.232.61.145: bytes=32 time=53ms TTL=52
    Reply from 199.232.61.145: bytes=32 time=49ms TTL=52
    Reply from 199.232.61.145: bytes=32 time=40ms TTL=52
    Ping statistics for 199.232.61.145:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
    Minimum = 40ms, Maximum = 53ms, Average = 46ms
    

    To test your connection with traceroute

    • traceroute hostname

      Or, if you're using a Windows system, tracert hostname.

    The traceroute command (Code Listing 3.8) does more work than a simple ping. It sends packets out to the specified system, but it also polls the systems between you and your target.

    Tips

    • The columns in the output are the network hop number, the response times for three packets, and the name of the host at that hop.

    • If a host doesn't respond, times of * are displayed, and the host's name is Request timed out. When your destination can't be reached, traceroute will print these lines several times as it tries to reach the end point.

    Code listing 3.8. Using the traceroute command to test your Internet connection.
    chrish@taffer [503]: tracert www.cbc.ca
    Tracing route to a1849.gc.akamai.net [65.161.97.143]
    over a maximum of 30 hops:
    1     1 ms     1 ms     1 ms  router [192.168.0.1]
    2    21 ms     9 ms    11 ms  10.116.76.1
    3    11 ms    10 ms    11 ms  gw03.flfrd.phub.net.cable.rogers.com [66.185.90.241]
    4     *        *        *     Request timed out.
    5    13 ms    13 ms    14 ms  gw02.mtnk.phub.net.cable.rogers.com [66.185.82.125]
    6    35 ms    39 ms    35 ms  igw01.ny8th.phub.net.cable.rogers.com [66.185.81.13]
    7    35 ms   114 ms    35 ms  dcr1-so-4-3-0.NewYork.savvis.net [206.24.207.101]
    8    31 ms    32 ms    31 ms  dcr2-loopback.NewYork.savvis.net [206.24.194.100]
    9    31 ms    43 ms    29 ms  144.232.9.117
    10    35 ms    35 ms    29 ms  sl-bb21-nyc-6-0.sprintlink.net [144.232.13.186]
    11    34 ms    42 ms    44 ms  sl-bb27-pen-12-0.sprintlink.net [144.232.20.97]
    12    52 ms    35 ms    51 ms  sl-bb22-pen-8-0.sprintlink.net [144.232.16.53]
    13    34 ms    37 ms    33 ms  sl-bb21-pen-15-0.sprintlink.net [144.232.16.29]
    14    66 ms    51 ms    48 ms  sl-bb23-rly-0-0.sprintlink.net [144.232.20.32]
    15    45 ms    42 ms    41 ms  sl-st20-ash-10-0.sprintlink.net [144.232.20.152]
    16    42 ms    42 ms    43 ms  65.161.97.143
    Trace complete.