Home

get_network_adapter.sh




Purpose

get_network_adapter.sh is a kornshell script to retrieve the current settings of a network adapter using ndd or kstat.


Back to top

License


# CDDL HEADER START
#
# The contents of this file and the script are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END


Back to top

History


Version
Releasedate
         Description
1.1.0
03/08/2005
initial public release
1.2.0
12/14/2005
added support for bge adapter
1.2.3
11/02/2007 #          1.2.1 /bs 05/19/2006 - minor bug fixes
#          1.2.2 /bs 08/09/2006 - corrected code for bge adapters
#          1.2.3 /bs 11/02/2007 - added support for nxge adapters
#
1.2.4
12/21/2007
#          1.2.4 /bs 12/21/2007 - added support for new GLDv3 driver
1.2.5
03/31/2008
#          1.2.5 /bs 03/31/2008 - added support for e1000gx driver






Back to top

Operating system

Solaris


Back to top

Language / type

Kornshell Script


Back to top

Prerequisites

You must be root to execute this script


Back to top

Usage


bash-2.05# get_network_adapter.sh -h
get_network_adapter.sh - get the status of a network adapter

Usage: get_network_adapter.sh adapter [kstat|ndd]

kstat - use kstat, ndd - use ndd; default: use the approbiate
method for the adapter.

Hint: The output of kstat maybe wrong if it is not supported by the driver!

bash-2.05#



Back to top

Examples


bash-2.05# get_network_adapter.sh hme0
Retrieving the status for the adapter "hme0" using the method "ndd" ... 
The advertised capabilities of the interface are:
adv_autoneg_cap :  1
adv_100T4_cap :  0
adv_100fdx_cap :  1
adv_100hdx_cap :  1
adv_10fdx_cap :  1
adv_10hdx_cap :  1
The capabilities of the link partner are:
lp_autoneg_cap :  1
lp_100T4_cap :  0
lp_100fdx_cap :  1
lp_100hdx_cap :  1
lp_10fdx_cap :  1
lp_10hdx_cap :  1
The current mode of the interface is:
The link is up
The mode is 100 MBit
The mode is Full Duplex
bash-2.05#

# get_network_adapter.sh called for a qfe using the old non-GLDv3 driver
#
# /applications/SunTools/CURRENT/bin/get_network_adapter.sh qfe1
Retrieving the status for the adapter "qfe1" using the method "ndd" ...
The advertised capabilities of the interface are:
adv_autoneg_cap :  1
adv_100T4_cap :  1
adv_100fdx_cap :  1
adv_100hdx_cap :  1
adv_10fdx_cap :  1
adv_10hdx_cap :  1
The capabilities of the link partner are:
NOTE: THESE VALUES ARE ONLY VALID IF THE NETWORK CARD AND THE SWITCH ARE CONFIGURED FOR AUTONEG!
lp_autoneg_cap :  0
lp_100T4_cap :  0
lp_100fdx_cap :  0
lp_100hdx_cap :  0
lp_10fdx_cap :  0
lp_10hdx_cap :  0
The current mode of the interface is:
The link is down
The mode is 10 MBit
The mode is Half Duplex

# get_network_adapter.sh called for a qfe using the new GLDv3 driver:
#

# /applications/SunTools/CURRENT/bin/get_network_adapter.sh qfe1
operation failed: Invalid argument
Note: This looks like a new GLDv3 driver is used for this adapter
Retrieving the status for the adapter "qfe1" using the method "kstat" ...
The capabilities of the interface are:
qfe:1:mac:cap_1000fdx   0
qfe:1:mac:cap_1000hdx   0
qfe:1:mac:cap_100T4     0
qfe:1:mac:cap_100fdx    1
qfe:1:mac:cap_100hdx    1
qfe:1:mac:cap_10fdx     1
qfe:1:mac:cap_10hdx     1
qfe:1:mac:cap_asmpause  0
qfe:1:mac:cap_autoneg   1
qfe:1:mac:cap_pause     0
qfe:1:mac:cap_rem_fault 0
The advertised capabilities of the interface are (retrieved with ndd):
adv_autoneg_cap :  0
adv_100T4_cap :  0
adv_100fdx_cap :  1
adv_100hdx_cap :  0
adv_10fdx_cap :  0
adv_10hdx_cap :  0
The link partner capabilities are:
NOTE: THESE VALUES ARE ONLY VALID IF THE NETWORK CARD AND THE SWITCH ARE CONFIGURED FOR AUTONEG!
qfe:1:mac:lp_cap_1000fdx        0
qfe:1:mac:lp_cap_1000hdx        0
qfe:1:mac:lp_cap_100T4  0
qfe:1:mac:lp_cap_100fdx 1
qfe:1:mac:lp_cap_100hdx 1
qfe:1:mac:lp_cap_10fdx  1
qfe:1:mac:lp_cap_10hdx  1
qfe:1:mac:lp_cap_asmpause       0
qfe:1:mac:lp_cap_autoneg        1
qfe:1:mac:lp_cap_pause  0
The current mode of the interface is:
(Note: link_duplex: 0 = down, 1 = half, 2 = full
      link_speed in MBit/s, link_up: 1 = up, 0 = down)
qfe:1:mac:link_asmpause 0
qfe:1:mac:link_autoneg  0
qfe:1:mac:link_duplex   2
qfe:1:mac:link_pause    0
qfe:1:mac:link_state    1
qfe:1:mac:link_up       1






Back to top

Notes

Tested with hme, qfe, skge, ce, bge, nxge, e1000 interfaces.
The scripts supports GLDv3 and non-GLDv3 driver for the network adapter.


Back to top

Download


Download get_network_adapter.sh



Back to top