- 论坛徽章:
- 0
|
Configuring NIC Speed/Duplex on Solaris
出自:
http://www.brandonhutchinson.com/Solaris_NIC_speed_and_duple x_settings.html
原文:
Solaris NIC speed and duplex settingsQuerying your current NIC settings (ex. hme0, assuming "instance" is 0):
# ndd -get /dev/hme link_mode
Interpretation:
0 -- half-duplex
1 -- full-duplex
# ndd -get /dev/hme link_speed
Interpretation:
0 -- 10 Mbit
1 -- 100 Mbit
1000 -- 1 Gbit
To query a different NIC, such as hme1, set the "instance" to 1, and then perform the link_mode and link_speed queries above.
# ndd -set /dev/hme instance 1
Note: the ndd commands above must be run as root. Otherwise, you will receive errors such as "couldn't push module 'hme0', No such device or address."
Here is a quick script I wrote to determine the speed and duplex settings for all plumbed network interfaces on a Solaris system. Thanks to William Favorite for fixing the script to work with two-letter network interfaces (e.g. ge0); the original script did not.
#!/bin/sh# Only the root user can run the ndd commandsif [ "`/usr/bin/id | /usr/bin/cut -c1-5`" != "uid=0" ] ; then echo "You must be the root user to run `basename $0`." exit 1fi# Print column header information/usr/bin/echo "Interface Speed Duplex"/usr/bin/echo "--------- ----- ------"# Determine the speed and duplex for each live NIC on the systemfor INTERFACE in `/usr/bin/netstat -i | /usr/bin/egrep -v "^Name|^lo0" | /usr/bin/awk '{print $1}'`do INTERFACE_TYPE=`/usr/bin/echo $INTERFACE | /usr/bin/sed -e "s/[0-9]*$//"`
INSTANCE=`/usr/bin/echo $INTERFACE | /usr/bin/sed -e "s/^[a-z]*//"`
/usr/sbin/ndd -set /dev/$INTERFACE_TYPE instance $INSTANCE SPEED=`/usr/sbin/ndd -get /dev/$INTERFACE_TYPE link_speed` case "$SPEED" in 0) SPEED="10 Mbit/s" ;; 1) SPEED="100 Mbit/s" ;; 1000) SPEED="1 Gbit/s" ;;
*) SPEED="Use "kstat $INTERFACE_TYPE" for speed and duplex information." esac DUPLEX=`/usr/sbin/ndd -get /dev/$INTERFACE_TYPE link_mode` case "$DUPLEX" in 0) DUPLEX="half" ;; 1) DUPLEX="full" ;;
*) DUPLEX="" ;; esac /usr/bin/echo "$INTERFACE $SPEED $DUPLEX"done
Example output:
Interface Speed & amp; nbsp; Duplex--------- ----- & amp; nbsp; ------hme0 &a mp;n bsp; 100 Mbit/s fullhme1 &a mp;n bsp; 100 Mbit/s fullhme2 &a mp;n bsp; 100 Mbit/s full
Solaris often is unable to correctly auto-negotiate duplex settings with a link partner (e.g. switch), especially when a switch is set to 100Mbit full-duplex. You can force the NIC into 100Mbit full-duplex by disabling auto-negotiation and disabling 100Mbit half-duplex capability.
Example with hme0:
1. Make the changes to the running system.
ndd -set /dev/hme adv_100hdx_cap 0ndd -set /dev/hme adv_100fdx_cap 1ndd -set /dev/hme adv_autoneg_cap 0
2. Make kernel parameter changes to preserve the speed and duplex settings after a reboot.
vi /etc/system
Add:
set hme:hme_adv_autoneg_cap=0set hme:hme_adv_100hdx_cap=0set hme:hme_adv_100fdx_cap=1
Note: the /etc/system change affects all hme interfaces if multiple NICs are present (ex. hme0, hme1).
More information:
http://www.science.uva.nl/pub/solaris/solaris2/Q4.13.html
ce Ethernet adapters
Older versions of the Sun GigaSwift Ethernet 1.0 driver do not support the ndd link_mode and link_speed parameters. You may either install the latest Sun GigaSwift Ethernet adapter patch (111883) or you may use kstat ce ce_device to get speed and duplex information for "ce" Ethernet adapters.
-----
For example (from
[color="#800080"]http://www.samag.com/documents/s=9142/sam0405l/0405l.htm
):
netstat -k ce0 | egrep 'link_speed|link_status|link_duplex'
The output has the following meaning:
link_up - 0 down, 1 up
link_speed - speed in Mbit/s
link_duplex - 1 half duplex, 2 full duplex, 0 down
-----
The /etc/system settings listed above are not supported for configuring "ce" Ethernet adapters during system startup; you may either use ndd commands in an /etc/rc?.d script or create a /platform/sun4u/kernel/drv/ce.conf file detailed
here
.
Example: /etc/init.d/nddconfig
#!/bin/shndd -set /dev/ce instance 0ndd -set /dev/ce adv_1000fdx_cap 0ndd -set /dev/ce adv_1000hdx_cap 0ndd -set /dev/ce adv_100fdx_cap 1ndd -set /dev/ce adv_100hdx_cap 0ndd -set /dev/ce adv_10fdx_cap 0ndd -set /dev/ce adv_10hdx_cap 0ndd -set /dev/ce adv_autoneg_cap 0
ln -s /etc/init.d/nddconfig /etc/rc2.d/S31nddconfig
dmesg | grep ce0
Jan 20 11:05:01 crmmdb22 genunix: [ID 611667 kern.info] NOTICE: ce0: xcvr addr:0x01 - link up 100 Mbps half duplexJan 20 11:05:15 crmmdb22 genunix: [ID 408822 kern.info] NOTICE: ce0: no fault external to device; service availableJan 20 11:05:15 crmmdb22 genunix: [ID 611667 kern.info] NOTICE: ce0: xcvr addr:0x01 - link up 100 Mbps full duplex
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/6922/showart_26540.html |
|