Thanks to those who responded so quickly.
The responses were:
1. Use dmesg and look for link up and down messages.
This is similar to the existing mechanism (using syslog) and would have the same problems.
2. Use ifconfig. If it doesn't say 'UP' and 'RUNNING' you know you have
problems.
No change in ifconfig output after 5 minutes of disconnected cable. [on idle system]
3. Ping to a known host.
This has it's uses, but is not what I needed.
4. Use ndd.
ndd -get /dev/hme link_status
0 disconnected, 1 connected.
This works just fine and responds within a second.
You can also ask for link_speed (10 / 100) and link_mode (HDX / FDX)
5. Use netstat.
netstat -k hme0
This provides many useful configuration parameters and statistics but not current status.
6. Use the prom command.
At the prom you can use
ok watch-nets
I needed an up-and-running solution.
---The original question was:
I need to obtain the status of the network interface to detect, for example, if the LAN cable has been disconnected.
I tried ifconfig, but that appears to only be configured information--not current status.
I'm currently using syslog and parsing the output but that is not reliable and is cumbersome.
Is there a simple command or script that can determine if the LAN device is active or in error state?
Applicable configuration: Solaris 2.5.1, 2.6; E3500, U2; hme*, qe* --------------------------------------------------------------- mailto:mikey@synacom.com (408) 296-0303 Fax: (408) 296-0982 Mike Youngberg +--------------------+ Synacom Technology, Inc | | 3031 Tisch Way, 4th Floor +--------------------+ San Jose, CA 95128 http://www.synacom.com
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:14 CDT