Plugged Or Unplugged

Today I’ve tried some commands on Solaris OS to check whether network cable plugged/connected to the network adapter. For example : my server has two different network adapter, one is hme0 (10/100Mbps Ethernet card) and the other one is fjgi0 (Gigabit Ethernet). Assume that I’ve activated both of them and give them IP addresses and already connected both of them to the switch. How can I know whether the physical connection to the network adapter is in the good way? How can I know is the RJ45 connected to the network adapter properly? Or maybe, how can I know that the cable do the job (connect my server and the switch) completely? I cannot answer those questionsby only type ifconfig command.

After Googling for a while, I got the answer. To answer above questions, I just type this command in the console :

# ndd /dev/hme link_status

If the cable connected/plugged well, that command will give output “1”. In the other situation (if the cables unplugged, or maybe the cable was broken), that command will “0” as the result. See the following example :

smc01# ifconfig -a
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 6
       inet 192.168.1.1 netmask ffffff00 broadcast 192.168.1.255
       ether 0:b:5d:f3:97:1b
smc01# tail -f /var/adm/messages
Jun 19 23:07:51 smc01 hme: [ID 786680 kern.notice] SUNW,hme0 : No response from Ethernet network : Link down -- cable problem?
Jun 19 23:08:46 smc01 last message repeated 5 times
Jun 19 23:08:57 smc01 hme: [ID 786680 kern.notice] SUNW,hme0 : No response from Ethernet network : Link down -- cable problem?

smc01# ndd /dev/hme link_status
0

From the example above I know that the something going wrong in my connection (as you can see on the output of /var/adm/messages ). And I was sure that my Ethernet card wasn’t defect. But from ifconfig command, the status of hme0 still UP.  The command ndd can help me to know that the problem was in the physical connection.

The option of the  ndd command related to this case is how to choose whether network adapter want to be tested. For example I have 3 same Ethernet card (hme0 hme1 hme2) and I want to test the physical connection to the Ethernet number 3. It can be done by type this command :

smc01# ndd -set /dev/hme instance 3
smc01# ndd /dev/hme link_status
1

(Thanks to Ramdhan for the suggestion to use ndd command, and also many thanks to Google.com 😀 )

4 thoughts on “Plugged Or Unplugged

  1. hhmm…i thought it was more better in OpenSuse. We don’t have to add anything to check if the line was down/unplug. We can see it from log file.

    so…opensuse is more better ?? 😛

  2. @ Untung : basiclly we can see the /var/adm/messages* to see whether the cable already plugged again or not. Ya..Linux is more easy to use rather than Solaris

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.