HostedDB - Dedicated UNIX Servers

-->
Internet Security Professional Reference:Understanding TCP/IP
Previous Table of Contents Next


The ruptime and rwho Commands

The ruptime command uses the facilities of the rwhod server to show the status of the local machines on the network. It prints a status line for each host in its database. This database is built by using broadcast rwho packets, once every one to three minutes. Machines that have not reported a status for five minutes are reported as down. The output of ruptime is shown here.

$ ruptime
chelsea       up 17+01:28,     0 users,  load 0.00, 0.00, 0.00
daffy         up 29+06:11,     0 users,  load 1.00, 1.00, 1.00
gateway       up 16+14:34,     1 user,   load 1.00, 1.05, 1.02
mallow        up  5+12:46,     0 users,  load 0.00, 0.00, 0.00
oreo          up 19+13:13,     1 user,   load 2.00, 2.00, 1.33
ovide         up  4+04:54,     1 user,   load 1.14, 1.16, 1.17
wabbit      down 107+01:33
$

If the rwhod server is not running on any of the hosts in your network, then ruptime reports the status message no hosts!!! and exits. In the preceding example, the system wabbit appears to be down. This might be accurate, but it also might be that the rwhod server has exited or is no longer running on the system.

Normally, the ruptime output is sorted by hostname, but the following options alter the output format of ruptime.

Table 1.6
ruptime Options

Option Description

-a Includes all users in ruptime output. (Users idle for more than an hour are not usually counted in the user list.)
-l Sorts the output by load average.
-t Sorts the output by uptime.
-u Sorts the output by the number of users.
-r Reverses the sort order.

The rwho command lists the users who currently are logged in on each of the servers in the network. The rwho command reports the users who are logged in on hosts that are responding to and transmitting rwhod packets. The output of the rwho command is shown here:

$ rwho
chare    oreo:ttyp0    Oct  9 14:58 :01
root     ovide:tty08   Oct  4 18:05
topgun   gateway:tty2A Oct  9 13:54
$

In this output, the name of the user is shown as well as the system name, the port he is logged in on, and the date he logged in to the system. This looks like the output from the who command, except the system name is included in the port information.

The ifconfig Command

The ifconfig command has been presented in some detail, but this section illustrates some additional uses for it. By using ifconfig, for example, it is possible to query the interface to find out how it has been configured, as shown here:

$ /etc/ifconfig wdn0
wdn0: flags=23<UP,BROADCAST,NOTRAILERS>
inet 198.73.138.2 netmask ffffff00 broadcast 198.73.138.255
$

This output shows that the interface is up, it does not use trailer encapsulation, and it identifies the addresses and netmask currently used by the interface. Any interface that is configured on the system can be queried in this manner.

The following illustrates marking an interface down, verifying that information, and then marking the interface up.

# ifconfig du0
du0: flags=51<UP,POINTOPOINT,RUNNING>
inet 142.77.252.6 --> 142.77.17.1 netmask ffff0000
# ifconfig du0 down
# ifconfig du0
du0: flags=50<POINTOPOINT,RUNNING>
inet 142.77.252.6 --> 142.77.17.1 netmask ffff0000
# ping toradm
PING toradm.widgets.ca (142.77.253.13): 56 data bytes
ping: sendto: Network is unreachable
ping: wrote toradm.widgets.ca 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote toradm.widgets.ca 64 chars, ret=-1
ping: sendto: Network is unreachable
ping: wrote toradm.widgets.ca 64 chars, ret=-1

-- toradm.widgets.ca ping statistics --
3 packets transmitted, 0 packets received, 100% packet loss
# ifconfig du0 up
# ifconfig du0
du0: flags=51<UP,POINTOPOINT,RUNNING>
inet 142.77.252.6 ––> 142.77.17.1 netmask ffff0000
# ping toradm
PING toradm.widgets.ca (142.77.253.13): 56 data bytes
64 bytes from toradm.widgets.ca (142.77.253.13): icmp_seq=0 ttl=251
time=610 ms
64 bytes from toradm.widgets.ca (142.77.253.13): icmp_seq=1 ttl=251
time=630 ms

-- toradm.widgets.ca ping statistics --
3 packets transmitted, 2 packets received, 33% packet loss
round-trip min/avg/max = 610/620/630 ms
#

In this example, the interface being affected is a point-to-point protocol link, which is illustrated in the output of ifconfig. When the interface is marked down, packets will not be transmitted on that link, as shown using ping. When the interface is later marked up, traffic once again flows on that link.

The use of ifconfig to configure an interface is restricted to the super-user. Any user on the system, however, can use ifconfig to query the interface for its current operating statistics.


Previous Table of Contents Next