sun.com docs.sun.com My Sun Worldwide Sites

Previous Previous     Contents     Index     Next Next

ProcedureHow to Display the Status of Transmissions for Packets of a Specific Address Type

Use the -f option of the netstat command to view statistics related to packet transmissions of a particular address family.

  • View statistics for transmissions of either IPv4 or IPv6 packets.

    $ netstat -f inet  |  inet6

    To view IPv4 transmission information, type inet as the argument to netstat -f. Use inet6 as the argument to netstat -f to view IPv6 information.

Example 8-10   Status of IPv4 Packet Transmission

The following example shows output from the netstat -f inet command.

TCP: IPv4
   Local Address        Remote Address    Swind Send-Q Rwind Recv-Q  State
-------------------- -------------------- ----- ------ ----- ------ -------
host58.734         host19.nfsd       49640      0 49640      0 ESTABLISHED
host58.38063       host19.32782      49640      0 49640      0 CLOSE_WAIT
host58.38146       host41.43601      49640      0 49640      0 ESTABLISHED
host58.996         remote-host.login 49640      0 49206      0 ESTABLISHED

Example 8-11   Status of IPv6 Packet Transmission

The following example shows output from the netstat -f inet6 command.

TCP: IPv6
 Local Address          Remote Address        Swind Send-Q Rwind Recv-Q   State    If
------------------ ------------------------- ----- ------ ----- ------ --------- -----
localhost.38065         localhost.32792       49152   0 49152      0    ESTABLISHED  
localhost.32792         localhost.38065       49152   0 49152      0    ESTABLISHED 
localhost.38089         localhost.38057       49152   0 49152      0    ESTABLISHED 

ProcedureHow to Display the Status of Known Routes

The -r option of the netstat command displays the routing table for the local host. This table shows the status of all routes that the host knows about. You can run this option of netstat from your user account.

  • Display the IP routing table.

    $ netstat -r

Example 8-12   Routing Table Output by the netstat Command

The following example shows output from the netstat -r command.

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
host15               myhost               U         1  31059  hme0
10.0.0.14            myhost               U         1      0  hme0
default              distantrouter        UG        1      2  hme0
localhost            localhost            UH        42019361  lo0

Routing Table: IPv6
  Destination/Mask            Gateway                   Flags Ref   Use   If  
--------------------------- --------------------------- ----- --- ------ -----
2002:0a00:3010:2::/64    2002:0a00:3010:2:1b2b:3c4c:5e6e:abcd U  1      0 hme0:1
fe80::/10                fe80::1a2b:3c4d:5e6f:12a2    U       1     23 hme0 
ff00::/8                 fe80::1a2b:3c4d:5e6f:12a2    U       1      0 hme0 
default                  fe80::1a2b:3c4d:5e6f:12a2    UG      1      0 hme0 
localhost                localhost                   UH      9  21832 lo0 

Parameter

Description

Destination

Destination/Mask

Specifies the host that is the destination endpoint of the route. Note that the IPv6 routing table shows the prefix for a 6to4 tunnel endpoint (2002:0a00:3010:2::/64) as the route destination endpoint.

Gateway

Specifies the gateway to use for forwarding packets.

Flags

Indicates the current status of the route. The U flag indicates that the route is up. The G flag indicates that the route is to a gateway.

Use

Shows the number of packets sent.

Interface

Indicates the particular interface on the local host that is the source endpoint of the transmission.

Probing Remote Hosts With the ping Command

You can use the ping command to determine the status of a remote host. When you run ping, the ICMP protocol sends a datagram to the host that you specify, asking for a response. ICMP is the protocol responsible for error handling on a TCP/IP network. When you use ping, you can find out whether an IP connection exists for the specified remote host.

The following is the basic syntax of ping:

/usr/sbin/ping host [timeout]

In this syntax, host is the name of the remote host. The optional timeout argument indicates the time in seconds for the ping command to continue trying to reach the remote host. The default is 20 seconds. For additional syntax and options, refer to the ping(1M) man page.

ProcedureHow to Determine if a Remote Host Is Running

  • Type the following form of the ping command:

    $ ping hostname

    If host hostname is accepting ICMP transmissions, this message is displayed:

    hostname is alive

    This message indicates that hostname responded to the ICMP request. However, if hostname is down or cannot receive the ICMP packets, you receive the following response from the ping command:

    no answer from hostname

ProcedureHow to Determine if a Host Is Dropping Packets

Use the -s option of the ping command to determine if a remote host is running but nevertheless losing packets.

  • Type the following form of the ping command:

    $ ping -s hostname

Example 8-13   ping Output for Detecting Packet Dropping

The ping -s hostname command continually sends packets to the specified host until you send an interrupt character or a time out occurs. The responses on your screen resemble the following:

& ping -s host1.domain8
PING host1.domain8 : 56 data bytes
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=0. time=1.67 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=1. time=1.02 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=2. time=0.986 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=3. time=0.921 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=4. time=1.16 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=5. time=1.00 ms
64 bytes from host1.domain8.COM (172.16.83.64): icmp_seq=5. time=1.980 ms

^C

----host1.domain8  PING Statistics----
7 packets transmitted, 7 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 0.921/1.11/1.67/0.26

The packet-loss statistic indicates whether the host has dropped packets. If ping fails, check the status of the network that is reported by the ifconfig and netstat commands. Refer to Monitoring the Interface Configuration With the ifconfig Command and Monitoring Network Status With the netstat Command.

Administering and Logging Network Status Displays

The following tasks show how to check the status of the network by using well-known networking commands.

ProcedureHow to Control the Display Output of IP-Related Commands

You can control the output of the netstat and ifconfig commands to display IPv4 information only, or both IPv4 and IPv6 information.

  1. Create the /etc/default/inet_type file.

  2. Add one of the following entries to /etc/default/inet_type, as required for your network:

    • To display IPv4 information only:

      DEFAULT_IP=IP_VERSION4

    • To display both IPv4 and IPv6 information:

      DEFAULT_IP=BOTH

      Or

      DEFAULT_IP=IP_VERSION6

      For more information about the inet_type file, see the inet_type(4) man page.


    Note - The -4 and -6 flags in the ifconfig command override the values set in the inet_type file. The -f flag in the netstat command also overrides the values set in the inet_type file.


Example 8-14   Controlling Output to Select IPv4 and IPv6 Information
  • When you specify the DEFAULT_IP=BOTH or DEFAULT_IP=IP_VERSION6 variable in the inet_type file, you should have the following output:

    % ifconfig -a
    lo0: flags=1000849 mtu 8232 index 1
            inet 10.10.0.1 netmask ff000000 
    qfe0: flags=1000843 mtu 1500 index 2
            inet 10.46.86.54 netmask ffffff00 broadcast 10.46.86.255
            ether 8:0:20:56:a8 
    lo0: flags=2000849 mtu 8252 index 1
            inet6 ::1/128 
    qfe0: flags=2000841 mtu 1500 index 2
            ether 8:0:20:56:a8 
            inet6 fe80::a00:fe73:56a8/10 
    qfe0:1: flags=2080841 mtu 1500 index 2
            inet6 2001:db8:3c4d:5:a00:fe73:56a8/64 

  • When you specify the DEFAULT_IP=IP_VERSION4 or DEFAULT_IP=IP_VERSION6 variable in the inet_type file, you should have the following output:

    % ifconfig -a
    lo0: flags=849 mtu 8232
            inet 10.10.0.1 netmask ff000000 
    qfe0: flags=843 mtu 1500
            inet 10.46.86.54 netmask ffffff00 broadcast 10.46.86.255
            ether 8:0:20:56:a8

Previous Previous     Contents     Index     Next Next
Company Info Contact Terms of Use Privacy Copyright 1994-2007 Sun Microsystems, Inc.